merge_with_preprocessor_map() — svelte Function Reference
Architecture documentation for the merge_with_preprocessor_map() function in mapped_code.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD cbb1ee69_356b_2015_1118_b75b5cb5088f["merge_with_preprocessor_map()"] d383a41d_5383_ee86_cab6_03bf1a2daf93["mapped_code.js"] cbb1ee69_356b_2015_1118_b75b5cb5088f -->|defined in| d383a41d_5383_ee86_cab6_03bf1a2daf93 1129e6de_ad88_9249_cdc1_424cf9bba55e["render_stylesheet()"] 1129e6de_ad88_9249_cdc1_424cf9bba55e -->|calls| cbb1ee69_356b_2015_1118_b75b5cb5088f 0accce76_056a_b49e_69ca_069fe7e3e216["transform_component()"] 0accce76_056a_b49e_69ca_069fe7e3e216 -->|calls| cbb1ee69_356b_2015_1118_b75b5cb5088f fee21348_d647_ae03_a75d_4957b319966c["get_basename()"] cbb1ee69_356b_2015_1118_b75b5cb5088f -->|calls| fee21348_d647_ae03_a75d_4957b319966c 75dd917c_6b23_2b41_3ed7_e5aa56348c12["apply_preprocessor_sourcemap()"] cbb1ee69_356b_2015_1118_b75b5cb5088f -->|calls| 75dd917c_6b23_2b41_3ed7_e5aa56348c12 83e8a17c_7a83_f4d3_1629_6a92427d44f2["get_relative_path()"] cbb1ee69_356b_2015_1118_b75b5cb5088f -->|calls| 83e8a17c_7a83_f4d3_1629_6a92427d44f2 style cbb1ee69_356b_2015_1118_b75b5cb5088f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/utils/mapped_code.js lines 394–417
export function merge_with_preprocessor_map(result, options, source_name) {
if (options.sourcemap) {
const file_basename = get_basename(options.filename);
// The preprocessor map is expected to contain `sources: [basename_of_filename]`, but our own
// map may contain a different file name. Patch our map beforehand to align sources so merging
// with the preprocessor map works correctly.
result.map.sources = [file_basename];
Object.assign(
result.map,
apply_preprocessor_sourcemap(
file_basename,
result.map,
/** @type {any} */ (options.sourcemap)
)
);
// After applying the preprocessor map, we need to do the inverse and make the sources
// relative to the input file again in case the output code is in a different directory.
if (file_basename !== source_name) {
result.map.sources = result.map.sources.map(
/** @param {string} source */ (source) => get_relative_path(source_name, source)
);
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does merge_with_preprocessor_map() do?
merge_with_preprocessor_map() is a function in the svelte codebase, defined in packages/svelte/src/compiler/utils/mapped_code.js.
Where is merge_with_preprocessor_map() defined?
merge_with_preprocessor_map() is defined in packages/svelte/src/compiler/utils/mapped_code.js at line 394.
What does merge_with_preprocessor_map() call?
merge_with_preprocessor_map() calls 3 function(s): apply_preprocessor_sourcemap, get_basename, get_relative_path.
What calls merge_with_preprocessor_map()?
merge_with_preprocessor_map() is called by 2 function(s): render_stylesheet, transform_component.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free