Home / Function/ read_declaration() — svelte Function Reference

read_declaration() — svelte Function Reference

Architecture documentation for the read_declaration() function in style.js from the svelte codebase.

Function javascript Compiler Transformer calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  883f8dc6_d58a_da13_a1b1_889d3d0b4fa2["read_declaration()"]
  251e2338_f8b8_69b4_b2e5_29ee7decbfa6["style.js"]
  883f8dc6_d58a_da13_a1b1_889d3d0b4fa2 -->|defined in| 251e2338_f8b8_69b4_b2e5_29ee7decbfa6
  b72c2083_31ae_feed_8216_d263cace4b10["read_block_item()"]
  b72c2083_31ae_feed_8216_d263cace4b10 -->|calls| 883f8dc6_d58a_da13_a1b1_889d3d0b4fa2
  998e5052_9be5_2c73_14b0_84ce50994d42["read_value()"]
  883f8dc6_d58a_da13_a1b1_889d3d0b4fa2 -->|calls| 998e5052_9be5_2c73_14b0_84ce50994d42
  d1ba2f5a_92ba_201e_c3b7_3d6f05513d00["css_empty_declaration()"]
  883f8dc6_d58a_da13_a1b1_889d3d0b4fa2 -->|calls| d1ba2f5a_92ba_201e_c3b7_3d6f05513d00
  style 883f8dc6_d58a_da13_a1b1_889d3d0b4fa2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/1-parse/read/style.js lines 463–491

function read_declaration(parser) {
	const start = parser.index;

	const property = parser.read_until(REGEX_WHITESPACE_OR_COLON);
	parser.allow_whitespace();
	parser.eat(':');
	let index = parser.index;
	parser.allow_whitespace();

	const value = read_value(parser);

	if (!value && !property.startsWith('--')) {
		e.css_empty_declaration({ start, end: index });
	}

	const end = parser.index;

	if (!parser.match('}')) {
		parser.eat(';', true);
	}

	return {
		type: 'Declaration',
		start,
		end,
		property,
		value
	};
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does read_declaration() do?
read_declaration() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/read/style.js.
Where is read_declaration() defined?
read_declaration() is defined in packages/svelte/src/compiler/phases/1-parse/read/style.js at line 463.
What does read_declaration() call?
read_declaration() calls 2 function(s): css_empty_declaration, read_value.
What calls read_declaration()?
read_declaration() is called by 1 function(s): read_block_item.

Analyze Your Own Codebase

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

Try Supermodel Free