Skip to main content

Module sfc

Module sfc 

Source
Expand description

Vue/Svelte Single File Component (SFC) script and style extraction.

Extracts <script> block content from .vue and .svelte files using regex, handling lang, src metadata, and generic attributes, and filtering HTML comments. Vue external script references are emitted as graph edges; Svelte markup-level script src references are treated as runtime HTML. Also extracts <style> block sources (@import / @use / @forward / @plugin and <style src="...">) so referenced CSS / SCSS files become reachable from the component, preventing false unused-files reports on co-located styles.

Structs§

SfcScript
An extracted <script> block from a Vue or Svelte SFC.
SfcStyle
An extracted <style> block from a Vue or Svelte SFC.
SourceRegion
A source region extracted from a larger file while preserving the byte offset of the region body in the original source.

Functions§

extract_sfc_scripts
Extract all <script> blocks from a Vue/Svelte SFC source string.
extract_sfc_styles
Extract all <style> blocks from a Vue/Svelte SFC source string.
extract_sfc_template_regions
Extract template markup regions from a Vue/Svelte SFC.
is_sfc_file
Check if a file path is a Vue or Svelte SFC (.vue or .svelte).