svelte 5.45.2 → 5.45.3
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/index.js +32 -16
- package/src/compiler/phases/1-parse/read/context.js +3 -12
- package/src/compiler/phases/1-parse/state/element.js +79 -55
- package/src/compiler/phases/1-parse/state/tag.js +5 -16
- package/src/compiler/phases/2-analyze/index.js +2 -2
- package/src/compiler/phases/2-analyze/visitors/Identifier.js +2 -1
- package/src/compiler/phases/2-analyze/visitors/RegularElement.js +3 -2
- package/src/compiler/phases/3-transform/client/transform-template/index.js +1 -2
- package/src/compiler/phases/3-transform/client/visitors/BindDirective.js +27 -11
- package/src/compiler/phases/3-transform/client/visitors/CallExpression.js +2 -1
- package/src/compiler/phases/3-transform/client/visitors/Component.js +1 -2
- package/src/compiler/phases/3-transform/client/visitors/Fragment.js +1 -1
- package/src/compiler/phases/3-transform/client/visitors/RegularElement.js +1 -0
- package/src/compiler/phases/3-transform/client/visitors/SvelteComponent.js +2 -1
- package/src/compiler/phases/3-transform/client/visitors/SvelteHead.js +1 -1
- package/src/compiler/phases/3-transform/client/visitors/SvelteSelf.js +2 -1
- package/src/compiler/phases/3-transform/client/visitors/TitleElement.js +1 -1
- package/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js +2 -1
- package/src/compiler/phases/3-transform/client/visitors/shared/component.js +27 -25
- package/src/compiler/phases/3-transform/client/visitors/shared/events.js +8 -2
- package/src/compiler/phases/3-transform/client/visitors/shared/fragment.js +10 -4
- package/src/compiler/phases/3-transform/client/visitors/shared/utils.js +2 -2
- package/src/compiler/phases/3-transform/server/visitors/RegularElement.js +1 -1
- package/src/compiler/phases/3-transform/server/visitors/SvelteElement.js +1 -1
- package/src/compiler/phases/3-transform/server/visitors/shared/element.js +2 -2
- package/src/compiler/phases/nodes.js +4 -2
- package/src/compiler/state.js +12 -4
- package/src/compiler/utils/builders.js +6 -2
- package/src/internal/client/dev/debug.js +361 -3
- package/src/internal/client/reactivity/batch.js +3 -0
- package/src/internal/client/reactivity/sources.js +2 -0
- package/src/internal/server/hydratable.js +11 -1
- package/src/version.js +1 -1
- package/types/index.d.ts +16 -11
- package/types/index.d.ts.map +1 -1
|
@@ -5,12 +5,18 @@ import {
|
|
|
5
5
|
BOUNDARY_EFFECT,
|
|
6
6
|
BRANCH_EFFECT,
|
|
7
7
|
CLEAN,
|
|
8
|
+
CONNECTED,
|
|
8
9
|
DERIVED,
|
|
10
|
+
DIRTY,
|
|
9
11
|
EFFECT,
|
|
10
12
|
ASYNC,
|
|
13
|
+
DESTROYED,
|
|
14
|
+
INERT,
|
|
11
15
|
MAYBE_DIRTY,
|
|
12
16
|
RENDER_EFFECT,
|
|
13
|
-
ROOT_EFFECT
|
|
17
|
+
ROOT_EFFECT,
|
|
18
|
+
WAS_MARKED,
|
|
19
|
+
MANAGED_EFFECT
|
|
14
20
|
} from '#client/constants';
|
|
15
21
|
import { snapshot } from '../../shared/clone.js';
|
|
16
22
|
import { untrack } from '../runtime.js';
|
|
@@ -30,11 +36,13 @@ export function root(effect) {
|
|
|
30
36
|
/**
|
|
31
37
|
*
|
|
32
38
|
* @param {Effect} effect
|
|
39
|
+
* @param {boolean} append_effect
|
|
40
|
+
* @returns {string}
|
|
33
41
|
*/
|
|
34
|
-
|
|
42
|
+
function effect_label(effect, append_effect = false) {
|
|
35
43
|
const flags = effect.f;
|
|
36
44
|
|
|
37
|
-
let label =
|
|
45
|
+
let label = `(unknown ${append_effect ? 'effect' : ''})`;
|
|
38
46
|
|
|
39
47
|
if ((flags & ROOT_EFFECT) !== 0) {
|
|
40
48
|
label = 'root';
|
|
@@ -42,6 +50,8 @@ export function log_effect_tree(effect, depth = 0) {
|
|
|
42
50
|
label = 'boundary';
|
|
43
51
|
} else if ((flags & BLOCK_EFFECT) !== 0) {
|
|
44
52
|
label = 'block';
|
|
53
|
+
} else if ((flags & MANAGED_EFFECT) !== 0) {
|
|
54
|
+
label = 'managed';
|
|
45
55
|
} else if ((flags & ASYNC) !== 0) {
|
|
46
56
|
label = 'async';
|
|
47
57
|
} else if ((flags & BRANCH_EFFECT) !== 0) {
|
|
@@ -52,6 +62,20 @@ export function log_effect_tree(effect, depth = 0) {
|
|
|
52
62
|
label = 'effect';
|
|
53
63
|
}
|
|
54
64
|
|
|
65
|
+
if (append_effect && !label.endsWith('effect')) {
|
|
66
|
+
label += ' effect';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return label;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {Effect} effect
|
|
74
|
+
*/
|
|
75
|
+
export function log_effect_tree(effect, depth = 0) {
|
|
76
|
+
const flags = effect.f;
|
|
77
|
+
const label = effect_label(effect);
|
|
78
|
+
|
|
55
79
|
let status =
|
|
56
80
|
(flags & CLEAN) !== 0 ? 'clean' : (flags & MAYBE_DIRTY) !== 0 ? 'maybe dirty' : 'dirty';
|
|
57
81
|
|
|
@@ -140,3 +164,337 @@ function log_dep(dep) {
|
|
|
140
164
|
);
|
|
141
165
|
}
|
|
142
166
|
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Logs all reactions of a source or derived transitively
|
|
170
|
+
* @param {Derived | Value} signal
|
|
171
|
+
*/
|
|
172
|
+
export function log_reactions(signal) {
|
|
173
|
+
/** @type {Set<Derived | Value>} */
|
|
174
|
+
const visited = new Set();
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Returns an array of flag names that are set on the given flags bitmask
|
|
178
|
+
* @param {number} flags
|
|
179
|
+
* @returns {string[]}
|
|
180
|
+
*/
|
|
181
|
+
function get_derived_flag_names(flags) {
|
|
182
|
+
/** @type {string[]} */
|
|
183
|
+
const names = [];
|
|
184
|
+
|
|
185
|
+
if ((flags & CLEAN) !== 0) names.push('CLEAN');
|
|
186
|
+
if ((flags & DIRTY) !== 0) names.push('DIRTY');
|
|
187
|
+
if ((flags & MAYBE_DIRTY) !== 0) names.push('MAYBE_DIRTY');
|
|
188
|
+
if ((flags & CONNECTED) !== 0) names.push('CONNECTED');
|
|
189
|
+
if ((flags & WAS_MARKED) !== 0) names.push('WAS_MARKED');
|
|
190
|
+
if ((flags & INERT) !== 0) names.push('INERT');
|
|
191
|
+
if ((flags & DESTROYED) !== 0) names.push('DESTROYED');
|
|
192
|
+
|
|
193
|
+
return names;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @param {Derived | Value} d
|
|
198
|
+
* @param {number} depth
|
|
199
|
+
*/
|
|
200
|
+
function log_derived(d, depth) {
|
|
201
|
+
const flags = d.f;
|
|
202
|
+
const flag_names = get_derived_flag_names(flags);
|
|
203
|
+
const flags_str = flag_names.length > 0 ? `(${flag_names.join(', ')})` : '(no flags)';
|
|
204
|
+
|
|
205
|
+
// eslint-disable-next-line no-console
|
|
206
|
+
console.group(
|
|
207
|
+
`%c${flags & DERIVED ? '$derived' : '$state'} %c${d.label ?? '<unknown>'} %c${flags_str}`,
|
|
208
|
+
'font-weight: bold; color: CornflowerBlue',
|
|
209
|
+
'font-weight: normal; color: inherit',
|
|
210
|
+
'font-weight: normal; color: gray'
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
// eslint-disable-next-line no-console
|
|
214
|
+
console.log(untrack(() => snapshot(d.v)));
|
|
215
|
+
|
|
216
|
+
if ('fn' in d) {
|
|
217
|
+
// eslint-disable-next-line no-console
|
|
218
|
+
console.log('%cfn:', 'font-weight: bold', d.fn);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (d.reactions !== null && d.reactions.length > 0) {
|
|
222
|
+
// eslint-disable-next-line no-console
|
|
223
|
+
console.group('%creactions', 'font-weight: bold');
|
|
224
|
+
|
|
225
|
+
for (const reaction of d.reactions) {
|
|
226
|
+
if ((reaction.f & DERIVED) !== 0) {
|
|
227
|
+
const derived_reaction = /** @type {Derived} */ (reaction);
|
|
228
|
+
|
|
229
|
+
if (visited.has(derived_reaction)) {
|
|
230
|
+
// eslint-disable-next-line no-console
|
|
231
|
+
console.log(
|
|
232
|
+
`%c$derived %c${derived_reaction.label ?? '<unknown>'} %c(already seen)`,
|
|
233
|
+
'font-weight: bold; color: CornflowerBlue',
|
|
234
|
+
'font-weight: normal; color: inherit',
|
|
235
|
+
'font-weight: bold; color: orange'
|
|
236
|
+
);
|
|
237
|
+
} else {
|
|
238
|
+
visited.add(derived_reaction);
|
|
239
|
+
log_derived(derived_reaction, depth + 1);
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
// It's an effect
|
|
243
|
+
const label = effect_label(/** @type {Effect} */ (reaction), true);
|
|
244
|
+
const status = (flags & MAYBE_DIRTY) !== 0 ? 'maybe dirty' : 'dirty';
|
|
245
|
+
|
|
246
|
+
// Collect parent statuses
|
|
247
|
+
/** @type {string[]} */
|
|
248
|
+
const parent_statuses = [];
|
|
249
|
+
let show = false;
|
|
250
|
+
let current = /** @type {Effect} */ (reaction).parent;
|
|
251
|
+
while (current !== null) {
|
|
252
|
+
const parent_flags = current.f;
|
|
253
|
+
if ((parent_flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
|
254
|
+
const parent_status = (parent_flags & CLEAN) !== 0 ? 'clean' : 'not clean';
|
|
255
|
+
if (parent_status === 'clean' && parent_statuses.includes('not clean')) show = true;
|
|
256
|
+
parent_statuses.push(parent_status);
|
|
257
|
+
}
|
|
258
|
+
if (!current.parent) break;
|
|
259
|
+
current = current.parent;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Check if reaction is reachable from root
|
|
263
|
+
const seen_effects = new Set();
|
|
264
|
+
let reachable = false;
|
|
265
|
+
/**
|
|
266
|
+
* @param {Effect | null} effect
|
|
267
|
+
*/
|
|
268
|
+
function check_reachable(effect) {
|
|
269
|
+
if (effect === null || reachable) return;
|
|
270
|
+
if (effect === reaction) {
|
|
271
|
+
reachable = true;
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (effect.f & DESTROYED) return;
|
|
275
|
+
if (seen_effects.has(effect)) {
|
|
276
|
+
throw new Error('');
|
|
277
|
+
}
|
|
278
|
+
seen_effects.add(effect);
|
|
279
|
+
let child = effect.first;
|
|
280
|
+
while (child !== null) {
|
|
281
|
+
check_reachable(child);
|
|
282
|
+
child = child.next;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
if (current) check_reachable(current);
|
|
287
|
+
} catch (e) {
|
|
288
|
+
// eslint-disable-next-line no-console
|
|
289
|
+
console.log(
|
|
290
|
+
`%c⚠️ Circular reference detected in effect tree`,
|
|
291
|
+
'font-weight: bold; color: red',
|
|
292
|
+
seen_effects
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (!reachable) {
|
|
297
|
+
// eslint-disable-next-line no-console
|
|
298
|
+
console.log(
|
|
299
|
+
`%c⚠️ Effect is NOT reachable from its parent chain`,
|
|
300
|
+
'font-weight: bold; color: red'
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const parent_status_str = show ? ` (${parent_statuses.join(', ')})` : '';
|
|
305
|
+
|
|
306
|
+
// eslint-disable-next-line no-console
|
|
307
|
+
console.log(
|
|
308
|
+
`%c${label} (${status})${parent_status_str}`,
|
|
309
|
+
`font-weight: bold; color: ${parent_status_str ? 'red' : 'green'}`,
|
|
310
|
+
reaction
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// eslint-disable-next-line no-console
|
|
316
|
+
console.groupEnd();
|
|
317
|
+
} else {
|
|
318
|
+
// eslint-disable-next-line no-console
|
|
319
|
+
console.log('%cno reactions', 'font-style: italic; color: gray');
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// eslint-disable-next-line no-console
|
|
323
|
+
console.groupEnd();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// eslint-disable-next-line no-console
|
|
327
|
+
console.group(`%cDerived Reactions Graph`, 'font-weight: bold; color: purple');
|
|
328
|
+
|
|
329
|
+
visited.add(signal);
|
|
330
|
+
log_derived(signal, 0);
|
|
331
|
+
|
|
332
|
+
// eslint-disable-next-line no-console
|
|
333
|
+
console.groupEnd();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Traverses an effect tree and logs branches where a non-clean branch exists below a clean branch
|
|
338
|
+
* @param {Effect} effect
|
|
339
|
+
*/
|
|
340
|
+
export function log_inconsistent_branches(effect) {
|
|
341
|
+
const root_effect = root(effect);
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* @typedef {{
|
|
345
|
+
* effect: Effect,
|
|
346
|
+
* status: 'clean' | 'maybe dirty' | 'dirty',
|
|
347
|
+
* parent_clean: boolean,
|
|
348
|
+
* children: BranchInfo[]
|
|
349
|
+
* }} BranchInfo
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Collects branch effects from the tree
|
|
354
|
+
* @param {Effect} eff
|
|
355
|
+
* @param {boolean} parent_clean - whether any ancestor branch is clean
|
|
356
|
+
* @returns {BranchInfo[]}
|
|
357
|
+
*/
|
|
358
|
+
function collect_branches(eff, parent_clean) {
|
|
359
|
+
/** @type {BranchInfo[]} */
|
|
360
|
+
const branches = [];
|
|
361
|
+
const flags = eff.f;
|
|
362
|
+
const is_branch = (flags & BRANCH_EFFECT) !== 0;
|
|
363
|
+
|
|
364
|
+
if (is_branch) {
|
|
365
|
+
const status =
|
|
366
|
+
(flags & CLEAN) !== 0 ? 'clean' : (flags & MAYBE_DIRTY) !== 0 ? 'maybe dirty' : 'dirty';
|
|
367
|
+
|
|
368
|
+
/** @type {BranchInfo[]} */
|
|
369
|
+
const child_branches = [];
|
|
370
|
+
|
|
371
|
+
let child = eff.first;
|
|
372
|
+
while (child !== null) {
|
|
373
|
+
child_branches.push(...collect_branches(child, status === 'clean'));
|
|
374
|
+
child = child.next;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
branches.push({
|
|
378
|
+
effect: eff,
|
|
379
|
+
status,
|
|
380
|
+
parent_clean,
|
|
381
|
+
children: child_branches
|
|
382
|
+
});
|
|
383
|
+
} else {
|
|
384
|
+
// Not a branch, continue traversing
|
|
385
|
+
let child = eff.first;
|
|
386
|
+
while (child !== null) {
|
|
387
|
+
branches.push(...collect_branches(child, parent_clean));
|
|
388
|
+
child = child.next;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return branches;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Checks if a branch tree contains any inconsistencies (non-clean below clean)
|
|
397
|
+
* @param {BranchInfo} branch
|
|
398
|
+
* @param {boolean} ancestor_clean
|
|
399
|
+
* @returns {boolean}
|
|
400
|
+
*/
|
|
401
|
+
function has_inconsistency(branch, ancestor_clean) {
|
|
402
|
+
const is_inconsistent = ancestor_clean && branch.status !== 'clean';
|
|
403
|
+
if (is_inconsistent) return true;
|
|
404
|
+
|
|
405
|
+
const new_ancestor_clean = ancestor_clean || branch.status === 'clean';
|
|
406
|
+
for (const child of branch.children) {
|
|
407
|
+
if (has_inconsistency(child, new_ancestor_clean)) return true;
|
|
408
|
+
}
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Logs a branch and its children, but only if there are inconsistencies
|
|
414
|
+
* @param {BranchInfo} branch
|
|
415
|
+
* @param {boolean} ancestor_clean
|
|
416
|
+
* @param {number} depth
|
|
417
|
+
*/
|
|
418
|
+
function log_branch(branch, ancestor_clean, depth) {
|
|
419
|
+
const is_inconsistent = ancestor_clean && branch.status !== 'clean';
|
|
420
|
+
const new_ancestor_clean = ancestor_clean || branch.status === 'clean';
|
|
421
|
+
|
|
422
|
+
// Only log if this branch or any descendant has an inconsistency
|
|
423
|
+
if (!has_inconsistency(branch, ancestor_clean) && !is_inconsistent) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const style = is_inconsistent
|
|
428
|
+
? 'font-weight: bold; color: red'
|
|
429
|
+
: branch.status === 'clean'
|
|
430
|
+
? 'font-weight: normal; color: green'
|
|
431
|
+
: 'font-weight: bold; color: orange';
|
|
432
|
+
|
|
433
|
+
const warning = is_inconsistent ? ' ⚠️ INCONSISTENT' : '';
|
|
434
|
+
|
|
435
|
+
// eslint-disable-next-line no-console
|
|
436
|
+
console.group(`%cbranch (${branch.status})${warning}`, style);
|
|
437
|
+
|
|
438
|
+
// eslint-disable-next-line no-console
|
|
439
|
+
console.log('%ceffect:', 'font-weight: bold', branch.effect);
|
|
440
|
+
|
|
441
|
+
if (branch.effect.fn) {
|
|
442
|
+
// eslint-disable-next-line no-console
|
|
443
|
+
console.log('%cfn:', 'font-weight: bold', branch.effect.fn);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (branch.effect.deps !== null) {
|
|
447
|
+
// eslint-disable-next-line no-console
|
|
448
|
+
console.groupCollapsed('%cdeps', 'font-weight: normal');
|
|
449
|
+
for (const dep of branch.effect.deps) {
|
|
450
|
+
log_dep(dep);
|
|
451
|
+
}
|
|
452
|
+
// eslint-disable-next-line no-console
|
|
453
|
+
console.groupEnd();
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (is_inconsistent) {
|
|
457
|
+
log_effect_tree(branch.effect);
|
|
458
|
+
} else if (branch.children.length > 0) {
|
|
459
|
+
// eslint-disable-next-line no-console
|
|
460
|
+
console.group('%cchild branches', 'font-weight: bold');
|
|
461
|
+
for (const child of branch.children) {
|
|
462
|
+
log_branch(child, new_ancestor_clean, depth + 1);
|
|
463
|
+
}
|
|
464
|
+
// eslint-disable-next-line no-console
|
|
465
|
+
console.groupEnd();
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// eslint-disable-next-line no-console
|
|
469
|
+
console.groupEnd();
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const branches = collect_branches(root_effect, false);
|
|
473
|
+
|
|
474
|
+
// Check if there are any inconsistencies at all
|
|
475
|
+
let has_any_inconsistency = false;
|
|
476
|
+
for (const branch of branches) {
|
|
477
|
+
if (has_inconsistency(branch, false)) {
|
|
478
|
+
has_any_inconsistency = true;
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (!has_any_inconsistency) {
|
|
484
|
+
// eslint-disable-next-line no-console
|
|
485
|
+
console.log('%cNo inconsistent branches found', 'font-weight: bold; color: green');
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// eslint-disable-next-line no-console
|
|
490
|
+
console.group(`%cInconsistent Branches (non-clean below clean)`, 'font-weight: bold; color: red');
|
|
491
|
+
|
|
492
|
+
for (const branch of branches) {
|
|
493
|
+
log_branch(branch, false, 0);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// eslint-disable-next-line no-console
|
|
497
|
+
console.groupEnd();
|
|
498
|
+
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
@@ -175,6 +175,9 @@ export class Batch {
|
|
|
175
175
|
this.#traverse_effect_tree(root, target);
|
|
176
176
|
// Note: #traverse_effect_tree runs block effects eagerly, which can schedule effects,
|
|
177
177
|
// which means queued_root_effects now may be filled again.
|
|
178
|
+
|
|
179
|
+
// Helpful for debugging reactivity loss that has to do with branches being skipped:
|
|
180
|
+
// log_inconsistent_branches(root);
|
|
178
181
|
}
|
|
179
182
|
|
|
180
183
|
if (!this.is_fork) {
|
|
@@ -228,6 +228,8 @@ export function internal_set(source, value) {
|
|
|
228
228
|
|
|
229
229
|
source.wv = increment_write_version();
|
|
230
230
|
|
|
231
|
+
// For debugging, in case you want to know which reactions are being scheduled:
|
|
232
|
+
// log_reactions(source);
|
|
231
233
|
mark_reactions(source, DIRTY);
|
|
232
234
|
|
|
233
235
|
// It's possible that the current reaction might not have up-to-date dependencies
|
|
@@ -56,7 +56,7 @@ function encode(key, value, unresolved) {
|
|
|
56
56
|
let uid = 1;
|
|
57
57
|
|
|
58
58
|
entry.serialized = devalue.uneval(entry.value, (value, uneval) => {
|
|
59
|
-
if (value
|
|
59
|
+
if (is_promise(value)) {
|
|
60
60
|
const p = value
|
|
61
61
|
.then((v) => `r(${uneval(v)})`)
|
|
62
62
|
.catch((devalue_error) =>
|
|
@@ -90,6 +90,16 @@ function encode(key, value, unresolved) {
|
|
|
90
90
|
return entry;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* @param {any} value
|
|
95
|
+
* @returns {value is Promise<any>}
|
|
96
|
+
*/
|
|
97
|
+
function is_promise(value) {
|
|
98
|
+
// we use this check rather than `instanceof Promise`
|
|
99
|
+
// because it works cross-realm
|
|
100
|
+
return Object.prototype.toString.call(value) === '[object Promise]';
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
/**
|
|
94
104
|
* @param {string} key
|
|
95
105
|
* @param {HydratableLookupEntry} a
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -842,7 +842,7 @@ declare module 'svelte/attachments' {
|
|
|
842
842
|
|
|
843
843
|
declare module 'svelte/compiler' {
|
|
844
844
|
import type { SourceMap } from 'magic-string';
|
|
845
|
-
import type { ArrayExpression, ArrowFunctionExpression, VariableDeclaration, VariableDeclarator, Expression, Identifier, MemberExpression, Node, ObjectExpression, Pattern, Program, ChainExpression, SimpleCallExpression, SequenceExpression } from 'estree';
|
|
845
|
+
import type { ArrayExpression, ArrowFunctionExpression, VariableDeclaration, VariableDeclarator, Expression, Identifier, MemberExpression, Node, ObjectExpression, Pattern, Program, ChainExpression, SimpleCallExpression, SequenceExpression, SourceLocation } from 'estree';
|
|
846
846
|
import type { Location } from 'locate-character';
|
|
847
847
|
import type { default as ts } from 'esrap/languages/ts';
|
|
848
848
|
/**
|
|
@@ -1302,7 +1302,7 @@ declare module 'svelte/compiler' {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
|
|
1304
1304
|
/** An `animate:` directive */
|
|
1305
|
-
export interface AnimateDirective extends
|
|
1305
|
+
export interface AnimateDirective extends BaseAttribute {
|
|
1306
1306
|
type: 'AnimateDirective';
|
|
1307
1307
|
/** The 'x' in `animate:x` */
|
|
1308
1308
|
name: string;
|
|
@@ -1311,7 +1311,7 @@ declare module 'svelte/compiler' {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
|
|
1313
1313
|
/** A `bind:` directive */
|
|
1314
|
-
export interface BindDirective extends
|
|
1314
|
+
export interface BindDirective extends BaseAttribute {
|
|
1315
1315
|
type: 'BindDirective';
|
|
1316
1316
|
/** The 'x' in `bind:x` */
|
|
1317
1317
|
name: string;
|
|
@@ -1320,7 +1320,7 @@ declare module 'svelte/compiler' {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
|
|
1322
1322
|
/** A `class:` directive */
|
|
1323
|
-
export interface ClassDirective extends
|
|
1323
|
+
export interface ClassDirective extends BaseAttribute {
|
|
1324
1324
|
type: 'ClassDirective';
|
|
1325
1325
|
/** The 'x' in `class:x` */
|
|
1326
1326
|
name: 'class';
|
|
@@ -1329,7 +1329,7 @@ declare module 'svelte/compiler' {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
|
|
1331
1331
|
/** A `let:` directive */
|
|
1332
|
-
export interface LetDirective extends
|
|
1332
|
+
export interface LetDirective extends BaseAttribute {
|
|
1333
1333
|
type: 'LetDirective';
|
|
1334
1334
|
/** The 'x' in `let:x` */
|
|
1335
1335
|
name: string;
|
|
@@ -1338,7 +1338,7 @@ declare module 'svelte/compiler' {
|
|
|
1338
1338
|
}
|
|
1339
1339
|
|
|
1340
1340
|
/** An `on:` directive */
|
|
1341
|
-
export interface OnDirective extends
|
|
1341
|
+
export interface OnDirective extends BaseAttribute {
|
|
1342
1342
|
type: 'OnDirective';
|
|
1343
1343
|
/** The 'x' in `on:x` */
|
|
1344
1344
|
name: string;
|
|
@@ -1358,7 +1358,7 @@ declare module 'svelte/compiler' {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
|
|
1360
1360
|
/** A `style:` directive */
|
|
1361
|
-
export interface StyleDirective extends
|
|
1361
|
+
export interface StyleDirective extends BaseAttribute {
|
|
1362
1362
|
type: 'StyleDirective';
|
|
1363
1363
|
/** The 'x' in `style:x` */
|
|
1364
1364
|
name: string;
|
|
@@ -1369,7 +1369,7 @@ declare module 'svelte/compiler' {
|
|
|
1369
1369
|
|
|
1370
1370
|
// TODO have separate in/out/transition directives
|
|
1371
1371
|
/** A `transition:`, `in:` or `out:` directive */
|
|
1372
|
-
export interface TransitionDirective extends
|
|
1372
|
+
export interface TransitionDirective extends BaseAttribute {
|
|
1373
1373
|
type: 'TransitionDirective';
|
|
1374
1374
|
/** The 'x' in `transition:x` */
|
|
1375
1375
|
name: string;
|
|
@@ -1383,7 +1383,7 @@ declare module 'svelte/compiler' {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
|
|
1385
1385
|
/** A `use:` directive */
|
|
1386
|
-
export interface UseDirective extends
|
|
1386
|
+
export interface UseDirective extends BaseAttribute {
|
|
1387
1387
|
type: 'UseDirective';
|
|
1388
1388
|
/** The 'x' in `use:x` */
|
|
1389
1389
|
name: string;
|
|
@@ -1393,6 +1393,7 @@ declare module 'svelte/compiler' {
|
|
|
1393
1393
|
|
|
1394
1394
|
export interface BaseElement extends BaseNode {
|
|
1395
1395
|
name: string;
|
|
1396
|
+
name_loc: SourceLocation;
|
|
1396
1397
|
attributes: Array<Attribute | SpreadAttribute | Directive | AttachTag>;
|
|
1397
1398
|
fragment: Fragment;
|
|
1398
1399
|
}
|
|
@@ -1517,9 +1518,13 @@ declare module 'svelte/compiler' {
|
|
|
1517
1518
|
body: Fragment;
|
|
1518
1519
|
}
|
|
1519
1520
|
|
|
1520
|
-
export interface
|
|
1521
|
-
type: 'Attribute';
|
|
1521
|
+
export interface BaseAttribute extends BaseNode {
|
|
1522
1522
|
name: string;
|
|
1523
|
+
name_loc: SourceLocation | null;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
export interface Attribute extends BaseAttribute {
|
|
1527
|
+
type: 'Attribute';
|
|
1523
1528
|
/**
|
|
1524
1529
|
* Quoted/string values are represented by an array, even if they contain a single expression like `"{x}"`
|
|
1525
1530
|
*/
|
package/types/index.d.ts.map
CHANGED
|
@@ -272,6 +272,6 @@
|
|
|
272
272
|
null,
|
|
273
273
|
null
|
|
274
274
|
],
|
|
275
|
-
"mappings": ";;;;;;;kBAUiBA,2BAA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkC/BC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAwEhBC,kBAAkBA;;;;;;;;;;;;;;;;;;;;;;;;kBAwBbC,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCbC,oBAAoBA;;;;;;;;;;;;;;;;;;;;;;;;aAwBrBC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCfC,cAAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA6BdC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;kBAuBRC,OAAOA;;;;;;;;;;;;;;;;kBAgBPC,eAAeA;;;;;;;;;;;;;;;;aAgBpBC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA0CPC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCnSLC,cAAcA;;;;;;;;;;;;iBAsBdC,OAAOA;;;;;;;;iBAwBPC,SAASA;;;;;;;;;;;;;;;;;;;;;;iBA0CTC,qBAAqBA;;;;;;;;;;iBA2CrBC,YAAYA;;;;;;;;;;iBAuBZC,WAAWA;iBClNXC,UAAUA;;;;iBC4DVC,gBAAgBA;;;;;MCvEpBC,WAAWA;;;;;
|
|
275
|
+
"mappings": ";;;;;;;kBAUiBA,2BAA2BA;;;;;;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