Skip to content

Commit ee042b8

Browse files
authored
Merge pull request #7641 from QwikDev/v2-merge-main
chore: merge main into v2
2 parents e2eb140 + 126ca50 commit ee042b8

File tree

251 files changed

+3744
-1212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+3744
-1212
lines changed

.github/ISSUE_TEMPLATE/bug.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ body:
5353
id: system-info
5454
attributes:
5555
label: System Info
56-
description: Output of `npx envinfo --system --npmPackages '{vite,typescript,@builder.io/*}' --binaries --browsers`
56+
description: Output of `npx envinfo --system --npmPackages '{vite,typescript,@builder.io/*,@qwik.dev/*}' --binaries --browsers`
5757
render: shell
5858
placeholder: System, Binaries, Browsers
5959
validations:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ jobs:
571571
572572
- run: pnpm install --frozen-lockfile
573573
- name: Build Qwik Docs
574-
run: pnpm run build.packages.docs && echo ok > docs-build-completed.txt
574+
run: pnpm build --tsc-docs && pnpm run build.packages.docs && echo ok > docs-build-completed.txt
575575

576576
- name: Save Docs Artifacts
577577
uses: actions/upload-artifact@v4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bun create qwik@latest
5252

5353
## Related
5454

55-
- [Partytown](https://partytown.builder.io/): Relocate resource intensive third-party scripts off of the main thread and into a web worker 🎉.
55+
- [Partytown](https://partytown.qwik.dev/): Relocate resource intensive third-party scripts off of the main thread and into a web worker 🎉.
5656
- [Mitosis](https://github.com/BuilderIO/mitosis): Write components once, run everywhere. Compiles to Vue, React, Solid, Angular, Svelte, and more.
5757
- [Builder](https://github.com/BuilderIO/builder): Drag and drop page builder and CMS for React, Vue, Angular, and more.
5858

e2e/qwik-cli-e2e/tests/serve.spec.ts

Lines changed: 100 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,116 @@
1-
import { assert, test, beforeAll, expect } from 'vitest';
1+
/* eslint-disable no-console */
2+
import { existsSync, readFileSync, writeFileSync } from 'fs';
3+
import { join } from 'path';
4+
import { assert, beforeAll, beforeEach, describe, expect, test } from 'vitest';
25
import {
36
assertHostUnused,
7+
DEFAULT_TIMEOUT,
48
getPageHtml,
5-
promisifiedTreeKill,
69
killAllRegisteredProcesses,
10+
log,
11+
promisifiedTreeKill,
712
runCommandUntil,
813
scaffoldQwikProject,
9-
DEFAULT_TIMEOUT,
14+
type QwikProjectType,
1015
} from '../utils';
11-
import { existsSync, readFileSync, writeFileSync } from 'fs';
12-
import { join } from 'path';
13-
14-
const SERVE_PORT = 3535;
15-
beforeAll(() => {
16-
const config = scaffoldQwikProject();
17-
global.tmpDir = config.tmpDir;
1816

19-
return async () => {
20-
await killAllRegisteredProcesses();
21-
config.cleanupFn();
22-
};
17+
let SERVE_PORT = 3535;
18+
beforeEach(() => {
19+
// the port doesn't clear immediately after the previous test
20+
SERVE_PORT++;
2321
});
22+
for (const type of ['empty', 'playground'] as QwikProjectType[]) {
23+
describe(`template: ${type}`, () => {
24+
beforeAll(() => {
25+
const config = scaffoldQwikProject(type);
26+
global.tmpDir = config.tmpDir;
27+
28+
return async () => {
29+
try {
30+
await killAllRegisteredProcesses();
31+
} catch (e) {
32+
log(`Error during process cleanup: ${e.message}`);
33+
}
34+
config.cleanupFn();
35+
};
36+
});
37+
38+
if (type === 'playground') {
39+
test(
40+
'Should serve the app in dev mode and update the content on hot reload',
41+
{ timeout: DEFAULT_TIMEOUT },
42+
async () => {
43+
const host = `http://localhost:${SERVE_PORT}/`;
44+
await assertHostUnused(host);
45+
const p = await runCommandUntil(
46+
`npm run dev -- --port ${SERVE_PORT}`,
47+
global.tmpDir,
48+
(output) => {
49+
return output.includes(host);
50+
}
51+
);
52+
assert.equal(existsSync(global.tmpDir), true);
2453

25-
test(
26-
'Should serve the app in dev mode and update the content on hot reload',
27-
{ timeout: DEFAULT_TIMEOUT },
28-
async () => {
29-
const host = `http://localhost:${SERVE_PORT}/`;
30-
await assertHostUnused(host);
31-
const p = await runCommandUntil(
32-
`npm run dev -- --port ${SERVE_PORT}`,
33-
global.tmpDir,
34-
(output) => {
35-
return output.includes(host);
54+
await expectHtmlOnARootPage(host);
55+
56+
// Don't let process termination errors fail the test
57+
try {
58+
await promisifiedTreeKill(p.pid!, 'SIGKILL');
59+
} catch (e) {
60+
log(`Error terminating dev server: ${e.message}`);
61+
}
62+
}
63+
);
64+
}
65+
66+
test('Should preview the app', { timeout: DEFAULT_TIMEOUT }, async () => {
67+
const host = `http://localhost:${SERVE_PORT}/`;
68+
await assertHostUnused(host);
69+
70+
// First build the app
71+
const buildProcess = await runCommandUntil(`npm run build`, global.tmpDir, (output) => {
72+
return output.includes('dist/build') || output.includes('built in');
73+
});
74+
75+
try {
76+
await promisifiedTreeKill(buildProcess.pid!, 'SIGKILL');
77+
} catch (e) {
78+
log(`Error terminating build process: ${e.message}`);
3679
}
37-
);
38-
assert.equal(existsSync(global.tmpDir), true);
3980

40-
await expectHtmlOnARootPage(host);
81+
// Now run the preview
82+
const p = await runCommandUntil(
83+
`npm run preview -- --no-open --port ${SERVE_PORT}`,
84+
global.tmpDir,
85+
(output) => {
86+
return output.includes(host);
87+
}
88+
);
89+
90+
assert.equal(existsSync(global.tmpDir), true);
91+
92+
// Wait a bit for the server to fully start
93+
await new Promise((resolve) => setTimeout(resolve, 2000));
4194

42-
await promisifiedTreeKill(p.pid!, 'SIGKILL');
43-
}
44-
);
95+
const res = await fetch(host, { headers: { accept: 'text/html' } }).then((r) => r.text());
96+
console.log('** res', res);
97+
98+
// Check for the appropriate content based on template type
99+
if (type === 'playground') {
100+
expect(res).toContain('fantastic');
101+
} else if (type === 'empty') {
102+
expect(res).toContain('Hi');
103+
expect(res).toContain('qwik');
104+
}
105+
106+
try {
107+
await promisifiedTreeKill(p.pid!, 'SIGKILL');
108+
} catch (e) {
109+
log(`Error terminating preview server: ${e.message}`);
110+
}
111+
});
112+
});
113+
}
45114

46115
async function expectHtmlOnARootPage(host: string) {
47116
expect((await getPageHtml(host)).querySelector('.container h1')?.textContent).toBe(

e2e/qwik-cli-e2e/utils/index.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ import treeKill from 'tree-kill';
77
import { promisify } from 'util';
88
import { createDocument } from '../../../packages/qwik/src/testing/document';
99

10-
export function scaffoldQwikProject(): { tmpDir: string; cleanupFn: () => void } {
11-
const tmpHostDirData = getTmpDirSync(process.env.TEMP_E2E_PATH);
10+
export type QwikProjectType = 'playground' | 'library' | 'empty';
11+
export function scaffoldQwikProject(type: QwikProjectType): {
12+
tmpDir: string;
13+
cleanupFn: () => void;
14+
} {
15+
const tmpHostDirData = getTmpDirSync(
16+
process.env.TEMP_E2E_PATH ? `${process.env.TEMP_E2E_PATH}/${type}` : undefined
17+
);
1218
const cleanupFn = () => {
1319
if (!tmpHostDirData.overridden) {
1420
cleanup(tmpHostDirData.path);
@@ -17,7 +23,7 @@ export function scaffoldQwikProject(): { tmpDir: string; cleanupFn: () => void }
1723
}
1824
};
1925
try {
20-
const tmpDir = runCreateQwikCommand(tmpHostDirData.path);
26+
const tmpDir = runCreateQwikCommand(tmpHostDirData.path, type);
2127
log(`Created test application at "${tmpDir}"`);
2228
replacePackagesWithLocalOnes(tmpDir);
2329
return { cleanupFn, tmpDir };
@@ -52,10 +58,10 @@ function getTmpDirSync(tmpDirOverride?: string) {
5258
return { path: dirSync({ prefix: 'qwik_e2e' }).name, overridden: false };
5359
}
5460

55-
function runCreateQwikCommand(tmpDir: string): string {
61+
function runCreateQwikCommand(tmpDir: string, type: 'playground' | 'library' | 'empty'): string {
5662
const appDir = 'e2e-app';
5763
execSync(
58-
`node "${workspaceRoot}/packages/create-qwik/create-qwik.cjs" playground "${join(tmpDir, appDir)}"`
64+
`node "${workspaceRoot}/packages/create-qwik/create-qwik.cjs" ${type} "${join(tmpDir, appDir)}"`
5965
);
6066
return join(tmpDir, appDir);
6167
}
@@ -153,11 +159,15 @@ export async function assertHostUnused(host: string): Promise<void> {
153159
// promisify fails to get the proper type overload, so manually enforcing the type
154160
const _promisifiedTreeKill = promisify(treeKill) as (pid: number, signal: string) => Promise<void>;
155161

156-
export const promisifiedTreeKill = (pid: number, signal: string) => {
162+
export const promisifiedTreeKill = async (pid: number, signal: string) => {
157163
try {
158-
return _promisifiedTreeKill(pid, signal);
164+
return await _promisifiedTreeKill(pid, signal);
159165
} catch (error) {
160-
console.error('Failed to kill the process ' + pid, error);
166+
// Don't treat process termination failures as test failures
167+
// This is especially important on Windows where processes may already be gone
168+
// or may not be properly terminated with tree-kill
169+
log(`Process ${pid} could not be killed, but continuing: ${error.message}`);
170+
return Promise.resolve();
161171
}
162172
};
163173

e2e/qwik-cli-e2e/vite.config.mts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
import { defineConfig } from 'vitest/config';
2-
import tsconfigPaths from 'vite-tsconfig-paths';
1+
import { existsSync, mkdirSync } from 'fs';
32
import { resolve } from 'path';
4-
import { mkdirSync } from 'fs';
3+
import tsconfigPaths from 'vite-tsconfig-paths';
4+
import { defineConfig } from 'vitest/config';
55

66
// if we're running in github CI
77
if (process.env.CI) {
88
// Workaround for npm/pnpm crashing in scaffoldQwikProject because "name is too long"
99
const testPath = resolve(process.cwd(), 'e2e-test-tmp');
10-
mkdirSync(testPath);
10+
11+
// Create base directory if it doesn't exist
12+
if (!existsSync(testPath)) {
13+
mkdirSync(testPath);
14+
}
15+
16+
// Create subdirectories for each template type
17+
const templateTypes = ['empty', 'playground'];
18+
for (const type of templateTypes) {
19+
const templatePath = resolve(testPath, type);
20+
if (!existsSync(templatePath)) {
21+
mkdirSync(templatePath);
22+
}
23+
}
24+
1125
process.env.TEMP_E2E_PATH = testPath;
1226
}
1327

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"esbuild-plugin-raw": "^0.1.8"
7676
},
7777
"devDependencies": {
78-
"@builder.io/partytown": "0.10.2",
7978
"@changesets/cli": "2.29.3",
8079
"@changesets/get-github-info": "0.6.0",
8180
"@changesets/types": "6.1.0",
@@ -91,6 +90,7 @@
9190
"@playwright/test": "1.50.1",
9291
"@qwik.dev/core": "workspace:*",
9392
"@qwik.dev/router": "workspace:*",
93+
"@qwik.dev/partytown": "0.11.1",
9494
"@types/brotli": "1.3.4",
9595
"@types/bun": "1.1.6",
9696
"@types/cross-spawn": "6.0.6",
@@ -103,6 +103,7 @@
103103
"@types/tmp": "0.2.6",
104104
"@types/which-pm-runs": "1.0.2",
105105
"@vitest/coverage-v8": "3.1.1",
106+
"@vitejs/plugin-basic-ssl": "2.0.0",
106107
"all-contributors-cli": "6.26.1",
107108
"brotli": "1.3.3",
108109
"concurrently": "8.2.2",
@@ -160,8 +161,7 @@
160161
"pnpm": {
161162
"overrides": {
162163
"typescript": "5.8.2",
163-
"vfile": "6.0.2",
164-
"@supabase/realtime-js": "2.8.4"
164+
"vfile": "6.0.2"
165165
},
166166
"patchedDependencies": {
167167

packages/create-qwik/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@
2222

2323
## 2.0.0-alpha.0
2424

25+
## 1.14.1
26+
27+
### Patch Changes
28+
29+
- 🐞🩹 starter app missing package and added preview cli test (by [@wmertens](https://github.com/wmertens) in [#7626](https://github.com/QwikDev/qwik/pull/7626))
30+
31+
## 1.14.0
32+
33+
### Patch Changes
34+
35+
- 🐞🩹 create-qwik logAppCreated.ts now displays correct next steps for deno. (by [@LogProphet](https://github.com/LogProphet) in [#7566](https://github.com/QwikDev/qwik/pull/7566))
36+
37+
After using the create-qwik command, the logAppCreated.ts file was not displaying the correct next steps for deno. Prior to this fix it would display "deno start" instead of "deno task start". This would cause a failure to run, as deno requires the 'task' keyword. This fixes bug 7520
38+
39+
- 🐞🩹 linting errors which were previously being ignored across the monorepo. (by [@better-salmon](https://github.com/better-salmon) in [#7418](https://github.com/QwikDev/qwik/pull/7418))
40+
2541
## 1.13.0
2642

2743
## 1.12.1

packages/create-qwik/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ console.log(result);
3535
## Related
3636

3737
- [Qwik](https://qwik.dev/)
38-
- [Partytown](https://partytown.builder.io)
38+
- [Partytown](https://partytown.qwik.dev)
3939
- [Mitosis](https://github.com/BuilderIO/mitosis)
4040
- [Builder.io](https://github.com/BuilderIO/)

packages/docs/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"devDependencies": {
88
"@algolia/autocomplete-core": "1.7.4",
99
"@algolia/client-search": "4.14.3",
10-
"@builder.io/partytown": "0.10.2",
10+
"@builder.io/qwik": "1.14.1",
1111
"@emotion/react": "11.13.0",
1212
"@emotion/styled": "11.13.0",
1313
"@modular-forms/qwik": "0.23.1",
@@ -16,13 +16,14 @@
1616
"@mui/x-data-grid": "6.20.4",
1717
"@qwik-ui/headless": "0.6.3",
1818
"@qwik.dev/core": "workspace:*",
19+
"@qwik.dev/partytown": "0.11.1",
1920
"@qwik.dev/react": "workspace:*",
2021
"@qwik.dev/router": "workspace:*",
2122
"@shikijs/colorized-brackets": "3.1.0",
2223
"@shikijs/rehype": "3.1.0",
2324
"@shikijs/transformers": "3.1.0",
2425
"@shikijs/types": "3.1.0",
25-
"@supabase/supabase-js": "2.44.4",
26+
"@supabase/supabase-js": "2.49.4",
2627
"@tailwindcss/vite": "4.0.12",
2728
"@types/leaflet": "1.9.12",
2829
"@types/prismjs": "1.26.4",

packages/docs/public/_headers

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
/*
2+
Cache-Control: public, max-age=3600, s-maxage=3600;
3+
14
/assets/*
2-
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable
5+
! Cache-Control
6+
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable;
37

48
/build/*
5-
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable
9+
! Cache-Control
10+
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable;
611

712
/*.svg
8-
Cache-Control: public, max-age=86400, s-maxage=86400
13+
! Cache-Control
14+
Cache-Control: public, max-age=86400, s-maxage=86400;
915

1016
/favicon.ico
11-
Cache-Control: public, max-age=604800, s-maxage=604800
12-
13-
/*
14-
Cache-Control: public, max-age=3600, s-maxage=3600
17+
! Cache-Control
18+
Cache-Control: public, max-age=604800, s-maxage=604800;

packages/docs/public/docs/qwikcity/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)