Home / Function/ constructor() — svelte Function Reference

constructor() — svelte Function Reference

Architecture documentation for the constructor() function in compile-errors.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  09b8c1e9_4b51_2855_0e60_604426913ea9["constructor()"]
  f58f5246_8fe8_7bac_5004_bebb4973006b["InternalCompileError"]
  09b8c1e9_4b51_2855_0e60_604426913ea9 -->|defined in| f58f5246_8fe8_7bac_5004_bebb4973006b
  style 09b8c1e9_4b51_2855_0e60_604426913ea9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/scripts/process-messages/templates/compile-errors.js lines 14–24

	constructor(code, message, position) {
		super(message);
		this.stack = ''; // avoid unnecessary noise; don't set it as a class property or it becomes enumerable

		// We want to extend from Error so that various bundler plugins properly handle it.
		// But we also want to share the same object shape with that of warnings, therefore
		// we create an instance of the shared class an copy over its properties.
		this.#diagnostic = new CompileDiagnostic(code, message, position);
		Object.assign(this, this.#diagnostic);
		this.name = 'CompileError';
	}

Domain

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the svelte codebase, defined in packages/svelte/scripts/process-messages/templates/compile-errors.js.
Where is constructor() defined?
constructor() is defined in packages/svelte/scripts/process-messages/templates/compile-errors.js at line 14.

Analyze Your Own Codebase

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

Try Supermodel Free