Skip to content

Commit 1b7fd1d

Browse files
authored
Merge pull request #7382 from QwikDev/v2-vite-6
chore: vite 6 (just upgrade, no env)
2 parents 8619d6a + 5a00c0b commit 1b7fd1d

13 files changed

+845
-712
lines changed

package.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"dependencies": [
3030
"vite"
3131
],
32-
"pinVersion": "^5"
32+
"pinVersion": ">=5 <7"
3333
},
3434
{
3535
"label": "use workspace protocol for local packages and allow patch versions (used in e.g. qwik-react)",
@@ -115,7 +115,7 @@
115115
"@types/which-pm-runs": "1.0.2",
116116
"@typescript-eslint/eslint-plugin": "7.16.1",
117117
"@typescript-eslint/parser": "7.16.1",
118-
"@vitest/coverage-v8": "3.0.8",
118+
"@vitest/coverage-v8": "3.1.1",
119119
"all-contributors-cli": "6.26.1",
120120
"brotli": "1.3.3",
121121
"concurrently": "8.2.2",
@@ -139,7 +139,7 @@
139139
"prettier-plugin-jsdoc": "1.3.2",
140140
"pretty-quick": "4.0.0",
141141
"prompts": "2.4.2",
142-
"rollup": "4.24.2",
142+
"rollup": "4.39.0",
143143
"semver": "7.6.3",
144144
"simple-git-hooks": "2.11.1",
145145
"snoop": "1.0.4",
@@ -152,11 +152,11 @@
152152
"tsx": "4.19.2",
153153
"typescript": "5.8.2",
154154
"vfile": "6.0.2",
155-
"vite": "5.4.10",
156-
"vite-imagetools": "7.0.4",
157-
"vite-plugin-dts": "4.3.0",
155+
"vite": "6.2.6",
156+
"vite-imagetools": "7.0.5",
157+
"vite-plugin-dts": "4.5.3",
158158
"vite-tsconfig-paths": "5.1.4",
159-
"vitest": "3.0.8",
159+
"vitest": "3.1.1",
160160
"watchlist": "0.3.1",
161161
"which-pm-runs": "1.1.0",
162162
"zod": "3.22.4"
@@ -175,7 +175,8 @@
175175
"@supabase/realtime-js": "2.8.4"
176176
},
177177
"patchedDependencies": {
178-
178+
179+
"@auth/qwik": "patches/@auth__qwik.patch"
179180
}
180181
},
181182
"private": true,

packages/docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"typescript": "5.8.2",
5757
"undici": "*",
5858
"valibot": "0.33.3",
59-
"vite": "5.4.10",
59+
"vite": "6.2.6",
6060
"vite-plugin-inspect": "0.8.5",
6161
"wrangler": "3.65.1"
6262
},

packages/docs/vite.config.ts

-5
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ export default defineConfig(async () => {
100100
optimizeDeps: {
101101
entries: ['./src/routes/**/index.tsx', './src/routes/**/layout.tsx'],
102102
},
103-
dev: {
104-
headers: {
105-
'Cache-Control': 'public, max-age=0',
106-
},
107-
},
108103
preview: {
109104
headers: {
110105
'Cache-Control': 'public, max-age=600',

packages/insights/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Qwik Insights dashboard",
44
"version": "0.1.0",
55
"dependencies": {
6-
"@auth/qwik": "0.2.2",
6+
"@auth/qwik": "0.6.0",
77
"@libsql/client": "^0.14.0",
88
"@modular-forms/qwik": "^0.24.0",
99
"@typescript/analyze-trace": "^0.10.1",
@@ -33,9 +33,9 @@
3333
"tailwindcss": "3.4.6",
3434
"typescript": "5.8.2",
3535
"undici": "*",
36-
"vite": "5.4.10",
36+
"vite": "6.2.6",
3737
"vite-tsconfig-paths": "5.1.4",
38-
"vitest": "3.0.8",
38+
"vitest": "3.1.1",
3939
"zod": "3.22.4"
4040
},
4141
"engines": {

packages/insights/vite.config.ts

+17-24
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,22 @@ import { qwikRouter } from '@qwik.dev/router/vite';
55
import { defineConfig, loadEnv } from 'vite';
66
import tsconfigPaths from 'vite-tsconfig-paths';
77

8-
export default defineConfig(async () => {
9-
return {
10-
plugins: [
11-
macroPlugin({ preset: 'pandacss' }),
12-
qwikRouter(),
13-
qwikVite({
14-
experimental: ['insights'],
15-
}),
16-
tsconfigPaths({ projects: ['.'] }),
17-
qwikInsights({ publicApiKey: loadEnv('', '.', '').PUBLIC_QWIK_INSIGHTS_KEY }),
18-
],
19-
dev: {
20-
headers: {
21-
'Cache-Control': 'public, max-age=0',
22-
},
8+
export default defineConfig({
9+
plugins: [
10+
macroPlugin({ preset: 'pandacss' }),
11+
qwikRouter(),
12+
qwikVite({
13+
experimental: ['insights'],
14+
}),
15+
tsconfigPaths({ projects: ['.'] }),
16+
qwikInsights({ publicApiKey: loadEnv('', '.', '').PUBLIC_QWIK_INSIGHTS_KEY }),
17+
],
18+
preview: {
19+
headers: {
20+
'Cache-Control': 'public, max-age=600',
2321
},
24-
preview: {
25-
headers: {
26-
'Cache-Control': 'public, max-age=600',
27-
},
28-
},
29-
optimizeDeps: {
30-
include: ['@auth/core'],
31-
},
32-
};
22+
},
23+
optimizeDeps: {
24+
include: ['@auth/core'],
25+
},
3326
});

packages/qwik-react/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"react": "18.3.1",
1111
"react-dom": "18.3.1",
1212
"typescript": "5.8.2",
13-
"vite": "5.4.10"
13+
"vite": "6.2.6"
1414
},
1515
"engines": {
1616
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
@@ -40,7 +40,7 @@
4040
"@types/react-dom": "^18",
4141
"react": "^18",
4242
"react-dom": "^18",
43-
"vite": "^5"
43+
"vite": ">=5 <7"
4444
},
4545
"publishConfig": {
4646
"access": "public"

packages/qwik-router/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"undici": "*",
1212
"valibot": ">=0.36.0 <2",
1313
"vfile": "6.0.2",
14-
"vite": "^5",
15-
"vite-imagetools": "^7",
14+
"vite": ">=5 <7",
15+
"vite-imagetools": "^7.0.5",
1616
"zod": "3.22.4"
1717
},
1818
"devDependencies": {
@@ -176,7 +176,7 @@
176176
"license": "MIT",
177177
"main": "./lib/index.qwik.mjs",
178178
"peerDependencies": {
179-
"vite": "^5"
179+
"vite": ">=5 <7"
180180
},
181181
"publishConfig": {
182182
"access": "public"

packages/qwik/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"kleur": "4.1.5",
1919
"prettier": "3.4.2",
2020
"ts-morph": "23.0.0",
21-
"vitest": "3.0.8"
21+
"vitest": "3.1.1"
2222
},
2323
"engines": {
2424
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
@@ -178,8 +178,8 @@
178178
"main": "./src/index.ts",
179179
"peerDependencies": {
180180
"prettier": "*",
181-
"vite": "^5",
182-
"vitest": "^2"
181+
"vite": ">=5 <7",
182+
"vitest": ">=2 <3"
183183
},
184184
"peerDependenciesMeta": {
185185
"vitest": {

packages/qwik/src/core/shared/shared-serialization.ts

+6-14
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,8 @@ const inflate = (
324324
case TypeIds.Error: {
325325
const d = data as unknown[];
326326
target.message = d[0];
327-
const second = d[1];
328-
if (second && Array.isArray(second)) {
329-
for (let i = 0; i < second.length; i++) {
330-
target[second[i++]] = second[i];
331-
}
332-
target.stack = d[2];
333-
} else {
334-
target.stack = second;
327+
for (let i = 1; i < d.length; i += 2) {
328+
target[d[i] as string] = d[i + 1];
335329
}
336330
break;
337331
}
@@ -818,7 +812,7 @@ export const createSerializationContext = (
818812
) {
819813
// ignore
820814
} else if (obj instanceof Error) {
821-
discoveredValues.push(...Object.values(obj));
815+
discoveredValues.push(obj.message, ...Object.values(obj), isDev && obj.stack);
822816
} else if (isStore(obj)) {
823817
const target = getStoreTarget(obj)!;
824818
const effects = getStoreHandler(obj)!.$effects$;
@@ -1268,13 +1262,11 @@ function serialize(serializationContext: SerializationContext): void {
12681262
output(TypeIds.Regex, value.toString());
12691263
} else if (value instanceof Error) {
12701264
const out: any[] = [value.message];
1271-
const extraProps = Object.entries(value).flat();
1272-
if (extraProps.length) {
1273-
out.push(extraProps);
1274-
}
1265+
// flatten gives us the right output
1266+
out.push(...Object.entries(value).flat());
12751267
/// In production we don't want to leak the stack trace.
12761268
if (isDev) {
1277-
out.push(value.stack);
1269+
out.push('stack', value.stack);
12781270
}
12791271
output(TypeIds.Error, out);
12801272
} else if ($isSsrNode$(value)) {

packages/qwik/src/core/shared/shared-serialization.unit.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -161,26 +161,28 @@ describe('shared-serialization', () => {
161161
err.stack = err
162162
.stack!.replaceAll(/([A-Z]:){0,1}(\/|\\).*\./g, '/...path/file.')
163163
.replaceAll(/:\d+:\d+/g, ':123:456');
164-
expect(await dump(err)).toMatchInlineSnapshot(`
164+
const dumpNoSize = async (obj: any) =>
165+
(await dump(obj)).replaceAll(/\(\d+ chars\)/g, '(x chars)');
166+
expect(await dumpNoSize(err)).toMatchInlineSnapshot(`
165167
"
166168
0 Error [
167169
String "hi"
170+
String "stack"
168171
String "Error: hi\\n at /...path/file.ts:123:456\\n at file:/...path/file.js:123:456\\n at file:/...path/file.js:123:456\\"...
169172
]
170-
(487 chars)"
173+
(x chars)"
171174
`);
172175
(err as any).extra = 'yey';
173-
expect(await dump(err)).toMatchInlineSnapshot(`
176+
expect(await dumpNoSize(err)).toMatchInlineSnapshot(`
174177
"
175178
0 Error [
176179
String "hi"
177-
Array [
178-
String "extra"
179-
String "yey"
180-
]
180+
String "extra"
181+
String "yey"
182+
String "stack"
181183
String "Error: hi\\n at /...path/file.ts:123:456\\n at file:/...path/file.js:123:456\\n at file:/...path/file.js:123:456\\"...
182184
]
183-
(509 chars)"
185+
(x chars)"
184186
`);
185187
});
186188
it(title(TypeIds.Object), async () => {

packages/qwik/src/core/tests/container.spec.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,14 @@ describe('serializer v2', () => {
311311

312312
describe('ErrorSerializer, ///////// ' + TypeIds.Error, () => {
313313
it('should serialize and deserialize', async () => {
314-
const obj = Object.assign(new Error('MyError'), { extra: 'property' });
314+
const date = new Date();
315+
const obj = Object.assign(new Error('MyError'), {
316+
extra: { foo: ['bar', { hi: true }], bar: date },
317+
});
315318
const result = (await withContainer((ssr) => ssr.addRoot(obj))).$getObjectById$(0);
316-
expect(result).toBeInstanceOf(Error);
317-
expect(result.message).toBe('MyError');
318-
expect((result as any).extra).toBe('property');
319+
expect(result.message).toEqual(obj.message);
320+
expect(result.extra.foo).toEqual(['bar', { hi: true }]);
321+
expect(result.extra.bar).toEqual(date);
319322
});
320323
});
321324

patches/@auth__qwik.patch

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/index.qwik.js b/index.qwik.js
2+
index 344a147d81a24d041488239401b91b078b061edc..61c0c9afdd048e6befe4d142dd4def44244d9d4a 100644
3+
--- a/index.qwik.js
4+
+++ b/index.qwik.js
5+
@@ -1,7 +1,6 @@
6+
import { globalActionQrl, zodQrl, z, routeLoaderQrl } from "@builder.io/qwik-city";
7+
import { inlinedQrl, useLexicalScope, implicit$FirstArg } from "@builder.io/qwik";
8+
-import { Auth, skipCSRFCheck, isAuthAction } from "@auth/core";
9+
-import { customFetch } from "@auth/core";
10+
+import { customFetch as customFetch$1, Auth, skipCSRFCheck, isAuthAction } from "@auth/core";
11+
import { isServer } from "@builder.io/qwik/build";
12+
var setCookie = { exports: {} };
13+
var defaultParseOptions = {
14+
@@ -292,9 +291,11 @@ AccountNotLinked.type = "AccountNotLinked";
15+
class ExperimentalFeatureNotEnabled extends AuthError {
16+
}
17+
ExperimentalFeatureNotEnabled.type = "ExperimentalFeatureNotEnabled";
18+
+const customFetch = isServer ? customFetch$1 : void 0;
19+
function QwikAuthQrl(authOptions) {
20+
const useSignIn = globalActionQrl(/* @__PURE__ */ inlinedQrl(async ({ providerId, redirectTo: _redirectTo, options, authorizationParams }, req) => {
21+
const [authOptions2] = useLexicalScope();
22+
+ if (!isServer) return;
23+
const { redirectTo = _redirectTo ?? defaultRedirectTo(req), ...rest } = options ?? {};
24+
const isCredentials = providerId === "credentials";
25+
const authOpts = await authOptions2(req);
26+
@@ -325,6 +326,7 @@ function QwikAuthQrl(authOptions) {
27+
}, "QwikAuthQrl_useSignIn_globalAction_zod_X0EcrMISJRM")));
28+
const useSignOut = globalActionQrl(/* @__PURE__ */ inlinedQrl(async ({ redirectTo }, req) => {
29+
const [authOptions2] = useLexicalScope();
30+
+ if (!isServer) return;
31+
redirectTo ?? (redirectTo = defaultRedirectTo(req));
32+
const authOpts = await authOptions2(req);
33+
setEnvDefaults(req.env, authOpts);
34+
@@ -374,6 +376,7 @@ function QwikAuthQrl(authOptions) {
35+
}
36+
const QwikAuth$ = /* @__PURE__ */ implicit$FirstArg(QwikAuthQrl);
37+
async function authAction(body, req, path, authOptions) {
38+
+ if (!isServer) return;
39+
const request = new Request(new URL(path, req.request.url), {
40+
method: req.request.method,
41+
headers: req.request.headers,
42+
@@ -431,6 +434,7 @@ async function getSessionData(req, options) {
43+
throw new Error(data.message);
44+
}
45+
const setEnvDefaults = (env, config) => {
46+
+ if (!isServer) return;
47+
config.basePath = "/auth";
48+
if (!config.secret?.length) {
49+
config.secret = [];

0 commit comments

Comments
 (0)