check_bundle() — svelte Function Reference
Architecture documentation for the check_bundle() function in check-treeshakeability.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 1cd82827_acca_004a_c145_7eb440520ec5["check_bundle()"] a1cf3ce1_4e6b_8aaa_e102_ea18e7bc71ed["check-treeshakeability.js"] 1cd82827_acca_004a_c145_7eb440520ec5 -->|defined in| a1cf3ce1_4e6b_8aaa_e102_ea18e7bc71ed style 1cd82827_acca_004a_c145_7eb440520ec5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/scripts/check-treeshakeability.js lines 125–146
function check_bundle(case_name, ...strings) {
for (const string of strings) {
const index = bundle.indexOf(string);
if (index >= 0) {
// eslint-disable-next-line no-console
console.error(`❌ ${case_name} not treeshakeable`);
failed = true;
let lines = bundle.slice(index - 500, index + 500).split('\n');
const target_line = lines.findIndex((line) => line.includes(string));
// mark the failed line
lines = lines
.map((line, i) => (i === target_line ? `> ${line}` : `| ${line}`))
.slice(target_line - 5, target_line + 6);
// eslint-disable-next-line no-console
console.error('The first failed line:\n' + lines.join('\n'));
return;
}
}
// eslint-disable-next-line no-console
console.error(`✅ ${case_name} treeshakeable`);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does check_bundle() do?
check_bundle() is a function in the svelte codebase, defined in packages/svelte/scripts/check-treeshakeability.js.
Where is check_bundle() defined?
check_bundle() is defined in packages/svelte/scripts/check-treeshakeability.js at line 125.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free