You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
904 B

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=e(require("postcss-selector-parser"));const t=()=>({postcssPlugin:"postcss-selector-not",Rule:(e,{result:t})=>{if(e.selector&&e.selector.indexOf(":not(")>-1)try{const t=s.default().astSync(e.selector);t.walkPseudos((e=>{if(":not"!==e.value)return;if(!e.nodes||e.nodes.length<2)return;const t=[];e.nodes.forEach((e=>{!function(e){e.spaces&&(e.spaces.after="",e.spaces.before=""),e.nodes&&e.nodes.length>0&&(e.nodes[0]&&e.nodes[0].spaces&&(e.nodes[0].spaces.before=""),e.nodes[e.nodes.length-1]&&e.nodes[e.nodes.length-1].spaces&&(e.nodes[e.nodes.length-1].spaces.after=""))}(e);const o=s.default.pseudo({value:":not",nodes:[e]});t.push(o)})),e.replaceWith(...t)}));const o=t.toString();o!==e.selector&&(e.selector=o)}catch(s){e.warn(t,`Failed to parse selector "${e.selector}"`)}}});t.postcss=!0,module.exports=t;