Files
soul-yongping/soul-admin/node_modules/@tailwindcss/postcss/dist/index.mjs

11 lines
43 KiB
JavaScript
Raw Normal View History

2026-02-09 14:43:35 +08:00
var pe=(e,r)=>(r=Symbol[e])?r:Symbol.for("Symbol."+e),de=e=>{throw TypeError(e)};var me=(e,r,t)=>{if(r!=null){typeof r!="object"&&typeof r!="function"&&de("Object expected");var o,a;t&&(o=r[pe("asyncDispose")]),o===void 0&&(o=r[pe("dispose")],t&&(a=o)),typeof o!="function"&&de("Object not disposable"),a&&(o=function(){try{a.call(this)}catch(n){return Promise.reject(n)}}),e.push([t,o,r])}else t&&e.push([t]);return r},ge=(e,r,t)=>{var o=typeof SuppressedError=="function"?SuppressedError:function(i,l,u,s){return s=Error(u),s.name="SuppressedError",s.error=i,s.suppressed=l,s},a=i=>r=t?new o(i,r,"An error was suppressed during disposal"):(t=!0,i),n=i=>{for(;i=e.pop();)try{var l=i[1]&&i[1].call(i[2]);if(i[0])return Promise.resolve(l).then(n,u=>(a(u),n()))}catch(u){a(u)}if(t)throw r};return n()};import Kt from"@alloc/quick-lru";import{compileAst as zt,env as Mt,Features as ue,Instrumentation as Ft,optimize as jt,Polyfills as fe}from"@tailwindcss/node";import{clearRequireCache as Wt}from"@tailwindcss/node/require-cache";import{Scanner as Bt}from"@tailwindcss/oxide";import Yt from"fs";import D,{relative as We}from"path";function M(e){return{kind:"word",value:e}}function He(e,r){return{kind:"function",value:e,nodes:r}}function qe(e){return{kind:"separator",value:e}}function S(e){let r="";for(let t of e)switch(t.kind){case"word":case"separator":{r+=t.value;break}case"function":r+=t.value+"("+S(t.nodes)+")"}return r}var he=92,Ze=41,ve=58,ke=44,Qe=34,we=61,ye=62,be=60,xe=10,Je=40,Xe=39,et=47,Ae=32,Ce=9;function A(e){e=e.replaceAll(`\r
`,`
`);let r=[],t=[],o=null,a="",n;for(let i=0;i<e.length;i++){let l=e.charCodeAt(i);switch(l){case he:{a+=e[i]+e[i+1],i++;break}case et:{if(a.length>0){let s=M(a);o?o.nodes.push(s):r.push(s),a=""}let u=M(e[i]);o?o.nodes.push(u):r.push(u);break}case ve:case ke:case we:case ye:case be:case xe:case Ae:case Ce:{if(a.length>0){let c=M(a);o?o.nodes.push(c):r.push(c),a=""}let u=i,s=i+1;for(;s<e.length&&(n=e.charCodeAt(s),!(n!==ve&&n!==ke&&n!==we&&n!==ye&&n!==be&&n!==xe&&n!==Ae&&n!==Ce));s++);i=s-1;let f=qe(e.slice(u,s));o?o.nodes.push(f):r.push(f);break}case Xe:case Qe:{let u=i;for(let s=i+1;s<e.length;s++)if(n=e.charCodeAt(s),n===he)s+=1;else if(n===l){i=s;break}a+=e.slice(u,i+1);break}case Je:{let u=He(a,[]);a="",o?o.nodes.push(u):r.push(u),t.push(u),o=u;break}case Ze:{let u=t.pop();if(a.length>0){let s=M(a);u?.nodes.push(s),a=""}t.length>0?o=t[t.length-1]:o=null;break}default:a+=String.fromCharCode(l)}}return a.length>0&&r.push(M(a)),r}var d=class extends Map{constructor(t){super();this.factory=t}get(t){let o=super.get(t);return o===void 0&&(o=this.factory(t,this),this.set(t,o)),o}};var rr=new Uint8Array(256);var G=new Uint8Array(256);function w(e,r){let t=0,o=[],a=0,n=e.length,i=r.charCodeAt(0);for(let l=0;l<n;l++){let u=e.charCodeAt(l);if(t===0&&u===i){o.push(e.slice(a,l)),a=l+1;continue}switch(u){case 92:l+=1;break;case 39:case 34:for(;++l<n;){let s=e.charCodeAt(l);if(s===92){l+=1;continue}if(s===u)break}break;case 40:G[t]=41,t++;break;case 91:G[t]=93,t++;break;case 123:G[t]=125,t++;break;case 93:case 125:case 41:t>0&&u===G[t-1]&&t--;break}}return o.push(e.slice(a)),o}var ee=(i=>(i[i.Continue=0]="Continue",i[i.Skip=1]="Skip",i[i.Stop=2]="Stop",i[i.Replace=3]="Replace",i[i.ReplaceSkip=4]="ReplaceSkip",i[i.ReplaceStop=5]="ReplaceStop",i))(ee||{}),h={Continue:{kind:0},Skip:{kind:1},Stop:{kind:2},Replace:e=>({kind:3,nodes:Array.isArray(e)?e:[e]}),ReplaceSkip:e=>({kind:4,nodes:Array.isArray(e)?e:[e]}),ReplaceStop:e=>({kind:5,nodes:Array.isArray(e)?e:[e]})};function v(e,r){typeof r=="function"?Se(e,r):Se(e,r.enter,r.exit)}function Se(e,r=()=>h.Continue,t=()=>h.Continue){let o=[[e,0,null]],a={parent:null,depth:0,path(){let n=[];for(let i=1;i<o.length;i++){let l=o[i][2];l&&n.push(l)}return n}};for(;o.length>0;){let n=o.length-1,i=o[n],l=i[0],u=i[1],s=i[2];if(u>=l.length){o.pop();continue}if(a.parent=s,a.depth=n,u>=0){let O=l[u],T=r(O,a)??h.Continue;switch(T.kind){case 0:{O.nodes&&O.nodes.length>0&&o.push([O.nodes,0,O]),i[1]=~u;continue}case 2:return;case 1:{i[1]=~u;continue}case 3:{l.splice(u,1,...T.nodes);continue}case 5:{l.splice(u,1,...T.nodes);return}case 4:{l.splice(u,1,...T.nodes),i[1]+=T.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${ee[T.kind]??`Unknown(${T.kind})`}\` in enter.`)}}let f=~u,c=l[f],m=t(c,a)??h.Continue;switch(m.kind){case 0:i[1]=f+1;continue;case 2:return;case 3:{l.splice(f,1,...m.nodes),i[1]=f+m.nodes.length;continue}case 5:{l.splice(f,1,...m.nodes);return}case 4:{l.splice(f,1,...m.nodes),i[1]=f+m.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${ee[m.kind]??`Unknown(${m.kind})`}\` in exit.`)}}}var dr=new d(e=>{let r=A(e),t=new Set;return v(r,(o,a)=>{let n=a.parent===null?r:a.parent.nodes??[];if(o.kind==="word"&&(o.value==="+"||o.value==="-"||o.value==="*"||o.value==="/")){let i=n.indexOf(o)??-1;if(i===-1)return;let l=n[i-1];if(l?.kind!=="separator"||l.value!==" ")return;let u=n[i+1];if(u?.kind!=="separator"||u.value!==" ")return;t.add(l),t.add(u)}else o.kind==="separator"&&o.value.length>0&&o.value.trim()===""?(n[0]===o||n[n.length-1]===o)&&t.add(o):o.kind==="separator"&&o.value.trim()===","&&(o.value=",")}),t.size>0&&v(r,o=>{if(t.has(o))return t.delete(o),h.ReplaceSkip([])}),te(r),S(r)});var mr=new d(e=>{let r=A(e);return r.length===3&&r[0].kind==="word"&&r[0].value==="&"&&r[1].kind==="separator"&&r[1].value===":"&&r[2].kind==="function"&&r[2].value==="is"?S(r[2].nodes):e});function te(e){for(let r of e)switch(r.kind){case"function":{if(r.value==="url"||r.value.endsWith("_url")){r.value=F(r.value);break}if(r.value==="var"||r.value.endsWith("_var")||r.value==="them
`,r){t+=s.length;let f=t;t+=i.property.length,t+=2,t+=i.value?.length??0,i.important&&(t+=11);let c=t;t+=2,i.dst=[o,f,c]}}else if(i.kind==="rule"){if(u+=`${s}${i.selector} {
`,r){t+=s.length;let f=t;t+=i.selector.length,t+=1;let c=t;i.dst=[o,f,c],t+=2}for(let f of i.nodes)u+=a(f,l+1);u+=`${s}}
`,r&&(t+=s.length,t+=2)}else if(i.kind==="at-rule"){if(i.nodes.length===0){let f=`${s}${i.name} ${i.params};
`;if(r){t+=s.length;let c=t;t+=i.name.length,t+=1,t+=i.params.length;let m=t;t+=2,i.dst=[o,c,m]}return f}if(u+=`${s}${i.name}${i.params?` ${i.params} `:" "}{
`,r){t+=s.length;let f=t;t+=i.name.length,i.params&&(t+=1,t+=i.params.length),t+=1;let c=t;i.dst=[o,f,c],t+=2}for(let f of i.nodes)u+=a(f,l+1);u+=`${s}}
`,r&&(t+=s.length,t+=2)}else if(i.kind==="comment"){if(u+=`${s}/*${i.value}*/
`,r){t+=s.length;let f=t;t+=2+i.value.length+2;let c=t;i.dst=[o,f,c],t+=1}}else if(i.kind==="context"||i.kind==="at-root")return"";return u}let n="";for(let i of e)n+=a(i,0);return o.code=n,n}var Lt=33;function Me(e,r,t){let o=new d(s=>new e.Input(s.code,{map:t?.input.map,from:s.file??void 0})),a=new d(s=>q(s.code)),n=e.root();n.source=t;function i(s){if(!s||!s[0])return;let f=a.get(s[0]),c=f.find(s[1]),m=f.find(s[2]);return{input:o.get(s[0]),start:{line:c.line,column:c.column+1,offset:s[1]},end:{line:m.line,column:m.column+1,offset:s[2]}}}function l(s,f){let c=i(f);c?s.source=c:delete s.source}function u(s,f){if(s.kind==="declaration"){let c=e.decl({prop:s.property,value:s.value??"",important:s.important});l(c,s.src),f.append(c)}else if(s.kind==="rule"){let c=e.rule({selector:s.selector});l(c,s.src),c.raws.semicolon=!0,f.append(c);for(let m of s.nodes)u(m,c)}else if(s.kind==="at-rule"){let c=e.atRule({name:s.name.slice(1),params:s.params});l(c,s.src),c.raws.semicolon=!0,f.append(c);for(let m of s.nodes)u(m,c)}else if(s.kind==="comment"){let c=e.comment({text:s.value});c.raws.left="",c.raws.right="",l(c,s.src),f.append(c)}else s.kind==="at-root"||s.kind}for(let s of r)u(s,n);return n}function Fe(e){let r=new d(n=>({file:n.file??n.id??null,code:n.css}));function t(n){let i=n.source;if(!i)return;let l=i.input;if(l&&i.start!==void 0&&i.end!==void 0)return[r.get(l),i.start.offset,i.end.offset]}function o(n,i){if(n.type==="decl"){let l=$(n.prop,n.value,n.important);l.src=t(n),i.push(l)}else if(n.type==="rule"){let l=P(n.selector);l.src=t(n),n.each(u=>o(u,l.nodes)),i.push(l)}else if(n.type==="atrule"){let l=x(`@${n.name}`,n.params);l.src=t(n),n.each(u=>o(u,l.nodes)),i.push(l)}else if(n.type==="comment"){if(n.text.charCodeAt(0)!==Lt)return;let l=Z(n.text);l.src=t(n),i.push(l)}}let a=[];return e.each(n=>o(n,a)),a}import{normalizePath as je}from"@tailwindcss/node";import J from"path";var le="'",ae='"';function se(){let e=new WeakSet;function r(t){let o=t.root().source?.input.file;if(!o)return;let a=t.source?.input.file;if(!a||e.has(t))return;let n=t.params[0],i=n[0]===ae&&n[n.length-1]===ae?ae:n[0]===le&&n[n.length-1]===le?le:null;if(!i)return;let l=t.params.slice(1,-1),u="";if(l.startsWith("!")&&(l=l.slice(1),u="!"),!l.startsWith("./")&&!l.startsWith("../"))return;let s=J.posix.join(je(J.dirname(a)),l),f=J.posix.dirname(je(o)),c=J.posix.relative(f,s);c.startsWith(".")||(c="./"+c),t.params=i+u+c+i,e.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(t){t.walkAtRules(/source|plugin|config/,r)}}}var p=Mt.DEBUG,ce=new Kt({maxSize:50});function Gt(e,r,t){let o=`${r}:${t.base??""}:${JSON.stringify(t.optimize)}`;if(ce.has(o))return ce.get(o);let a={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:e.root(),optimizedPostCssAst:e.root(),fullRebuildPaths:[]};return ce.set(o,a),a}function Ht(e={}){let r=e.base??process.cwd(),t=e.optimize??process.env.NODE_ENV==="production",o=e.transformAssetUrls??!0;return{postcssPlugin:"@tailwindcss/postcss",plugins:[se(),{postcssPlugin:"tailwindcss",async Once(a,{result:n,postcss:i}){var T=[];try{let l=me(T,new Ft);let u=n.opts.from??"";let s=u.endsWith(".module.css");p&&l.start(`[@tailwindcss/postcss] ${We(r,u)}`);{p&&l.start("Quick bail check");let y=!0;if(a.walkAtRules(g=>{if(g.name==="import"||g.name==="reference"||g.name==="theme"||g.name==="variant"||g.name==="config"||g.name==="plugin"||g.name==="apply"||g.name==="tailwind")return y=!1,!1}),y)return;p&&l.end("Quick bail check")}let f=Gt(i,u,e);let c=D.dirname(D.resolve(u));let m=f.compiler===null;async function O(){p&&l.start("Setup compiler"),f.fullRebuildPaths.length>0&&!m&&Wt(f.fullRebuildPaths),f.fullRebuildPaths=[],p&&l.start("PostCSS AST -> Tailwind CSS AST");let y=Fe(a);p&&l.end("PostCSS AST -> Tailwind CSS AST"),p&&l.start("Create compiler");let g=await zt(y,{from:n.opts.from,base:c,shouldRewriteUrls:o,onDependency:X=>f.fullRebuildPaths.push(X),polyfills:s?fe.All^fe.AtProperty:fe.All});return p&&l.end("Create compiler"),p&&l.end("Setup compiler"),g}try{if(f.compiler??=O(),(await f.compile