(plugins)
| 12 | } |
| 13 | |
| 14 | normalize(plugins) { |
| 15 | let normalized = [] |
| 16 | for (let i of plugins) { |
| 17 | if (i.postcss === true) { |
| 18 | i = i() |
| 19 | } else if (i.postcss) { |
| 20 | i = i.postcss |
| 21 | } |
| 22 | |
| 23 | if (typeof i === 'object' && Array.isArray(i.plugins)) { |
| 24 | normalized = normalized.concat(i.plugins) |
| 25 | } else if (typeof i === 'object' && i.postcssPlugin) { |
| 26 | normalized.push(i) |
| 27 | } else if (typeof i === 'function') { |
| 28 | normalized.push(i) |
| 29 | } else if (typeof i === 'object' && (i.parse || i.stringify)) { |
| 30 | if (process.env.NODE_ENV !== 'production') { |
| 31 | throw new Error( |
| 32 | 'PostCSS syntaxes cannot be used as plugins. Instead, please use ' + |
| 33 | 'one of the syntax/parser/stringifier options as outlined ' + |
| 34 | 'in your PostCSS runner documentation.' |
| 35 | ) |
| 36 | } |
| 37 | } else { |
| 38 | throw new Error(i + ' is not a PostCSS plugin') |
| 39 | } |
| 40 | } |
| 41 | return normalized |
| 42 | } |
| 43 | |
| 44 | process(css, opts = {}) { |
| 45 | if ( |
no test coverage detected