diff --git a/.changeset/five-dolls-smash.md b/.changeset/five-dolls-smash.md new file mode 100644 index 000000000000..ad5e83fd9a84 --- /dev/null +++ b/.changeset/five-dolls-smash.md @@ -0,0 +1,20 @@ +--- +'@astrojs/svelte': major +--- + +Adds support for Svelte 5. Svelte 3 and 4 are no longer supported. + +The integration will now also no longer add `vitePreprocess()` by default if a preprocessor is not set up in `svelte.config.js`. It is recommended to set up the Svelte config manually so that features like IDE completion and syntax highlighting work properly. + +If you're using SCSS, Stylus, etc in your Svelte component style tags, make sure that the preprocessor is also set up in `svelte.config.js`. For example: + +```js +// svelte.config.js +import { vitePreprocess } from '@astrojs/svelte'; + +export default { + preprocess: vitePreprocess(), +}; +``` + +Refer to the [Svelte 5 migration guide](https://svelte.dev/docs/svelte/v5-migration-guide) and [`@sveltejs/vite-plugin-svelte` changelog](https://github.com/sveltejs/vite-plugin-svelte/blob/main/packages/vite-plugin-svelte/CHANGELOG.md#400) for details of their respective breaking changes. diff --git a/.changeset/tasty-coats-repair.md b/.changeset/tasty-coats-repair.md new file mode 100644 index 000000000000..10b97e1c3d45 --- /dev/null +++ b/.changeset/tasty-coats-repair.md @@ -0,0 +1,5 @@ +--- +'@astrojs/solid-js': patch +--- + +Handles checking Svelte 5 component functions to avoid processing them as Solid components diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 1e63e0247928..fa0af0805e23 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -23,7 +23,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "solid-js": "^1.9.3", - "svelte": "^4.2.19", + "svelte": "^5.1.16", "vue": "^3.5.12" } } diff --git a/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte b/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte index 01e58574a6ec..641312ae1b9f 100644 --- a/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte +++ b/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte @@ -2,7 +2,14 @@ A counter written with Svelte -->
- +
{count}
- +
- + {@render children?.()}
diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 9c1adf7cf9c6..779267dd64ba 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -13,6 +13,6 @@ "dependencies": { "@astrojs/svelte": "^5.7.3", "astro": "^4.16.12", - "svelte": "^4.2.19" + "svelte": "^5.1.16" } } diff --git a/examples/framework-svelte/src/components/Counter.svelte b/examples/framework-svelte/src/components/Counter.svelte index 1353736aaab7..a11538645e6c 100644 --- a/examples/framework-svelte/src/components/Counter.svelte +++ b/examples/framework-svelte/src/components/Counter.svelte @@ -1,5 +1,12 @@
- +
{count}
- +
- + {@render children?.()}
- diff --git a/examples/ssr/src/components/Cart.svelte b/examples/ssr/src/components/Cart.svelte index 74db0bc7947c..5d4b7d2510c1 100644 --- a/examples/ssr/src/components/Cart.svelte +++ b/examples/ssr/src/components/Cart.svelte @@ -1,5 +1,5 @@
- +
{ count }
- +
- + {@render children?.()}
diff --git a/packages/astro/e2e/fixtures/errors/package.json b/packages/astro/e2e/fixtures/errors/package.json index 3730d61f1bd0..77c40677853c 100644 --- a/packages/astro/e2e/fixtures/errors/package.json +++ b/packages/astro/e2e/fixtures/errors/package.json @@ -14,7 +14,7 @@ "react-dom": "^18.3.1", "sass": "^1.80.6", "solid-js": "^1.9.3", - "svelte": "^4.2.19", + "svelte": "^5.1.16", "vue": "^3.5.12" } } diff --git a/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte b/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte index 54dbab6a7540..69d62a884f73 100644 --- a/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte +++ b/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte @@ -1,5 +1,5 @@
- +
{ count }
- +
- + {@render children?.()}
- +
{ count }
- +
diff --git a/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte b/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte index c851a42f86c6..cb2d5149649f 100644 --- a/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte +++ b/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte @@ -1,8 +1,8 @@
- +
{ count }
- +
\ No newline at end of file diff --git a/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte b/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte index 8d6b3f5e1688..d4972b7f92a8 100644 --- a/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte +++ b/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte @@ -1,7 +1,7 @@
- +
{ count }
- +
- + {@render children?.()}
diff --git a/packages/astro/test/fixtures/astro-markdown/astro.config.mjs b/packages/astro/test/fixtures/astro-markdown/astro.config.mjs index ac3f1ab6439e..201ce52f26ef 100644 --- a/packages/astro/test/fixtures/astro-markdown/astro.config.mjs +++ b/packages/astro/test/fixtures/astro-markdown/astro.config.mjs @@ -1,8 +1,6 @@ -import svelte from "@astrojs/svelte"; -import { defineConfig } from 'astro/config'; +import { defineConfig } from "astro/config"; // https://astro.build/config export default defineConfig({ - integrations: [svelte()], - site: 'https://astro.build/', + site: "https://astro.build/", }); diff --git a/packages/astro/test/fixtures/astro-markdown/package.json b/packages/astro/test/fixtures/astro-markdown/package.json index c1903a941ea1..9fe9dae0124d 100644 --- a/packages/astro/test/fixtures/astro-markdown/package.json +++ b/packages/astro/test/fixtures/astro-markdown/package.json @@ -3,7 +3,6 @@ "version": "0.0.0", "private": true, "dependencies": { - "@astrojs/svelte": "workspace:*", "astro": "workspace:*" } } diff --git a/packages/astro/test/fixtures/astro-markdown/src/components/Counter.svelte b/packages/astro/test/fixtures/astro-markdown/src/components/Counter.svelte deleted file mode 100644 index 4e91b26596c4..000000000000 --- a/packages/astro/test/fixtures/astro-markdown/src/components/Counter.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/packages/astro/test/fixtures/astro-slots-nested/package.json b/packages/astro/test/fixtures/astro-slots-nested/package.json index 114e369d6cd6..6d541872ec11 100644 --- a/packages/astro/test/fixtures/astro-slots-nested/package.json +++ b/packages/astro/test/fixtures/astro-slots-nested/package.json @@ -13,7 +13,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "solid-js": "^1.9.3", - "svelte": "^4.2.19", + "svelte": "^5.1.16", "vue": "^3.5.12" } } diff --git a/packages/astro/test/fixtures/component-library-shared/Counter.svelte b/packages/astro/test/fixtures/component-library-shared/Counter.svelte index 2f4c07339060..0ca9f08b0d96 100644 --- a/packages/astro/test/fixtures/component-library-shared/Counter.svelte +++ b/packages/astro/test/fixtures/component-library-shared/Counter.svelte @@ -1,5 +1,6 @@
- +
{ count }
- +
- + {@render children?.()}