svelte 5.43.6 → 5.43.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/index.js +1 -1
- package/package.json +1 -1
- package/src/compiler/phases/1-parse/state/element.js +5 -0
- package/src/compiler/phases/2-analyze/visitors/Component.js +6 -0
- package/src/compiler/phases/2-analyze/visitors/SvelteComponent.js +1 -1
- package/src/compiler/phases/3-transform/client/visitors/TitleElement.js +3 -4
- package/src/compiler/phases/3-transform/client/visitors/shared/component.js +5 -0
- package/src/compiler/phases/3-transform/server/visitors/shared/component.js +13 -4
- package/src/internal/client/dom/blocks/each.js +159 -241
- package/src/internal/client/index.js +1 -0
- package/src/internal/client/reactivity/batch.js +28 -2
- package/src/internal/client/reactivity/effects.js +55 -41
- package/src/version.js +1 -1
- package/types/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -242,6 +242,10 @@ export default function element(parser) {
|
|
|
242
242
|
parser.allow_whitespace();
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
if (element.type === 'Component') {
|
|
246
|
+
element.metadata.expression = new ExpressionMetadata();
|
|
247
|
+
}
|
|
248
|
+
|
|
245
249
|
if (element.type === 'SvelteComponent') {
|
|
246
250
|
const index = element.attributes.findIndex(
|
|
247
251
|
/** @param {any} attr */
|
|
@@ -257,6 +261,7 @@ export default function element(parser) {
|
|
|
257
261
|
}
|
|
258
262
|
|
|
259
263
|
element.expression = get_attribute_expression(definition);
|
|
264
|
+
element.metadata.expression = new ExpressionMetadata();
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
if (element.type === 'SvelteElement') {
|
|
@@ -16,5 +16,11 @@ export function Component(node, context) {
|
|
|
16
16
|
binding !== null &&
|
|
17
17
|
(binding.kind !== 'normal' || node.name.includes('.'));
|
|
18
18
|
|
|
19
|
+
if (binding) {
|
|
20
|
+
node.metadata.expression.has_state = node.metadata.dynamic;
|
|
21
|
+
node.metadata.expression.dependencies.add(binding);
|
|
22
|
+
node.metadata.expression.references.add(binding);
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
visit_component(node, context);
|
|
20
26
|
}
|
|
@@ -12,7 +12,7 @@ export function SvelteComponent(node, context) {
|
|
|
12
12
|
w.svelte_component_deprecated(node);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
context.visit(node.expression);
|
|
15
|
+
context.visit(node.expression, { ...context.state, expression: node.metadata.expression });
|
|
16
16
|
|
|
17
17
|
visit_component(node, context);
|
|
18
18
|
}
|
|
@@ -29,17 +29,16 @@ export function TitleElement(node, context) {
|
|
|
29
29
|
)
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
//
|
|
32
|
+
// Make sure it only changes the title once async work is done
|
|
33
33
|
if (has_state) {
|
|
34
34
|
context.state.after_update.push(
|
|
35
35
|
b.stmt(
|
|
36
36
|
b.call(
|
|
37
|
-
'$.
|
|
37
|
+
'$.deferred_template_effect',
|
|
38
38
|
b.arrow(memoizer.apply(), b.block([statement])),
|
|
39
39
|
memoizer.sync_values(),
|
|
40
40
|
memoizer.async_values(),
|
|
41
|
-
memoizer.blockers()
|
|
42
|
-
b.true
|
|
41
|
+
memoizer.blockers()
|
|
43
42
|
)
|
|
44
43
|
)
|
|
45
44
|
);
|
|
@@ -451,6 +451,11 @@ export function build_component(node, component_name, context) {
|
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
+
if (node.type !== 'SvelteSelf') {
|
|
455
|
+
// Component name itself could be blocked on async values
|
|
456
|
+
memoizer.check_blockers(node.metadata.expression);
|
|
457
|
+
}
|
|
458
|
+
|
|
454
459
|
const statements = [...snippet_declarations, ...memoizer.deriveds(context.state.analysis.runes)];
|
|
455
460
|
|
|
456
461
|
if (is_component_dynamic) {
|
|
@@ -325,17 +325,26 @@ export function build_inline_component(node, expression, context) {
|
|
|
325
325
|
);
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
if (node.type !== 'SvelteSelf') {
|
|
329
|
+
// Component name itself could be blocked on async values
|
|
330
|
+
optimiser.check_blockers(node.metadata.expression);
|
|
331
|
+
}
|
|
332
|
+
|
|
328
333
|
const is_async = optimiser.is_async();
|
|
329
334
|
|
|
330
335
|
if (is_async) {
|
|
331
336
|
statement = create_async_block(
|
|
332
|
-
b.block([
|
|
337
|
+
b.block([
|
|
338
|
+
optimiser.apply(),
|
|
339
|
+
dynamic && custom_css_props.length === 0
|
|
340
|
+
? b.stmt(b.call('$$renderer.push', empty_comment))
|
|
341
|
+
: b.empty,
|
|
342
|
+
statement
|
|
343
|
+
]),
|
|
333
344
|
optimiser.blockers(),
|
|
334
345
|
optimiser.has_await
|
|
335
346
|
);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
if (dynamic && custom_css_props.length === 0) {
|
|
347
|
+
} else if (dynamic && custom_css_props.length === 0) {
|
|
339
348
|
context.state.template.push(empty_comment);
|
|
340
349
|
}
|
|
341
350
|
|