Home / File/ tracing.js — svelte Source File

tracing.js — svelte Source File

Architecture documentation for tracing.js, a javascript file in the svelte codebase. 8 imports, 13 dependents.

File javascript ClientRuntime Hydration 8 imports 13 dependents 6 functions

Entity Profile

Dependency Diagram

graph LR
  2696eb67_452f_4c32_3e13_ee172192b366["tracing.js"]
  73865c3c_2786_c9ac_d34f_b51d28b3a29e["constants.js"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> 73865c3c_2786_c9ac_d34f_b51d28b3a29e
  258b696c_d923_7010_457a_b58908a057b0["clone.js"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> 258b696c_d923_7010_457a_b58908a057b0
  532a740d_d410_0fd6_983a_933cb13808e7["snapshot"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> 532a740d_d410_0fd6_983a_933cb13808e7
  1ae6fa4e_16ee_acdf_5e28_17eb0819fddb["effects.js"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> 1ae6fa4e_16ee_acdf_5e28_17eb0819fddb
  461d1f5f_ffa4_d984_98a4_868566c66f30["effect_tracking"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> 461d1f5f_ffa4_d984_98a4_868566c66f30
  bde4209f_8ffc_1594_4024_b1835a44bcf6["runtime.js"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> bde4209f_8ffc_1594_4024_b1835a44bcf6
  a814b193_e12a_4037_c3c8_dfd45f3bd0bb["untrack"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> a814b193_e12a_4037_c3c8_dfd45f3bd0bb
  54c2bfce_50b6_b8cc_4371_e1e14f283fb3["constants"]
  2696eb67_452f_4c32_3e13_ee172192b366 --> 54c2bfce_50b6_b8cc_4371_e1e14f283fb3
  6d3d606a_fb7a_54af_1ece_f1eb12f174d1["boundary.js"]
  6d3d606a_fb7a_54af_1ece_f1eb12f174d1 --> 2696eb67_452f_4c32_3e13_ee172192b366
  71020d3b_ab64_9fea_2a06_dab93412f92f["proxy.js"]
  71020d3b_ab64_9fea_2a06_dab93412f92f --> 2696eb67_452f_4c32_3e13_ee172192b366
  e5c35d51_28d8_9054_923d_b7f82a3c8dc2["sources.js"]
  e5c35d51_28d8_9054_923d_b7f82a3c8dc2 --> 2696eb67_452f_4c32_3e13_ee172192b366
  bde4209f_8ffc_1594_4024_b1835a44bcf6["runtime.js"]
  bde4209f_8ffc_1594_4024_b1835a44bcf6 --> 2696eb67_452f_4c32_3e13_ee172192b366
  5230511f_b608_2c86_cb6b_11014fdf94b5["spring.js"]
  5230511f_b608_2c86_cb6b_11014fdf94b5 --> 2696eb67_452f_4c32_3e13_ee172192b366
  99a316ef_52a9_1ecb_3a20_489761af28ad["tweened.js"]
  99a316ef_52a9_1ecb_3a20_489761af28ad --> 2696eb67_452f_4c32_3e13_ee172192b366
  9ad5fe9f_fc6f_e854_93df_194b16c3b738["create-subscriber.js"]
  9ad5fe9f_fc6f_e854_93df_194b16c3b738 --> 2696eb67_452f_4c32_3e13_ee172192b366
  style 2696eb67_452f_4c32_3e13_ee172192b366 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { Derived, Reaction, Value } from '#client' */
import { UNINITIALIZED } from '../../../constants.js';
import { snapshot } from '../../shared/clone.js';
import { DERIVED, ASYNC, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';
import { effect_tracking } from '../reactivity/effects.js';
import { active_reaction, untrack } from '../runtime.js';

/**
 * @typedef {{
 *   traces: Error[];
 * }} TraceEntry
 */

/** @type {{ reaction: Reaction | null, entries: Map<Value, TraceEntry> } | null} */
export let tracing_expressions = null;

/**
 * @param {Value} signal
 * @param {TraceEntry} [entry]
 */
function log_entry(signal, entry) {
	const value = signal.v;

	if (value === UNINITIALIZED) {
		return;
	}

	const type = get_type(signal);
	const current_reaction = /** @type {Reaction} */ (active_reaction);
	const dirty = signal.wv > current_reaction.wv || current_reaction.wv === 0;
	const style = dirty
		? 'color: CornflowerBlue; font-weight: bold'
		: 'color: grey; font-weight: normal';

	// eslint-disable-next-line no-console
	console.groupCollapsed(
		signal.label ? `%c${type}%c ${signal.label}` : `%c${type}%c`,
		style,
		dirty ? 'font-weight: normal' : style,
		typeof value === 'object' && value !== null && STATE_SYMBOL in value
			? snapshot(value, true)
			: value
	);

	if (type === '$derived') {
		const deps = new Set(/** @type {Derived} */ (signal).deps);
		for (const dep of deps) {
			log_entry(dep);
		}
	}

	if (signal.created) {
		// eslint-disable-next-line no-console
		console.log(signal.created);
	}

	if (dirty && signal.updated) {
		for (const updated of signal.updated.values()) {
			if (updated.error) {
				// eslint-disable-next-line no-console
// ... (103 more lines)

Domain

Subdomains

Frequently Asked Questions

What does tracing.js do?
tracing.js is a source file in the svelte codebase, written in javascript. It belongs to the ClientRuntime domain, Hydration subdomain.
What functions are defined in tracing.js?
tracing.js defines 6 function(s): get_type, label, log_entry, tag, tag_proxy, trace.
What does tracing.js depend on?
tracing.js imports 8 module(s): clone.js, constants, constants.js, effect_tracking, effects.js, runtime.js, snapshot, untrack.
What files import tracing.js?
tracing.js is imported by 13 file(s): boundary.js, create-subscriber.js, date.js, index.js, map.js, proxy.js, runtime.js, set.js, and 5 more.
Where is tracing.js in the architecture?
tracing.js is located at packages/svelte/src/internal/client/dev/tracing.js (domain: ClientRuntime, subdomain: Hydration, directory: packages/svelte/src/internal/client/dev).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free