getSource() — vite Function Reference
Architecture documentation for the getSource() function in css.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD b3a25877_fb4e_e12d_263d_f69173aee25a["getSource()"] c3eb47df_971b_0616_6c9f_29b3ded72224["css.ts"] b3a25877_fb4e_e12d_263d_f69173aee25a -->|defined in| c3eb47df_971b_0616_6c9f_29b3ded72224 0a163673_dac2_220c_2b8a_a489f9a38632["scssProcessor()"] 0a163673_dac2_220c_2b8a_a489f9a38632 -->|calls| b3a25877_fb4e_e12d_263d_f69173aee25a b115d8d2_4bdd_4a69_c76d_1789ff11d443["lessProcessor()"] b115d8d2_4bdd_4a69_c76d_1789ff11d443 -->|calls| b3a25877_fb4e_e12d_263d_f69173aee25a 158d0e42_28ce_8bd3_13df_1f08b6dbf23f["stylProcessor()"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| b3a25877_fb4e_e12d_263d_f69173aee25a style b3a25877_fb4e_e12d_263d_f69173aee25a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/plugins/css.ts lines 3096–3129
async function getSource(
source: string,
filename: string,
additionalData: PreprocessorAdditionalData | undefined,
enableSourcemap: boolean,
sep: string = '',
): Promise<{ content: string; map?: ExistingRawSourceMap }> {
if (!additionalData) return { content: source }
if (typeof additionalData === 'function') {
const newContent = await additionalData(source, filename)
if (typeof newContent === 'string') {
return { content: newContent }
}
return newContent
}
if (!enableSourcemap) {
return { content: additionalData + sep + source }
}
const ms = new MagicString(source)
ms.appendLeft(0, sep)
ms.appendLeft(0, additionalData)
const map = ms.generateMap({ hires: 'boundary' })
map.file = filename
map.sources = [filename]
return {
content: ms.toString(),
map,
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does getSource() do?
getSource() is a function in the vite codebase, defined in packages/vite/src/node/plugins/css.ts.
Where is getSource() defined?
getSource() is defined in packages/vite/src/node/plugins/css.ts at line 3096.
What calls getSource()?
getSource() is called by 3 function(s): lessProcessor, scssProcessor, stylProcessor.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free