Home / File/ validate.js — svelte Source File

validate.js — svelte Source File

Architecture documentation for validate.js, a javascript file in the svelte codebase. 9 imports, 0 dependents.

File javascript ClientRuntime Hydration 9 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  a927f58e_e80a_6a7b_4e18_83d6571bb37f["validate.js"]
  48cf26f8_bf34_fd7a_3d52_cc963051e167["context.js"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> 48cf26f8_bf34_fd7a_3d52_cc963051e167
  73865c3c_2786_c9ac_d34f_b51d28b3a29e["constants.js"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> 73865c3c_2786_c9ac_d34f_b51d28b3a29e
  1ae6fa4e_16ee_acdf_5e28_17eb0819fddb["effects.js"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> 1ae6fa4e_16ee_acdf_5e28_17eb0819fddb
  7494b934_a3b8_689e_91b6_8435e26461c5["render_effect"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> 7494b934_a3b8_689e_91b6_8435e26461c5
  df278ca2_0a6c_fefe_09f2_b397500fe3c2["warnings.js"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> df278ca2_0a6c_fefe_09f2_b397500fe3c2
  49e6453b_f889_68d3_168f_19a644745ce8["store.js"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> 49e6453b_f889_68d3_168f_19a644745ce8
  30a9ce87_f086_adc7_ccd8_8a6ffbd469fe["capture_store_binding"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> 30a9ce87_f086_adc7_ccd8_8a6ffbd469fe
  1ad3e508_c069_abae_2e4a_bd17c8892e18["async.js"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> 1ad3e508_c069_abae_2e4a_bd17c8892e18
  a1d7f44d_5b8b_629c_39ba_eeb1486eee4a["run_after_blockers"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f --> a1d7f44d_5b8b_629c_39ba_eeb1486eee4a
  style a927f58e_e80a_6a7b_4e18_83d6571bb37f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { Blocker } from '#client' */
import { dev_current_component_function } from './context.js';
import { FILENAME } from '../../constants.js';
import { render_effect } from './reactivity/effects.js';
import * as w from './warnings.js';
import { capture_store_binding } from './reactivity/store.js';
import { run_after_blockers } from './reactivity/async.js';

/**
 * @param {string} binding
 * @param {Blocker[]} blockers
 * @param {() => Record<string, any>} get_object
 * @param {() => string} get_property
 * @param {number} line
 * @param {number} column
 */
export function validate_binding(binding, blockers, get_object, get_property, line, column) {
	run_after_blockers(blockers, () => {
		var warned = false;

		var filename = dev_current_component_function?.[FILENAME];

		render_effect(() => {
			if (warned) return;

			var [object, is_store_sub] = capture_store_binding(get_object);

			if (is_store_sub) return;

			var property = get_property();

			var ran = false;

			// by making the (possibly false, but it would be an extreme edge case) assumption
			// that a getter has a corresponding setter, we can determine if a property is
			// reactive by seeing if this effect has dependencies
			var effect = render_effect(() => {
				if (ran) return;

				// eslint-disable-next-line @typescript-eslint/no-unused-expressions
				object[property];
			});

			ran = true;

			if (effect.deps === null) {
				var location = `${filename}:${line}:${column}`;
				w.binding_property_non_reactive(binding, location);

				warned = true;
			}
		});
	});
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does validate.js do?
validate.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 validate.js?
validate.js defines 1 function(s): validate_binding.
What does validate.js depend on?
validate.js imports 9 module(s): async.js, capture_store_binding, constants.js, context.js, effects.js, render_effect, run_after_blockers, store.js, and 1 more.
Where is validate.js in the architecture?
validate.js is located at packages/svelte/src/internal/client/validate.js (domain: ClientRuntime, subdomain: Hydration, directory: packages/svelte/src/internal/client).

Analyze Your Own Codebase

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

Try Supermodel Free