the-forest/client/node_modules/css-blank-pseudo/dist/cli.cjs

4 lines
83 KiB
JavaScript
Raw Normal View History

2024-09-17 20:35:18 -04:00
#!/usr/bin/env node
"use strict";var e=require("postcss-selector-parser"),t=require("tty"),r=require("path"),n=require("url"),s=require("fs");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(e),a=i(t),l=i(r),u=i(n),c=i(s);const h=e=>{const t=String(Object(e).replaceWith||"[blank]"),r=o.default().astSync(t),n=Boolean(!("preserve"in Object(e))||e.preserve);return{postcssPlugin:"css-blank-pseudo",Rule:(e,{result:t})=>{if(-1===e.selector.indexOf(":blank"))return;let s;try{const t=o.default((e=>{e.walkPseudos((e=>{":blank"===e.value&&(e.nodes&&e.nodes.length||e.replaceWith(r.clone()))}))})).processSync(e.selector);s=String(t)}catch(r){return void e.warn(t,`Failed to parse selector : ${e.selector}`)}if(void 0===s)return;if(s===e.selector)return;const i=e.clone({selector:s});n?e.before(i):e.replaceWith(i)}}};var p;h.postcss=!0,function(e){e.InvalidArguments="INVALID_ARGUMENTS"}(p||(p={}));var f={exports:{}};let d=a.default,g=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||"win32"===process.platform||d.isatty(1)&&"dumb"!==process.env.TERM||"CI"in process.env),m=(e,t,r=e)=>n=>{let s=""+n,i=s.indexOf(t,e.length);return~i?e+w(s,t,r,i)+t:e+s+t},w=(e,t,r,n)=>{let s=e.substring(0,n)+r,i=e.substring(n+t.length),o=i.indexOf(t);return~o?s+w(i,t,r,o):s+i},y=(e=g)=>({isColorSupported:e,reset:e?e=>`${e}`:String,bold:e?m("","",""):String,dim:e?m("","",""):String,italic:e?m("",""):String,underline:e?m("",""):String,inverse:e?m("",""):String,hidden:e?m("",""):String,strikethrough:e?m("",""):String,black:e?m("",""):String,red:e?m("",""):String,green:e?m("",""):String,yellow:e?m("",""):String,blue:e?m("",""):String,magenta:e?m("",""):String,cyan:e?m("",""):String,white:e?m("",""):String,gray:e?m("",""):String,bgBlack:e?m("",""):String,bgRed:e?m("",""):String,bgGreen:e?m("",""):String,bgYellow:e?m("",""):String,bgBlue:e?m("",""):String,bgMagenta:e?m("",""):String,bgCyan:e?m("",""):String,bgWhite:e?m("",""):String});f.exports=y(),f.exports.createColors=y;const v="'".charCodeAt(0),S='"'.charCodeAt(0),C="\\".charCodeAt(0),b="/".charCodeAt(0),_="\n".charCodeAt(0),x=" ".charCodeAt(0),O="\f".charCodeAt(0),A="\t".charCodeAt(0),M="\r".charCodeAt(0),k="[".charCodeAt(0),E="]".charCodeAt(0),L="(".charCodeAt(0),R=")".charCodeAt(0),P="{".charCodeAt(0),I="}".charCodeAt(0),j=";".charCodeAt(0),N="*".charCodeAt(0),U=":".charCodeAt(0),B="@".charCodeAt(0),D=/[\t\n\f\r "#'()/;[\\\]{}]/g,F=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,T=/.[\n"'(/\\]/,$=/[\da-f]/i;var G=function(e,t={}){let r,n,s,i,o,a,l,u,c,h,p=e.css.valueOf(),f=t.ignoreErrors,d=p.length,g=0,m=[],w=[];function y(t){throw e.error("Unclosed "+t,g)}return{back:function(e){w.push(e)},nextToken:function(e){if(w.length)return w.pop();if(g>=d)return;let t=!!e&&e.ignoreUnclosed;switch(r=p.charCodeAt(g),r){case _:case x:case A:case M:case O:n=g;do{n+=1,r=p.charCodeAt(n)}while(r===x||r===_||r===A||r===M||r===O);h=["space",p.slice(g,n)],g=n-1;break;case k:case E:case P:case I:case U:case j:case R:{let e=String.fromCharCode(r);h=[e,e,g];break}case L:if(u=m.length?m.pop()[1]:"",c=p.charCodeAt(g+1),"url"===u&&c!==v&&c!==S&&c!==x&&c!==_&&c!==A&&c!==O&&c!==M){n=g;do{if(a=!1,n=p.indexOf(")",n+1),-1===n){if(f||t){n=g;break}y("bracket")}for(l=n;p.charCodeAt(l-1)===C;)l-=1,a=!a}while(a);h=["brackets",p.slice(g,n+1),g,n],g=n}else n=p.indexOf(")",g+1),i=p.slice(g,n+1),-1===n||T.test(i)?h=["(","(",g]:(h=["brackets",i,g,n],g=n);break;case v:case S:s=r===v?"'":'"',n=g;do{if(a=!1,n=p.indexOf(s,n+1),-1===n){if(f||t){n=g+1;break}y("string")}for(l=n;p.charCodeAt(l-1)===C;)l-=1,a=!a}while(a);h=["string",p.slice(g,n+1),g,n],g=n;break;case B:D.lastIndex=g+1,D.test(p),n=0===D.lastIndex?p.length-1:D.lastIndex-2,h=["at-word",p.slice(g,n+1),g,n],g=n;break;case C:for(n=g,o=!0;p.charCodeAt(n+1)===