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

Vite 6 #12270

Merged
merged 38 commits into from
Nov 29, 2024
Merged

Vite 6 #12270

Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
960eca6
Vite 6
benmccann Jul 31, 2024
baea0df
Vite 6
benmccann Jul 31, 2024
bd4475a
Merge branch 'vite-6' of https://github.com/sveltejs/kit into vite-6
eltigerchino Oct 6, 2024
0e5304b
upgrade to beta 2
eltigerchino Oct 6, 2024
696ca19
Merge branch 'main' into vite-6
eltigerchino Oct 6, 2024
392855d
update lock file
eltigerchino Oct 6, 2024
a2e2852
Merge branch 'main' into vite-6
eltigerchino Oct 6, 2024
0b75723
broken lockfile
eltigerchino Oct 6, 2024
610ac56
Merge branch 'main' into vite-6
eltigerchino Nov 27, 2024
b2363de
forgot the version caret
eltigerchino Nov 27, 2024
b471bf5
update lockfile
benmccann Nov 27, 2024
27668fd
other packages
benmccann Nov 27, 2024
e2b7ac7
dedupe
benmccann Nov 27, 2024
d9bd406
fix invalid file
benmccann Nov 27, 2024
368c37c
format
benmccann Nov 27, 2024
397df91
regenerate types
benmccann Nov 27, 2024
34bba89
upgrade vitest
benmccann Nov 27, 2024
1127da3
update to vite 6.0.1
eltigerchino Nov 27, 2024
270ac6b
fix invalid expected file
eltigerchino Nov 27, 2024
042d033
change package expected test output to match svelte 5 output
eltigerchino Nov 27, 2024
e3675e8
update rollup in enhanced-img
eltigerchino Nov 27, 2024
5c11a87
update to vite 6.0.1
eltigerchino Nov 27, 2024
09ceaa6
fix lockfile
eltigerchino Nov 27, 2024
b9a817a
dedupe
benmccann Nov 27, 2024
a1f692f
try to deflake scroll tests
benmccann Nov 27, 2024
a9c4feb
fix args
benmccann Nov 27, 2024
b3c2e10
other function too
benmccann Nov 27, 2024
6822e08
try this
benmccann Nov 27, 2024
71677ab
bump dts-buddy
benmccann Nov 27, 2024
10104ed
attempted fix
benmccann Nov 27, 2024
68b6211
fix
benmccann Nov 27, 2024
1081652
format
benmccann Nov 27, 2024
732cc55
changeset
benmccann Nov 27, 2024
d9259b2
does this work?
benmccann Nov 27, 2024
5aff1c0
how about this?
benmccann Nov 27, 2024
647d70f
upgrade esbuild
benmccann Nov 27, 2024
bee0111
update esm-env
benmccann Nov 27, 2024
d704a1c
bump esm-env
benmccann Nov 29, 2024
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
8 changes: 8 additions & 0 deletions .changeset/curvy-garlics-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@sveltejs/adapter-cloudflare-workers': minor
'@sveltejs/adapter-cloudflare': minor
'@sveltejs/adapter-netlify': minor
'@sveltejs/adapter-vercel': minor
---

chore: upgrade esbuild to 0.24.0
5 changes: 5 additions & 0 deletions .changeset/purple-comics-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': minor
---

feat: Vite 6 support
2 changes: 1 addition & 1 deletion packages/adapter-auto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"@types/node": "^18.19.48",
"typescript": "^5.3.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare-workers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": {
"@cloudflare/workers-types": "^4.20231121.0",
"@iarna/toml": "^2.2.5",
"esbuild": "^0.21.5"
"esbuild": "^0.24.0"
},
"devDependencies": {
"@cloudflare/kv-asset-handler": "^0.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"dependencies": {
"@cloudflare/workers-types": "^4.20231121.0",
"esbuild": "^0.21.5",
"esbuild": "^0.24.0",
"worktop": "0.8.0-next.18"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/adapter-netlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"esbuild": "^0.21.5",
"esbuild": "^0.24.0",
"set-cookie-parser": "^2.6.0"
},
"devDependencies": {
Expand All @@ -51,12 +51,12 @@
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"@types/node": "^18.19.48",
"@types/set-cookie-parser": "^2.4.7",
"rollup": "^4.14.2",
"typescript": "^5.3.3",
"vitest": "^2.0.1"
"vitest": "^2.1.6"
},
"peerDependencies": {
"@sveltejs/kit": "^2.4.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
"devDependencies": {
"@polka/url": "^1.0.0-next.28",
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"@types/node": "^18.19.48",
"polka": "^1.0.0-next.28",
"sirv": "^3.0.0",
"typescript": "^5.3.3",
"vitest": "^2.0.1"
"vitest": "^2.1.6"
},
"dependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/adapter-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
"devDependencies": {
"@playwright/test": "^1.44.1",
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"@types/node": "^18.19.48",
"sirv": "^3.0.0",
"svelte": "^4.2.10",
"svelte": "^5.2.9",
"typescript": "^5.3.3",
"vite": "^5.3.2"
"vite": "^6.0.1"
},
"peerDependencies": {
"@sveltejs/kit": "^2.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/adapter-static/test/apps/prerendered/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
},
"devDependencies": {
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"sirv-cli": "^3.0.0",
"svelte": "^4.2.10",
"vite": "^5.3.2"
"svelte": "^5.2.9",
"vite": "^6.0.1"
},
"type": "module"
}
6 changes: 3 additions & 3 deletions packages/adapter-static/test/apps/spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"devDependencies": {
"@sveltejs/adapter-node": "workspace:^",
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"sirv-cli": "^3.0.0",
"svelte": "^4.2.10",
"vite": "^5.3.2"
"svelte": "^5.2.9",
"vite": "^6.0.1"
},
"type": "module"
}
6 changes: 3 additions & 3 deletions packages/adapter-vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
},
"dependencies": {
"@vercel/nft": "^0.27.1",
"esbuild": "^0.21.5"
"esbuild": "^0.24.0"
},
"devDependencies": {
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"@types/node": "^18.19.48",
"typescript": "^5.3.3",
"vitest": "^2.0.1"
"vitest": "^2.1.6"
},
"peerDependencies": {
"@sveltejs/kit": "^2.4.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/enhanced-img/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
"devDependencies": {
"@types/estree": "^1.0.5",
"@types/node": "^18.19.48",
"rollup": "^4.14.2",
"svelte": "^5.1.3",
"rollup": "^4.27.4",
"svelte": "^5.2.9",
"typescript": "^5.6.3",
"vite": "^5.3.2",
"vitest": "^2.0.1"
"vite": "^6.0.1",
"vitest": "^2.1.6"
},
"peerDependencies": {
"svelte": "^5.0.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/cookie": "^0.6.0",
"cookie": "^0.6.0",
"devalue": "^5.1.0",
"esm-env": "^1.0.0",
"esm-env": "^1.2.0",
"import-meta-resolve": "^4.1.0",
"kleur": "^4.1.5",
"magic-string": "^0.30.5",
Expand All @@ -33,22 +33,22 @@
},
"devDependencies": {
"@playwright/test": "^1.44.1",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"@types/connect": "^3.4.38",
"@types/node": "^18.19.48",
"@types/set-cookie-parser": "^2.4.7",
"dts-buddy": "^0.5.3",
"dts-buddy": "^0.5.4",
"rollup": "^4.14.2",
"svelte": "^4.2.10",
"svelte": "^5.2.9",
"svelte-preprocess": "^6.0.0",
"typescript": "^5.3.3",
"vite": "^5.3.2",
"vitest": "^2.0.1"
"vite": "^6.0.1",
"vitest": "^2.1.6"
},
"peerDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1",
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0",
"svelte": "^4.0.0 || ^5.0.0-next.0",
"vite": "^5.0.3"
"vite": "^5.0.3 || ^6.0.0"
},
"bin": {
"svelte-kit": "svelte-kit.js"
Expand Down
11 changes: 6 additions & 5 deletions packages/kit/src/exports/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ export interface ActionFailure<T extends Record<string, unknown> | undefined = u
[uniqueSymbol]: true; // necessary or else UnpackValidationError could wrongly unpack objects with the same shape as ActionFailure
}

type UnpackValidationError<T> = T extends ActionFailure<infer X>
? X
: T extends void
? undefined // needs to be undefined, because void will corrupt union type
: T;
type UnpackValidationError<T> =
T extends ActionFailure<infer X>
? X
: T extends void
? undefined // needs to be undefined, because void will corrupt union type
: T;

/**
* This object is passed to the `adapt` function of adapters.
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ async function load_route({ id, invalidating, url, params, route, preload }) {
server_data_node: create_data_node(
// server_data_node is undefined if it wasn't reloaded from the server;
// and if current loader uses server data, we want to reuse previous data.
server_data_node === undefined && loader[0] ? { type: 'skip' } : server_data_node ?? null,
server_data_node === undefined && loader[0] ? { type: 'skip' } : (server_data_node ?? null),
loader[0] ? previous?.server : undefined
)
});
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/page/load_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export function create_universal_fetch(event, state, fetched, csr, resolve_opts)
}
} else {
// simulate CORS errors and "no access to body in no-cors mode" server-side for consistency with client-side behaviour
const mode = input instanceof Request ? input.mode : init?.mode ?? 'cors';
const mode = input instanceof Request ? input.mode : (init?.mode ?? 'cors');
if (mode === 'no-cors') {
response = new Response('', {
status: response.status,
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/page/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export async function render_response({

const form_value =
action_result?.type === 'success' || action_result?.type === 'failure'
? action_result.data ?? null
? (action_result.data ?? null)
: null;

/** @type {string} */
Expand Down
6 changes: 3 additions & 3 deletions packages/kit/test/apps/amp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"devDependencies": {
"@sveltejs/amp": "workspace:^",
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"cross-env": "^7.0.3",
"dropcss": "^1.0.16",
"svelte": "^4.2.10",
"svelte": "^5.2.9",
"svelte-check": "^4.0.1",
"typescript": "^5.5.4",
"vite": "^5.3.2"
"vite": "^6.0.1"
},
"type": "module"
}
6 changes: 3 additions & 3 deletions packages/kit/test/apps/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"devDependencies": {
"@sveltejs/kit": "workspace:^",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"cross-env": "^7.0.3",
"svelte": "^4.2.10",
"svelte": "^5.2.9",
"svelte-check": "^4.0.1",
"typescript": "^5.5.4",
"vite": "^5.3.2"
"vite": "^6.0.1"
},
"type": "module"
}
40 changes: 24 additions & 16 deletions packages/kit/test/apps/basics/test/cross-platform/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,12 @@
test('url-supplied non-ascii anchor works on navigation to page after manual scroll', async ({
page,
in_view,
clicknav
clicknav,
scroll_to
}) => {
await page.goto('/anchor');
await clicknav('#non-ascii-anchor');
await page.evaluate(() => {
window.scrollTo(0, 50);
});
await scroll_to(0, 50);
await page.locator('#non-ascii-anchor').click();
expect(await in_view('#go-to-encöded')).toBe(true);
});
Expand Down Expand Up @@ -359,7 +358,8 @@

test('scroll is restored after hitting the back button for an in-app cross-document navigation', async ({
page,
clicknav
clicknav,
scroll_to
}) => {
await page.goto('/scroll/cross-document/a');

Expand All @@ -368,7 +368,7 @@
if (!rect) throw new Error('Could not determine bounding box');

const target_scroll_y = rect.y + rect.height - height;
await page.evaluate((y) => scrollTo(0, y), target_scroll_y);
await scroll_to(0, target_scroll_y);

await page.locator('[href="/scroll/cross-document/b"]').click();
expect(await page.textContent('h1')).toBe('b');
Expand Down Expand Up @@ -441,7 +441,8 @@
test('scroll positions are recovered on reloading the page', async ({
page,
app,
browserName
browserName,
scroll_to
}) => {
// No idea why the workaround below works only in dev mode
// A better solution would probably be to set fission.webContentIsolationStrategy: 1
Expand All @@ -451,20 +452,21 @@
}

await page.goto('/anchor');
await page.evaluate(() => window.scrollTo(0, 1000));
await scroll_to(0, 1000);
await app.goto('/anchor/anchor');
await page.evaluate(() => window.scrollTo(0, 1000));
await scroll_to(0, 1000);

await page.reload();
if (browserName === 'firefox') {
// Firefox with Playwright pushed new history entry history after reload
// See https://github.com/microsoft/playwright/issues/22640
await page.goBack();
}
expect(await page.evaluate(() => window.scrollY)).toBe(1000);
await page.waitForFunction(() => window.scrollY === 1000);

const waiter = page.waitForFunction(() => window.scrollY === 1000);
await page.goBack();
expect(await page.evaluate(() => window.scrollY)).toBe(1000);
await waiter;
});

test('scroll position is top of page on ssr:false reload', async ({ page }) => {
Expand All @@ -474,26 +476,32 @@
expect(await page.evaluate(() => window.scrollY)).toBe(0);
});

test('clicking # or #top takes you to the top of the current page', async ({ page }) => {
test('clicking # or #top takes you to the top of the current page', async ({
page,
scroll_to
}) => {
await page.goto('/scroll/top');

for (const href of ['#', '#top']) {
await page.evaluate(() => window.scrollTo(0, 1000));
await scroll_to(0, 1000);
await page.click(`a[href="${href}"]`);
expect(await page.evaluate(() => window.scrollY)).toBe(0);

await page.evaluate(() => window.scrollTo(0, 1000));
await scroll_to(0, 1000);
await page.click(`a[href="${href}"]`);
expect(await page.evaluate(() => window.scrollY)).toBe(0);
}
});

test('Scroll position is correct after going back from a shallow route', async ({ page }) => {
test('Scroll position is correct after going back from a shallow route', async ({
page,
scroll_to
}) => {
await page.goto('/scroll/push-state');
await page.locator('#subpage-link').click();
await page.locator('#back-button').click();

await page.evaluate(() => window.scrollTo(0, 9999));
await scroll_to(0, 9999);

const scroll = await page.evaluate(() => window.scrollY);
expect(scroll).toBeGreaterThan(0);
Expand Down Expand Up @@ -820,7 +828,7 @@
expect(await page.textContent('h3')).toBe('bar');
});

test('responds to <form target="_blank"> submission with new tab', async ({ page }) => {

Check warning on line 831 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / test-kit-cross-browser (18, ubuntu-latest, firefox, build)

flaky test: responds to <form target="_blank"> submission with new tab

retries: 2
await page.goto('/routing/form-target-blank');

let tabs = page.context().pages();
Expand All @@ -834,7 +842,7 @@
expect(tabs.length > 1);
});

test('responds to <button formtarget="_blank" submission with new tab', async ({ page }) => {

Check warning on line 845 in packages/kit/test/apps/basics/test/cross-platform/client.test.js

View workflow job for this annotation

GitHub Actions / test-kit-cross-browser (18, ubuntu-latest, firefox, build)

flaky test: responds to <button formtarget="_blank" submission with new tab

retries: 2
await page.goto('/routing/form-target-blank');

let tabs = page.context().pages();
Expand Down
Loading
Loading