Home / Function/ get_stack() — svelte Function Reference

get_stack() — svelte Function Reference

Architecture documentation for the get_stack() function in dev.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  dc56a025_e89c_82a9_72a2_1f21312e2aa4["get_stack()"]
  66d86b00_6f66_4791_e665_59e2cf45dc7f["dev.js"]
  dc56a025_e89c_82a9_72a2_1f21312e2aa4 -->|defined in| 66d86b00_6f66_4791_e665_59e2cf45dc7f
  8362c319_fb03_c16d_839d_c59e10f334e7["get_user_code_location()"]
  8362c319_fb03_c16d_839d_c59e10f334e7 -->|calls| dc56a025_e89c_82a9_72a2_1f21312e2aa4
  cc46feba_170d_5970_a6be_f512f15aa0ee["get_error()"]
  cc46feba_170d_5970_a6be_f512f15aa0ee -->|calls| dc56a025_e89c_82a9_72a2_1f21312e2aa4
  style dc56a025_e89c_82a9_72a2_1f21312e2aa4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/shared/dev.js lines 31–65

export function get_stack() {
	// @ts-ignore - doesn't exist everywhere
	const limit = Error.stackTraceLimit;
	// @ts-ignore - doesn't exist everywhere
	Error.stackTraceLimit = Infinity;
	const stack = new Error().stack;
	// @ts-ignore - doesn't exist everywhere
	Error.stackTraceLimit = limit;

	if (!stack) return [];

	const lines = stack.split('\n');
	const new_lines = [];

	for (let i = 0; i < lines.length; i++) {
		const line = lines[i];
		const posixified = line.replaceAll('\\', '/');

		if (line.trim() === 'Error') {
			continue;
		}

		if (line.includes('validate_each_keys')) {
			return [];
		}

		if (posixified.includes('svelte/src/internal') || posixified.includes('node_modules/.vite')) {
			continue;
		}

		new_lines.push(line);
	}

	return new_lines;
}

Subdomains

Frequently Asked Questions

What does get_stack() do?
get_stack() is a function in the svelte codebase, defined in packages/svelte/src/internal/shared/dev.js.
Where is get_stack() defined?
get_stack() is defined in packages/svelte/src/internal/shared/dev.js at line 31.
What calls get_stack()?
get_stack() is called by 2 function(s): get_error, get_user_code_location.

Analyze Your Own Codebase

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

Try Supermodel Free