Skip to content

Commit dae9081

Browse files
committed
style
1 parent b686360 commit dae9081

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

.changeset/stale-jeans-refuse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'svelte': patch
33
---
44

5-
fix: allow stores in `transition`,`animation`,`use` directives
5+
fix: subscribe to stores in `transition`,`animation`,`use` directives

packages/svelte/src/compiler/phases/3-transform/server/transform-server.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,11 @@ function get_assignment_value(node, { state, visit }) {
345345
return operator === '='
346346
? /** @type {import('estree').Expression} */ (visit(node.right))
347347
: // turn something like x += 1 into x = x + 1
348-
b.binary(
348+
b.binary(
349349
/** @type {import('estree').BinaryOperator} */ (operator.slice(0, -1)),
350350
serialize_get_binding(node.left, state),
351351
/** @type {import('estree').Expression} */ (visit(node.right))
352-
);
352+
);
353353
} else {
354354
return /** @type {import('estree').Expression} */ (visit(node.right));
355355
}
@@ -801,7 +801,7 @@ function serialize_element_spread_attributes(
801801
b.id('join')
802802
),
803803
b.literal(' ')
804-
)
804+
)
805805
: b.literal('');
806806
args.push(
807807
b.object([
@@ -965,7 +965,7 @@ function serialize_inline_component(node, component_name, context) {
965965
: b.call(
966966
'$.spread_props',
967967
b.array(props_and_spreads.map((p) => (Array.isArray(p) ? b.object(p) : p)))
968-
);
968+
);
969969

970970
/** @type {import('estree').Statement} */
971971
let statement = b.stmt(
@@ -974,7 +974,7 @@ function serialize_inline_component(node, component_name, context) {
974974
? b.call(
975975
'$.validate_component',
976976
typeof component_name === 'string' ? b.id(component_name) : component_name
977-
)
977+
)
978978
: component_name,
979979
b.id('$$payload'),
980980
props_expression
@@ -1066,7 +1066,7 @@ const javascript_visitors_legacy = {
10661066
'$.value_or_fallback',
10671067
prop,
10681068
/** @type {import('estree').Expression} */ (visit(declarator.init))
1069-
)
1069+
)
10701070
: prop;
10711071

10721072
declarations.push(b.declarator(declarator.id, init));
@@ -1204,7 +1204,7 @@ const template_visitors = {
12041204
template: [],
12051205
init: []
12061206
}
1207-
}
1207+
}
12081208
: { ...context, state };
12091209

12101210
const { hoisted, trimmed } = clean_nodes(
@@ -1532,9 +1532,9 @@ const template_visitors = {
15321532
b.let(
15331533
node.expression.type === 'ObjectExpression'
15341534
? // @ts-expect-error types don't match, but it can't contain spread elements and the structure is otherwise fine
1535-
b.object_pattern(node.expression.properties)
1535+
b.object_pattern(node.expression.properties)
15361536
: // @ts-expect-error types don't match, but it can't contain spread elements and the structure is otherwise fine
1537-
b.array_pattern(node.expression.elements),
1537+
b.array_pattern(node.expression.elements),
15381538
b.member(b.id('$$slotProps'), b.id(node.name))
15391539
),
15401540
b.return(b.object(bindings.map((binding) => b.init(binding.node.name, binding.node))))
@@ -1768,12 +1768,12 @@ function serialize_element_attributes(node, context) {
17681768
? b.call(
17691769
b.member(attribute.expression, b.id('includes')),
17701770
serialize_attribute_value(value_attribute.value, context)
1771-
)
1771+
)
17721772
: b.binary(
17731773
'===',
17741774
attribute.expression,
17751775
serialize_attribute_value(value_attribute.value, context)
1776-
),
1776+
),
17771777
metadata: {
17781778
contains_call_expression: false,
17791779
dynamic: false

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
294294
const SvelteDirective = (node, context) => {
295295
const name = node.name;
296296

297-
if (name[0] === '$') context.state.scope.reference(b.id(name), context.path);
297+
if (name[0] === '$') {
298+
context.state.scope.reference(b.id(name), context.path);
299+
}
298300
};
299301

300302
/**

0 commit comments

Comments
 (0)