Skip to content

Commit a4e2d76

Browse files
committed
Merge branch 'main' into gh-12624
2 parents 07fc7d7 + e860547 commit a4e2d76

File tree

38 files changed

+503
-672
lines changed

38 files changed

+503
-672
lines changed

.changeset/five-shirts-run.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
fix: use WAAPI to control timing of JS-based animations

.changeset/pre.json

+5
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
"fifty-steaks-float",
202202
"fifty-toys-invite",
203203
"five-maps-reflect",
204+
"five-shirts-run",
204205
"five-tigers-search",
205206
"flat-feet-visit",
206207
"flat-ghosts-fly",
@@ -342,6 +343,7 @@
342343
"itchy-terms-guess",
343344
"khaki-cheetahs-refuse",
344345
"khaki-cooks-develop",
346+
"khaki-donkeys-jump",
345347
"khaki-ligers-sing",
346348
"khaki-mails-draw",
347349
"khaki-mails-scream",
@@ -633,6 +635,7 @@
633635
"silver-points-approve",
634636
"silver-sheep-knock",
635637
"six-apes-peel",
638+
"six-beans-laugh",
636639
"six-bears-trade",
637640
"six-boats-shave",
638641
"six-chicken-kneel",
@@ -648,6 +651,7 @@
648651
"slimy-clouds-talk",
649652
"slimy-hairs-impress",
650653
"slimy-laws-explode",
654+
"slimy-news-help",
651655
"slimy-onions-approve",
652656
"slimy-walls-draw",
653657
"slow-beds-shave",
@@ -810,6 +814,7 @@
810814
"twenty-gifts-develop",
811815
"two-brooms-fail",
812816
"two-candles-move",
817+
"two-cats-approve",
813818
"two-dogs-accept",
814819
"two-dragons-yell",
815820
"two-falcons-buy",

.changeset/six-beans-laugh.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: prevent binding to imports

.changeset/slimy-news-help.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
fix: never abort bidirectional transitions

packages/svelte/CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# svelte
22

3+
## 5.0.0-next.240
4+
5+
### Patch Changes
6+
7+
- fix: use WAAPI to control timing of JS-based animations ([#13018](https://github.com/sveltejs/svelte/pull/13018))
8+
9+
- fix: prevent binding to imports ([#13035](https://github.com/sveltejs/svelte/pull/13035))
10+
11+
- fix: never abort bidirectional transitions ([#13018](https://github.com/sveltejs/svelte/pull/13018))
12+
13+
## 5.0.0-next.239
14+
15+
### Patch Changes
16+
17+
- fix: properly handle proxied array length mutations ([#13026](https://github.com/sveltejs/svelte/pull/13026))
18+
19+
- fix: repair `href` attribute mismatches ([#13032](https://github.com/sveltejs/svelte/pull/13032))
20+
321
## 5.0.0-next.238
422

523
### Patch Changes

packages/svelte/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svelte",
33
"description": "Cybernetically enhanced web apps",
44
"license": "MIT",
5-
"version": "5.0.0-next.238",
5+
"version": "5.0.0-next.240",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {

packages/svelte/src/compiler/phases/2-analyze/visitors/BindDirective.js

-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ export function BindDirective(node, context) {
4444
e.bind_invalid_value(node.expression);
4545
}
4646

47-
if (binding?.kind === 'derived') {
48-
e.constant_binding(node.expression, 'derived state');
49-
}
50-
5147
if (context.state.analysis.runes && binding?.kind === 'each') {
5248
e.each_item_invalid_assignment(node);
5349
}

packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ export function validate_no_const_assignment(node, argument, scope, is_binding)
7171
}
7272
} else if (argument.type === 'Identifier') {
7373
const binding = scope.get(argument.name);
74-
if (binding?.declaration_kind === 'const' && binding.kind !== 'each') {
74+
if (
75+
binding?.kind === 'derived' ||
76+
binding?.declaration_kind === 'import' ||
77+
(binding?.declaration_kind === 'const' && binding.kind !== 'each')
78+
) {
7579
// e.invalid_const_assignment(
7680
// node,
7781
// is_binding,
@@ -83,7 +87,12 @@ export function validate_no_const_assignment(node, argument, scope, is_binding)
8387
// );
8488

8589
// TODO have a more specific error message for assignments to things like `{:then foo}`
86-
const thing = 'constant';
90+
const thing =
91+
binding.declaration_kind === 'import'
92+
? 'import'
93+
: binding.kind === 'derived'
94+
? 'derived state'
95+
: 'constant';
8796

8897
if (is_binding) {
8998
e.constant_binding(node, thing);

packages/svelte/src/compiler/phases/scope.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
390390

391391
if (node.expression) {
392392
for (const id of extract_identifiers_from_destructuring(node.expression)) {
393-
const binding = scope.declare(id, 'derived', 'const');
393+
const binding = scope.declare(id, 'template', 'const');
394394
bindings.push(binding);
395395
}
396396
} else {
@@ -401,7 +401,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
401401
start: node.start,
402402
end: node.end
403403
};
404-
const binding = scope.declare(id, 'derived', 'const');
404+
const binding = scope.declare(id, 'template', 'const');
405405
bindings.push(binding);
406406
}
407407
},
@@ -492,7 +492,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
492492
for (const id of extract_identifiers(declarator.id)) {
493493
const binding = state.scope.declare(
494494
id,
495-
is_parent_const_tag ? 'derived' : 'normal',
495+
is_parent_const_tag ? 'template' : 'normal',
496496
node.kind,
497497
declarator.init
498498
);
@@ -548,7 +548,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
548548
binding.metadata = { inside_rest: is_rest_id };
549549
}
550550
if (node.context.type !== 'Identifier') {
551-
scope.declare(b.id('$$item'), 'derived', 'synthetic');
551+
scope.declare(b.id('$$item'), 'template', 'synthetic');
552552
}
553553
// Visit to pick up references from default initializers
554554
visit(node.context, { scope });
@@ -557,7 +557,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
557557
const is_keyed =
558558
node.key &&
559559
(node.key.type !== 'Identifier' || !node.index || node.key.name !== node.index);
560-
scope.declare(b.id(node.index), is_keyed ? 'derived' : 'normal', 'const', node);
560+
scope.declare(b.id(node.index), is_keyed ? 'template' : 'normal', 'const', node);
561561
}
562562
if (node.key) visit(node.key, { scope });
563563

@@ -604,7 +604,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
604604
scopes.set(node.value, value_scope);
605605
context.visit(node.value, { scope: value_scope });
606606
for (const id of extract_identifiers(node.value)) {
607-
then_scope.declare(id, 'derived', 'const');
607+
then_scope.declare(id, 'template', 'const');
608608
value_scope.declare(id, 'normal', 'const');
609609
}
610610
}
@@ -618,7 +618,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
618618
scopes.set(node.error, error_scope);
619619
context.visit(node.error, { scope: error_scope });
620620
for (const id of extract_identifiers(node.error)) {
621-
catch_scope.declare(id, 'derived', 'const');
621+
catch_scope.declare(id, 'template', 'const');
622622
error_scope.declare(id, 'normal', 'const');
623623
}
624624
}

packages/svelte/src/compiler/types/index.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export interface Binding {
267267
* - `snippet`: A snippet parameter
268268
* - `store_sub`: A $store value
269269
* - `legacy_reactive`: A `$:` declaration
270+
* - `template`: A binding declared in the template, e.g. in an `await` block or `const` tag
270271
*/
271272
kind:
272273
| 'normal'
@@ -279,7 +280,8 @@ export interface Binding {
279280
| 'each'
280281
| 'snippet'
281282
| 'store_sub'
282-
| 'legacy_reactive';
283+
| 'legacy_reactive'
284+
| 'template';
283285
declaration_kind: DeclarationKind;
284286
/**
285287
* What the value was initialized with.

packages/svelte/src/internal/client/dom/blocks/snippet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function createRawSnippet(fn) {
9292
var fragment = create_fragment_from_html(html);
9393
element = /** @type {Element} */ (get_first_child(fragment));
9494

95-
if (DEV && (get_next_sibling(element) !== null || element.nodeType !== 3)) {
95+
if (DEV && (get_next_sibling(element) !== null || element.nodeType !== 1)) {
9696
w.invalid_raw_snippet_render();
9797
}
9898

0 commit comments

Comments
 (0)