Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: vite 6 (just upgrade, no env) #7382

Open
wants to merge 2 commits into
base: build/v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": [
"vite"
],
"pinVersion": "^5"
"pinVersion": ">=5 <7"
},
{
"label": "use workspace protocol for local packages and allow patch versions (used in e.g. qwik-react)",
Expand Down Expand Up @@ -151,11 +151,11 @@
"tsx": "4.19.2",
"typescript": "5.4.5",
"vfile": "6.0.2",
"vite": "5.4.10",
"vite-imagetools": "7.0.4",
"vite-plugin-dts": "4.3.0",
"vite-tsconfig-paths": "5.0.1",
"vitest": "2.1.4",
"vite": "6.2.0",
"vite-imagetools": "7.0.5",
"vite-plugin-dts": "4.5.0",
"vite-tsconfig-paths": "5.1.4",
"vitest": "3.0.7",
"watchlist": "0.3.1",
"which-pm-runs": "1.1.0",
"zod": "3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"typescript": "5.4.5",
"undici": "*",
"valibot": "0.33.3",
"vite": "5.4.10",
"vite": "6.2.0",
"vite-plugin-inspect": "0.8.5",
"wrangler": "3.65.1"
},
Expand Down
10 changes: 2 additions & 8 deletions packages/docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { defineConfig, loadEnv, type Plugin } from 'vite';
import Inspect from 'vite-plugin-inspect';
import { examplesData, playgroundData, rawSource, tutorialData } from './vite.repl-apps';
import { sourceResolver } from './vite.source-resolver';
import rehypePrettyCode from 'rehype-pretty-code';

const PUBLIC_QWIK_INSIGHTS_KEY = loadEnv('', '.', 'PUBLIC').PUBLIC_QWIK_INSIGHTS_KEY;
const docsDir = new URL(import.meta.url).pathname;
Expand Down Expand Up @@ -52,19 +53,12 @@ const muteWarningsPlugin = (warningsToIgnore: string[][]): Plugin => {
};
};

export default defineConfig(async () => {
const { default: rehypePrettyCode } = await import('rehype-pretty-code');

export default defineConfig(() => {
const routesDir = resolve('src', 'routes');
return {
optimizeDeps: {
entries: ['./src/routes/**/index.tsx', './src/routes/**/layout.tsx'],
},
dev: {
headers: {
'Cache-Control': 'public, max-age=0',
},
},
preview: {
headers: {
'Cache-Control': 'public, max-age=600',
Expand Down
6 changes: 3 additions & 3 deletions packages/insights/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"tailwindcss": "3.4.6",
"typescript": "5.4.5",
"undici": "*",
"vite": "5.4.10",
"vite-tsconfig-paths": "5.0.1",
"vitest": "2.1.4",
"vite": "6.2.0",
"vite-tsconfig-paths": "5.1.4",
"vitest": "3.0.7",
"zod": "3.22.4"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"react": "18.3.1",
"react-dom": "18.3.1",
"typescript": "5.4.5",
"vite": "5.4.10"
"vite": "6.2.0"
},
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
Expand Down Expand Up @@ -40,7 +40,7 @@
"@types/react-dom": "^18",
"react": "^18",
"react-dom": "^18",
"vite": "^5"
"vite": ">=5 <7"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions packages/qwik-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"undici": "*",
"valibot": ">=0.36.0 <2",
"vfile": "6.0.2",
"vite": "^5",
"vite-imagetools": "^7",
"vite": ">=5 <7",
"vite-imagetools": "^7.0.5",
"zod": "3.22.4"
},
"devDependencies": {
Expand Down Expand Up @@ -176,7 +176,7 @@
"license": "MIT",
"main": "./lib/index.qwik.mjs",
"peerDependencies": {
"vite": "^5"
"vite": ">=5 <7"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions packages/qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"kleur": "4.1.5",
"prettier": "3.4.2",
"ts-morph": "23.0.0",
"vitest": "2.1.4"
"vitest": "3.0.7"
},
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
Expand Down Expand Up @@ -173,8 +173,8 @@
"main": "./src/index.ts",
"peerDependencies": {
"prettier": "*",
"vite": "^5",
"vitest": "^2"
"vite": ">=5 <7",
"vitest": ">=2 <3"
},
"peerDependenciesMeta": {
"vitest": {
Expand Down
20 changes: 6 additions & 14 deletions packages/qwik/src/core/shared/shared-serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,8 @@ const inflate = (
case TypeIds.Error: {
const d = data as unknown[];
target.message = d[0];
const second = d[1];
if (second && Array.isArray(second)) {
for (let i = 0; i < second.length; i++) {
target[second[i++]] = d[i];
}
target.stack = d[2];
} else {
target.stack = second;
for (let i = 1; i < d.length; i += 2) {
target[d[i] as string] = d[i + 1];
}
break;
}
Expand Down Expand Up @@ -802,7 +796,7 @@ export const createSerializationContext = (
) {
// ignore
} else if (obj instanceof Error) {
discoveredValues.push(...Object.values(obj));
discoveredValues.push(obj.message, ...Object.values(obj), isDev && obj.stack);
} else if (isStore(obj)) {
const target = getStoreTarget(obj)!;
const effects = getStoreHandler(obj)!.$effects$;
Expand Down Expand Up @@ -1205,13 +1199,11 @@ function serialize(serializationContext: SerializationContext): void {
output(TypeIds.Regex, value.toString());
} else if (value instanceof Error) {
const out: any[] = [value.message];
const extraProps = Object.entries(value).flat();
if (extraProps.length) {
out.push(extraProps);
}
// flatten gives us the right output
out.push(...Object.entries(value).flat());
/// In production we don't want to leak the stack trace.
if (isDev) {
out.push(value.stack);
out.push('stack', value.stack);
}
output(TypeIds.Error, out);
} else if ($isSsrNode$(value)) {
Expand Down
18 changes: 10 additions & 8 deletions packages/qwik/src/core/shared/shared-serialization.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,26 +153,28 @@ describe('shared-serialization', () => {
err.stack = err
.stack!.replaceAll(/([A-Z]:){0,1}(\/|\\).*\./g, '/...path/file.')
.replaceAll(/:\d+:\d+/g, ':123:456');
expect(await dump(err)).toMatchInlineSnapshot(`
const dumpNoSize = async (obj: any) =>
(await dump(obj)).replaceAll(/\(\d+ chars\)/g, '(x chars)');
expect(await dumpNoSize(err)).toMatchInlineSnapshot(`
"
0 Error [
String "hi"
String "stack"
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\\"...
]
(513 chars)"
(x chars)"
`);
(err as any).extra = 'yey';
expect(await dump(err)).toMatchInlineSnapshot(`
expect(await dumpNoSize(err)).toMatchInlineSnapshot(`
"
0 Error [
String "hi"
Array [
String "extra"
String "yey"
]
String "extra"
String "yey"
String "stack"
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\\"...
]
(535 chars)"
(x chars)"
`);
});
it(title(TypeIds.Object), async () => {
Expand Down
10 changes: 8 additions & 2 deletions packages/qwik/src/core/tests/container.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,14 @@ describe('serializer v2', () => {

describe('ErrorSerializer, ///////// ' + TypeIds.Error, () => {
it('should serialize and deserialize', async () => {
const obj = Object.assign(new Error('MyError'), { extra: 'property' });
expect((await withContainer((ssr) => ssr.addRoot(obj))).$getObjectById$(0)).toEqual(obj);
const date = new Date();
const obj = Object.assign(new Error('MyError'), {
extra: { foo: ['bar', { hi: true }], bar: date },
});
const result = (await withContainer((ssr) => ssr.addRoot(obj))).$getObjectById$(0);
expect(result.message).toEqual(obj.message);
expect(result.extra.foo).toEqual(['bar', { hi: true }]);
expect(result.extra.bar).toEqual(date);
});
});

Expand Down
Loading
Loading