svelte-prune 0.0.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ var z=/<!--[\s\S]*?-->|<script\s+(?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=(["'])?([^"' >]+)\1[^>]*>/y;function ne(e){return e.charCodeAt(0)===65279?e.slice(1):e}function h(e){return e>=48&&e<=57}function l(e){if(e===32||e<=13&&e>=9)return!0;if(e<160)return!1;return e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function s(e,r){let t=r;while(t<e.length&&l(e.charCodeAt(t)))t++;return t}function re(e){let r=e.indexOf("<");while(r!==-1){let t=e.charCodeAt(r+1);if(t===33||t===115){z.lastIndex=r;let i=z.exec(e);if(i){if(t===115)return i[2]==="ts";r=e.indexOf("<",z.lastIndex);continue}}r=e.indexOf("<",r+1)}return!1}function se(e,r){let t=e.indexOf("</script",r);while(t!==-1){if(e.charCodeAt(s(e,t+8))===B)return t;t=e.indexOf("</script",t+8)}return-1}function oe(e,r){return s(e,r+8)+1}var Je=new Set("area base br col command embed hr img input keygen link meta param source track wbr".split(" "));function q(e){return Je.has(e)||e.charCodeAt(0)===33&&e.toLowerCase()==="!doctype"}function ae(e,r){let t=r;while(t<e.length){let i=e.charCodeAt(t);if(i===47&&e.charCodeAt(t+1)===42){let n=e.indexOf("*/",t+2);t=n===-1?e.length:n+2}else if(i===34||i===39){t++;while(t<e.length){let n=e.charCodeAt(t);if(n===i||n===10)break;t+=n===92?2:1}t++}else if(i===60&&e.startsWith("</style",t))break;else t++}return Math.min(t,e.length)}var ze=34,Ze=39,Ae=47,ke=61,B=62,x=(e)=>e===ze||e===Ze;function L(e,r,t){let i=r;for(;i<e.length;i++){let n=e.charCodeAt(i);if(l(n)||n===Ae||n===B)break;if(t&&(x(n)||n===ke))break}return i}function le(e,r){let t=e.charCodeAt(r);return l(t)||x(t)||t===ke||t===60||t===B||t===96||t===Ae&&e.charCodeAt(r+1)===B}var P=0,d=1,W=2,m=3,xe=0,Ce=1,Ee=2,j=3,ie=4,D=4,ee=5,Q=6,we=7,et={await:d,case:d,default:d,delete:d,extends:d,in:d,instanceof:d,new:d,of:d,return:d,throw:d,typeof:d,void:d,yield:d,do:W,else:W,finally:W,try:W,for:D,if:D,while:D,with:D,import:ee,export:Q,require:we},Te=10,te=Array(he(128,0)).fill(null);for(let e of Object.entries(et)){let r=he(e[0].charCodeAt(0),e[0].length),t=te[r]??[];t.push(e),te[r]=t}function he(e,r){return e*(Te+1)+r}function $e(e,r,t){let i=e.charCodeAt(r);if(i>=128||t-r>Te)return m;let n=he(i,t-r),a=te[n];if(a===null)return m;for(let c=0;c<a.length;c++)if(e.startsWith(a[c][0],r))return a[c][1];return m}var We=new Uint8Array(128);for(let e of["az","AZ","09","__","$$","\\\\"])for(let r=e.charCodeAt(0);r<=e.charCodeAt(1);r++)We[r]=1;function S(e){return e>=128?!l(e):We[e]===1}function be(e,r,t,i=!1){fe(e,tt(e,r,i),r,i,t,void 0,void 0)}function Oe(e,r){fe(e,e.length-1,!1,!1,void 0,r,void 0)}function Re(e,r){fe(e,e.length-1,!1,!1,void 0,void 0,r)}function fe(e,r,t,i,n,a,c){let A=[],f=e.startsWith("#!")?H(e,2):0,g=P,y=!1,_=!1,M=-1,J=()=>{if(g=P,A.length===0)M=-1};while(f<=r){let R=e.charCodeAt(f);if(R===32||R===10||l(R)){f++;continue}if(R===47){let C=de(e,f);if(C!==-1){f=C;continue}}let Xe=y,Fe=_;if(y=!1,_=!1,S(R)||R===35){let C=f;f=_e(e,f+1);let b=Xe?m:$e(e,C,f);if(c!==void 0&&(b===ee||b===we))c(C,g===P||g===m);if(n!==void 0&&A.length===0&&(b===Q?t||Ie(e,f,i):b===ee&&De(e,f)))f=Math.max(f,n(M!==-1&&b===Q?M:C,C)),J();else if(b===Q)g=W;else if(b===D)_=!0,g=m;else g=b===d||b===W?b:m;continue}switch(f++,R){case 34:case 39:{let C=f-1;f=ge(e,f,R),a?.(C,f,!1),g=m;break}case 96:{let C=f;f=Y(e,f,A),a?.(C,ye(e,f),!0),g=e.charCodeAt(f-1)===123?d:m;break}case 47:{let C=g===m?-1:Pe(e,f);if(C===-1)g=d;else f=V(e,C),g=m;break}case 40:A.push(Fe?Ce:xe),g=d;break;case 41:g=A.pop()===Ce?W:m;break;case 123:A.push(g===d?j:Ee),g=P;break;case 125:{let C=A.pop();if(C===ie){let b=f;f=Y(e,f,A),a?.(b,ye(e,f),!0),g=e.charCodeAt(f-1)===123?d:m}else if(C===j)g=m;else J();break}case 59:J();break;case 44:g=A[A.length-1]===j?P:d;break;case 93:g=m;break;case 46:if(h(e.charCodeAt(f)))f=V(e,f),g=m;else if(e.startsWith("..",f))f+=2,g=d;else y=!0,g=d;break;case 63:if(e.charCodeAt(f)===46&&!h(e.charCodeAt(f+1)))f++,y=!0;g=d;break;case 33:g=g===m&&!l(e.charCodeAt(f-2))?m:d;break;case 43:case 45:if(e.charCodeAt(f)===R&&g===m)f++;else g=d;break;case 61:if(g=e.charCodeAt(f)===62?W:d,g===W)f++;break;case 64:if(A.length===0&&M===-1)M=f-1;g=d;break;default:g=d}}}function ve(e,r,t){let i=e.length,n=[],a=r,c=d,A=!1;while(a<i){let f=e.charCodeAt(a);if(f===32||f===10||l(f)){a++;continue}if(f===47){let y=de(e,a);if(y!==-1){a=y;continue}}let g=A;if(A=!1,S(f)||f===35){let y=a;if(a=_e(e,a+1),!g&&t?.(y,a))return-1;let _=g?m:$e(e,y,a);c=_===d||_===W||_===D?d:m;continue}switch(a++,f){case 34:case 39:a=ge(e,a,f),c=m;break;case 96:a=Y(e,a,n),c=e.charCodeAt(a-1)===123?d:m;break;case 47:{let y=c===m?-1:Pe(e,a);if(y===-1)c=d;else a=V(e,y),c=m;break}case 40:n.push(xe),c=d;break;case 41:if(n.length===0)return a-1;n.pop(),c=m;break;case 123:n.push(c===d?j:Ee),c=P;break;case 125:{if(n.length===0)return a-1;let y=n.pop();if(y===ie)a=Y(e,a,n),c=e.charCodeAt(a-1)===123?d:m;else c=y===j?m:P;break}case 93:c=m;break;case 46:if(h(e.charCodeAt(a)))a=V(e,a),c=m;else if(e.startsWith("..",a))a+=2,c=d;else A=!0,c=d;break;case 63:if(e.charCodeAt(a)===46&&!h(e.charCodeAt(a+1)))a++,A=!0;c=d;break;case 33:c=c===m&&!l(e.charCodeAt(a-2))?m:d;break;case 43:case 45:if(e.charCodeAt(a)===f&&c===m)a++;else c=d;break;case 61:if(e.charCodeAt(a)===62)a++;c=d;break;default:c=d}}return i}function Le(e){return e===10||e===13||e===8232||e===8233}function H(e,r){for(let t=r;t<e.length;t++)if(Le(e.charCodeAt(t)))return t;return e.length}function de(e,r){let t=e.charCodeAt(r+1);if(t===47)return H(e,r+2);if(t!==42)return-1;let i=e.indexOf("*/",r+2);return i===-1?e.length:i+2}function _e(e,r){let t=r;while(t<e.length){let i=e.charCodeAt(t);if(i===92)t+=2;else if(S(i))t++;else break}return t}function V(e,r){let t=r;while(t<e.length&&S(e.charCodeAt(t)))t++;return t}function ge(e,r,t){for(let i=r;i<e.length;i++){let n=e.charCodeAt(i);if(n===t)return i+1;if(n===92)i+=e.startsWith(`\r
2
+ `,i+1)?2:1;else if(n===10||n===13)return i}return e.length}function Y(e,r,t){for(let i=r;i<e.length;i++){let n=e.charCodeAt(i);if(n===96)return i+1;if(n===92)i++;else if(n===36&&e.charCodeAt(i+1)===123)return t.push(ie),i+2}return e.length}function ye(e,r){let t=e.charCodeAt(r-1);if(t===96)return r-1;if(t===123&&e.charCodeAt(r-2)===36)return r-2;return r}function Pe(e,r){let t=!1;for(let i=r;i<e.length;i++){let n=e.charCodeAt(i);if(Le(n))return-1;if(n===92)i++;else if(n===91)t=!0;else if(n===93)t=!1;else if(n===47&&!t)return i+1}return-1}function v(e,r){let t=r;while(t<e.length){let i=e.charCodeAt(t);if(l(i)){t++;continue}let n=i===47?de(e,t):-1;if(n===-1)return t;t=n}return e.length}function I(e,r,t){return e.charCodeAt(r)===t.charCodeAt(0)&&e.startsWith(t,r)&&!S(e.charCodeAt(r+t.length))}function De(e,r){let t=e.charCodeAt(v(e,r));return t!==40&&t!==46}function Ie(e,r,t){let i=v(e,r);if(I(e,i,"import"))return!0;if(I(e,i,"type"))i=v(e,i+4);let n=e.charCodeAt(i);if(n===42)return!0;if(n!==123)return!1;if(t)return!0;for(i++;i<e.length;i++){let a=e.charCodeAt(i);if(a===125)break;if(a===34||a===39)i=ge(e,i+1,a)-1;else if(a===47)i=Math.max(i,v(e,i)-1)}return I(e,v(e,i+1),"from")}var Z=/import|export/g;function tt(e,r,t){let i=-1;Z.lastIndex=0;for(let n=Z.exec(e);n!==null;n=Z.exec(e)){let a=n.index,c=a+6;if(!S(e.charCodeAt(a-1))&&!S(e.charCodeAt(c))&&(e.charCodeAt(a)===105?De(e,c):r||Ie(e,c,t)))i=a}return i}function p(e,r={}){let t=new X(e);t.exportLists=r.exportLists??!1;let i=[];return be(e,!1,(n,a)=>{let c=t.statement(a);return i.push(c),c.end},t.exportLists),i}function qe(e){let r=new X(e),t=[];return Re(e,(i,n)=>{let a=r.dynamicImport(i,n);if(a!==null)t.push(a)}),t}function Ge(e){let r=new X(e),t=[];return Oe(e,(i,n,a)=>{let c=a?0:1;t.push({kind:a?"template":"string",value:r.cooked(i+c,n-c,a),start:i,end:n})}),t}class X{source;pos=0;end=0;escapeEnd=0;exportLists=!1;constructor(e){this.source=e}statement(e){this.pos=this.end=e+6;let r={kind:this.source.charCodeAt(e)===105?"import":"export",start:e,end:0,source:null,typeOnly:!1,specifiers:[]};if(!(r.kind==="import"?this.import(r):this.export(r)))r.source=null,r.specifiers=[];return r.end=this.end,r}import(e){let r=this.string();if(r!==null)return e.source=r,this.finish();if(this.isWord("type")){let a=this.peekAfter(4);if(a===123||a===42||me(a)&&!this.isWordAfter(4,"from"))e.typeOnly=!0,this.advance(4)}let{specifiers:t,typeOnly:i}=e,n=this.at();if(n!==123&&n!==42){let a=this.pos,c=this.name();if(c===null)return!1;if(this.at()===61)return this.importEquals();if(t.push({kind:"default",imported:"default",local:c,typeOnly:i,start:a,end:this.end}),!this.eat(44))return this.from(e);n=this.at()}if(n===42){let a=this.pos;if(this.advance(1),!this.eatWord("as"))return!1;let c=this.name();if(c===null)return!1;return t.push({kind:"namespace",imported:"*",local:c,typeOnly:i,start:a,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let a=this.skip(),c=this.typeModifier()||i,A=this.name(),f=A??this.string()?.value;if(f===void 0)return!1;let g=A;if(this.eatWord("as"))g=this.name();if(g===null)return!1;if(t.push({kind:"named",imported:f,local:g,typeOnly:c,start:a,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}return this.from(e)}export(e){if(this.eatWord("import")){if(this.isWord("type")&&me(this.peekAfter(4))&&!this.isWordAfter(4,"from"))e.typeOnly=!0,this.advance(4);return this.name()!==null&&this.at()===61&&this.importEquals()}if(this.isWord("type")){let i=this.peekAfter(4);if(i===123||i===42)e.typeOnly=!0,this.advance(4)}let{specifiers:r,typeOnly:t}=e;if(this.at()===42){let i=this.pos;this.advance(1);let n=null;if(this.eatWord("as")){if(n=this.moduleExportName(),n===null)return!1}return r.push({kind:n===null?"all":"namespace",local:"*",exported:n,typeOnly:t,start:i,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let i=this.skip(),n=this.typeModifier()||t,a=this.moduleExportName();if(a===null)return!1;let c=a;if(this.eatWord("as"))c=this.moduleExportName();if(c===null)return!1;if(r.push({kind:"named",local:a,exported:c,typeOnly:n,start:i,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}if(this.exportLists&&!this.isWord("from")){for(let i of r)i.kind="local";return this.eat(59),!0}return this.from(e)}dynamicImport(e,r){let t=this.source.charCodeAt(e)===105;this.pos=this.end=e+(t?6:7);let i=t?"import":"require";if(t&&this.eat(46)){if(!this.eatWord("meta")||!this.eat(46)||!this.eatWord("glob")||!this.typeArguments())return null;i="glob"}if(!this.eat(40))return null;let n=this.skip(),a=this.string()??this.template(),c=this.at()===41?this.pos:-1;if(c===-1){if(this.at()!==44)a=null;c=ve(this.source,n)}if(r&&i!=="glob"){let A=this.source.charCodeAt(v(this.source,c+1));if(A===123||A===58)return null}return{kind:i,source:a,start:e,end:Math.min(c+1,this.source.length)}}typeArguments(){if(this.at()!==60)return!0;let e=this.source,r=0;for(let t=this.pos;t<e.length;t=v(e,t+1)){let i=e.charCodeAt(t);if(i===34||i===39||i===96){let n=e.indexOf(e[t],t+1);if(n===-1)return!1;t=n}else if(i===60)r++;else if(i===62&&e.charCodeAt(t-1)!==61){if(--r===0)return this.advance(t+1-this.pos),!0}}return!1}template(){let e=this.source,r=this.skip();if(e.charCodeAt(r)!==96)return null;for(let t=r+1;t<e.length;t++){let i=e.charCodeAt(t);if(i===96){let n=this.cooked(r+1,t,!0);if(n===null)return null;return this.advance(t+1-r),{value:n,start:r,end:t+1}}if(i===92)t++;else if(i===36&&e.charCodeAt(t+1)===123)return null}return null}typeModifier(){if(!this.isWord("type"))return!1;let e=this.peekAfter(4);if(e===34||e===39||me(e)&&!this.isWordAfter(4,"as"))return this.advance(4),!0;return!1}importEquals(){if(this.advance(1),this.isWord("require")&&this.peekAfter(7)===40){if(this.advance(7),this.eat(40),this.string()===null||!this.eat(41))return!1}else do if(this.name()===null)return!1;while(this.eat(46));return this.eat(59),!0}from(e){if(!this.eatWord("from"))return!1;return e.source=this.string(),e.source!==null&&this.finish()}finish(){let e=this.isWord("with")?4:0;if(this.isWord("assert")&&H(this.source,this.end)>=this.pos)e=6;if(e!==0&&this.peekAfter(e)===123){this.advance(e),this.eat(123);while(!this.eat(125))if(this.string()===null&&this.name()===null&&!this.eat(58)&&!this.eat(44))return!1}return this.eat(59),!0}skip(){return this.pos=v(this.source,this.pos),this.pos}at(){return this.source.charCodeAt(this.skip())}advance(e){this.pos+=e,this.end=this.pos}peekAfter(e){return this.source.charCodeAt(v(this.source,this.pos+e))}isWordAfter(e,r){return I(this.source,v(this.source,this.pos+e),r)}eat(e){if(this.at()!==e)return!1;return this.advance(1),!0}isWord(e){return I(this.source,this.skip(),e)}eatWord(e){if(!this.isWord(e))return!1;return this.advance(e.length),!0}moduleExportName(){return this.name()??this.string()?.value??null}name(){let e=this.source,r=this.skip();if(!S(e.charCodeAt(r))||h(e.charCodeAt(r)))return null;let t="",i=r,n=r;while(n<e.length){let a=e.charCodeAt(n);if(a===92){if(e.charCodeAt(n+1)!==117)return null;let c=this.unicodeEscape(n+2);if(c===null)return null;t+=e.slice(i,n)+c,n=i=this.escapeEnd}else if(S(a))n++;else break}return this.advance(n-r),t+e.slice(i,n)}string(){let e=this.source,r=this.skip(),t=e.charCodeAt(r);if(t!==34&&t!==39)return null;let i="",n=r+1;for(let a=n;a<e.length;){let c=e.charCodeAt(a);if(c===t)return this.advance(a+1-r),{value:i+e.slice(n,a),start:r,end:a+1};if(c===10||c===13)return null;if(c===92){let A=this.escape(a+1);if(A===null)return null;i+=e.slice(n,a)+A,a=n=this.escapeEnd}else a++}return null}cooked(e,r,t){let i=this.source,n="",a=e;for(let c=e;c<r;){let A=i.charCodeAt(c);if(A===92){let f=this.escape(c+1);if(f===null)return null;n+=i.slice(a,c)+f,c=a=this.escapeEnd}else if(A===13&&t)n+=`${i.slice(a,c)}
3
+ `,c+=i.charCodeAt(c+1)===10?2:1,a=c;else c++}return n+i.slice(a,r)}escape(e){let r=this.source.charCodeAt(e);switch(this.escapeEnd=e+1,r){case 110:return`
4
+ `;case 114:return"\r";case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 48:return h(this.source.charCodeAt(e+1))?null:"\x00";case 120:return this.hexEscape(e+1,2);case 117:return this.unicodeEscape(e+1);case 13:if(this.source.charCodeAt(e+1)===10)this.escapeEnd++;return"";case 10:case 8232:case 8233:return"";default:return h(r)||e>=this.source.length?null:String.fromCharCode(r)}}unicodeEscape(e){if(this.source.charCodeAt(e)!==123)return this.hexEscape(e,4);let r=0,t=e+1;for(;this.source.charCodeAt(t)!==125;t++){let i=Ne(this.source.charCodeAt(t));if(i===-1)return null;if(r=r*16+i,r>1114111)return null}if(t===e+1)return null;return this.escapeEnd=t+1,String.fromCodePoint(r)}hexEscape(e,r){let t=0;for(let i=e;i<e+r;i++){let n=Ne(this.source.charCodeAt(i));if(n===-1)return null;t=t*16+n}return this.escapeEnd=e+r,String.fromCharCode(t)}}function me(e){return e!==92&&S(e)&&!h(e)}function Ne(e){if(h(e))return e-48;let r=e|32;return r>=97&&r<=102?r-87:-1}import{realpathSync as rt}from"node:fs";var ce=/\.svelte$/,Ke=/\.js$/,it=/[?#].*$/,F=/\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/;function O(e){return ce.test(e)}function o(e){return e.replace(it,"")}function w(e){try{return rt(e)}catch{return}}function pe(e){return e instanceof Error?e.message:String(e)}function ue(e,r){return`${e}\x00${r}`}var Me=/[\w-]+/g,nt={marker:"",text:(e)=>Array.from(e.matchAll(Me),([r])=>`.${r}`),script(e,r){for(let[t]of e.matchAll(Me))r.add(`.${t}`)}};function K(e){return e.classTokens??(e.styles?nt:void 0)}var st=/[.*+?^${}()|[\]\\/]/g;function U(e){return e.replace(st,"\\$&")}function je(e){let r=new WeakMap;return(t)=>{let i=r.get(t);if(i===void 0)i=e(t),r.set(t,i);return i}}var at=je(lt);function lt(e){let r=U(e.name),t=`${r}\\/${U(e.srcDir)}\\/`;return{argument:new RegExp(`["'\`]${r}\\b`),directComponentPath:new RegExp(`^${t}(.+\\.svelte)$`),contextKey:new RegExp(`(["'\`])(${U(e.contextKeyPrefix)}[^"'\`\\s]+)\\1`,"g"),valueSubpath:new RegExp(`["'\`]${r}\\/(?![^"'\`]*\\.(?:svelte|css)["'\`])`),scriptSpecifier:new RegExp(`["']${t}(?![^"']*\\.svelte["'])[^"']*["']`),barrelImport:new RegExp(`\\bimport\\s+(type\\s+)?\\{([^}]*)\\}\\s*from\\s*(["'])${r}\\3`,"g"),barrelSpecifier:new RegExp(`["']${r}["']`,"g"),directComponentSpecifier:new RegExp(`["']${t}([^"']+\\.svelte)["']`,"g"),componentSource:new RegExp(e.componentPackages.length>0?`\\.svelte$|^(?:${e.componentPackages.map(U).join("|")})(\\/|$)`:"\\.svelte$"),importText:new RegExp(`\\b(?:from|import|require)\\s*\\(?\\s*["'\`]${r}(?:["'\`]|\\/)`),dynamicImport:new RegExp(`\\b(?:import|require)\\s*\\(\\s*(["'\`])(${r}(?:\\/[^"'\`]*)?)\\1`,"g"),directComponentName:new RegExp(`^${t}.+\\/([A-Za-z0-9_]+)\\.svelte$`),segment:new RegExp(`(^|[\\\\/])${r}([\\\\/]|$)`),srcSegment:new RegExp(`(?:^|[\\\\/])${r}[\\\\/]${U(e.srcDir)}[\\\\/](.+)$`)}}var ot=/\\/g;class Se{spec;patterns;constructor(e){this.spec=e,this.patterns=at(e)}get name(){return this.spec.name}get logPrefix(){return`${this.spec.tool}:`}get srcPrefix(){return`${this.name}/${this.spec.srcDir}/`}get barrelKey(){return this.spec.barrel}moduleKey(e){return this.patterns.srcSegment.exec(e)?.[1].replace(ot,"/")}importKey(e){let r=this.moduleKey(o(e));return r&&(r===this.barrelKey||O(r))?r:void 0}isSpecifier(e){return e===this.name||e.startsWith(`${this.name}/`)}isComponentFile(e){return O(e)&&this.patterns.segment.test(e)}}var u=je((e)=>new Se(e));import{existsSync as ht,readFileSync as ct,realpathSync as Ue,statSync as ft}from"node:fs";import{readdir as ut}from"node:fs/promises";import dt,{createRequire as Be}from"node:module";import T from"node:path";var pt=/\.(js|svelte)$/;async function E(e){return(await ut(e,{recursive:!0})).filter((t)=>pt.test(t)).map((t)=>t.split(T.sep).join("/")).sort((t,i)=>t.localeCompare(i))}var gt=Be(import.meta.url);function mt(e,r){let{findPnpApi:t}=dt;if(typeof t!=="function")return;let i=`${T.resolve(r)}${T.sep}`;try{let n=t(i)?.resolveToUnqualified(e,i);return n?T.resolve(n):void 0}catch{return}}function Qe(e,r=process.cwd()){let t=mt(e,r);if(t)return t;let i=Be(T.join(r,"__resolve__.js")),n=new Set([...i.resolve.paths(e)??[],...gt.resolve.paths(e)??[]]);for(let a of n){let c=T.join(a,e);if(ht(T.join(c,"package.json")))return c}return}function N(e,r){let t=Qe(e,r);if(!t)throw Error(`Could not resolve an installed "${e}" package.`);return t}function G(e,r=process.cwd()){let t=Qe(e,r);if(!t)return;let i=Number.parseInt(String(Ve(t)),10);return Number.isNaN(i)?void 0:i}function Ve(e){try{return JSON.parse(ct(T.join(e,"package.json"),"utf8")).version}catch{return}}var Ye=(e)=>!e.split(T.sep).includes("node_modules");function He(e){try{return Ye(Ue(e))}catch{return!1}}async function k(e,r){let t=Ve(e),i;try{i=Ue(e)}catch{return""}let n=`${i}@${String(t)}`;if(t!==void 0&&!Ye(i))return n;let a=T.join(e,r);try{for(let c of await E(a))n+=`:${ft(T.join(a,c)).mtimeMs}`}catch{}return n}
5
+ export{ne,h,l,s,re,se,oe,q,ae,x,L,le,be,ve,p,qe,Ge,ce,Ke,F,O,o,w,pe,ue,K,Se,u,E,N,G,He,k};
@@ -0,0 +1,2 @@
1
+ import{D}from"./index-xt8m9vw2.js";import{H,X,Y}from"./index-zq01wexv.js";import{ce,Ke,u}from"./index-4992cggh.js";import{randomUUID as S}from"node:crypto";import{existsSync as E}from"node:fs";import h from"node:path";import{fileURLToPath as P}from"node:url";function Ee(e){return(e.options.mode??"production")==="production"}function ke(e){let o;try{o=e.originalSource?.()?.source()}catch{}return typeof o==="string"||Buffer.isBuffer(o)?o.toString():void 0}function Ae(e,o){let i=[];for(let{originModule:t,dependency:g}of o){let n=t?.resource,c=g?.request;if(typeof n==="string")i.push({id:e,importer:n,specifier:typeof c==="string"?c:void 0})}return i}function I(e){let o=(()=>{try{return e.resolverFactory?.get("normal")}catch{return}})();if(!o)return;return(i,t)=>new Promise((g)=>{try{o.resolve({},h.dirname(t),i,{},(n,c)=>g(n||!c?void 0:c))}catch{g(void 0)}})}var C=(()=>{let e=h.dirname(P(import.meta.url)),o=[h.join(e,"loader.js"),h.join(e,"loader.ts")];return o.find((i)=>E(i))??o[0]})();class Ce{spec;options;names;constructor(e,o,i={}){this.spec=e,this.options=o,this.names={...X,loader:C,...i}}apply(e){if(!Ee(e)){if(this.spec.tailwind!==!0)return;let r=async()=>{let d=await H(this.spec,e.context,this.names);if(d)e.getInfrastructureLogger(this.names.plugin).warn(d)};e.hooks.beforeRun.tapPromise(this.names.plugin,r),e.hooks.watchRun.tapPromise(this.names.plugin,r);return}let{WebpackError:o}=e.webpack,{spec:i}=this,t=this.names.plugin,g=u(i),n=Y(i,this.options,this.names),c=S();D().set(c,n),e.hooks.shutdown?.tap(t,()=>{D().delete(c)}),e.options.module.rules.push({test:ce,enforce:"pre",use:[{loader:this.names.loader,options:{id:c}}]},{test:Ke,include:g.patterns.srcSegment,enforce:"pre",use:[{loader:this.names.loader,options:{id:c}}]});let y,k=async()=>{let r=await n.prepare(e.context,I(e));if(y=r.warning,r.info)e.getInfrastructureLogger(t).info(r.info);for(let d of r.report??[])console.log(d)};e.hooks.beforeRun.tapPromise(t,k),e.hooks.watchRun.tapPromise(t,k),e.hooks.thisCompilation.tap(t,(r)=>{if(y)r.warnings.push(new o(y));r.hooks.finishModules.tap(t,(d)=>{for(let l of d){let{resource:s}=l;if(typeof s!=="string")continue;let p=ke(l);if(p!==void 0)n.check(s,p);let{moduleGraph:a}=r;if(s.endsWith(".js")&&n.load(s))n.checkScriptImporters(s,[...a.getIncomingConnections(l)].map(({originModule:m})=>typeof m?.resource==="string"?m.resource:void 0));if(g.importKey(s))for(let m of Ae(s,a.getIncomingConnections(l)))n.checkLibraryImport(m);else if(n.isClosed(s)){let m=[],w=!1;for(let{originModule:b,dependency:v}of a.getIncomingConnections(l)){if(b===l)continue;m.push(typeof b?.resource==="string"?b.resource:void 0),w||=v?.type==="import()"}n.checkImporters(s,m,w)}}let f=n.error();if(f)r.errors.push(new o(f))}),r.hooks.processAssets.tap({name:t,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},(d)=>{let f=new Map;for(let p of Object.keys(d)){if(!p.endsWith(".css"))continue;let a=r.getAsset(p)?.source.source();if(a===void 0)continue;f.set(p,typeof a==="string"?a:new TextDecoder().decode(a))}if(f.size===0)return;let l=new Map(f),s=n.pruneStyles(f);for(let[p,a]of f){if(a===l.get(p))continue;r.updateAsset(p,new e.webpack.sources.RawSource(a))}if(s)e.getInfrastructureLogger(t).info(s)})})}}
2
+ export{Ee,ke,Ae,Ce};
@@ -0,0 +1,2 @@
1
+ import{U,P,A,e,t,n,r,d,a,i,Q}from"./index-n6hffmks.js";import{f,B,z}from"./index-wkcyw7a9.js";import{_,R,ie}from"./index-4960rqxx.js";import{p,E,k}from"./index-4992cggh.js";import{readFile as se}from"node:fs/promises";import K from"node:path";var fe={tables:new Map,readers:new Map,barrel:new Map},de=new Set(["tailwind-variants","tailwind-variants/lite"]),ue="tailwind-variants",me=new Set(["class","className"]);function F(s){let{start:l,end:c}=s;return{start:l,end:c}}var Z=new Map;async function ge(s){let l=await k(s.root,s.spec.srcDir),c=Z.get(s.src);if(c?.signature===l)return c.scan;let o=await he(s);return Z.set(s.src,{signature:l,scan:o}),o}function ye(s){let l=[];for(let c of s.ast.module?.content.body??[]){let o=c.type==="ExportNamedDeclaration"?c.declaration:c;if(o?.type!=="VariableDeclaration"||o.kind!=="const")continue;for(let{id:u,init:m}of o.declarations)if(u.type==="Identifier"&&m)l.push({id:u.name,init:m})}return l}function q(s){if(s.type!=="ObjectExpression")return;let l=new Map;for(let c of s.properties){if(c.type!=="Property"||c.kind!=="init")return;let o=A(c);if(o===void 0||c.computed)return;l.set(o,c)}return l}function H(s){if(s.type==="Literal"&&!(("regex"in s)&&s.regex))return typeof s.value==="bigint"?e:s.value;if(s.type==="Identifier"&&s.name==="undefined")return;return e}function be(s,l,c){let o={module:s,name:l,config:c,variants:new Map,defaults:new Map,compounds:[],slots:!1},u=q(c);if(!u)return o.open="its config isn't an object literal",o;if(u.has("extend"))o.open="it extends another table";o.slots=u.has("slots");let m=(h)=>u.get(h)?.value,b=m("variants");if(b){let h=q(b);if(!h)return o.open="its variants aren't an object literal",o;for(let[y,w]of h){let T=w.value;o.variants.set(y,q(T)?T.properties:null)}}let v=m("defaultVariants");if(v){let h=q(v);if(h){let y=new Map;for(let[w,T]of h)y.set(w,H(T.value));o.defaults=y}else o.defaults=e}let g=m("compoundVariants");if(g?.type==="ArrayExpression")o.compounds=g.elements.filter((h)=>h!==null);else if(g)o.compounds=[];return o}function oe(s,l){let c={imports:[],exports:[]},o=(b,v)=>{for(let g of p(b)){if(!g.source||g.typeOnly)continue;let h=g.source.value;if(g.kind==="import")for(let y of g.specifiers){if(y.typeOnly)continue;c.imports.push({local:y.local,imported:y.kind==="namespace"?"*":y.kind==="default"?"default":y.imported,source:h,module:v})}else if(v)for(let y of g.specifiers){if(y.typeOnly)continue;c.exports.push({kind:y.kind,local:y.local,exported:y.exported,source:h})}}};if(!s.endsWith(".svelte"))return o(l,!0),c;let{instance:u,module:m}=_(l);if(m)o(l.slice(m.content.start,m.content.end),!0);if(u)o(l.slice(u.content.start,u.content.end),!1);return c}async function he(s){let{src:l}=s,c=await E(l),o=await Promise.all(c.map((M)=>se(K.join(l,M),"utf8"))),u=new Map,m=new Map,b=(M,x,N)=>{let I=m.get(M)??new Map;if(m.set(M,I),I.has(x))return!1;return I.set(x,N),!0},v=(M,x)=>{let N=u.get(M);if(N&&!N.open)N.open=x};for(let[M,x]of c.entries()){if(!x.endsWith(".js")||!o[M].includes(ue))continue;let N=P(l,x);if(!N)continue;let I=new Set;for(let C of N.ast.module?.content.body??[]){if(C.type!=="ImportDeclaration"||!de.has(String(C.source.value)))continue;for(let S of C.specifiers)if(S.type==="ImportSpecifier"&&S.imported.type==="Identifier"&&S.imported.name==="tv")I.add(S.local.name)}if(I.size===0)continue;for(let{id:C,init:S}of ye(N)){if(S.type!=="CallExpression"||S.callee.type!=="Identifier"||!I.has(S.callee.name)||S.arguments.length===0||S.arguments[0].type==="SpreadElement")continue;let O=`${x}#${C}`;u.set(O,be(x,C,S.arguments[0]));let D=N.scopes.module.declarations.get(C);if(we(N,C))b(x,C,O);for(let J of D?.references??[]){let j=ae(J.parent);if(j===void 0)v(O,`${x} reads it`);else b(x,j,O)}}}if(u.size===0)return fe;let g=new Set(c),h=(M,x)=>{if(x===s.name)return s.barrelKey;if(!x.startsWith("."))return;let N=K.posix.join(K.posix.dirname(M),x);return[N,`${N}.js`,`${N}.svelte`,K.posix.join(N,"index.js")].find((I)=>g.has(I))},y={tables:u,readers:new Map,barrel:new Map,open:re(s,c,o)},w=c.map((M,x)=>oe(M,o[x])),T=new Set;for(let M=!0;M;){M=!1;for(let[x,N]of c.entries()){let{imports:I,exports:C}=w[x];for(let{kind:S,local:O,exported:D,source:J}of C){let j=h(N,J),W=j&&m.get(j);if(!W)continue;if(S==="all"){for(let[V,L]of W)if(V!=="default")M=b(N,V,L)||M}else if(S==="namespace")for(let V of W.values())v(V,`${N} re-exports it in a namespace`);else{let V=W.get(O);if(V&&D)M=b(N,D,V)||M}}for(let{local:S,imported:O,source:D,module:J}of I){let j=h(N,D),W=j&&m.get(j);if(!W)continue;let V=O==="*"?[...W.values()]:[W.get(O)];for(let L of V){if(!L)continue;let X=`${N}\x00${S}\x00${L}`;if(T.has(X))continue;if(T.add(X),O==="*"){if(N.endsWith(".svelte")||Ne(l,N,S))v(L,`${N} imports it in a namespace`)}else if(N.endsWith(".svelte")){if(J)v(L,`${N} imports it in \`<script module>\``);let Y=y.readers.get(N)??new Map;Y.set(S,L),y.readers.set(N,Y)}else{let Y=le(l,N,S);if(!Y)v(L,`${N} reads it`);else for(let pe of Y)M=b(N,pe,L)||M}}}}}for(let[M,x]of c.entries()){let N=x.endsWith(".svelte")?ie(o[M]):R(o[M]);for(let{source:I}of N){if(I===null){y.open??=`${x} imports a module it computes`;continue}let C=h(x,I);for(let S of C&&m.get(C)?.values()||[])v(S,`${x} imports it dynamically`)}}for(let[M,x]of m.get(s.barrelKey)??[])y.barrel.set(M,x);return y}function re(s,l,c){let o=U(s.src);for(let[u,m]of l.entries()){if(!m.endsWith(".js"))continue;for(let{source:b,local:v,imported:g}of oe(m,c[u]).imports){if(s.isSpecifier(b)&&b!==s.name)return`${m} imports \`${b}\``;if(!b.startsWith(".")||b.endsWith(".css"))continue;if(o.importOf(m,b,g).kind!=="value"&&!Me(s.src,m,v))return`${m} uses a component`}}return}var ee=new Map;async function _e(s){let l=await k(s.root,s.spec.srcDir),c=ee.get(s.src);if(c?.signature===l)return c.reason;let o=(await E(s.src)).filter((b)=>b.endsWith(".js")),u=await Promise.all(o.map((b)=>se(K.join(s.src,b),"utf8"))),m=re(s,o,u);return ee.set(s.src,{signature:l,reason:m}),m}function we(s,l){return(s.ast.module?.content.body??[]).some((c)=>c.type==="ExportNamedDeclaration"&&c.declaration?.type==="VariableDeclaration"&&c.declaration.declarations.some(({id:o})=>o.type==="Identifier"&&o.name===l))}function ae(s){if(s.type!=="ExportSpecifier")return;let{exported:l}=s;return l.type==="Identifier"?l.name:String(l.value)}function ce(s,l,c){let o=P(s,l);if(!o)return;return o.scopes.module.declarations.get(c)??null}function le(s,l,c){let o=ce(s,l,c);if(o===void 0)return;let u=[];for(let m of o?.references??[]){let b=ae(m.parent);if(b===void 0)return;u.push(b)}return u}function Me(s,l,c){return le(s,l,c)!==void 0}function Ne(s,l,c){let o=ce(s,l,c);return o===void 0||(o?.references.length??0)>0}var te=new WeakMap;function xe(s){let l=te.get(s);if(!l){let c=new Map;f(s.ast,{enter(o,u){c.set(o,u)}}),l=c,te.set(s,l)}return l}function ve(s){if(s===e)return;let l=[];for(let o of s)if(o===void 0||o===null)l.push(new Map);else if(d(o)&&o.kind==="object")l.push(o.props);else return;let c=new Map;for(let o of l)for(let[u,m]of o)c.set(u,r(c.get(u)??t(),m));for(let[o,u]of c)if(l.some((m)=>!m.has(o)))c.set(o,r(u,n));return c}function ke(s,l,c,o){let u=new Map,m=xe(s),b=s.ast.module,v=(y)=>b!=null&&F(y).start>=b.start&&F(y).end<=b.end,g=(y,w)=>{o(y).open??=w},h=s.key;for(let[y,w]of l){let T=c.get(w),M=s.scopes.instance.declarations.get(y)??s.scopes.module.declarations.get(y);if(!T||!M||M.kind!=="import"){g(w,`${h} can't be read`);continue}for(let{node:x,parent:N}of M.references){if(v(x)){g(w,`${h} reads it in \`<script module>\``);continue}if(N.type!=="CallExpression"||N.callee!==x){g(w,`${h} uses it other than by calling it`);continue}if(u.set(N,{id:w,slot:!1}),!Te(s,N,m,w,u)&&T.slots)g(w,`${h} hands on what it returns`)}}return u}function Te(s,l,c,o,u){let m=(w,T)=>{if(w?.type!=="MemberExpression"||w.object!==T||w.computed)return!1;let M=c.get(w);if(M?.type!=="CallExpression"||M.callee!==w)return!1;return u.set(M,{id:o,slot:!0}),!0},b=(w)=>{if(!w)return!1;for(let{node:T,parent:M}of w.references)if(M.type==="CallExpression"&&M.callee===T)u.set(M,{id:o,slot:!0});else return!1;return!0},v=l,g=c.get(l);if(g?.type==="CallExpression"&&g.callee.type==="Identifier"&&g.callee.name==="$derived"&&g.arguments[0]===v)v=g,g=c.get(g);if(m(g,v))return!0;if(g?.type!=="VariableDeclarator"||g.init!==v)return!1;let{id:h}=g;if(h.type==="ObjectPattern"){for(let w of h.properties)if(w.type!=="Property"||w.value.type!=="Identifier"||!b(s.scopes.bindingOf(w.value)))return!1;return!0}if(h.type!=="Identifier")return!1;return s.scopes.bindingOf(h)?.references.every(({node:w,parent:T})=>m(T,w))??!1}function Se(s){if(s===null)return;let l=s===!1?"false":s===!0?"true":s===0?"0":s;return l?String(l):"false"}function Ie(s){let l=new Map,c=new Set(s.calls.flatMap((u)=>[...u.keys()]));for(let u of c){let m=t();for(let b of s.calls)m=r(m,b.get(u)??n);l.set(u,m)}let o=new Map;for(let u of s.slotCalls)for(let[m,b]of u)o.set(m,r(o.get(m)??t(),b));return(u)=>r(l.get(u)??n,o.get(u)??t())}function Ee(s,l,c){if(c===e)return null;let o=new Set;for(let u of c){if(a(u))return null;let m=u;if(m===void 0){let v=s.defaults===e?e:s.defaults.get(l);if(v===e)return null;m=v}let b=Se(m);if(b!==void 0)o.add(b)}return o}function Ce(s,l){let c=(o)=>o==null||o===!1;return s===l||c(s)&&c(l)}function Oe(s,l,c){let o=q(l);if(!o)return!0;for(let[u,m]of o){if(me.has(u))continue;let b=m.value,v=b.type==="ArrayExpression"?b.elements.map((y)=>y?H(y):e):[H(b)];if(v.includes(e))continue;let g=c(u);if(g===e)continue;let h=[];for(let y of g)if(y!==void 0)h.push(y);else{let w=s.defaults===e?e:s.defaults.get(u);if(w===e)return!0;h.push(w)}if(!h.some((y)=>v.some((w)=>Ce(w,y))))return!1}return!0}function ne(s,l){let c=[];for(let[o,u]of s.entries()){if(!l.has(u))continue;let m=s[o+1];c.push({start:F(u).start,end:m?F(m).start:F(u).end})}return c}function $e(s,l){if(s.open||l?.open)return;if(!l||l.calls.length===0){if(s.config.type==="ObjectExpression"&&s.config.properties.length===0)return;return{edits:[{...F(s.config),text:"{}"}],stats:{keys:0,compounds:0,emptied:!0}}}let c=Ie(l),o=[],u={keys:0,compounds:0,emptied:!1};for(let[b,v]of s.variants){if(!v)continue;let g=Ee(s,b,c(b));if(!g)continue;let h=new Set(v.filter((y)=>{let w=A(y);return w===void 0||!g.has(w)}));u.keys+=h.size,o.push(...ne(v,h))}let m=new Set(s.compounds.filter((b)=>!Oe(s,b,c)));return u.compounds+=m.size,o.push(...ne(s.compounds,m)),o.length>0?{edits:o,stats:u}:void 0}var G={modules:new Map,pruned:0,emptied:0,keys:0,compounds:0,kept:new Map};async function Ye(s,l,c){let o=await ge(s);if(o.tables.size===0||o.open)return G;let u=new Map,m=(g)=>{let h=u.get(g);if(!h)h={calls:[],slotCalls:[]},u.set(g,h);return h};for(let g of l){let h=g.file?K.basename(g.file):"an app module";if(g.openAll||g.libraryValues==="any")return G;for(let y of g.libraryValues??[]){let w=o.barrel.get(y);if(w)m(w).open??=`${h} imports it`}}for(let[g,h]of o.readers){let y=c(g);if(!y)continue;let w=ke(y.model,h,o.tables,m);if(w.size===0)continue;Q(y,s,{watched:w,call(T){let M=w.get(T);if(!M||T.type!=="CallExpression")return;let x=m(M.id),[N]=T.arguments,I=N===void 0?new Map:N.type==="SpreadElement"?void 0:ve(i(N,y));if(!I)x.open??=`${g} passes props it can't read`;else(M.slot?x.slotCalls:x.calls).push(I)}})}let b={...G,modules:new Map,kept:new Map};for(let[g,{open:h}]of u){let y=o.tables.get(g)?.open??h;if(y)b.kept.set(g.replace("#"," "),y)}let v=new Map;for(let g of o.tables.values()){let h=v.get(g.module)??[];h.push(g),v.set(g.module,h)}for(let[g,h]of v){let y=[];for(let M of h){let x=$e(M,u.get(`${M.module}#${M.name}`));if(!x)continue;if(y.push(...x.edits),x.stats.emptied)b.emptied++;else b.pruned++;b.keys+=x.stats.keys,b.compounds+=x.stats.compounds}if(y.length===0)continue;let w=P(s.src,g);if(!w)continue;let T=w.code;y.sort((M,x)=>M.start-x.start),b.modules.set(g,{source:T,mapped:z(B(T,0,T.length),y)})}return b}
2
+ export{_e,Ye};