process_tag() — svelte Function Reference
Architecture documentation for the process_tag() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 3d6e4414_b36d_fff0_63de_9aea1fab6869["process_tag()"] ccf6927a_1f1b_1dda_8616_80903a72ba16["index.js"] 3d6e4414_b36d_fff0_63de_9aea1fab6869 -->|defined in| ccf6927a_1f1b_1dda_8616_80903a72ba16 a7a70deb_64ca_bb14_028e_9cb3aec87b0f["preprocess()"] a7a70deb_64ca_bb14_028e_9cb3aec87b0f -->|calls| 3d6e4414_b36d_fff0_63de_9aea1fab6869 f60b5bcd_c389_6937_b4c0_e720a97b643a["from_source()"] 3d6e4414_b36d_fff0_63de_9aea1fab6869 -->|calls| f60b5bcd_c389_6937_b4c0_e720a97b643a 2f8f22ce_6b99_47f9_f47d_9e47a039bde4["slice_source()"] 3d6e4414_b36d_fff0_63de_9aea1fab6869 -->|calls| 2f8f22ce_6b99_47f9_f47d_9e47a039bde4 082d508a_e627_7a95_fce0_02014a5b6784["parse_tag_attributes()"] 3d6e4414_b36d_fff0_63de_9aea1fab6869 -->|calls| 082d508a_e627_7a95_fce0_02014a5b6784 860c55db_f911_8bca_7055_338865a9f9b0["processed_tag_to_code()"] 3d6e4414_b36d_fff0_63de_9aea1fab6869 -->|calls| 860c55db_f911_8bca_7055_338865a9f9b0 395c4d8f_d709_5627_02c8_e3da7b9cf209["stringify_tag_attributes()"] 3d6e4414_b36d_fff0_63de_9aea1fab6869 -->|calls| 395c4d8f_d709_5627_02c8_e3da7b9cf209 e504078b_ad3f_7265_675b_c14b85115247["replace_in_code()"] 3d6e4414_b36d_fff0_63de_9aea1fab6869 -->|calls| e504078b_ad3f_7265_675b_c14b85115247 style 3d6e4414_b36d_fff0_63de_9aea1fab6869 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/preprocess/index.js lines 265–302
async function process_tag(tag_name, preprocessor, source) {
const { filename, source: markup } = source;
const tag_regex = tag_name === 'style' ? regex_style_tags : regex_script_tags;
/**
* @type {string[]}
*/
const dependencies = [];
/**
* @param {string} tag_with_content
* @param {number} tag_offset
* @returns {Promise<MappedCode>}
*/
async function process_single_tag(tag_with_content, attributes = '', content = '', tag_offset) {
const no_change = () =>
MappedCode.from_source(slice_source(tag_with_content, tag_offset, source));
if (!attributes && !content) return no_change();
const processed = await preprocessor({
content: content || '',
attributes: parse_tag_attributes(attributes || ''),
markup,
filename
});
if (!processed) return no_change();
if (processed.dependencies) dependencies.push(...processed.dependencies);
if (!processed.map && processed.code === content) return no_change();
return processed_tag_to_code(
processed,
tag_name,
attributes,
stringify_tag_attributes(processed.attributes) ?? attributes,
slice_source(content, tag_offset, source)
);
}
const { string, map } = await replace_in_code(tag_regex, process_single_tag, source);
return { string, map, dependencies };
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does process_tag() do?
process_tag() is a function in the svelte codebase, defined in packages/svelte/src/compiler/preprocess/index.js.
Where is process_tag() defined?
process_tag() is defined in packages/svelte/src/compiler/preprocess/index.js at line 265.
What does process_tag() call?
process_tag() calls 6 function(s): from_source, parse_tag_attributes, processed_tag_to_code, replace_in_code, slice_source, stringify_tag_attributes.
What calls process_tag()?
process_tag() is called by 1 function(s): preprocess.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free