MCPcopy
hub / github.com/sveltejs/svelte / get_stack

Function get_stack

packages/svelte/src/internal/shared/dev.js:33–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 * @returns {string[]}
32 */
33export function get_stack() {
34 // @ts-ignore - doesn't exist everywhere
35 const limit = Error.stackTraceLimit;
36 // @ts-ignore - doesn't exist everywhere
37 Error.stackTraceLimit = Infinity;
38 const stack = new Error().stack;
39 // @ts-ignore - doesn't exist everywhere
40 Error.stackTraceLimit = limit;
41
42 if (!stack) return [];
43
44 const lines = stack.split('\n');
45 const new_lines = [];
46
47 for (let i = 0; i < lines.length; i++) {
48 const line = lines[i];
49 const posixified = line.replaceAll('\\', '/');
50
51 if (line.trim() === 'Error') {
52 continue;
53 }
54
55 if (line.includes('validate_each_keys')) {
56 return [];
57 }
58
59 if (posixified.includes('svelte/src/internal') || posixified.includes('node_modules/.vite')) {
60 continue;
61 }
62
63 new_lines.push(line);
64 }
65
66 return new_lines;
67}
68
69/**
70 * @param {boolean} condition

Callers 2

get_user_code_locationFunction · 0.90
get_errorFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected