Merge branch 'main' into chore/indent-option-for-print

pull/18474/head
Manuel 1 month ago committed by GitHub
commit aff886124a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
chore: drop dead code that make TSGO fail

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: correctly transform declaration tags during SSR

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: don't treat declaration tags as parts inside each blocks

@ -8,7 +8,7 @@ import { sanitize_template_string } from '../../../../../utils/sanitize_template
import { regex_is_valid_identifier } from '../../../../patterns.js';
import is_reference from 'is-reference';
import { dev, is_ignored, locator, component_name } from '../../../../../state.js';
import { build_getter } from '../../utils.js';
import { build_getter, is_state_source } from '../../utils.js';
import { ExpressionMetadata } from '../../../../nodes.js';
/**
@ -272,6 +272,10 @@ export function build_bind_this(expression, value, { state, visit }) {
const binding = state.scope.get(node.name);
if (!binding) return;
// if it is a state or a derived it means is a declaration tag...in that case we don't want to pass the
// value but the signal itself or assignment will break
if (is_state_source(binding, state.analysis) || binding.kind === 'derived') return;
for (const [owner, scope] of state.scopes) {
if (owner.type === 'EachBlock' && scope === binding.scope) {
ids.push(node);

@ -60,7 +60,9 @@ export function process_children(nodes, { visit, state }) {
if (evaluated.is_known) {
quasi.value.cooked += escape_html((evaluated.value ?? '') + '');
} else {
expressions.push(b.call('$.escape', /** @type {Expression} */ (visit(node.expression))));
expressions.push(
b.call('$.escape', /** @type {Expression} */ (visit(node.expression, state)))
);
quasi = b.quasi('', i + 1 === sequence.length);
quasis.push(quasi);
@ -80,7 +82,7 @@ export function process_children(nodes, { visit, state }) {
if (node.type === 'ExpressionTag' && node.metadata.expression.is_async()) {
flush();
const expression = /** @type {Expression} */ (visit(node.expression));
const expression = /** @type {Expression} */ (visit(node.expression, state));
let call = b.call(
'$$renderer.push',

@ -91,10 +91,7 @@ const rest_props_handler = {
*/
/*#__NO_SIDE_EFFECTS__*/
export function rest_props(props, exclude, name) {
return new Proxy(
DEV ? { props, exclude, name, other: {}, to_proxy: [] } : { props, exclude },
rest_props_handler
);
return new Proxy(DEV ? { props, exclude, name } : { props, exclude }, rest_props_handler);
}
/**

@ -0,0 +1,10 @@
import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
async test({ target, assert }) {
const [btn1, btn2] = target.querySelectorAll('button');
flushSync(() => btn2.click());
assert.equal(btn1.textContent, '1');
}
});

@ -0,0 +1,6 @@
{#each Array(1)}
{let ref = $state()}
{let count = $state(0)}
<button onclick={()=>count++} bind:this={ref}>{count}</button>
<button onclick={()=>ref.click()}></button>
{/each}

@ -0,0 +1,4 @@
<div>
{let dt = $derived(Date.parse("2026-10-01T00:00:00Z"))}
{typeof dt}
</div>
Loading…
Cancel
Save