| 116 | |
| 117 | // .styl |
| 118 | const 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 | |
| 141 | function getSource( |
| 142 | source: string, |