Skip to content

Commit 49324db

Browse files
authored
breaking: drop support for svelte4, remove unused code and update types (#892)
* breaking: drop support for svelte4, remove unused code and update types * fix: lint errors * fix: add workaround for lint issue * fix: lint and some type errors * fix: use new hmr option instead of hot * fix: update types again * fix or work around type issues, remove code that is no longer needed for ts transform error handling * breaking: disable vitePreprocess script by default * refactor: turn svelte-inspector into optional peer and lazy install with a vite plugin hack * chore: update svelte and test snapshots * docs: add changesets * cleanup tests * remove svelte-hmr from docs, update optimizeDeps * remove treatment for svelte/ssr thats no longer needed * fix: use hydrate instead of mount in vite-ssr-esm test * fix: patch svelte hmr accept output until it is taken care of by the compiler * chore: remove more svelte4 refs * docs: update changeset * chore: cleanup ci and add node 22
1 parent 78b9e98 commit 49324db

File tree

130 files changed

+1523
-2172
lines changed

Some content is hidden

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

130 files changed

+1523
-2172
lines changed

.changeset/popular-months-vanish.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte-inspector': major
3+
'@sveltejs/vite-plugin-svelte': major
4+
---
5+
6+
remove support for Svelte 4

.changeset/thin-rats-sniff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': major
3+
---
4+
5+
disable script preprocessing in vitePreprocess() by default because Svelte 5 supports lang=ts out of the box

.changeset/wet-rabbits-wink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': major
3+
---
4+
5+
replaced svelte-hmr with Svelte 5 compiler hmr integration

.github/workflows/ci.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
matrix:
3232
# pseudo-matrix for convenience, NEVER use more than a single combination
33-
node: [18]
33+
node: [20]
3434
os: [ubuntu-latest]
3535
steps:
3636
- uses: actions/checkout@v4
@@ -76,15 +76,11 @@ jobs:
7676
matrix:
7777
node: [20]
7878
os: [ubuntu-latest, macos-latest, windows-latest]
79-
svelte: [4]
8079
include:
8180
- node: 18
8281
os: ubuntu-latest
83-
svelte: 4
84-
# disable running tests with svelte5 in ci for now. Enable once they pass
85-
# - node: 20
86-
# os: ubuntu-latest
87-
# svelte: 5
82+
- node: 22
83+
os: ubuntu-latest
8884
steps:
8985
- uses: actions/checkout@v4
9086
- uses: actions/setup-node@v4
@@ -103,9 +99,6 @@ jobs:
10399
cache-dependency-path: '**/pnpm-lock.yaml'
104100
- name: install
105101
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
106-
# - name: use svelte5
107-
# if: (${{matrix.svelte == 5 }})
108-
# run: pnpm i -Dw svelte@^5.0.0-next.1 && pnpm install
109102
- name: install playwright chromium
110103
run: pnpm playwright install chromium
111104
- name: run tests

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
# pseudo-matrix for convenience, NEVER use more than a single combination
21-
node: [18]
21+
node: [20]
2222
os: [ubuntu-latest]
2323
steps:
2424
- name: checkout

docs/config.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,10 @@ A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patt
173173

174174
### hot
175175

176-
- **Type:** `boolean | SvelteHotOptions` - See [svelte-hmr](https://github.com/sveltejs/svelte-hmr/blob/master/packages/svelte-hmr#options)
176+
- **Deprecated**: use compileOptions.hmr instead
177+
- **Type:** `boolean`
177178
- **Default:** `true` for development, always `false` for production
178179

179-
Enable or disable Hot Module Replacement ([HMR](https://github.com/sveltejs/svelte-hmr/blob/master/packages/svelte-hmr#whats-hmr-by-the-way)).
180-
181-
> Do not customize the options unless you know exactly what you are doing.
182-
183180
### ignorePluginPreprocessors
184181

185182
- **Type:** `boolean | string[]`

docs/faq.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
### Why is component state reset on HMR update?
44

5-
Preservation of local component state after JS updates is disabled to avoid unpredictable and error-prone behavior. You can read more about it [here](https://github.com/sveltejs/svelte-hmr/blob/master/packages/svelte-hmr#preservation-of-local-state).
5+
Preservation of local component state after JS updates is disabled to avoid unpredictable and error-prone behavior.
6+
Since svelte-5, hmr is integrated in compileOptions, but the sentiment in the previously used [svelte-hmr docs](https://github.com/sveltejs/svelte-hmr/blob/master/packages/svelte-hmr#preservation-of-local-state) still applies.
67

78
Please note that if you only edit the `<style>` node, a separate CSS update can be applied where component state is 100% preserved.
89

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
"prettier": "^3.2.5",
4949
"prettier-plugin-svelte": "^3.2.3",
5050
"publint": "^0.2.7",
51-
"svelte": "^4.2.15",
51+
"svelte": "^5.0.0-next.121",
5252
"typescript": "^5.4.5",
53-
"vite": "^5.2.9",
54-
"vitest": "^1.5.0"
53+
"vite": "^5.2.11",
54+
"vitest": "^1.5.3"
5555
},
5656
"lint-staged": {
5757
"*.{js,ts,svelte,html,md,svx}": "eslint --cache --fix",
@@ -66,7 +66,7 @@
6666
},
6767
"pnpm": {
6868
"overrides": {
69-
"@sveltejs/kit>@sveltejs/vite-plugin-svelte": "^3.0.0",
69+
"@sveltejs/kit>@sveltejs/vite-plugin-svelte": "workspace:^",
7070
"@sveltejs/vite-plugin-svelte": "workspace:^",
7171
"@sveltejs/vite-plugin-svelte-inspector": "workspace:^",
7272
"svelte": "$svelte",

packages/e2e-tests/_test_dependencies/svelte-api-only/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
},
1616
"type": "module",
1717
"dependencies": {
18-
"svelte": "^4.2.15"
18+
"svelte": "^5.0.0-next.121"
1919
}
2020
}

packages/e2e-tests/_test_dependencies/svelte-module/src/counter/Counter.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
let localCounter = $state(0);
55
</script>
66

7-
<button on:click={counter.increment}>
7+
<button onclick={counter.increment}>
88
count is {counter.count}
99
</button>
1010

11-
<button on:click={() => localCounter++}>
11+
<button onclick={() => localCounter++}>
1212
local count is {localCounter}
1313
</button>

0 commit comments

Comments
 (0)