MCPcopy
hub / github.com/vuejs/core / styl

Function styl

packages/compiler-sfc/src/style/preprocessors.ts:118–139  ·  view source on GitHub ↗
(source, map, options, load = require)

Source from the content-addressed store, hash-verified

116
117// .styl
118const styl: StylePreprocessor = (source, map, options, load = require) => {
119 const nodeStylus = load('stylus')
120 try {
121 const ref = nodeStylus(source, options)
122 if (map) ref.set('sourcemap', { inline: false, comment: false })
123
124 const result = ref.render()
125 const dependencies = ref.deps()
126 if (map) {
127 return {
128 code: result,
129 map: merge(map, ref.sourcemap),
130 errors: [],
131 dependencies,
132 }
133 }
134
135 return { code: result, errors: [], dependencies }
136 } catch (e: any) {
137 return { code: '', errors: [e], dependencies: [] }
138 }
139}
140
141function getSource(
142 source: string,

Callers

nothing calls this directly

Calls 3

renderMethod · 0.80
loadFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected