Skip to content

Commit 6e08f0c

Browse files
committed
Merge branch 'main' into gh-12624
2 parents 0ca2b01 + e03dae9 commit 6e08f0c

File tree

142 files changed

+1883
-1627
lines changed

Some content is hidden

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

142 files changed

+1883
-1627
lines changed

.changeset/beige-lamps-ring.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: always return true from `deleteProperty` trap

.changeset/clean-shirts-yawn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
breaking: throw error if derived creates state and then depends on it

.changeset/five-maps-reflect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: ensure assignments to state field inside constructor trigger effects

.changeset/green-baboons-sip.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: ensure $inspect works with SvelteMap and SvelteSet

.changeset/green-windows-tap.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: handle deletions of previously-unread state proxy properties

.changeset/khaki-donkeys-jump.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: properly handle proxied array length mutations

.changeset/mighty-poets-fix.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
chore: default options.filename to "(unknown)"

.changeset/olive-llamas-warn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: properly transform destructured `$derived.by` declarations

.changeset/pre.json

+12
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"beige-cobras-smoke",
2222
"beige-flies-wash",
2323
"beige-gifts-appear",
24+
"beige-lamps-ring",
2425
"beige-mirrors-listen",
2526
"beige-rabbits-shave",
2627
"beige-seas-share",
@@ -82,6 +83,7 @@
8283
"clean-cats-wave",
8384
"clean-eels-beg",
8485
"clean-melons-wash",
86+
"clean-shirts-yawn",
8587
"clever-chefs-relate",
8688
"clever-maps-travel",
8789
"clever-rockets-burn",
@@ -198,6 +200,7 @@
198200
"fifty-rice-wait",
199201
"fifty-steaks-float",
200202
"fifty-toys-invite",
203+
"five-maps-reflect",
201204
"five-tigers-search",
202205
"flat-feet-visit",
203206
"flat-ghosts-fly",
@@ -273,12 +276,14 @@
273276
"great-fans-unite",
274277
"great-icons-retire",
275278
"great-plums-pretend",
279+
"green-baboons-sip",
276280
"green-eggs-approve",
277281
"green-fishes-lie",
278282
"green-hounds-play",
279283
"green-snails-tickle",
280284
"green-tigers-judge",
281285
"green-walls-clap",
286+
"green-windows-tap",
282287
"grumpy-avocados-fetch",
283288
"grumpy-insects-sleep",
284289
"grumpy-jars-sparkle",
@@ -419,6 +424,7 @@
419424
"mighty-files-hammer",
420425
"mighty-frogs-obey",
421426
"mighty-paws-smash",
427+
"mighty-poets-fix",
422428
"mighty-shoes-nail",
423429
"modern-apricots-promise",
424430
"modern-fishes-double",
@@ -478,6 +484,7 @@
478484
"olive-cobras-wonder",
479485
"olive-forks-grin",
480486
"olive-kangaroos-brake",
487+
"olive-llamas-warn",
481488
"olive-mice-fix",
482489
"olive-moons-act",
483490
"olive-seals-sell",
@@ -538,6 +545,7 @@
538545
"quiet-cobras-smile",
539546
"quiet-crabs-nail",
540547
"quiet-timers-speak",
548+
"rare-ears-agree",
541549
"rare-insects-tell",
542550
"rare-mirrors-act",
543551
"rare-pears-whisper",
@@ -606,6 +614,7 @@
606614
"shiny-rats-heal",
607615
"shiny-shrimps-march",
608616
"shiny-starfishes-cross",
617+
"shiny-wombats-argue",
609618
"short-buses-camp",
610619
"short-countries-rush",
611620
"short-starfishes-beg",
@@ -628,6 +637,7 @@
628637
"six-boats-shave",
629638
"six-chicken-kneel",
630639
"six-gorillas-obey",
640+
"six-moons-invent",
631641
"six-vans-add",
632642
"sixty-items-crash",
633643
"sixty-numbers-hope",
@@ -820,7 +830,9 @@
820830
"weak-frogs-bow",
821831
"weak-terms-destroy",
822832
"wet-bats-exercise",
833+
"wet-donkeys-fry",
823834
"wet-games-fly",
835+
"wet-pears-buy",
824836
"wet-pears-remain",
825837
"wet-wombats-repeat",
826838
"wicked-bikes-matter",

.changeset/shiny-wombats-argue.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: correctly hydrate empty raw blocks

.changeset/six-moons-invent.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: make internal sources ownerless

.changeset/two-cats-approve.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: repair `href` attribute mismatches

.changeset/wet-donkeys-fry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: join text nodes separated by comments

.changeset/wet-pears-buy.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
feat: allow non-synchronous legacy component instantiation

.prettierignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# see: https://github.com/sveltejs/svelte/pull/9609
33
documentation/docs/05-misc/03-typescript.md
44

5-
# The following are all duplicated with prettierignore configs in the packages,
6-
# which is necessary because of https://github.com/prettier/prettier-vscode/issues/3424
75
packages/**/dist/*.js
86
packages/**/build/*.js
97
packages/**/npm/**/*
108
packages/**/config/*.js
9+
10+
# packages/svelte
1111
packages/svelte/messages/**/*.md
1212
packages/svelte/src/compiler/errors.js
1313
packages/svelte/src/compiler/warnings.js
@@ -17,6 +17,7 @@ packages/svelte/src/internal/shared/errors.js
1717
packages/svelte/src/internal/shared/warnings.js
1818
packages/svelte/src/internal/server/errors.js
1919
packages/svelte/tests/migrate/samples/*/output.svelte
20+
packages/svelte/tests/**/*.svelte
2021
packages/svelte/tests/**/_expected*
2122
packages/svelte/tests/**/_actual*
2223
packages/svelte/tests/**/expected*
@@ -29,6 +30,7 @@ packages/svelte/compiler/index.js
2930
playgrounds/sandbox/input/**.svelte
3031
playgrounds/sandbox/output
3132

33+
# sites/svelte.dev
3234
sites/svelte.dev/static/svelte-app.json
3335
sites/svelte.dev/scripts/svelte-app/
3436
sites/svelte.dev/src/routes/_components/Supporters/contributors.jpg

.vscode/launch.json

-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4-
{
5-
"type": "chrome",
6-
"request": "launch",
7-
"name": "Playground: Browser",
8-
"url": "http://localhost:10001"
9-
},
10-
{
11-
"type": "node",
12-
"request": "launch",
13-
"runtimeArgs": ["--watch"],
14-
"name": "Playground: Server",
15-
"outputCapture": "std",
16-
"program": "start.js",
17-
"cwd": "${workspaceFolder}/playgrounds/demo",
18-
"cascadeTerminateToConfigurations": ["Playground: Browser"]
19-
},
204
{
215
"type": "node",
226
"request": "launch",
@@ -26,11 +10,5 @@
2610
"NODE_OPTIONS": "--stack-trace-limit=10000"
2711
}
2812
}
29-
],
30-
"compounds": [
31-
{
32-
"name": "Playground: Full",
33-
"configurations": ["Playground: Server", "Playground: Browser"]
34-
}
3513
]
3614
}

benchmarking/benchmarks/kairo/kairo_avoidable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as $ from '../../../packages/svelte/src/internal/client/index.js';
33
import { busy } from './util.js';
44

55
function setup() {
6-
let head = $.source(0);
6+
let head = $.state(0);
77
let computed1 = $.derived(() => $.get(head));
88
let computed2 = $.derived(() => ($.get(computed1), 0));
99
let computed3 = $.derived(() => (busy(), $.get(computed2) + 1)); // heavy computation

benchmarking/benchmarks/kairo/kairo_broad.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { assert, fastest_test } from '../../utils.js';
22
import * as $ from '../../../packages/svelte/src/internal/client/index.js';
33

44
function setup() {
5-
let head = $.source(0);
5+
let head = $.state(0);
66
let last = head;
77
let counter = 0;
88

benchmarking/benchmarks/kairo/kairo_deep.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let len = 50;
55
const iter = 50;
66

77
function setup() {
8-
let head = $.source(0);
8+
let head = $.state(0);
99
let current = head;
1010
for (let i = 0; i < len; i++) {
1111
let c = current;

benchmarking/benchmarks/kairo/kairo_diamond.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as $ from '../../../packages/svelte/src/internal/client/index.js';
44
let width = 5;
55

66
function setup() {
7-
let head = $.source(0);
7+
let head = $.state(0);
88
let current = [];
99
for (let i = 0; i < width; i++) {
1010
current.push(

benchmarking/benchmarks/kairo/kairo_mux.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { assert, fastest_test } from '../../utils.js';
22
import * as $ from '../../../packages/svelte/src/internal/client/index.js';
33

44
function setup() {
5-
let heads = new Array(100).fill(null).map((_) => $.source(0));
5+
let heads = new Array(100).fill(null).map((_) => $.state(0));
66
const mux = $.derived(() => {
77
return Object.fromEntries(heads.map((h) => $.get(h)).entries());
88
});

benchmarking/benchmarks/kairo/kairo_repeated.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as $ from '../../../packages/svelte/src/internal/client/index.js';
44
let size = 30;
55

66
function setup() {
7-
let head = $.source(0);
7+
let head = $.state(0);
88
let current = $.derived(() => {
99
let result = 0;
1010
for (let i = 0; i < size; i++) {

benchmarking/benchmarks/kairo/kairo_triangle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function count(number) {
1111
}
1212

1313
function setup() {
14-
let head = $.source(0);
14+
let head = $.state(0);
1515
let current = head;
1616
let list = [];
1717
for (let i = 0; i < width; i++) {

benchmarking/benchmarks/kairo/kairo_unstable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { assert, fastest_test } from '../../utils.js';
22
import * as $ from '../../../packages/svelte/src/internal/client/index.js';
33

44
function setup() {
5-
let head = $.source(0);
5+
let head = $.state(0);
66
const double = $.derived(() => $.get(head) * 2);
77
const inverse = $.derived(() => -$.get(head));
88
let current = $.derived(() => {

benchmarking/benchmarks/kairo/util.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
export function busy() {
3-
let a = 0;
4-
for (let i = 0; i < 1_00; i++) {
5-
a++;
6-
}
2+
let a = 0;
3+
for (let i = 0; i < 1_00; i++) {
4+
a++;
5+
}
76
}

benchmarking/benchmarks/mol_bench.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const numbers = Array.from({ length: 5 }, (_, i) => i);
2020

2121
function setup() {
2222
let res = [];
23-
const A = $.source(0);
24-
const B = $.source(0);
23+
const A = $.state(0);
24+
const B = $.state(0);
2525
const C = $.derived(() => ($.get(A) % 2) + ($.get(B) % 2));
2626
const D = $.derived(() => numbers.map((i) => i + ($.get(A) % 2) - ($.get(B) % 2)));
2727
D.equals = function (/** @type {number[]} */ l) {

benchmarking/benchmarks/sbench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const COUNT = 1e5;
99
*/
1010
function create_data_signals(n, sources) {
1111
for (let i = 0; i < n; i++) {
12-
sources[i] = $.source(i);
12+
sources[i] = $.state(i);
1313
}
1414
return sources;
1515
}

documentation/docs/03-runes/02-side-effects.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ To run _side-effects_ when the component is mounted to the DOM, and when values
3333

3434
The function passed to `$effect` will run when the component mounts, and will re-run after any changes to the values it reads that were declared with `$state` or `$derived` (including those passed in with `$props`). Re-runs are batched (i.e. changing `color` and `size` in the same moment won't cause two separate runs), and happen after any DOM updates have been applied.
3535

36+
You can place `$effect` anywhere, not just at the top level of a component, as long as it is called during component initialization (or while a parent effect is active). It is then tied to the lifecycle of the component (or parent effect) and will therefore destroy itself when the component unmounts (or the parent effect is destroyed).
37+
3638
You can return a function from `$effect`, which will run immediately before the effect re-runs, and before it is destroyed ([demo](/#H4sIAAAAAAAAE42SzW6DMBCEX2Vl5RDaVCQ9JoDUY--9lUox9lKsGBvZC1GEePcaKPnpqSe86_m0M2t6ViqNnu0_e2Z4jWzP3pqGbRhdmrHwHWrCUHvbOjF2Ei-caijLTU4aCYRtDUEKK0-ccL2NDstNrbRWHoU10t8Eu-121gTVCssSBa3XEaQZ9GMrpziGj0p5OAccCgSHwmEgJZwrNNihg6MyhK7j-gii4uYb_YyGUZ5guQwzPdL7b_U4ZNSOvp9T2B3m1rB5cLx4zMkhtc7AHz7YVCVwEFzrgosTBMuNs52SKDegaPbvWnMH8AhUXaNUIY6-hHCldQhUIcyLCFlfAuHvkCKaYk8iYevGGgy2wyyJnpy9oLwG0sjdNe2yhGhJN32HsUzi2xOapNpl_bSLIYnDeeoVLZE1YI3QSpzSfo7-8J5PKbwOmdf2jC6JZyD7HxpPaMk93aHhF6utVKVCyfbkWhy-hh9Z3o_2nQIAAA==)).
3739

3840
```svelte

eslint.config.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export default [
3939
{
4040
languageOptions: {
4141
parserOptions: {
42-
project: true
42+
projectService: true,
43+
tsconfigRootDir: import.meta.dirname
4344
}
4445
},
4546
plugins: {
@@ -64,10 +65,14 @@ export default [
6465
}
6566
},
6667
{
67-
files: ['playgrounds/**/*'],
68+
// If you get an error along the lines of "@typescript-eslint/await-thenable needs a project service configured", then that likely means
69+
// that eslint rules that need to be type-aware run through a Svelte file which seems unsupported at the moment. In that case, ensure that
70+
// these are excluded to run on Svelte files.
71+
files: ['**/*.svelte'],
6872
rules: {
69-
'lube/svelte-naming-convention': 'off',
70-
'no-console': 'off'
73+
'@typescript-eslint/await-thenable': 'off',
74+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
75+
'@typescript-eslint/require-await': 'off'
7176
}
7277
},
7378
{
@@ -87,6 +92,12 @@ export default [
8792
'packages/svelte/src/internal/client/warnings.js',
8893
'packages/svelte/src/internal/shared/warnings.js',
8994
'packages/svelte/compiler/index.js',
95+
// stuff we don't want to lint
96+
'benchmarking/**',
97+
'coverage/**',
98+
'playgrounds/sandbox/**',
99+
// exclude top level config files
100+
'*.config.js',
90101
// documentation can contain invalid examples
91102
'documentation',
92103
// contains a fork of the REPL which doesn't adhere to eslint rules

0 commit comments

Comments
 (0)