Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions packages/svelte/src/internal/client/dev/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
RENDER_EFFECT,
ROOT_EFFECT
} from '#client/constants';
import { snapshot } from '../../shared/clone.js';
import { untrack } from '../runtime.js';

/**
*
Expand Down Expand Up @@ -84,6 +86,16 @@ export function log_effect_tree(effect, depth = 0) {
console.groupEnd();
}

if (effect.nodes_start && effect.nodes_end) {
// eslint-disable-next-line no-console
console.log(effect.nodes_start);

if (effect.nodes_start !== effect.nodes_end) {
// eslint-disable-next-line no-console
console.log(effect.nodes_end);
}
}

let child = effect.first;
while (child !== null) {
log_effect_tree(child, depth + 1);
Expand All @@ -103,7 +115,13 @@ function log_dep(dep) {
const derived = /** @type {Derived} */ (dep);

// eslint-disable-next-line no-console
console.groupCollapsed('%cderived', 'font-weight: normal', derived.v);
console.groupCollapsed(
`%c$derived %c${dep.label ?? '<unknown>'}`,
'font-weight: bold; color: CornflowerBlue',
'font-weight: normal',
untrack(() => snapshot(derived.v))
);

if (derived.deps) {
for (const d of derived.deps) {
log_dep(d);
Expand All @@ -114,6 +132,11 @@ function log_dep(dep) {
console.groupEnd();
} else {
// eslint-disable-next-line no-console
console.log('state', dep.v);
console.log(
`%c$state %c${dep.label ?? '<unknown>'}`,
'font-weight: bold; color: CornflowerBlue',
'font-weight: normal',
untrack(() => snapshot(dep.v))
);
}
}
Loading