stylProcessor() — vite Function Reference
Architecture documentation for the stylProcessor() function in css.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 158d0e42_28ce_8bd3_13df_1f08b6dbf23f["stylProcessor()"] c3eb47df_971b_0616_6c9f_29b3ded72224["css.ts"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|defined in| c3eb47df_971b_0616_6c9f_29b3ded72224 1da538be_8fb3_3d85_2856_d9bfecfb04f5["createPreprocessorWorkerController()"] 1da538be_8fb3_3d85_2856_d9bfecfb04f5 -->|calls| 158d0e42_28ce_8bd3_13df_1f08b6dbf23f ee6b4ebe_4e17_548c_a8a5_aafc4db9c675["loadPreprocessorPath()"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| ee6b4ebe_4e17_548c_a8a5_aafc4db9c675 e785fd68_f38b_c6ee_f2fa_64c4d896543f["makeStylWorker()"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| e785fd68_f38b_c6ee_f2fa_64c4d896543f b3a25877_fb4e_e12d_263d_f69173aee25a["getSource()"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| b3a25877_fb4e_e12d_263d_f69173aee25a dfa2b928_25a4_a78f_1e11_1e7e643cae09["resolve()"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| dfa2b928_25a4_a78f_1e11_1e7e643cae09 5966ecdc_9762_a343_8afc_07170ca8f866["formatStylusSourceMap()"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| 5966ecdc_9762_a343_8afc_07170ca8f866 562e9e2b_e379_c47c_c40f_7b7850f80d38["close()"] 158d0e42_28ce_8bd3_13df_1f08b6dbf23f -->|calls| 562e9e2b_e379_c47c_c40f_7b7850f80d38 style 158d0e42_28ce_8bd3_13df_1f08b6dbf23f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/plugins/css.ts lines 3021–3074
const stylProcessor = (
maxWorkers: number | undefined,
): StylePreprocessor<StylusStylePreprocessorInternalOptions> => {
let worker: ReturnType<typeof makeStylWorker> | undefined
return {
close() {
worker?.stop()
},
async process(_environment, source, root, options, _resolvers) {
const stylusPath = loadPreprocessorPath(PreprocessLang.stylus, root)
worker ??= makeStylWorker(maxWorkers)
// Get source with preprocessor options.additionalData. Make sure a new line separator
// is added to avoid any render error, as added stylus content may not have semi-colon separators
const { content, map: additionalMap } = await getSource(
source,
options.filename,
options.additionalData,
options.enableSourcemap,
'\n',
)
// Get preprocessor options.imports dependencies as stylus
// does not return them with its builtin `.deps()` method
const importsDeps = (options.imports ?? []).map((dep: string) =>
path.resolve(dep),
)
const optionsWithoutAdditionalData = {
...options,
additionalData: undefined,
}
try {
const { code, map, deps } = await worker.run(
pathToFileURL(stylusPath).href,
content,
root,
optionsWithoutAdditionalData,
)
return {
code,
map: formatStylusSourceMap(map, root),
additionalMap,
// Concat imports deps with computed deps
deps: [...deps, ...importsDeps],
}
} catch (e) {
const wrapped = new Error(`[stylus] ${e.message}`)
wrapped.name = e.name
wrapped.stack = e.stack
return { code: '', error: wrapped, deps: [] }
}
},
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does stylProcessor() do?
stylProcessor() is a function in the vite codebase, defined in packages/vite/src/node/plugins/css.ts.
Where is stylProcessor() defined?
stylProcessor() is defined in packages/vite/src/node/plugins/css.ts at line 3021.
What does stylProcessor() call?
stylProcessor() calls 6 function(s): close, formatStylusSourceMap, getSource, loadPreprocessorPath, makeStylWorker, resolve.
What calls stylProcessor()?
stylProcessor() is called by 1 function(s): createPreprocessorWorkerController.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free