@tailwindcss/language-server 0.0.0-insiders.74aad3d → 0.0.0-insiders.78b8ca4
Sign up to get free protection for your applications and to get access to all the features.
@@ -2951,11 +2951,11 @@ If omitted, Tailwind will append these classes to the very end of your styleshee
|
|
2951
2951
|
`,{origin:0}),s=[];r.forEach(a=>{let c=n.toIndex(a.start.line,a.start.character),u=n.toIndex(a.end.line,a.end.character);for(let H=c-1;H>=0&&/\s/.test(e.charAt(H));H--)c=H;s.push({start:c,end:u})}),s.sort((a,c)=>a.start-c.start);let i="",o=0;return s.forEach(a=>{i+=e.substring(o,a.start),o=a.end}),i+=e.substring(o),i.trim()}async function GZ(e,t,r){return[{title:`Delete ${cf(r.otherClassNames.map(n=>`'${n.className}'`))}`,kind:"quickfix",diagnostics:[r],edit:{changes:{[t.textDocument.uri]:[{range:r.className.classList.range,newText:jI(r.className.classList.classList,r.otherClassNames.map(n=>n.relativeRange))}]}}}]}var rz=Qt(xs());var nz=Qt(zZ());var JZ=/\s*!important\s*$/i,xke={"box-flex":!0,"box-flex-group":!0,"column-count":!0,flex:!0,"flex-grow":!0,"flex-positive":!0,"flex-shrink":!0,"flex-negative":!0,"font-weight":!0,"line-clamp":!0,"line-height":!0,opacity:!0,order:!0,orphans:!0,"tab-size":!0,widows:!0,"z-index":!0,zoom:!0,"fill-opacity":!0,"stroke-dashoffset":!0,"stroke-opacity":!0,"stroke-width":!0};function Cke(e){return e.replace(/([A-Z])/g,"-$1").replace(/^ms-/,"-ms-").toLowerCase()}function YZ(e,t,r,n){r===!1||r===null||(t=Cke(t),typeof r=="number"&&(r===0||xke[t]?r=r.toString():r=r.toString()+"px"),t==="css-float"&&(t="float"),JZ.test(r)?(r=r.replace(JZ,""),e.push(n.decl({prop:t,value:r,important:!0}))):e.push(n.decl({prop:t,value:r})))}function QZ(e,t,r,n){var s=n.atRule({name:t[1],params:t[3]||""});typeof r=="object"&&(s.nodes=[],SC(r,s,n)),e.push(s)}function SC(e,t,r){var n,s,i,o;for(n in e)if(e.hasOwnProperty(n)){if(s=e[n],s===null||typeof s>"u")continue;if(n[0]==="@"){var a=n.match(/@([^\s]+)(\s+([\w\W]*)\s*)?/);if(Array.isArray(s))for(o=0;o<s.length;o++)QZ(t,a,s[o],r);else QZ(t,a,s,r)}else if(Array.isArray(s))for(o=0;o<s.length;o++)YZ(t,n,s[o],r);else typeof s=="object"?(i=r.rule({selector:n}),SC(s,i,r),t.push(i)):YZ(t,n,s,r)}}function ez(e,t){var r=t.root();return SC(e,r,t),r}var vC=Qt(bL());async function iz(e,t,r){if(!t)return[];let n=Fi(t,"css"),s,i=n,{postcss:o}=e.modules,a=[],c=r.className.classList.classList.split(/\s+/).length,u=r.className.className,H=ZH(e,u),l=(0,rz.default)(e.classNames.classNames,H);if(Array.isArray(l))return[];if(!ga(e,t)){let f=rs(e,t);if(!f)return[];if(s=f.filter(d=>d.type==="css").find(({range:d})=>Hp(r.range.start,d))?.range,!s)return[];i=Fi(t,"css",s)}try{await o.module([o.module.plugin("",(f={})=>d=>{d.walkRules(h=>{if(a.length)return!1;h.walkAtRules("apply",m=>{let y=tz(m.source);if(s&&(y=yH(y,s)),!Hp(r.range.start,y))return;let g=wke(e,H,h.selector,r.className.classList.important);if(!g)return!1;h.after(g.nodes);let _=h.next();if(!_)return!1;c===1?m.remove():a.push({range:r.className.classList.range,newText:jI(r.className.classList.classList,r.className.relativeRange)});let I=tz(h.source);s&&(I=yH(I,s));let v,T=(0,nz.default)(i);return a.push({range:I,newText:h.toString()+(_.raws.before||`
|
2952
2952
|
|
2953
2953
|
`)+_.toString().replace(/\n\s*\n/g,`
|
2954
|
-
`).replace(/(@apply [^;\n]+)$/gm,"$1;").replace(/([^\s^]){$/gm,"$1 {").replace(/^\s+/gm,b=>(typeof v>"u"&&(v=b),b.replace(new RegExp(v,"g"),T.indent))).replace(/^(\s+)(.*?[^{}]\n)([^\s}])/gm,"$1$2$1$3")}),!1})})})]).process(i,{from:void 0})}catch{return[]}return a.length?[{title:"Extract to new rule",kind:"quickfix",diagnostics:[r],edit:{changes:{[t.uri]:a}}}]:[]}function tz(e){return{start:{line:e.start.line-1,character:e.start.column-1},end:{line:e.end.line-1,character:e.end.column}}}function wke(e,t,r,n=!1){let s=t[t.length-1],i=Wu(e,[s]);if(i===null||i.isApplyable===!1)return null;let o=cp(e,t);if(Array.isArray(o))return null;let a=o.context,c=o.pseudo,u=e.classNames.context,H=[];for(let d=0;d<t.length-1;d++){let h=t[d],m=u[h];if(!m)return null;e.screens.includes(h)&&(H.push(`@screen ${h}`),a=a.filter(y=>!m.includes(y)))}H.push(...a);let l={};for(let d=1;d<=H.length;d++)ja(l,H.slice(0,d),{});if(r=kke(r,c),r===null)return null;let f={[r]:{[`@apply ${s}${n?" !important":""}`]:""}};return H.length?ja(l,H,f):l=f,ez(l,e.modules.postcss)}function kke(e,t){if(t.length===0)return e;let r=!0,n=(0,vC.default)(s=>{gu(s.split(i=>!0)).forEach(i=>{for(let o=i.nodes.length-1;o>=0&&i.nodes[o].type==="pseudo";o--)if(t.includes(i.nodes[o].value)){r=!1;break}r&&t.forEach(o=>{i.append(vC.default.pseudo({value:o}))})})}).processSync(e);return r?n:null}function sz(e,t,r){return r.suggestions.map(n=>({title:`Replace with '${n}'`,kind:"quickfix",diagnostics:[r],edit:{changes:{[t.textDocument.uri]:[{range:r.range,newText:n}]}}}))}async function Mke(e,t,r,n){if(!r)return[];let s=await UI(e,r,n);return t.context.diagnostics.map(i=>s.find(o=>o.code===i.code&&o.message===i.message&&yy(o.range,i.range))).filter(Boolean)}async function az(e,t,r){if(!e.enabled)return[];let n=await Mke(e,t,r,t.context.diagnostics.map(s=>s.code).filter(Boolean));return Promise.all(n.map(s=>fZ(s)?iz(e,r,s):dZ(s)?GZ(e,t,s):_Z(s)||EZ(s)||hZ(s)||mZ(s)||yZ(s)?sz(e,t,s):[])).then(gu).then(s=>r4(s,i=>JSON.stringify(i.edit)))}var oz=Qt(xs());async function Hz(e,t){let r=[];return!e.enabled||(await e.editor.getConfiguration(t.uri)).tailwindCSS.colorDecorators===!1?r:((await af(e,t)).forEach(o=>{up(o,e.blocklist).forEach(c=>{let u=EH(e,c.className);u===null||typeof u=="string"||(u.alpha??1)===0||r.push({range:c.range,color:gC(u)})})}),TI(e,t).forEach(o=>{let a=kI(o.path),c=o.helper==="theme"?["theme"]:[],u=(0,oz.default)(e.config,[...c,...a]),H=FI(u);H&&typeof H!="string"&&(H.alpha??1)!==0&&r.push({range:o.ranges.path,color:gC(H)})}),Rh(r))}function lz(e,t,r){return Nke(e,t,r)}function Nke(e,t,r){if(!Rr(e.version,"3.2.0"))return[];let n=[],s=[];if(ga(e,t))s.push(void 0);else{let i=rs(e,t);if(!i)return[];s.push(...i.filter(o=>o.type==="css").map(({range:o})=>o))}for(let i of s){let o=Fi(t,"css",i),a=Lo(/@config\s*(?<path>'[^']+'|"[^"]+")/g,o);for(let c of a)n.push({target:r(c.groups.path.slice(1,-1)),range:yH({start:oi(o,c.index+c[0].length-c.groups.path.length),end:oi(o,c.index+c[0].length)},i)})}return n}var tle=Qt(cz());var oE=Qt(require("fs")),pf=Qt(require("path")),pz=Qt(Pu()),Oke=[".js",".cjs",".mjs"],Rke=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Fke=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];function Bke(e,t){for(let r of t){let n=`${e}${r}`;if(oE.default.existsSync(n)&&oE.default.statSync(n).isFile())return n}for(let r of t){let n=`${e}/index${r}`;if(oE.default.existsSync(n))return n}return null}function*dz(e,t,r,n=pf.default.extname(e)){let s=Bke(pf.default.resolve(t,e),Oke.includes(n)?Rke:Fke);if(s===null||r.has(s))return;r.add(s),yield s,t=pf.default.dirname(s),n=pf.default.extname(s);let i=oE.default.readFileSync(s,"utf-8");for(let o of[...i.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),...i.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),...i.matchAll(/require\(['"`](.+)['"`]\)/gi)])o[1].startsWith(".")&&(yield*dz(o[1],t,r,n))}function WI(e){return Array.from(dz(e,pf.default.dirname(e),new Set)).filter(t=>t!==e).map(t=>(0,pz.default)(t))}var X1=Qt(require("assert"));var rh=Qt(OI()),rle=Qt(_C());function HE(e){let t=[];return Rr(e,"4.0.0")?["css-at-theme","layer:base","content-list"]:e.startsWith("0.0.0-development")?["css-at-theme","layer:base","content-list"]:e.startsWith("0.0.0-oxide")?["css-at-theme","layer:base","content-list"]:(Rr(e,"0.99.0")?(t.push("layer:base"),t.push("separator:root")):(t.push("layer:preflight"),t.push("separator:options")),Rr(e,"1.4.0")&&cL(e,"1.99.0")&&t.push("browserslist-in-plugins"),Rr(e,"3.0.0")||(Rr(e,"1.99.0")?t.push("apply-complex-classes"):Rr(e,"1.7.0")&&t.push("apply-complex-classes:flagged")),Rr(e,"3.0.0")?t.push("content-list"):t.push("purge-list"),Rr(e,"3.0.0")?t.push("jit"):Rr(e,"2.1.0"),Rr(e,"3.2.0")&&(t.push("css-at-config"),t.push("relative-content-paths")),Rr(e,"3.3.0")&&t.push("transpiled-configs"),t)}var yJ=Qt(BC()),XMe=go([(0,yJ.default)()]),qMe=/@import\s*(?:'tailwindcss'|"tailwindcss")/,KMe=/@theme\s*\{/;async function GMe(e){return KMe.test(e)||qMe.test(e)}async function gJ(e,t,r){if(!e.__unstable__loadDesignSystem||!GMe(r))return null;let n=await XMe.process(r,{from:t}),s=e.__unstable__loadDesignSystem(n.css);return Object.assign(s,{optimizeCss(i){return e.optimizeCss(i)},compile(i){return s.candidatesToCss(i).map(c=>{if(c===null)return go.root();let u="";for(let d=0;d<c.length;++d)if(c[d]==="\\")u+=c[d]+c[d+1],d+=1;else if(c[d]==='"'){let h=c.indexOf('"',d+1);u+=c.slice(d,h+1),d=h}else if(c[d]==="'"){let h=c.indexOf("'",d+1);u+=c.slice(d,h+1),d=h}else c[d]==="{"
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
`),l=0;for(let d=0;d<H.length;++d){let h=H[d];h.includes("}")&&l
|
2954
|
+
`).replace(/(@apply [^;\n]+)$/gm,"$1;").replace(/([^\s^]){$/gm,"$1 {").replace(/^\s+/gm,b=>(typeof v>"u"&&(v=b),b.replace(new RegExp(v,"g"),T.indent))).replace(/^(\s+)(.*?[^{}]\n)([^\s}])/gm,"$1$2$1$3")}),!1})})})]).process(i,{from:void 0})}catch{return[]}return a.length?[{title:"Extract to new rule",kind:"quickfix",diagnostics:[r],edit:{changes:{[t.uri]:a}}}]:[]}function tz(e){return{start:{line:e.start.line-1,character:e.start.column-1},end:{line:e.end.line-1,character:e.end.column}}}function wke(e,t,r,n=!1){let s=t[t.length-1],i=Wu(e,[s]);if(i===null||i.isApplyable===!1)return null;let o=cp(e,t);if(Array.isArray(o))return null;let a=o.context,c=o.pseudo,u=e.classNames.context,H=[];for(let d=0;d<t.length-1;d++){let h=t[d],m=u[h];if(!m)return null;e.screens.includes(h)&&(H.push(`@screen ${h}`),a=a.filter(y=>!m.includes(y)))}H.push(...a);let l={};for(let d=1;d<=H.length;d++)ja(l,H.slice(0,d),{});if(r=kke(r,c),r===null)return null;let f={[r]:{[`@apply ${s}${n?" !important":""}`]:""}};return H.length?ja(l,H,f):l=f,ez(l,e.modules.postcss)}function kke(e,t){if(t.length===0)return e;let r=!0,n=(0,vC.default)(s=>{gu(s.split(i=>!0)).forEach(i=>{for(let o=i.nodes.length-1;o>=0&&i.nodes[o].type==="pseudo";o--)if(t.includes(i.nodes[o].value)){r=!1;break}r&&t.forEach(o=>{i.append(vC.default.pseudo({value:o}))})})}).processSync(e);return r?n:null}function sz(e,t,r){return r.suggestions.map(n=>({title:`Replace with '${n}'`,kind:"quickfix",diagnostics:[r],edit:{changes:{[t.textDocument.uri]:[{range:r.range,newText:n}]}}}))}async function Mke(e,t,r,n){if(!r)return[];let s=await UI(e,r,n);return t.context.diagnostics.map(i=>s.find(o=>o.code===i.code&&o.message===i.message&&yy(o.range,i.range))).filter(Boolean)}async function az(e,t,r){if(!e.enabled)return[];let n=await Mke(e,t,r,t.context.diagnostics.map(s=>s.code).filter(Boolean));return Promise.all(n.map(s=>fZ(s)?iz(e,r,s):dZ(s)?GZ(e,t,s):_Z(s)||EZ(s)||hZ(s)||mZ(s)||yZ(s)?sz(e,t,s):[])).then(gu).then(s=>r4(s,i=>JSON.stringify(i.edit)))}var oz=Qt(xs());async function Hz(e,t){let r=[];return!e.enabled||(await e.editor.getConfiguration(t.uri)).tailwindCSS.colorDecorators===!1?r:((await af(e,t)).forEach(o=>{up(o,e.blocklist).forEach(c=>{let u=EH(e,c.className);u===null||typeof u=="string"||(u.alpha??1)===0||r.push({range:c.range,color:gC(u)})})}),TI(e,t).forEach(o=>{let a=kI(o.path),c=o.helper==="theme"?["theme"]:[],u=(0,oz.default)(e.config,[...c,...a]),H=FI(u);H&&typeof H!="string"&&(H.alpha??1)!==0&&r.push({range:o.ranges.path,color:gC(H)})}),Rh(r))}function lz(e,t,r){return Nke(e,t,r)}function Nke(e,t,r){if(!Rr(e.version,"3.2.0"))return[];let n=[],s=[];if(ga(e,t))s.push(void 0);else{let i=rs(e,t);if(!i)return[];s.push(...i.filter(o=>o.type==="css").map(({range:o})=>o))}for(let i of s){let o=Fi(t,"css",i),a=Lo(/@config\s*(?<path>'[^']+'|"[^"]+")/g,o);for(let c of a)n.push({target:r(c.groups.path.slice(1,-1)),range:yH({start:oi(o,c.index+c[0].length-c.groups.path.length),end:oi(o,c.index+c[0].length)},i)})}return n}var tle=Qt(cz());var oE=Qt(require("fs")),pf=Qt(require("path")),pz=Qt(Pu()),Oke=[".js",".cjs",".mjs"],Rke=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Fke=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];function Bke(e,t){for(let r of t){let n=`${e}${r}`;if(oE.default.existsSync(n)&&oE.default.statSync(n).isFile())return n}for(let r of t){let n=`${e}/index${r}`;if(oE.default.existsSync(n))return n}return null}function*dz(e,t,r,n=pf.default.extname(e)){let s=Bke(pf.default.resolve(t,e),Oke.includes(n)?Rke:Fke);if(s===null||r.has(s))return;r.add(s),yield s,t=pf.default.dirname(s),n=pf.default.extname(s);let i=oE.default.readFileSync(s,"utf-8");for(let o of[...i.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),...i.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),...i.matchAll(/require\(['"`](.+)['"`]\)/gi)])o[1].startsWith(".")&&(yield*dz(o[1],t,r,n))}function WI(e){return Array.from(dz(e,pf.default.dirname(e),new Set)).filter(t=>t!==e).map(t=>(0,pz.default)(t))}var X1=Qt(require("assert"));var rh=Qt(OI()),rle=Qt(_C());function HE(e){let t=[];return Rr(e,"4.0.0")?["css-at-theme","layer:base","content-list"]:e.startsWith("0.0.0-development")?["css-at-theme","layer:base","content-list"]:e.startsWith("0.0.0-oxide")?["css-at-theme","layer:base","content-list"]:(Rr(e,"0.99.0")?(t.push("layer:base"),t.push("separator:root")):(t.push("layer:preflight"),t.push("separator:options")),Rr(e,"1.4.0")&&cL(e,"1.99.0")&&t.push("browserslist-in-plugins"),Rr(e,"3.0.0")||(Rr(e,"1.99.0")?t.push("apply-complex-classes"):Rr(e,"1.7.0")&&t.push("apply-complex-classes:flagged")),Rr(e,"3.0.0")?t.push("content-list"):t.push("purge-list"),Rr(e,"3.0.0")?t.push("jit"):Rr(e,"2.1.0"),Rr(e,"3.2.0")&&(t.push("css-at-config"),t.push("relative-content-paths")),Rr(e,"3.3.0")&&t.push("transpiled-configs"),t)}var yJ=Qt(BC()),XMe=go([(0,yJ.default)()]),qMe=/@import\s*(?:'tailwindcss'|"tailwindcss")/,KMe=/@theme\s*\{/;async function GMe(e){return KMe.test(e)||qMe.test(e)}async function gJ(e,t,r){if(!e.__unstable__loadDesignSystem||!GMe(r))return null;let n=await XMe.process(r,{from:t}),s=e.__unstable__loadDesignSystem(n.css);return Object.assign(s,{optimizeCss(i){return e.optimizeCss(i)},compile(i){return s.candidatesToCss(i).map(c=>{if(c===null)return go.root();let u="";for(let d=0;d<c.length;++d)if(c[d]==="\\")u+=c[d]+c[d+1],d+=1;else if(c[d]==='"'){let h=c.indexOf('"',d+1);u+=c.slice(d,h+1),d=h}else if(c[d]==="'"){let h=c.indexOf("'",d+1);u+=c.slice(d,h+1),d=h}else if(c[d]==="{")u+=` {
|
2955
|
+
`;else if(c[d]==="}")u+=`}
|
2956
|
+
`;else if(c[d]===";")u+=`;
|
2957
|
+
`;else if(c[d]===":"){let h=c.charCodeAt(d-1);h>=65&&h<=90||h>=97&&h<=122||h>=48&&h<=57?u+=": ":u+=":"}else u+=c[d];let H=u.split(`
|
2958
|
+
`),l=0;for(let d=0;d<H.length;++d){let h=H[d];h.includes("}")&&l--;let m=" ".repeat(Math.max(0,l));H[d]=m+h,h.includes("{")&&l++}let f=H.join(`
|
2959
2959
|
`).trim();try{return go.parse(f)}catch{return go.parse(c)}})},toCss(i){return Array.isArray(i)?go.root({nodes:i}).toString().trim():i.toString().trim()}}),s}var LJ=require("node:fs/promises");async function df(e){try{let t=await(0,LJ.readFile)(e,"utf8");return Fi(t,"css")}catch{return null}}var GHe=Object.keys(rle.default);function ZHe(e,t){return JSON.stringify([e,...t].map(r=>[r,wp.statSync(r).mtimeMs]))}function nle(e){if(typeof e.mode<"u")return e.mode;if(Array.isArray(e.presets))for(let t=e.presets.length-1;t>=0;t--){let r=nle(e.presets[t]);if(typeof r<"u")return r}}function ile(e){if(delete e.mode,Array.isArray(e.presets))for(let t of e.presets)ile(t)}function pb(e,t){let r,n=Un.dirname(e),s=[e,n];if(n===t)return s;for(;n=Un.dirname(r=n),r!==n;)if(s.push(n),n===t)break;return s}async function sle(e,t,r,n,s,i,o,a,c,u,H){let l=!1,f=t.folder,d=[],h=t.documentSelector,m=n.capabilities.textDocument?.completion?.completionList?.itemDefaults??[];n.clientInfo?.name?.includes("Visual Studio Code")&&!m.includes("data")&&m.push("data");let y={enabled:!1,completionItemData:{_projectKey:e},editor:{connection:r,folder:f,userLanguages:n.initializationOptions?.userLanguages?n.initializationOptions.userLanguages:{},capabilities:{configuration:!0,diagnosticRelatedInformation:!0,itemDefaults:m},getConfiguration:H,getDocumentSymbols:A=>r.sendRequest("@/tailwindCSS/getDocumentSymbols",{uri:A}),async readDirectory(A,$){try{$=Un.resolve(Un.dirname(Ag(A.uri)),$);let x=await wp.promises.readdir($,{withFileTypes:!0});return(await Promise.all(x.map(async C=>{let w=C.isDirectory();return await qu(y,A,Un.join($,C.name,w?"/":""))?null:[C.name,{isDirectory:w}]}))).filter(C=>C!==null)}catch{return[]}}}};if(t.configPath&&t.config.source==="js"){let A=[];try{A=WI(t.configPath)}catch{}c([...pb(t.configPath,t.folder),...A.flatMap($=>pb($,t.folder))])}function g(...A){console.log(`[${Un.relative(t.folder,t.configPath)}] ${A.join(" ")}`)}function _(A){let $=!1,x=!1;for(let S of A){let C=(0,OR.default)(S.file),w=dm(C,[t.configPath]),N=dm(C,y.dependencies??[]),R=(0,YHe.default)(C,`**/${bd}`,{dot:!0});if(!(!w&&!N&&!R)){if(!l){!t.isUserConfigured&&t.configPath&&(w||N)&&(h=[...h.filter(({priority:U})=>U!==1),...JHe(t.configPath,u,t.folder)],o());continue}if(S.type===db.FileChangeType.Created){g("File created:",S.file),$=!0;break}else if(S.type===db.FileChangeType.Changed)if(g("File changed:",S.file),!y.enabled||R){$=!0;break}else x=!0;else if(S.type===db.FileChangeType.Deleted)if(g("File deleted:",S.file),!y.enabled||w||R){$=!0;break}else x=!0}}$?v():x&&T()}function I(){Object.keys(y).forEach(A=>{A!=="editor"&&A!=="dependencies"&&delete y[A]}),y.enabled=!1,a(),i(),r.sendNotification("@/tailwindCSS/projectReset")}async function v(){if(l)try{await b(),r.sendNotification("@/tailwindCSS/projectInitialized")}catch(A){I(),DT(r,A)}}async function T(){if(l)try{await P()}catch(A){I(),DT(r,A)}}async function b(){g("Initializing..."),pm();let A=t.configPath;if(!A)throw new yg("No config file found.");c(pb(A,t.folder));let $=fc.default.sync(V=>{let q=Un.join(V,".pnp.js");if(fc.default.sync.exists(q)||(q=Un.join(V,".pnp.cjs"),fc.default.sync.exists(q)))return q;if(V===Un.normalize(f))return fc.default.stop},{cwd:f});if($){let V=require($);V.setup(),s4(V)}let x=t.config.source==="js"?WI(A):[],S=ZHe(A,x),C=Un.dirname(A),w,N,R,U,j,G,J,z,X,ie,Q={future:[],experimental:[]},W;try{let V=sn(C,"tailwindcss"),q=sn(C,"tailwindcss/package.json"),ne=Un.dirname(q);j=require(q).version;let Ae=HE(j);if(g(`supported features: ${JSON.stringify(Ae)}`),w=await import(V),w=w.default??w,g(`Loaded tailwindcss v${j}: ${ne}`),Ae.includes("css-at-theme"))return y.configPath=A,y.version=j,y.isCssConfig=!0,y.v4=!0,y.jit=!0,y.modules={tailwindcss:{version:j,module:w},postcss:{version:null,module:null},resolveConfig:{module:null},loadConfig:{module:null}},T();if(t.config.source==="css"){g("CSS-based configuration is not supported before Tailwind CSS v4"),y.enabled=!1,l=!1;return}let ye=sn(ne,"postcss"),$e=sn(ne,"postcss/package.json"),ke=Un.dirname($e),Ge=sn(ne,"postcss-selector-parser");if(G=require($e).version,J=Object.keys(tL).map(Oe=>{try{return require(sn(C,`${Oe}/package.json`)).version}catch{return""}}).join(","),y.enabled&&G===y.modules.postcss.version&&j===y.modules.tailwindcss.version&&J===y.pluginVersions&&A===y.configPath&&S===y.configId)return;g(`Loaded Tailwind CSS config file: ${A}`),N=require(ye),R=require(Ge),g(`Loaded postcss v${G}: ${ke}`);try{X=require(sn(ne,"./resolveConfig.js"))}catch{try{let Ve=require(sn(ne,"./lib/util/resolveConfig.js")),le=require(sn(ne,"./stubs/defaultConfig.stub.js"));X=B=>Ve([B,le])}catch{try{let le=require(sn(ne,"./lib/util/mergeConfigWithDefaults.js")),B=require(sn(ne,"./defaultConfig.js"));X=Te=>le.default(Te,B())}catch{throw Error("Failed to load resolveConfig function.")}}}try{ie=require(sn(ne,"./loadConfig.js"))}catch{}if(Rr(j,"1.4.0")&&cL(j,"1.99.0")){let Oe=sn(ne,"browserslist");z=require(Oe)(void 0,{path:f})}Rr(j,"1.99.0")?W=jT(()=>require(sn(ne,"./lib/lib/substituteClassApplyAtRules"))):Rr(j,"1.7.0")&&(W=require(sn(ne,"./lib/flagged/applyComplexClasses")));try{Q=require(sn(ne,"./lib/featureFlags.js")).default}catch{}let et=new Set,ge=N.root(),Ee={opts:{},messages:[]},Fe=()=>{};try{let Oe=bg(()=>{let Ve=require(sn(C,"tailwindcss/lib/lib/setupContextUtils")).createContext;return X1.default.strictEqual(typeof Ve,"function"),le=>Ve(le.config)},()=>{let Ve=require(sn(C,"tailwindcss/lib/jit/lib/setupContextUtils")).createContext;return X1.default.strictEqual(typeof Ve,"function"),le=>Ve(le.config)},()=>{let Ve=require(sn(C,"tailwindcss/lib/jit/lib/setupTrackingContext")).default;return X1.default.strictEqual(typeof Ve,"function"),le=>Ve(le.configPath,et,Fe)(Ee,ge)},()=>{let Ve=require(sn(C,"tailwindcss/lib/jit/lib/setupContext")).default;return X1.default.strictEqual(typeof Ve,"function"),le=>Ve(le.configPath,et)(Ee,ge)});U={generateRules:{module:bg(()=>require(sn(C,"tailwindcss/lib/lib/generateRules")).generateRules,()=>require(sn(C,"tailwindcss/lib/jit/lib/generateRules")).generateRules)},createContext:{module:Oe},expandApplyAtRules:{module:bg(()=>require(sn(C,"tailwindcss/lib/lib/expandApplyAtRules")).default,()=>require(sn(C,"tailwindcss/lib/jit/lib/expandApplyAtRules")).default)},evaluateTailwindFunctions:{module:jT(()=>require(sn(C,"tailwindcss/lib/lib/evaluateTailwindFunctions")).default)}}}catch{try{let Ve=require(sn(C,"tailwindcss/jit/lib/setupContext"));U={generateRules:{module:require(sn(C,"tailwindcss/jit/lib/generateRules")).generateRules},createContext:{module:le=>Ve(le.configPath,et)(Ee,ge)},expandApplyAtRules:{module:require(sn(C,"tailwindcss/jit/lib/expandApplyAtRules"))}}}catch{}}}catch(V){let q=await import("node:util");console.error(q.format(V)),w=WHe(),X=z$(),ie=qHe(),N=ya(),j=If().version,G=KHe().version,R=bL(),U={generateRules:{module:H1().generateRules},createContext:{module:ne=>bf().createContext(ne.config)},expandApplyAtRules:{module:cR().default}},g("Failed to load workspace modules."),g(`Using bundled version of \`tailwindcss\`: v${j}`),g(`Using bundled version of \`postcss\`: v${G}`)}y.configPath=A,y.modules={tailwindcss:{version:j,module:w},postcss:{version:G,module:N},postcssSelectorParser:{module:R},resolveConfig:{module:X},loadConfig:{module:ie},jit:U},y.browserslist=z,y.featureFlags=Q,y.version=j,y.pluginVersions=J;try{y.corePlugins=Object.keys(require(sn(Un.dirname(y.configPath),"tailwindcss/lib/plugins/index.js")))}catch{}if(W&&!W.default.__patched){let V=W.default;W.default=(q,...ne)=>{if(y.jit)return y.modules.jit.expandApplyAtRules.module(y.jitContext);let Ae=Ou(q);Ae.separator=typeof y.separator>"u"?":":y.separator;let ye=V(Ae,...ne);return async $e=>($e.walkRules(ke=>{let Ge=ke.selector.replace(/__TWSEP__(.*?)__TWSEP__/g,"$1");Ge!==ke.selector&&(ke.before(N.comment({text:"__ORIGINAL_SELECTOR__:"+ke.selector})),ke.selector=Ge)}),await ye($e),$e.walkComments(ke=>{ke.text.startsWith("__ORIGINAL_SELECTOR__:")&&(ke.next().selector=ke.text.replace(/^__ORIGINAL_SELECTOR__:/,""),ke.remove())}),$e)},W.default.__patched=!0}await T()}async function P(){g("Building..."),pm();let{tailwindcss:A,postcss:$,resolveConfig:x,loadConfig:S}=y.modules,C=Rr(A.version,"0.99.0")?["separator"]:["options","separator"],w=[],N,R=Rr(A.version,"2.99.0"),U;if(y.isCssConfig)try{let J=await df(y.configPath),z=await gJ(y.modules.tailwindcss.module,y.configPath,J);y.designSystem=z,N={theme:{}}}catch{l=!1,y.enabled=!1;return}else if(S.module){U=new Fd(wp.realpathSync(y.configPath));try{N=await S.module(y.configPath),N=N.default??N,y.jit=!0}finally{U.unhook()}}else{U=new Fd(wp.realpathSync(y.configPath),J=>{N=Ou(J);let z=(0,DH.default)(J,C);typeof z!="string"&&(z=":"),ja(J,C,`__TWSEP__${z}__TWSEP__`),J[R?"content":"purge"]=[];let X=nle(J);if(ile(J),R||y.modules.jit&&X==="jit"){if(y.jit=!0,J.variants=[],Array.isArray(J.presets))for(let Q of J.presets)w.push(Q.variants),Q.variants=[]}else y.jit=!1;if(y.corePlugins){let Q={};for(let W of y.corePlugins)Q[W]=!0;J.corePlugins=Q}return Array.isArray(J.plugins)&&(J.plugins=J.plugins.map(Q=>{if(Q.__isOptionsFunction&&(Q=Q()),typeof Q=="function"){let W=(...V)=>(V[0].matchUtilities||(V[0].matchUtilities=()=>{}),Q(...V));return W.__intellisense_cache_bust=Math.random(),W}return Q.handler?{...Q,handler:(...W)=>(W[0].matchUtilities||(W[0].matchUtilities=()=>{}),Q.handler(...W)),__intellisense_cache_bust:Math.random()}:Q})),J});try{t.config.source==="js"&&require(y.configPath)}catch(J){throw U.unhook(),J}}if(!N)throw new yg(`Failed to load config file: ${y.configPath}`);t.isUserConfigured||(h=[...h.filter(({priority:J})=>J!==1),...JHe(y.configPath,A.version,t.folder,N)]);try{if(y.config=y.isCssConfig?N:x.module(N),y.separator=(0,DH.default)(y.config,C),typeof y.separator!="string"&&(y.separator=":"),y.blocklist=Array.isArray(y.config.blocklist)?y.config.blocklist:[],delete y.config.blocklist,y.v4){let J=y.designSystem.getClassList();y.classList=J.map(z=>[z[0],{...z[1],color:EH(y,z[0])}])}else if(y.jit){if(y.jitContext=y.modules.jit.createContext.module(y),y.jitContext.tailwindConfig.separator=y.config.separator,y.jitContext.getClassList){let J=y.jitContext.getClassList({includeMetadata:!0}).filter(z=>z!=="*");y.classListContainsMetadata=J.some(z=>Array.isArray(z)),y.classList=J.map(z=>Array.isArray(z)?[z[0],{color:EH(y,z[0]),...z[1]??{}}]:[z,{color:EH(y,z)}])}}else delete y.jitContext,delete y.classList}catch(J){throw U?.unhook(),J}let j;if(y.classList)U?.unhook();else try{j=await $.module([A.module(y.configPath)]).process([Rr(A.version,"0.99.0")?"base":"preflight","components","utilities"].map(J=>`/*__tw_intellisense_layer_${J}__*/
|
2960
2960
|
@tailwind ${J};`).join(`
|
2961
2961
|
`),{from:void 0})}catch(J){throw J}finally{U?.unhook()}y.dependencies=WI(y.configPath),c((y.dependencies??[]).flatMap(J=>pb(J,t.folder))),y.configId=ZHe(y.configPath,y.dependencies),y.plugins=await gQe(N),j&&(y.classNames=await YX(j.root)),y.variants=yQe(y);let G=(0,DH.default)(y.config,"theme.screens",(0,DH.default)(y.config,"screens",{}));y.screens=VH(G)?Object.keys(G):[],y.enabled=!0,a(),i()}return{projectConfig:t,enabled(){return l},enable(){l=!0},state:y,documentSelector(){return h},tryInit:v,async dispose(){y={enabled:!1};for(let A of d)(await A).dispose()},async onUpdateSettings(A){y.enabled&&a(),A.editor.colorDecorators?i():r.sendNotification("@/tailwindCSS/clearColors")},onFileEvents:_,async onHover(A){return Sd(async()=>{if(!y.enabled)return null;let $=s.getDocument(A.textDocument.uri);return!$||!(await y.editor.getConfiguration($.uri)).tailwindCSS.hovers||await qu(y,$)?null:bZ(y,$,A.position)},null)},async onCompletion(A){return Sd(async()=>{if(!y.enabled)return null;let $=s.getDocument(A.textDocument.uri);return!$||!(await y.editor.getConfiguration($.uri)).tailwindCSS.suggestions||await qu(y,$)?null:wZ(y,$,A.position,A.context)},null)},onCompletionResolve(A){return Sd(()=>y.enabled?kZ(y,A):null,null)},async onCodeAction(A){return Sd(async()=>{if(!y.enabled)return null;let $=s.getDocument(A.textDocument.uri);return!$||!(await y.editor.getConfiguration($.uri)).tailwindCSS.codeActions?null:az(y,A,$)},null)},onDocumentLinks(A){if(!y.enabled)return null;let $=s.getDocument(A.textDocument.uri);return $?lz(y,$,x=>NR.URI.file(Un.resolve(Un.dirname(NR.URI.parse($.uri).fsPath),x)).toString()):null},provideDiagnostics:(0,tle.debounce)(A=>{y.enabled&&bC(y,A)},n.initializationOptions?.testMode?0:500),provideDiagnosticsForce:A=>{y.enabled&&bC(y,A)},async onDocumentColor(A){return Sd(async()=>{if(!y.enabled)return[];let $=s.getDocument(A.textDocument.uri);return $?await qu(y,$)?null:Hz(y,$):[]},null)},async onColorPresentation(A){let $=s.getDocument(A.textDocument.uri);if(!$)return[];let x=$.getText(A.range),S=x.match(new RegExp(`-\\[(${GHe.join("|")}|(?:(?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$`,"i"));if(S===null)return[];let C=S[1],w=GHe.includes(C),N={mode:"rgb",r:A.color.red,g:A.color.green,b:A.color.blue,alpha:A.color.alpha},R=rh.formatHex8(N);if(!w&&(C.length===4||C.length===5)){let[,...j]=R.match(/^#([a-f\d])\1([a-f\d])\2([a-f\d])\3(?:([a-f\d])\4)?$/i)??[];j.length&&(R=`#${j.filter(Boolean).join("")}`)}R.length===5?R=R.replace(/f$/,""):R.length===9&&(R=R.replace(/ff$/,""));let U=x.substr(0,S.index);return[R,rh.formatRgb(N).replace(/ /g,""),rh.formatHsl(N).replace(/ /g,"").replace(/\d+\.\d+(%?)/g,(j,G)=>`${Math.round(parseFloat(j))}${G}`)].map(j=>({label:`${U}-[${j}]`}))},sortClassLists(A){return y.jit?A.map($=>{let x="",S=$.split(/(\s+)/),C=S.filter((R,U)=>U%2===0),w=S.filter((R,U)=>U%2!==0);C[C.length-1]===""&&C.pop();let N;y.v4?N=y.designSystem.getClassOrder(C):y.jitContext.getClassOrder?N=y.jitContext.getClassOrder(C):N=mQe(y,C),C=N.sort(([,R],[,U])=>R===U?0:R===null?-1:U===null?1:of(R-U)).map(([R])=>R);for(let R=0;R<C.length;R++)x+=`${C[R]}${w[R]??""}`;return x}):A}}}function zHe(e,t){let r=e.config.prefix;return typeof r=="function"?r(t):r+t}function mQe(e,t){let r=new Set([zHe(e,"group"),zHe(e,"peer")]),n=[];for(let s of t){let i=e.modules.jit.generateRules.module(new Set([s]),e.jitContext).sort(([o],[a])=>of(a-o))[0]?.[0]??null;i===null&&r.has(s)&&(i=e.jitContext.layerOrder.components),n.push([s,i])}return n}function _Qe(e,t,r={}){let n=t.config,s=t.modules.postcss.module,i=t.browserslist,o=i&&i.includes("ie 11")?"ie11":"relaxed",a=typeof e=="function"?e:e.handler;try{a({addUtilities:()=>{},addComponents:()=>{},addBase:()=>{},matchUtilities:()=>{},addVariant:()=>{},e:c=>c,prefix:c=>c,theme:(c,u)=>(0,DH.default)(n,`theme.${c}`,u),variants:()=>[],config:(c,u)=>(0,DH.default)(n,c,u),corePlugins:c=>Array.isArray(n.corePlugins)?n.corePlugins.includes(c):(0,DH.default)(n,`corePlugins.${c}`,!0),target:c=>{if(typeof n.target=="string")return n.target==="browserslist"?o:n.target;let[u,H]=(0,DH.default)(n,"target"),l=(0,DH.default)(H,c,u);return l==="browserslist"?o:l},postcss:s,...r})}catch{}}function EQe(e){return e.type==="atrule"}function yQe(e){if(e.v4)return e.designSystem.getVariants();if(e.jitContext?.getVariants)return e.jitContext.getVariants();if(e.jit){let i=[];return Array.from(e.jitContext.variantMap).forEach(([o,a])=>{i.push({name:o,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>{function c(y){let g=e.modules.postcssSelectorParser.module.className();return g.value=y,(0,DH.default)(g,"raws.value",g.value)}let u=(Array.isArray(a[0])?a:[a]).map(([y,g])=>g),H="__variant_placeholder__",l=e.modules.postcss.module.root({nodes:[e.modules.postcss.module.rule({selector:`.${c(H)}`,nodes:[]})]}),f=e.modules.postcssSelectorParser.module(y=>y.first.filter(({type:g})=>g==="class").pop().value);function d(y){return f.transformSync(y)}function h(y){return l.each(g=>{g.type==="rule"&&(g.selectors=g.selectors.map(_=>y({get className(){return d(_)},selector:_})))}),l}let m=[];for(let y of u){let g,_=l.clone(),I=Lj(()=>y({container:_,separator:e.separator,modifySelectors:h,format:v=>{g=v.replace(/:merge\(([^)]+)\)/g,"$1")},wrap:v=>{EQe(v)&&(g=`@${v.name} ${v.params}`)}}));if(g||(g=I),g){m.push(g);continue}_.walkDecls(v=>{v.remove()}),g=_.toString().replace(`.${c(`${o}:${H}`)}`,"&").replace(/(?<!\\)[{}]/g,"").replace(/\s*\n\s*/g," ").trim(),g.includes(H)||m.push(g)}return m}})}),i}let t=e.config,r=e.modules.tailwindcss.version,n=["responsive","hover"];return Rr(r,"0.3.0")&&n.push("focus","group-hover"),Rr(r,"0.5.0")&&n.push("active"),Rr(r,"0.7.0")&&n.push("focus-within"),Rr(r,"1.0.0-beta.1")&&n.push("default"),Rr(r,"1.1.0")&&n.push("first","last","odd","even","disabled","visited"),Rr(r,"1.3.0")&&n.push("group-focus"),Rr(r,"1.5.0")&&n.push("focus-visible","checked"),Rr(r,"1.6.0")&&n.push("motion-safe","motion-reduce"),Rr(r,"2.0.0-alpha.1")&&n.push("dark"),(Array.isArray(t.plugins)?t.plugins:[]).forEach(i=>{_Qe(i,e,{addVariant:o=>{n.push(o)}})}),n.map(i=>({name:i,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>[]}))}async function gQe(e){let t=e.plugins;return Array.isArray(t)?Promise.all(t.map(async r=>{let n=r.config;VH(n)||(n={});let s={theme:VH(n.theme)?Object.keys(n.theme):[],variants:VH(n.variants)?Object.keys(n.variants):[]},i=r.handler||r,o=typeof i.name=="string"&&i.name!=="handler"&&i.name!==""?i.name:null;try{i()}catch(a){let c=ele.default.parse(a);if(c.length===0)return{name:o};let u=c[0].fileName,H=Un.dirname(u);if(!QHe.default.sync({cwd:H}))return{name:o};let f;try{f=require(f)}catch{return{name:o}}if(f.name&&Un.resolve(H,f.main||"index.js")===u)return{name:f.name,homepage:f.homepage,contributes:s}}return{name:o}})):[]}function LQe(e,t){try{let r=fc.default.sync(n=>{let s=Un.join(n,"package.json");if(fc.default.sync.exists(s))return s;if(n===Un.normalize(t))return fc.default.stop},{cwd:e});return r?Un.dirname(r):t}catch{return t}}function JHe(e,t,r,n){let s=n??require(e),i=s.content?.files??s.content,o=Array.isArray(i)?i:[],a=Rr(t,"3.2.0")?s.future?.relativeContentPathsByDefault||s.content?.relative:!1,c;return a?c=Un.dirname(e):c=LQe(Un.dirname(e),r),o.filter(u=>typeof u=="string").map(u=>u.startsWith("!")?`!${Un.resolve(c,u.slice(1))}`:Un.resolve(c,u)).map(u=>({pattern:(0,OR.default)(u),priority:1}))}var ule=Qt(lle());function MQe(){return{editor:{tabSize:2},tailwindCSS:{emmetCompletions:!1,classAttributes:["class","className","ngClass"],codeActions:!0,hovers:!0,suggestions:!0,validate:!0,colorDecorators:!0,rootFontSize:16,lint:{cssConflict:"warning",invalidApply:"error",invalidScreen:"error",invalidVariant:"error",invalidConfigPath:"error",invalidTailwindDirective:"error",recommendedVariantOrder:"warning"},showPixelEquivalents:!0,includeLanguages:{},files:{exclude:["**/.git/**","**/node_modules/**","**/.hg/**","**/.svn/**"]},experimental:{classRegex:[],configFile:null}}}}function cle(e){let t=new Map;async function r(s){let i=t.get(s);return i||(i=await n(s),t.set(s,i)),i}async function n(s){let[i,o]=await Promise.all([e.workspace.getConfiguration({section:"editor",scopeUri:s}),e.workspace.getConfiguration({section:"tailwindCSS",scopeUri:s})]);return i=VH(i)?i:{},o=VH(o)?o:{},(0,ule.default)(MQe(),{editor:i,tailwindCSS:o},{arrayMerge:(a,c,u)=>c})}return{get:r,clear(){t.clear()}}}var Jle=Qt(require("node:os")),Bs=Qt(require("node:path")),Yle=Qt(require("node:fs/promises")),Qle=Qt(Zle()),eue=Qt(cm()),fl=Qt(Pu());var gb=class{constructor(){this.parents=new Map;this.children=new Map;this.nodes=new Map}add(t,r){return this.nodes.has(t)?this.nodes.get(t):(this.nodes.set(t,r),this.parents.set(t,new Set),this.children.set(t,new Set),r)}connect(t,r){let n=this.children.get(t);if(!n)throw new Error(`Node ${t} does not exist`);let s=this.parents.get(r);if(!s)throw new Error(`Node ${r} does not exist`);s.add(t),n.add(r)}*descendants(t){let r=[],n=new Set;for(let s of this.children.get(t))r.push(s);for(;r.length>0;){let s=r.shift();if(!n.has(s)){yield this.nodes.get(s),n.add(s);for(let i of this.children.get(s))r.push(i)}}}*roots(){for(let[t,r]of this.parents)r.size===0&&(yield this.nodes.get(t))}*leaves(){for(let[t,r]of this.children)r.size===0&&(yield this.nodes.get(t))}};var tue=Qt(BC());var Lb=class extends Map{remember(t,r){let n=super.get(t);return n||(n=r(t),this.set(t,n)),n}};var Ib=Qt(ZT()),ch=Qt(require("node:path"));async function zle(e,t){async function r(n){let s=ch.join(n,"package.json");if(await Ib.default.exists(s))return s;if(n===ch.normalize(t))return Ib.default.stop}try{let n=await(0,Ib.default)(r,{cwd:e});return n?ch.dirname(n):t}catch{return t}}var Ab=class{constructor(t,r){this.base=t;this.settings=r}async search(){let t=await this.findConfigs(),r=await Promise.allSettled(t.map(s=>this.createProject(s))),n=[];for(let s of r)s.status==="rejected"?console.error(`[GLOBAL] Error creating project: ${s.reason}`):s.status==="fulfilled"&&s.value&&n.push(s.value);return n}async createProject(t){let r=await this.detectTailwindVersion(t);if(console.log(JSON.stringify({tailwind:r})),t.type==="js"&&t.source==="css"&&(r.isDefaultVersion||!r.features.includes("css-at-config"))||t.type==="css"&&!r.features.includes("css-at-theme")||t.type==="js"&&(t.path.endsWith(".ts")||t.path.endsWith(".mjs"))&&!r.features.includes("transpiled-configs"))return null;t.packageRoot=await zle(Bs.dirname(t.path),this.base);let n=[];for(let s of t.entries)s.type==="css"&&n.push({pattern:s.path,priority:0});n.push({pattern:t.path,priority:0});for await(let s of utt(t,r.features))n.push(s);for(let s of t.entries)s.type==="css"&&n.push({pattern:(0,fl.default)(Bs.join(Bs.dirname(s.path),"**")),priority:2});return n.push({pattern:(0,fl.default)(Bs.join(Bs.dirname(t.path),"**")),priority:3}),n.push({pattern:(0,fl.default)(Bs.join(t.packageRoot,"**")),priority:4}),n.sort((s,i)=>s.priority-i.priority),n=n.filter(({pattern:s},i,o)=>o.findIndex(({pattern:a})=>a===s)===i),{config:t,folder:this.base,isUserConfigured:!1,configPath:t.path,documentSelector:n,tailwind:r}}async findConfigs(){let t=await(0,Qle.default)([`**/${Ad}`,`**/${Kc}`],{cwd:this.base,ignore:this.settings.tailwindCSS.files.exclude,onlyFiles:!0,absolute:!0,suppressErrors:!0,dot:!0,concurrency:Math.max(Jle.cpus().length,1)});t=await Promise.all(t.map(async a=>(0,fl.default)(await Yle.realpath(a)))),t=Array.from(new Set(t)).sort();let r=new Lb,n=t.map(a=>(0,eue.default)(a,`**/${Kc}`,{dot:!0})?new K1("css",a):new K1("css",a,[r.remember(a,()=>({source:"js",type:"js",path:a,entries:[],packageRoot:null,content:[]}))])),s=n.filter(a=>a.type==="css");await Promise.all(s.map(a=>a.read()));let i=[];for(let a of s){if(!a.content)continue;let c=a.configPathInCss();if(c){a.content=null,a.configs.push(r.remember(c,()=>({source:"css",type:"js",path:c,entries:[],packageRoot:null,content:[]})));continue}if(a.isMaybeTailwindRelated()){i.push(a);continue}}await Promise.all(i.map(a=>a.resolveImports()));let o=new gb;for(let a of i){o.add(a.path,a);for(let c of a.deps){let u=(0,fl.default)(c.file);o.add(u,new K1("css",u)),o.connect(a.path,u)}}for(let a of o.roots()){let c=r.remember(a.path,()=>({source:"css",type:"css",path:a.path,entries:[],packageRoot:null,content:[{kind:"auto"}]}));a.configs.push(c);for(let u of o.descendants(a.path))u.configs.push(c)}for(let a of n)for(let c of a.configs)c.entries.push(a);return Array.from(r.values())}async detectTailwindVersion(t){try{let s=sn(Bs.dirname(t.path),"tailwindcss/package.json"),{version:i}=require(s),o=HE(i);if(typeof i=="string")return{version:i,features:o,isDefaultVersion:!1}}catch{}let{version:r}=If(),n=HE(r);return{version:r,features:n,isDefaultVersion:!0}}};function utt(e,t,r){if(e.type==="css")return ptt(e);if(e.type==="js")return ctt(e,t,r)}async function*ctt(e,t,r){let n=r??require(e.path),s=n.content?.files??n.content,i=Array.isArray(s)?s:[],a=(t.includes("relative-content-paths")?n.future?.relativeContentPathsByDefault||n.content?.relative:!1)?Bs.dirname(e.path):e.packageRoot;for(let c of i){if(typeof c!="string")continue;let u=c.startsWith("!")?`!${Bs.resolve(a,c.slice(1))}`:Bs.resolve(a,c);yield{pattern:(0,fl.default)(u),priority:1}}}async function*ptt(e){let t=!1;for(let r of e.content)if(r.kind==="file")yield{pattern:(0,fl.default)(r.file),priority:1};else if(r.kind==="auto"&&!t){t=!0;for await(let n of dtt(e.packageRoot))yield{pattern:(0,fl.default)(n),priority:1}}}async function*dtt(e){try{let r=await import(sn(Bs.dirname(e),"@tailwindcss/oxide"));if(!r.scanDir)return;let{files:n,globs:s}=await r.scanDir({base:e,globs:!0});yield*n,yield*s}catch{}}var ftt=go([(0,tue.default)()]),K1=class{constructor(t,r,n=[]){this.type=t;this.path=r;this.configs=n;this.deps=[]}async read(){try{this.content=await df(this.path)}catch{this.content=null}}async resolveImports(){try{let t=await ftt.process(this.content,{from:this.path});this.deps=t.messages.filter(r=>r.type==="dependency"),this.content=t.css}catch{}}configPathInCss(){if(!this.content)return null;let t=this.content.match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return t?(0,fl.default)(Bs.resolve(Bs.dirname(this.path),t.groups.config.slice(1,-1))):null}isMaybeTailwindRelated(){if(!this.content)return!1;let t=/@import\s*(?<config>'[^']+'|"[^"]+");/,r=/@tailwind\s*[^;]+;/,n=/@theme\s*\{/;return t.test(this.content)||r.test(this.content)||n.test(this.content)}};var Vue=['"',"'","`"," ",".","(","[","]","!","/","-"];async function Grt(e){let r=(await df(e)).match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return r?(0,Rp.default)(oa.resolve(oa.dirname(e),r.groups.config.slice(1,-1))):null}var Ob=class{constructor(t){this.connection=t;this.lspHandlersAdded=!1;this.disposables=[];this.watchPatterns=()=>{};this.watched=[];this.documentService=new Tg(this.connection),this.projects=new Map,this.projectCounter=0,this.settingsCache=cle(t)}async init(){this.initPromise||(this.initPromise=this._init()),await this.initPromise}async _init(){pm();let t;if(this.initializeParams.rootUri?t=Nb.URI.parse(this.initializeParams.rootUri).fsPath:this.initializeParams.rootPath&&(t=gj(this.initializeParams.rootPath)),!t){console.error("No workspace folders found, not initializing.");return}t=(0,Rp.default)(t);let r=[],n=await this.settingsCache.get(),s=n.tailwindCSS.files.exclude,i=n.tailwindCSS.experimental.configFile,o=new Map,a=new Map,c=this.initializeParams.initializationOptions?.workspaceFile?oa.dirname(this.initializeParams.initializationOptions.workspaceFile):t;if(i){if(typeof i!="string"&&(!VH(i)||!Object.entries(i).every(([f,d])=>typeof f!="string"?!1:Array.isArray(d)?d.every(h=>typeof h=="string"):typeof d=="string"))){console.error("Invalid `experimental.configFile` configuration, not initializing.");return}let l=typeof i=="string"?{[i]:oa.resolve(t,"**")}:i;r=Object.entries(l).map(([f,d])=>{let h=(0,Rp.default)(oa.resolve(c,f));return{folder:t,configPath:h,config:{path:h},documentSelector:[].concat(d).map(m=>({priority:0,pattern:(0,Rp.default)(oa.resolve(c,m))})),isUserConfigured:!0,tailwind:{version:null,features:[],isDefaultVersion:!1}}})}else{console.log("Searching for Tailwind CSS projects in the workspace's folders.");let f=await new Ab(t,n).search();f.length===1&&f[0].documentSelector.push({pattern:(0,Rp.default)(oa.join(t,"**")),priority:5});for(let d of f)if(a.set(d.config.path,d.tailwind.version),d.config.source==="css")for(let h of d.config.entries)h.type==="css"&&o.set(h.path,d.config.path);f.length>0&&(r=f)}let u=r.map(l=>({folder:l.folder,config:l.config.path,selectors:l.documentSelector,user:l.isUserConfigured,tailwind:l.tailwind}));console.log(`[Global] Creating projects: ${JSON.stringify(u)}`);let H=async l=>{let f=!1;e:for(let d of l){let h=(0,Rp.default)(d.file);for(let _ of s)if((0,Op.default)(h,_,{dot:!0}))continue e;if((0,Op.default)(h,`**/${bd}`,{dot:!0}))for(let[,_]of this.projects){let I=If().version;try{let v=require(sn(oa.dirname(_.projectConfig.configPath),"tailwindcss/package.json")).version;typeof v=="string"&&(I=v)}catch{}if(a.get(_.projectConfig.configPath)!==I){f=!0;break e}}if((0,Op.default)(h,`**/${Kc}`,{dot:!0})&&d.type!==Vn.FileChangeType.Deleted){let _=await Grt(d.file);if(o.has(h)&&o.get(h)!==_){f=!0;break}else if(!o.has(h)&&_){f=!0;break}}if((0,Op.default)(h,`**/${Ad}`,{dot:!0})&&d.type===Vn.FileChangeType.Created){f=!0;break}for(let[,_]of this.projects)if(d.type===Vn.FileChangeType.Deleted&&dm(h,[_.projectConfig.configPath])){f=!0;break e}}if(f){this.restart();return}for(let[,d]of this.projects)d.onFileEvents(l)};if(this.initializeParams.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration){this.disposables.push(this.connection.onDidChangeWatchedFiles(async({changes:f})=>{let d=f.map(({uri:h,type:m})=>({file:Nb.URI.parse(h).fsPath,type:m})).filter((h,m,y)=>y.findIndex(g=>g.file===h.file&&g.type===h.type)===m);await H(d)}));let l=await this.connection.client.register(Vn.DidChangeWatchedFilesNotification.type,{watchers:[{globPattern:`**/${Ad}`},{globPattern:`**/${bd}`},{globPattern:`**/${Kc}`}]});this.disposables.push(l),this.watchPatterns=f=>{let d=this.filterNewWatchPatterns(f);d.length&&(console.log(`[Global] Adding watch patterns: ${d.join(", ")}`),this.connection.client.register(Vn.DidChangeWatchedFilesNotification.type,{watchers:d.map(h=>({globPattern:h}))}).then(h=>{this.disposables.push(h)}))}}else if(Rb.getBinding()){let l={create:Vn.FileChangeType.Created,update:Vn.FileChangeType.Changed,delete:Vn.FileChangeType.Deleted},f=await Rb.subscribe(t,(d,h)=>{H(h.map(m=>({file:m.path,type:l[m.type]})))},{ignore:s.map(d=>oa.resolve(t,d.replace(/^[*/]+/,"").replace(/[*/]+$/,"")))});this.disposables.push({dispose(){f.unsubscribe()}})}else{let l=Wue().watch,f=l([`**/${Ad}`,`**/${bd}`,`**/${Kc}`],{cwd:t,ignorePermissionErrors:!0,ignoreInitial:!0,ignored:s,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}});await new Promise(d=>{f.on("ready",()=>d())}),f.on("add",d=>H([{file:oa.resolve(t,d),type:Vn.FileChangeType.Created}])).on("change",d=>H([{file:oa.resolve(t,d),type:Vn.FileChangeType.Changed}])).on("unlink",d=>H([{file:oa.resolve(t,d),type:Vn.FileChangeType.Deleted}])),this.disposables.push({dispose(){f.close()}}),this.watchPatterns=d=>{let h=this.filterNewWatchPatterns(d);h.length&&(console.log(`[Global] Adding watch patterns: ${h.join(", ")}`),f.add(h))}}await Promise.all(r.map(l=>this.addProject(l,this.initializeParams,this.watchPatterns,a.get(l.configPath))));for(let l of this.documentService.getAllDocuments()){let f=this.getProject(l);f&&!f.enabled()&&(f.enable(),await f.tryInit())}this.setupLSPHandlers(),this.disposables.push(this.connection.onDidChangeConfiguration(async({settings:l})=>{let f=n.tailwindCSS.files.exclude;if(this.settingsCache.clear(),n=await this.settingsCache.get(),!oo(f,n.tailwindCSS.files.exclude)){this.restart();return}for(let[,d]of this.projects)d.onUpdateSettings(l)})),this.disposables.push(this.connection.onShutdown(()=>{this.dispose()})),this.disposables.push(this.documentService.onDidChangeContent(l=>{this.getProject(l.document)?.provideDiagnostics(l.document)})),this.disposables.push(this.documentService.onDidOpen(l=>{let f=this.getProject(l.document);f&&!f.enabled()&&(f.enable(),f.tryInit())}))}filterNewWatchPatterns(t){let r=t.filter(n=>!this.watched.includes(n));return this.watched.push(...r),r}async addProject(t,r,n,s){let i=String(this.projectCounter++),o=await sle(i,t,this.connection,r,this.documentService,()=>this.updateCapabilities(),()=>{for(let a of this.documentService.getAllDocuments()){let c=this.getProject(a);if(c&&!c.enabled()){c.enable(),c.tryInit();break}}},()=>this.refreshDiagnostics(),a=>n(a),s,this.settingsCache.get);this.projects.set(i,o),this.supportsTailwindProjectDetails&&this.connection.sendNotification("tailwind/projectDetails",{config:t.configPath,tailwind:t.tailwind})}get supportsTailwindProjectDetails(){return this.initializeParams.capabilities.experimental?.tailwind?.projectDetails??!1}refreshDiagnostics(){for(let t of this.documentService.getAllDocuments()){let r=this.getProject(t);r?r.provideDiagnosticsForce(t):this.connection.sendDiagnostics({uri:t.uri,diagnostics:[]})}}setupLSPHandlers(){this.lspHandlersAdded||(this.lspHandlersAdded=!0,this.connection.onHover(this.onHover.bind(this)),this.connection.onCompletion(this.onCompletion.bind(this)),this.connection.onCompletionResolve(this.onCompletionResolve.bind(this)),this.connection.onDocumentColor(this.onDocumentColor.bind(this)),this.connection.onColorPresentation(this.onColorPresentation.bind(this)),this.connection.onCodeAction(this.onCodeAction.bind(this)),this.connection.onDocumentLinks(this.onDocumentLinks.bind(this)),this.connection.onRequest(this.onRequest.bind(this)))}onRequest(t,r){if(t==="@/tailwindCSS/sortSelection"){let n=this.getProject({uri:r.uri});if(!n)return{error:"no-project"};try{return{classLists:n.sortClassLists(r.classLists)}}catch{return{error:"unknown"}}}if(t==="@/tailwindCSS/getProject"){let n=this.getProject({uri:r.uri});return!n||!n.enabled()||!n.state?.enabled?null:{version:n.state.version}}}updateCapabilities(){if(!Xue(this.initializeParams))return;this.registrations&&this.registrations.then(n=>n.dispose());let t=Array.from(this.projects.values()),r=Vn.BulkRegistration.create();r.add(Vn.HoverRequest.type,{documentSelector:null}),r.add(Vn.DocumentColorRequest.type,{documentSelector:null}),r.add(Vn.CodeActionRequest.type,{documentSelector:null}),r.add(Vn.DocumentLinkRequest.type,{documentSelector:null}),r.add(Vn.CompletionRequest.type,{documentSelector:null,resolveProvider:!0,triggerCharacters:[...Vue,...t.map(n=>n.state.separator).filter(n=>typeof n=="string").map(n=>n.slice(-1))].filter(Boolean)}),this.registrations=this.connection.client.register(r)}getProject(t){let r,n,s=1/0;for(let[,i]of this.projects)if(i.projectConfig.configPath){let o=i.documentSelector().concat().sort((a,c)=>a.pattern.startsWith("!")&&!c.pattern.startsWith("!")?-1:!a.pattern.startsWith("!")&&c.pattern.startsWith("!")?1:0);for(let a of o){let c=Nb.URI.parse(t.uri).fsPath,u=a.pattern.replace(/[\[\]{}]/g,H=>`\\${H}`);if(u.startsWith("!")&&(0,Op.default)(c,u.slice(1),{dot:!0}))break;(0,Op.default)(c,u,{dot:!0})&&a.priority<s&&(n=i,s=a.priority)}}else r||(r=i);return n||r}async onDocumentColor(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentColor(t)??[]}async onColorPresentation(t){return await this.init(),this.getProject(t.textDocument)?.onColorPresentation(t)??[]}async onHover(t){return await this.init(),this.getProject(t.textDocument)?.onHover(t)??null}async onCompletion(t){return await this.init(),this.getProject(t.textDocument)?.onCompletion(t)??null}async onCompletionResolve(t){return await this.init(),this.projects.get(t.data?._projectKey)?.onCompletionResolve(t)??null}async onCodeAction(t){return await this.init(),this.getProject(t.textDocument)?.onCodeAction(t)??null}async onDocumentLinks(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentLinks(t)??null}setup(){this.connection.onInitialize(async t=>(this.initializeParams=t,Xue(t)?{capabilities:{textDocumentSync:Vn.TextDocumentSyncKind.Full}}:(this.setupLSPHandlers(),{capabilities:{textDocumentSync:Vn.TextDocumentSyncKind.Full,hoverProvider:!0,colorProvider:!0,codeActionProvider:!0,documentLinkProvider:{},completionProvider:{resolveProvider:!0,triggerCharacters:[...Vue,":"]}}}))),this.connection.onInitialized(()=>this.init())}listen(){this.connection.listen()}dispose(){this.connection.sendNotification("@/tailwindCSS/projectsDestroyed");for(let[,t]of this.projects)t.dispose();this.projects=new Map,this.refreshDiagnostics(),this.registrations&&(this.registrations.then(t=>t.dispose()),this.registrations=void 0),this.disposables.forEach(t=>t.dispose()),this.disposables.length=0,this.watched.length=0}restart(){console.log(`----------
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@tailwindcss/language-server",
|
3
3
|
"description": "Tailwind CSS Language Server",
|
4
4
|
"license": "MIT",
|
5
|
-
"version": "0.0.0-insiders.
|
5
|
+
"version": "0.0.0-insiders.78b8ca4",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
8
8
|
"url": "git+https://github.com/tailwindlabs/tailwindcss-intellisense.git",
|