svelte 5.55.0 → 5.55.2
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/elements.d.ts +3 -3
- package/package.json +2 -2
- package/src/compiler/errors.js +2 -2
- package/src/compiler/phases/1-parse/acorn.js +58 -31
- package/src/compiler/phases/1-parse/index.js +0 -10
- package/src/compiler/phases/1-parse/read/context.js +28 -34
- package/src/compiler/phases/1-parse/read/expression.js +4 -38
- package/src/compiler/phases/1-parse/read/script.js +1 -8
- package/src/compiler/phases/1-parse/remove_typescript_nodes.js +2 -0
- package/src/compiler/phases/1-parse/state/tag.js +1 -6
- package/src/compiler/phases/2-analyze/visitors/shared/function.js +1 -1
- package/src/compiler/phases/2-analyze/visitors/shared/utils.js +0 -1
- package/src/compiler/phases/3-transform/client/transform-client.js +1 -1
- package/src/compiler/phases/3-transform/client/visitors/shared/fragment.js +1 -3
- package/src/internal/client/dom/blocks/each.js +5 -0
- package/src/internal/client/reactivity/batch.js +71 -15
- package/src/internal/client/reactivity/deriveds.js +5 -3
- package/src/internal/client/reactivity/effects.js +3 -1
- package/src/internal/client/reactivity/sources.js +2 -10
- package/src/internal/client/runtime.js +8 -1
- package/src/internal/server/errors.js +12 -0
- package/src/internal/server/renderer.js +11 -3
- package/src/reactivity/date.js +4 -0
- package/src/version.js +1 -1
- package/types/index.d.ts.map +1 -1
|
@@ -384,7 +384,6 @@ export function execute_derived(derived) {
|
|
|
384
384
|
* @returns {void}
|
|
385
385
|
*/
|
|
386
386
|
export function update_derived(derived) {
|
|
387
|
-
var old_value = derived.v;
|
|
388
387
|
var value = execute_derived(derived);
|
|
389
388
|
|
|
390
389
|
if (!derived.equals(value)) {
|
|
@@ -395,8 +394,11 @@ export function update_derived(derived) {
|
|
|
395
394
|
// otherwise, the next time we get here after a 'real world' state
|
|
396
395
|
// change, `derived.equals` may incorrectly return `true`
|
|
397
396
|
if (!current_batch?.is_fork || derived.deps === null) {
|
|
398
|
-
|
|
399
|
-
|
|
397
|
+
if (current_batch !== null) {
|
|
398
|
+
current_batch.capture(derived, value, true);
|
|
399
|
+
} else {
|
|
400
|
+
derived.v = value;
|
|
401
|
+
}
|
|
400
402
|
|
|
401
403
|
// deriveds without dependencies should never be recomputed
|
|
402
404
|
if (derived.deps === null) {
|
|
@@ -42,7 +42,7 @@ import { DEV } from 'esm-env';
|
|
|
42
42
|
import { define_property } from '../../shared/utils.js';
|
|
43
43
|
import { get_next_sibling } from '../dom/operations.js';
|
|
44
44
|
import { component_context, dev_current_component_function, dev_stack } from '../context.js';
|
|
45
|
-
import { Batch, collected_effects } from './batch.js';
|
|
45
|
+
import { Batch, collected_effects, current_batch } from './batch.js';
|
|
46
46
|
import { flatten, increment_pending } from './async.js';
|
|
47
47
|
import { without_reactive_context } from '../dom/elements/bindings/shared.js';
|
|
48
48
|
import { set_signal_status } from './status.js';
|
|
@@ -120,6 +120,8 @@ function create_effect(type, fn) {
|
|
|
120
120
|
effect.component_function = dev_current_component_function;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
current_batch?.register_created_effect(effect);
|
|
124
|
+
|
|
123
125
|
/** @type {Effect | null} */
|
|
124
126
|
var e = effect;
|
|
125
127
|
|
|
@@ -180,18 +180,10 @@ export function set(source, value, should_proxy = false) {
|
|
|
180
180
|
*/
|
|
181
181
|
export function internal_set(source, value, updated_during_traversal = null) {
|
|
182
182
|
if (!source.equals(value)) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (is_destroying_effect) {
|
|
186
|
-
old_values.set(source, value);
|
|
187
|
-
} else {
|
|
188
|
-
old_values.set(source, old_value);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
source.v = value;
|
|
183
|
+
old_values.set(source, is_destroying_effect ? value : source.v);
|
|
192
184
|
|
|
193
185
|
var batch = Batch.ensure();
|
|
194
|
-
batch.capture(source,
|
|
186
|
+
batch.capture(source, value);
|
|
195
187
|
|
|
196
188
|
if (DEV) {
|
|
197
189
|
if (tracing_mode_flag || active_effect !== null) {
|
|
@@ -399,7 +399,14 @@ function remove_reaction(signal, dependency) {
|
|
|
399
399
|
derived.f &= ~WAS_MARKED;
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
|
|
402
|
+
// In a fork it's possible that a derived is executed and gets reactions, then commits, but is
|
|
403
|
+
// never re-executed. This is possible when the derived is only executed once in the context
|
|
404
|
+
// of a new branch which happens before fork.commit() runs. In this case, the derived still has
|
|
405
|
+
// UNINITIALIZED as its value, and then when it's loosing its reactions we need to ensure it stays
|
|
406
|
+
// DIRTY so it is reexecuted once someone wants its value again.
|
|
407
|
+
if (derived.v !== UNINITIALIZED) {
|
|
408
|
+
update_derived_status(derived);
|
|
409
|
+
}
|
|
403
410
|
|
|
404
411
|
// freeze any effects inside this derived
|
|
405
412
|
freeze_derived_effects(derived);
|
|
@@ -105,6 +105,18 @@ export function invalid_csp() {
|
|
|
105
105
|
throw error;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* The `idPrefix` option cannot include `--`.
|
|
110
|
+
* @returns {never}
|
|
111
|
+
*/
|
|
112
|
+
export function invalid_id_prefix() {
|
|
113
|
+
const error = new Error(`invalid_id_prefix\nThe \`idPrefix\` option cannot include \`--\`.\nhttps://svelte.dev/e/invalid_id_prefix`);
|
|
114
|
+
|
|
115
|
+
error.name = 'Svelte error';
|
|
116
|
+
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
|
|
108
120
|
/**
|
|
109
121
|
* `%name%(...)` is not available on the server
|
|
110
122
|
* @param {string} name
|
|
@@ -468,10 +468,14 @@ export class Renderer {
|
|
|
468
468
|
}
|
|
469
469
|
|
|
470
470
|
this.local = other.local;
|
|
471
|
-
this.#out = other.#out.map((item) => {
|
|
472
|
-
|
|
473
|
-
|
|
471
|
+
this.#out = other.#out.map((item, i) => {
|
|
472
|
+
const current = this.#out[i];
|
|
473
|
+
|
|
474
|
+
if (current instanceof Renderer && item instanceof Renderer) {
|
|
475
|
+
current.subsume(item);
|
|
476
|
+
return current;
|
|
474
477
|
}
|
|
478
|
+
|
|
475
479
|
return item;
|
|
476
480
|
});
|
|
477
481
|
this.promise = other.promise;
|
|
@@ -755,6 +759,10 @@ export class Renderer {
|
|
|
755
759
|
* @returns {Renderer}
|
|
756
760
|
*/
|
|
757
761
|
static #open_render(mode, component, options) {
|
|
762
|
+
if (options.idPrefix?.includes('--')) {
|
|
763
|
+
e.invalid_id_prefix();
|
|
764
|
+
}
|
|
765
|
+
|
|
758
766
|
var previous_context = ssr_context;
|
|
759
767
|
|
|
760
768
|
try {
|
package/src/reactivity/date.js
CHANGED
package/src/version.js
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -273,6 +273,6 @@
|
|
|
273
273
|
null,
|
|
274
274
|
null
|
|
275
275
|
],
|
|
276
|
-
"mappings": ";;;;;;;;;kBAUiBA,2BAA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmC/BC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAwEhBC,kBAAkBA;;;;;;;;;;;;;;;;;;;;;;;;kBAwBbC,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCbC,oBAAoBA;;;;;;;;;;;;;;;;;;;;;;;;aAwBrBC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCfC,cAAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA6BdC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;kBAuBRC,OAAOA;;;;;;;;;;;;;;;;kBAgBPC,eAAeA;;;;;;;;;;;;;;;;aAgBpBC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA+CPC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCzSLC,cAAcA;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