Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import postcss from 'postcss';
import postcssNesting from 'postcss-nesting';
const nesting = postcssNesting();
// functional selector match
const functionalSelectorMatch = /(^|[^\w-])(%[_a-zA-Z]+[_a-zA-Z0-9-]*)([^\w-]|$)/i;
// plugin
export default postcss.plugin('postcss-extend-rule', rawopts => {
// options ( onFunctionalSelector, onRecursiveExtend, onUnusedExtend)
const opts = Object(rawopts);
const extendMatch = opts.name instanceof RegExp
? opts.name
: 'name' in opts
? new RegExp(`^${opts.name}$`, 'i')
: 'extend';
return (root, result) => {
const extendedAtRules = new WeakMap();