calculate_replacements() — svelte Function Reference
Architecture documentation for the calculate_replacements() function in replace_in_code.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD f0ba6afb_7305_48fb_a52f_c06b289193e5["calculate_replacements()"] 76cde72f_b08b_6c0b_1e04_dda16a7ac104["replace_in_code.js"] f0ba6afb_7305_48fb_a52f_c06b289193e5 -->|defined in| 76cde72f_b08b_6c0b_1e04_dda16a7ac104 e504078b_ad3f_7265_675b_c14b85115247["replace_in_code()"] e504078b_ad3f_7265_675b_c14b85115247 -->|calls| f0ba6afb_7305_48fb_a52f_c06b289193e5 style f0ba6afb_7305_48fb_a52f_c06b289193e5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/preprocess/replace_in_code.js lines 24–40
function calculate_replacements(re, get_replacement, source) {
/**
* @type {Array<Promise<Replacement>>}
*/
const replacements = [];
source.replace(re, (...match) => {
replacements.push(
get_replacement(...match).then((replacement) => {
const matched_string = match[0];
const offset = match[match.length - 2];
return { offset, length: matched_string.length, replacement };
})
);
return '';
});
return Promise.all(replacements);
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does calculate_replacements() do?
calculate_replacements() is a function in the svelte codebase, defined in packages/svelte/src/compiler/preprocess/replace_in_code.js.
Where is calculate_replacements() defined?
calculate_replacements() is defined in packages/svelte/src/compiler/preprocess/replace_in_code.js at line 24.
What calls calculate_replacements()?
calculate_replacements() is called by 1 function(s): replace_in_code.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free