@tailwindcss/upgrade 4.0.0-alpha.26 → 4.0.0-alpha.27
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.
- package/dist/index.mjs +121 -9
- package/package.json +6 -4
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,123 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{globby as
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function nt(){if(typeof globalThis.__tw_version=="string")return globalThis.__tw_version;let{version:e}=JSON.parse(rt.readFileSync(le("tailwindcss/package.json"),"utf-8"));return e}function ae({invalid:e,usage:t,options:i}){let r=process.stdout.columns;if(h(O()),e&&(h(),h(`${x.dim("Invalid command:")} ${e}`)),t&&t.length>0){h(),h(x.dim("Usage:"));for(let[n,o]of t.entries()){let l=o.slice(0,o.indexOf("[")),a=o.slice(o.indexOf("["));a=a.replace(/\[.*?\]/g,u=>x.dim(u));let c=T(a,r-z.indent-l.length-1);c.length>1&&n!==0&&h(),h(A(`${l}${c.shift()}`));for(let u of c)h(A(u,l.length))}}if(i){let n=0;for(let{alias:s}of Object.values(i))s&&(n=Math.max(n,s.length));let o=[],l=0;for(let[s,{alias:c}]of Object.entries(i)){let u=[c&&`${c.padStart(n)}`,c?s:" ".repeat(n+2)+s].filter(Boolean).join(", ");o.push(u),l=Math.max(l,u.length)}h(),h(x.dim("Options:"));let a=8;for(let{description:s,default:c=null}of Object.values(i)){let u=o.shift(),p=a+(l-u.length),f=2,d=r-u.length-p-f-z.indent,g=T(c!==null?`${s} ${x.dim(`[default:\u202F${P(`${c}`)}]`)}`:s,d);h(A(`${x.blue(u)} ${x.dim(x.gray("\xB7")).repeat(p)} ${g.shift()}`));for(let m of g)h(A(`${" ".repeat(u.length+p+f)}${m}`))}}}import Ne from"node:fs/promises";import xt from"node:path";import kt from"postcss";import{parse as lt}from"postcss";import{format as at}from"prettier";function v(e,t){let i;return e.each?.(r=>{let n=t(r)??0;if(n===2)return i=!1,i;if(n!==1)return i=v(r,t),i}),i}function X(e,t){e?.each?.(i=>{X(i,t),t(i)})}function se(){async function e(t){let i=[];v(t,r=>{if(r.raws.tailwind_pretty)return i.push(r),1}),await Promise.all(i.map(async r=>{r.replaceWith(lt(await at(r.toString(),{parser:"css",semi:!0})))}))}return{postcssPlugin:"@tailwindcss/upgrade/format-nodes",OnceExit:e}}var U=new Uint8Array(256);function w(e,t){let i=0,r=[],n=0,o=e.length,l=t.charCodeAt(0);for(let a=0;a<o;a++){let s=e.charCodeAt(a);if(i===0&&s===l){r.push(e.slice(n,a)),n=a+1;continue}switch(s){case 92:a+=1;break;case 39:case 34:for(;++a<o;){let c=e.charCodeAt(a);if(c===92){a+=1;continue}if(c===s)break}break;case 40:U[i]=41,i++;break;case 91:U[i]=93,i++;break;case 123:U[i]=125,i++;break;case 93:case 125:case 41:i>0&&s===U[i-1]&&i--;break}}return r.push(e.slice(n)),r}import be from"node:fs/promises";import yt from"node:path";import{Scanner as st}from"@tailwindcss/oxide";import ue from"string-byte-slice";async function fe(e){let i=new st({}).getCandidatesWithPositions({content:e,extension:"html"}),r=[];for(let{candidate:n,position:o}of i)r.push({rawCandidate:n,start:o,end:o+n.length});return r}function b(e,t){let i=[];for(let n of t.variants)i.unshift(ce(n));e.theme.prefix&&i.unshift(e.theme.prefix);let r="";return(t.kind==="static"||t.kind==="functional")&&t.negative&&(r+="-"),t.kind==="static"&&(r+=t.root),t.kind==="functional"&&(r+=t.root,t.value&&(t.value.kind==="arbitrary"?t.value===null?r+="":t.value.dataType?r+=`-[${t.value.dataType}:${k(t.value.value)}]`:r+=`-[${k(t.value.value)}]`:t.value.kind==="named"&&(r+=`-${t.value.value}`))),t.kind==="arbitrary"&&(r+=`[${t.property}:${k(t.value)}]`),(t.kind==="arbitrary"||t.kind==="functional")&&t.modifier&&(t.modifier.kind==="arbitrary"?r+=`/[${k(t.modifier.value)}]`:t.modifier.kind==="named"&&(r+=`/${t.modifier.value}`)),t.important&&(r+="!"),i.push(r),i.join(":")}function ce(e){if(e.kind==="static")return e.root;if(e.kind==="arbitrary")return`[${k(e.selector)}]`;let t="";return e.kind==="functional"&&(t+=e.root,e.value&&(e.value.kind==="arbitrary"?t+=`-[${k(e.value.value)}]`:e.value.kind==="named"&&(t+=`-${e.value.value}`))),e.kind==="compound"&&(t+=e.root,t+="-",t+=ce(e.variant)),(e.kind==="functional"||e.kind==="compound")&&e.modifier&&(e.modifier.kind==="arbitrary"?t+=`/[${k(e.modifier.value)}]`:e.modifier.kind==="named"&&(t+=`/${e.modifier.value}`)),t}function k(e){return e.replaceAll("_",String.raw`\_`).replaceAll(" ","_")}function pe(e,t,i,r){return ue(e,0,i)+t+ue(e,r)}function C(e,t,i=null,r={}){for(let n=0;n<e.length;n++){let o=e[n];if(o.kind==="context"){C(o.nodes,t,i,{...r,...o.context});continue}let l=t(o,{parent:i,replaceWith(a){e.splice(n,1,...Array.isArray(a)?a:[a]),n--},context:r})??0;if(l===2)return;l!==1&&o.kind==="rule"&&C(o.nodes,t,o,r)}}function ge(e,t,i){for(let r of e.parseCandidate(i)){let n=!1;if("modifier"in r&&r.modifier?.kind==="arbitrary"&&!B(e,r,r.modifier.value)){let{value:o,didChange:l}=L(r.modifier.value);r.modifier.value=o,n||=l}for(let o of r.variants)de(e,o)&&(n=!0);if(r.kind==="arbitrary"&&!B(e,r,r.value)){let{value:o,didChange:l}=L(r.value);r.value=o,n||=l}if(r.kind==="functional"&&r.value&&r.value.kind==="arbitrary"&&!B(e,r,r.value.value)){let{value:o,didChange:l}=L(r.value.value);r.value.value=o,n||=l}if(n)return b(e,r)}return i}function L(e){let t=!1;return e.startsWith("--")?(e=`var(${e})`,t=!0):e.startsWith(" --")&&(e=e.slice(1),t=!0),{value:e,didChange:t}}function de(e,t){let i=!1;if(t.kind==="functional"&&t.value&&t.value.kind==="arbitrary"&&!B(e,ut(t),t.value.value)){let{value:r,didChange:n}=L(t.value.value);t.value.value=r,i||=n}return t.kind==="compound"&&de(e,t.variant)&&(i=!0),i}function ut(e){return{kind:"arbitrary",property:"color",value:"red",modifier:null,variants:[e],important:!1,raw:"candidate"}}var ft=new Set(["scroll-timeline-name","timeline-scope","view-timeline-name","font-palette","anchor-name","anchor-scope","position-anchor","position-try-options","scroll-timeline","animation-timeline","view-timeline","position-try"]);function B(e,t,i){let r=e.compileAstNodes(t).map(o=>o.node),n=!1;return C(r,o=>{if(o.kind==="declaration"&&ft.has(o.property)&&o.value==i)return n=!0,2}),n}var ct=["t","tr","r","br","b","bl","l","tl"];function me(e,t,i){for(let r of e.parseCandidate(i))if(r.kind==="static"&&r.root.startsWith("bg-gradient-to-")){let n=r.root.slice(15);if(!ct.includes(n))continue;return r.root=`bg-linear-to-${n}`,b(e,r)}return i}function he(e,t,i){for(let r of e.parseCandidate(i))if(r.important&&r.raw[r.raw.length-1]!=="!")return b(e,r);return i}function ve(e,t,i){if(!e.theme.prefix)return i;let r=pt(e,t,i);if(!r)return i;let n=e.theme.prefix,o=null;try{e.theme.prefix=null;let l=i.slice(0,r.start)+r.base+i.slice(r.end),a=e.parseCandidate(l);a.length>0&&(o=a[0])}finally{e.theme.prefix=n}return o?b(e,o):i}function pt(e,t,i){if(!e.theme.prefix)return null;if(!t.prefix)throw new Error("Could not find the Tailwind CSS v3 `prefix` configuration inside the JavaScript config.");let n=w(i,":").pop(),o=i.length-n.length,l=o+n.length,a=!1,s=!1;return n[n.length-1]==="!"?(a=!0,n=n.slice(0,-1)):n[0]==="!"&&(a=!0,n=n.slice(1)),n[0]==="-"&&(s=!0,n=n.slice(1)),!n.startsWith(t.prefix)&&n[0]!=="["?null:(n[0]!=="["&&(n=n.slice(t.prefix.length)),s&&(n="-"+n),a&&(n+="!"),{base:n,start:o,end:l})}var gt=/([a-z]+)/;function ye(e){let t=gt.exec(e.toLocaleLowerCase());return t?t[0]:(console.warn(`The prefix "${e} can not be used with Tailwind CSS v4 and cannot be converted to a valid one automatically. We've updated it to "tw" for you.`),"tw")}function we(e,t,i){for(let r of e.parseCandidate(i)){if(r.variants.length<=1)continue;let n=[],o=[],l=[],a=r.variants;for(let u of r.variants)dt(e,u)?n.push(u):ht(e,u)?l.push(u):o.push(u);let s=o.some(u=>mt(e,u)),c=[...l,...s?o.reverse():o,...n];if(!vt(a,c))return b(e,{...r,variants:c})}return i}function dt(e,t){return t.kind==="static"&&t.root==="dark"?!0:Q(e,t).every(r=>r.kind==="rule"&&r.selector[0]==="@")}function mt(e,t){return Q(e,t).some(r=>r.kind==="rule"&&r.selector[0]!=="@"&&(r.selector.includes(" ")||r.selector.includes(">")||r.selector.includes("+")||r.selector.includes("~")))}function ht(e,t){return Q(e,t).some(r=>r.kind==="rule"&&(r.selector.includes("::after")||r.selector.includes("::backdrop")||r.selector.includes("::before")||r.selector.includes("::first-letter")||r.selector.includes("::first-line")||r.selector.includes("::marker")||r.selector.includes("::placeholder")||r.selector.includes("::selection")))}function Q(e,t){let i=[],r=e.compileAstNodes({kind:"arbitrary",property:"color",value:"red",modifier:null,variants:[t],important:!1,raw:"candidate"}).map(n=>n.node);return C(r,n=>{n.kind==="rule"&&n.selector===".candidate"||n.kind==="declaration"&&n.property==="color"&&n.value==="red"||i.push(n)}),i}function vt(e,t){return e.length!==t.length?!1:e.every((i,r)=>t[r]===i)}var wt=[ve,he,ge,me,we];function Z(e,t,i){for(let r of wt)i=r(e,t,i);return i}async function xe(e,t,i){let r=await fe(i);r.sort((o,l)=>l.start-o.start);let n=i;for(let{rawCandidate:o,start:l,end:a}of r){let s=Z(e,t,o);s!==o&&(n=pe(n,s,l,a))}return n}async function ke(e,t,i){let r=yt.resolve(process.cwd(),i),n=await be.readFile(r,"utf-8");await be.writeFile(r,await xe(e,t,n))}function $e({designSystem:e,userConfig:t}={}){function i(r){let n=r.params.split(/(\s+)/),o=n[n.length-1]==="!important"||n[n.length-1]==="#{!important}";o&&n.pop();let l=n.map(a=>{if(a.trim()==="")return a;let s=w(a,":"),c=s.pop();return o&&c[0]!=="!"&&c[c.length-1]!=="!"&&(c+="!"),c[0]==="!"&&(c=`${c.slice(1)}!`),[...s,c].join(":")});e&&t&&(l=l.map(a=>Z(e,t,a))),r.params=l.join("").trim()}return{postcssPlugin:"@tailwindcss/upgrade/migrate-at-apply",OnceExit(r){r.walkAtRules("apply",i)}}}import"postcss";import I from"postcss-selector-parser";function Te(){function e(t){if(t.params!=="utilities"&&t.params!=="components")return;let i=t.clone();v(t,o=>{if(o.type!=="rule")return;let l=w(o.selector,",");if(l.length>1){let a=[];for(let s of l){let c=o.clone({selector:s});a.push(c)}o.replaceWith(a)}return 1});let r=new Set;v(t,o=>{if(o.type==="rule")return I(l=>{l.each(a=>{v(a,s=>{if(s.type==="pseudo"&&s.value===":not")return 1;s.type==="class"&&r.add(s.value)})})}).processSync(o.selector,{updateSelector:!1}),1}),v(i,o=>{o.type==="rule"&&I(l=>{l.each(a=>{v(a,s=>{if(s.type==="pseudo"&&s.value===":not")return 1;if(s.type==="class"&&r.has(s.value))return o.remove(),2})})}).processSync(o,{updateSelector:!0})});let n=[i];for(let o of r){let l=t.clone();n.push(l),v(l,a=>{if(a.type!=="rule")return;let s=!1;if(I(c=>{c.each(u=>{v(u,p=>{if(p.type==="pseudo"&&p.value===":not")return 1;if(p.type==="class"&&p.value===o){s=!0;let f=u.atPosition(p.source.start.line,p.source.start.column),d=f.parent,g=(f.parent?.index(f)??0)-1;for(;g>=0&&d.at(g)?.type!=="combinator";){let m=d.at(g+1),S=d.at(g);d.at(g+1).replaceWith(S),d.at(g).replaceWith(m),g--}f.replaceWith(I.nesting())}})})}).processSync(a,{updateSelector:!0}),!s){let c=[a],u=a.parent?.index(a)??null;if(u!==null)for(let p=u-1;p>=0&&a.parent?.nodes.at(p)?.type!=="rule";p--)a.parent?.nodes.at(p)?.type==="comment"&&c.push(a.parent?.nodes.at(p));for(let p of c)p.remove()}return 1}),l.name="utility",l.params=o,l.raws.tailwind_pretty=!0,l.raws.before+=`
|
|
5
|
-
|
|
6
|
-
`}for(let o=n.length-1;o>=0;o--){let l=n[o];X(l,a=>{if(l===i&&a.type==="comment"){let s=!1;for(let c of n)if(c!==i&&(v(c,u=>{if(u.type==="comment"&&u.source?.start?.offset===a.source?.start?.offset)return a.remove(),s=!0,2}),s))return 1}if((a.type==="rule"||a.type==="atrule")&&a.nodes?.length===0)a.remove();else if(a.type==="rule"&&a.selector==="&"){let s=a.parent,c=!1;for(;s;){if(s.type==="rule"){c=!0;break}s=s.parent}c||a.replaceWith(a.nodes)}}),l.nodes?.length===0&&n.splice(o,1)}t.replaceWith(n)}return{postcssPlugin:"@tailwindcss/upgrade/migrate-at-layer-utilities",OnceExit:t=>{t.walkAtRules("layer",e);{let i=new Map;v(t,r=>{if(r.type==="atrule"&&r.name==="utility"){let n=i.get(r.params);n?(n.append(r.nodes),r.remove()):i.set(r.params,r)}})}}}}import{AtRule as bt}from"postcss";function Ke(){function e(t){let i="",r=[],n=[],o=null;t.each(l=>{if(l.type==="atrule"){if(l.name==="theme"||l.name==="utility"){r.length>0&&n.push([i,r.splice(0)]);return}if(l.name==="tailwind"&&l.params==="base"||l.name==="import"&&l.params.match(/^["']tailwindcss\/base["']/)){r.length>0&&n.push([i,r.splice(0)]),o??="base",i="base";return}if(l.name==="tailwind"&&l.params==="components"||l.name==="import"&&l.params.match(/^["']tailwindcss\/components["']/)){r.length>0&&n.push([i,r.splice(0)]),o??="components",i="components";return}if(l.name==="tailwind"&&l.params==="utilities"||l.name==="import"&&l.params.match(/^["']tailwindcss\/utilities["']/)){r.length>0&&n.push([i,r.splice(0)]),o??="utilities",i="utilities";return}if(l.name==="layer"){r.length>0&&n.push([i,r.splice(0)]);return}if(l.name==="import"){i!==""&&!l.params.includes("layer(")&&(l.params+=` layer(${i})`),r.length>0&&n.push([i,r.splice(0)]);return}}i===""&&(l.type==="comment"||l.type==="atrule"&&!l.nodes||l.type==="atrule"&&l.name==="charset")||r.push(l)});for(let[l,a]of n){if(a.every(u=>u.type==="comment"))continue;let s=a[0],c=new bt({name:"layer",params:l||o||"",nodes:a.map(u=>u===s?u:u.remove()),raws:{tailwind_pretty:!0}});s.replaceWith(c)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-missing-layers",OnceExit:e}}import{AtRule as W}from"postcss";var ee=["theme","base","components","utilities"];function Ce(e){let t=e.newPrefix?` prefix(${e.newPrefix})`:"";function i(r){let n=null,o=null,l=[],a=null,s=null,c=null,u=null,p=[];r.walkAtRules(f=>{f.name==="import"&&f.params.match(/^["']tailwindcss\/tailwind\.css["']$/)&&(f.params=f.params.replace("tailwindcss/tailwind.css","tailwindcss")),f.name==="import"&&f.params.match(/^["']tailwindcss["']/)?f.params+=t:f.name==="tailwind"&&f.params==="base"||f.name==="import"&&f.params.match(/^["']tailwindcss\/base["']$/)?(p.push("base"),l.push(f),n=f):f.name==="tailwind"&&f.params==="utilities"||f.name==="import"&&f.params.match(/^["']tailwindcss\/utilities["']$/)?(p.push("utilities"),l.push(f),o=f):(f.name==="tailwind"&&f.params==="components"||f.name==="tailwind"&&f.params==="screens"||f.name==="tailwind"&&f.params==="variants"||f.name==="import"&&f.params.match(/^["']tailwindcss\/components["']$/))&&f.remove()}),n!==null&&o!==null?(a||M(l).before(new W({name:"import",params:`'tailwindcss'${t}`})),n?.remove(),o?.remove()):o!==null?(s||M(l).before(new W({name:"import",params:"'tailwindcss/utilities' layer(utilities)"})),o?.remove()):n!==null&&(u||M(l).before(new W({name:"import",params:`'tailwindcss/theme' layer(theme)${t}`})),c||M(l).before(new W({name:"import",params:"'tailwindcss/preflight' layer(base)"})),n?.remove());{let f=p.toSorted((d,g)=>ee.indexOf(d)-ee.indexOf(g));if(p.some((d,g)=>d!==f[g])){let d=ee.toSorted((g,m)=>p.indexOf(g)-p.indexOf(m));r.prepend({name:"layer",params:d.join(", ")})}}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-tailwind-directives",OnceExit:i}}function M(e){let t=e.at(0),i=t.prev();for(;i;){if(i.type==="rule"&&(t=i),i.type==="atrule")if(i.name==="charset"||i.name==="import"){i=i.prev();continue}else if(i.name==="layer"&&!i.nodes){i=i.prev();continue}else t=i;i=i.prev()}return t}async function $t(e,t,i){return kt().use($e(t)).use(Te()).use(Ke()).use(Ce(t)).use(se()).process(e,{from:i}).then(r=>r.css)}async function Se(e,t){let i=xt.resolve(process.cwd(),e),r=await Ne.readFile(i,"utf-8");await Ne.writeFile(i,await $t(r,t,i))}import{__unstable__loadDesignSystem as We,compile as Ft}from"@tailwindcss/node";import ie from"node:path";import{dirname as Me}from"path";import{fileURLToPath as Ut}from"url";import G from"enhanced-resolve";import{createJiti as At}from"jiti";import ze from"node:fs";import yi from"node:fs/promises";import bi,{dirname as Ve,extname as xi}from"node:path";import{pathToFileURL as Ee}from"node:url";import{__unstable__loadDesignSystem as Ti,compile as Ki}from"tailwindcss";import te from"node:fs/promises";import V from"node:path";var Tt=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],Kt=[".js",".cjs",".mjs"],Ct=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Nt=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function St(e,t){for(let i of t){let r=`${e}${i}`;if((await te.stat(r).catch(()=>null))?.isFile())return r}for(let i of t){let r=`${e}/index${i}`;if(await te.access(r).then(()=>!0,()=>!1))return r}return null}async function Ae(e,t,i,r){let n=Kt.includes(r)?Ct:Nt,o=await St(V.resolve(i,t),n);if(o===null||e.has(o))return;e.add(o),i=V.dirname(o),r=V.extname(o);let l=await te.readFile(o,"utf-8"),a=[];for(let s of Tt)for(let c of l.matchAll(s))c[1].startsWith(".")&&a.push(Ae(e,c[1],i,r));await Promise.all(a)}async function _e(e){let t=new Set;return await Ae(t,e,V.dirname(e),V.extname(e)),Array.from(t)}async function Oe(e,t,i){if(e[0]!=="."){let l=await je(e,t);if(!l)throw new Error(`Could not resolve '${e}' from '${t}'`);let a=await Re(Ee(l).href);return{base:Ve(l),module:a.default??a}}let r=await je(e,t);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);let[n,o]=await Promise.all([Re(Ee(r).href+"?id="+Date.now()),_e(r)]);for(let l of o)i(l);return{base:Ve(r),module:n.default??n}}var De=null;async function Re(e){try{return await import(e)}catch(t){try{return De??=At(import.meta.url,{moduleCache:!1,fsCache:!1}),await De.import(e)}catch{}throw t}}var Ni=G.ResolverFactory.createResolver({fileSystem:new G.CachedInputFileSystem(ze,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});var _t=G.ResolverFactory.createResolver({fileSystem:new G.CachedInputFileSystem(ze,4e3),useSyncFileSystemCalls:!0});function je(e,t){return Vt(_t,e,t)}function Vt(e,t,i){return new Promise((r,n)=>e.resolve({},i,t,{},(o,l)=>{if(o)return n(o);r(l)}))}var E=class extends Map{constructor(i){super();this.factory=i}get(i){let r=super.get(i);return r===void 0&&(r=this.factory(i,this),this.set(i,r)),r}};var Et=["anchor-size"],ji=new RegExp(`(${Et.join("|")})\\(`,"g");var $=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,Bi=new RegExp(`^${$.source}$`);var Ii=new RegExp(`^${$.source}%$`);var Dt=["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"],Wi=new RegExp(`^${$.source}(${Dt.join("|")})$`);var Rt=["deg","rad","grad","turn"],Mi=new RegExp(`^${$.source}(${Rt.join("|")})$`);var Gi=new RegExp(`^${$.source} +${$.source} +${$.source}$`);function Pe(e,t){if(t===null)return e;let i=Number(t);return Number.isNaN(i)?t[t.length-1]!=="%"&&(t=`calc(${t} * 100%)`):t=`${i*100}%`,`color-mix(in srgb, ${e} ${t}, transparent)`}function Fe(e){let t=[];for(let i of w(e,".")){if(!i.includes("[")){t.push(i);continue}let r=0;for(;;){let n=i.indexOf("[",r),o=i.indexOf("]",n);if(n===-1||o===-1)break;n>r&&t.push(i.slice(r,n)),t.push(i.slice(n+1,o)),r=o+1}r<=i.length-1&&t.push(i.slice(r))}return t}function N(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function D(e,t,i,r=[]){for(let n of t)if(n!=null)for(let o of Reflect.ownKeys(n)){let l=[...r,o],a=i(e[o],n[o],l);a!==void 0?e[o]=a:!N(e[o])||!N(n[o])?e[o]=n[o]:e[o]=D({},[e[o],n[o]],i,l)}return e}function Be(e,t,i){return function(n,o){let l=n.lastIndexOf("/"),a=null;l!==-1&&(a=n.slice(l+1).trim(),n=n.slice(0,l).trim());let s=(()=>{let c=Fe(n),[u,p]=jt(e.theme,c),f=i(Ue(t()??{},c)??null);if(typeof u!="object")return typeof p!="object"&&p&4?f??u:u;if(f!==null&&typeof f=="object"&&!Array.isArray(f)){let d=D({},[f],(g,m)=>m);if(u===null&&Object.hasOwn(f,"__CSS_VALUES__")){let g={};for(let m in f.__CSS_VALUES__)g[m]=f[m],delete d[m];u=g}for(let g in u)g!=="__CSS_VALUES__"&&(f?.__CSS_VALUES__?.[g]&4&&Ue(d,g.split("-"))!==void 0||(d[g]=u[g]));return d}if(Array.isArray(u)&&Array.isArray(p)&&Array.isArray(f)){let d=u[0],g=u[1];p[0]&4&&(d=f[0]??d);for(let m of Object.keys(g))p[1][m]&4&&(g[m]=f[1][m]??g[m]);return[d,g]}return u??f})();return a&&typeof s=="string"&&(s=Pe(s,a)),s??o}}function jt(e,t){if(t.length===1&&t[0].startsWith("--"))return[e.get([t[0]]),e.getOptions(t[0])];let i=t.map(u=>u==="1"?"":u).map(u=>u.replaceAll(".","_").replace(/([a-z])([A-Z])/g,(p,f,d)=>`${f}-${d.toLowerCase()}`)).filter((u,p)=>u!=="DEFAULT"||p!==t.length-1).join("-"),r=new Map,n=new E(()=>new Map),o=e.namespace(`--${i}`);if(o.size===0)return[null,0];let l=new Map;for(let[u,p]of o){if(!u||!u.includes("--")){r.set(u,p),l.set(u,e.getOptions(u?`--${i}-${u}`:`--${i}`));continue}let f=u.indexOf("--"),d=u.slice(0,f),g=u.slice(f+2);g=g.replace(/-([a-z])/g,(m,S)=>S.toUpperCase()),n.get(d===""?null:d).set(g,[p,e.getOptions(`--${i}${u}`)])}let a=e.getOptions(`--${i}`);for(let[u,p]of n){let f=r.get(u);if(typeof f!="string")continue;let d={},g={};for(let[m,[S,Qe]]of p)d[m]=S,g[m]=Qe;r.set(u,[f,d]),l.set(u,[a,g])}let s={},c={};for(let[u,p]of r)Le(s,[u??"DEFAULT"],p);for(let[u,p]of l)Le(c,[u??"DEFAULT"],p);return t[t.length-1]==="DEFAULT"?[s?.DEFAULT??null,c.DEFAULT??0]:"DEFAULT"in s&&Object.keys(s).length===1?[s.DEFAULT,c.DEFAULT??0]:(s.__CSS_VALUES__=c,[s,c])}function Ue(e,t){for(let i=0;i<t.length;++i){let r=t[i];if(e[r]===void 0){if(t[i+1]===void 0)return;t[i+1]=`${r}-${t[i+1]}`;continue}e=e[r]}return e}function Le(e,t,i){for(let r of t.slice(0,-1))e[r]===void 0&&(e[r]={}),e=e[r];e[t[t.length-1]]=i}var zt={blocklist:[],prefix:"",important:!1,darkMode:null,theme:{},plugins:[],content:{files:[]}};function Ie(e,t){let i={design:e,configs:[],plugins:[],content:{files:[]},theme:{},extend:{},result:structuredClone(zt)};for(let r of t)re(i,r);for(let r of i.configs)"darkMode"in r&&r.darkMode!==void 0&&(i.result.darkMode=r.darkMode??null),"prefix"in r&&r.prefix!==void 0&&(i.result.prefix=r.prefix??""),"blocklist"in r&&r.blocklist!==void 0&&(i.result.blocklist=r.blocklist??[]),"important"in r&&r.important!==void 0&&(i.result.important=r.important??!1);return Pt(i),{...i.result,content:i.content,theme:i.theme,plugins:i.plugins}}function Ot(e,t){if(Array.isArray(e)&&N(e[0]))return e.concat(t);if(Array.isArray(t)&&N(t[0])&&N(e))return[e,...t];if(Array.isArray(t))return t}function re(e,{config:t,base:i,path:r}){let n=[];for(let a of t.plugins??[])"__isOptionsFunction"in a?n.push(a()):"handler"in a?n.push(a):n.push({handler:a});if(Array.isArray(t.presets)&&t.presets.length===0)throw new Error("Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.");for(let a of t.presets??[])re(e,{path:r,base:i,config:a});for(let a of n)e.plugins.push(a),a.config&&re(e,{path:r,base:i,config:a.config});let o=t.content??[],l=Array.isArray(o)?o:o.files;for(let a of l)e.content.files.push(typeof a=="object"?a:{base:i,pattern:a});e.configs.push(t)}function Pt(e){let t={theme:Be(e.design,()=>e.theme,i)};function i(r){return typeof r=="function"?r(t)??null:r??null}for(let r of e.configs){let n=r.theme??{},o=n.extend??{};Object.assign(e.theme,n);for(let l in o)e.extend[l]??=[],e.extend[l].push(o[l])}delete e.theme.extend;for(let r in e.extend){let n=[e.theme[r],...e.extend[r]];e.theme[r]=()=>{let o=n.map(i);return D({},o,Ot)}}for(let r in e.theme)e.theme[r]=i(e.theme[r]);if(e.theme.screens&&typeof e.theme.screens=="object")for(let r of Object.keys(e.theme.screens)){let n=e.theme.screens[r];n&&typeof n=="object"&&("raw"in n||"max"in n||"min"in n&&(e.theme.screens[r]=n.min))}}var Lt=Ut(import.meta.url),R=Me(Lt),Ge=String.raw;async function qe(e,t){let i=ie.resolve(t.base,e),r=ie.resolve(R),n=ie.relative(r,i);n.startsWith(".")||(n="./"+n);let o=await Bt(i),l=o.prefix?ye(o.prefix):null,a=Ge`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import{globby as ur}from"globby";import fr from"node:fs/promises";import Wi from"node:path";import Ji from"postcss";import{parse as pr}from"postcss";import{format as dr}from"prettier";function v(e,t){let r;return e.each?.(i=>{let n=t(i)??0;if(n===2)return r=!1,r;if(n!==1)return r=v(i,t),r}),r}function ke(e,t){e?.each?.(r=>{ke(r,t),t(r)})}function Be(){async function e(t){let r=[];v(t,i=>{if(i.raws.tailwind_pretty)return r.push(i),1}),await Promise.all(r.map(async i=>{i.replaceWith(pr(await dr(i.toString(),{parser:"css",semi:!0})))}))}return{postcssPlugin:"@tailwindcss/upgrade/format-nodes",OnceExit:e}}import E from"picocolors";import vr from"node:fs";import sn from"node:path";import{stripVTControlCharacters as wr}from"node:util";import x from"picocolors";import We from"enhanced-resolve";import mr from"node:fs";import{createRequire as gr}from"node:module";var hr=gr(import.meta.url).resolve;function Je(e){if(typeof globalThis.__tw_resolve=="function"){let t=globalThis.__tw_resolve(e);if(t)return t}return hr(e)}var yr=We.ResolverFactory.createResolver({fileSystem:new We.CachedInputFileSystem(mr,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});function qe(e,t){if(typeof globalThis.__tw_resolve=="function"){let r=globalThis.__tw_resolve(e,t);if(r)return r}return yr.resolveSync({},t,e)}var Q={indent:2};function Z(){return`${x.italic(x.bold(x.blue("\u2248")))} tailwindcss ${x.blue(`v${br()}`)}`}function X(e){return`${x.dim(x.blue("`"))}${x.blue(e)}${x.dim(x.blue("`"))}`}function K(e,t){let r=e.split(" "),i=[],n="",l=0;for(let a of r){let o=wr(a).length;l+o+1>t&&(i.push(n),n="",l=0),n+=(l?" ":"")+a,l+=o+(l?1:0)}return l&&i.push(n),i}function z(e,t=0){return`${" ".repeat(t+Q.indent)}${e}`}function R(e,t=P){K(e,process.stderr.columns-3).map(r=>t(`${x.green("\u2502")} ${r}`)),t()}function $(e,t=P){K(e,process.stderr.columns-3).map(r=>t(`${x.blue("\u2502")} ${r}`)),t()}function V(e,t=P){K(e,process.stderr.columns-3).map(r=>t(`${x.red("\u2502")} ${r}`)),t()}function ee(e,t=P){K(e,process.stderr.columns-3).map(r=>t(`${x.yellow("\u2502")} ${r}`)),t()}function P(e=""){process.stderr.write(`${e}
|
|
3
|
+
`)}function C(e=""){process.stdout.write(`${e}
|
|
4
|
+
`)}function br(){if(typeof globalThis.__tw_version=="string")return globalThis.__tw_version;let{version:e}=JSON.parse(vr.readFileSync(Je("tailwindcss/package.json"),"utf-8"));return e}function Ge({invalid:e,usage:t,options:r}){let i=process.stdout.columns;if(C(Z()),e&&(C(),C(`${E.dim("Invalid command:")} ${e}`)),t&&t.length>0){C(),C(E.dim("Usage:"));for(let[n,l]of t.entries()){let a=l.slice(0,l.indexOf("[")),o=l.slice(l.indexOf("["));o=o.replace(/\[.*?\]/g,f=>E.dim(f));let u=K(o,i-Q.indent-a.length-1);u.length>1&&n!==0&&C(),C(z(`${a}${u.shift()}`));for(let f of u)C(z(f,a.length))}}if(r){let n=0;for(let{alias:s}of Object.values(r))s&&(n=Math.max(n,s.length));let l=[],a=0;for(let[s,{alias:u}]of Object.entries(r)){let f=[u&&`${u.padStart(n)}`,u?s:" ".repeat(n+2)+s].filter(Boolean).join(", ");l.push(f),a=Math.max(a,f.length)}C(),C(E.dim("Options:"));let o=8;for(let{description:s,default:u=null}of Object.values(r)){let f=l.shift(),p=o+(a-f.length),c=2,m=i-f.length-p-c-Q.indent,d=K(u!==null?`${s} ${E.dim(`[default:\u202F${X(`${u}`)}]`)}`:s,m);C(z(`${E.blue(f)} ${E.dim(E.gray("\xB7")).repeat(p)} ${d.shift()}`));for(let g of d)C(z(`${" ".repeat(f.length+p+c)}${g}`))}}}import Yr from"node:path";import Pe from"postcss";var S=class extends Map{constructor(r){super();this.factory=r}get(r){let i=super.get(r);return i===void 0&&(i=this.factory(r,this),this.set(r,i)),i}};var te=new Uint8Array(256);function y(e,t){let r=0,i=[],n=0,l=e.length,a=t.charCodeAt(0);for(let o=0;o<l;o++){let s=e.charCodeAt(o);if(r===0&&s===a){i.push(e.slice(n,o)),n=o+1;continue}switch(s){case 92:o+=1;break;case 39:case 34:for(;++o<l;){let u=e.charCodeAt(o);if(u===92){o+=1;continue}if(u===s)break}break;case 40:te[r]=41,r++;break;case 91:te[r]=93,r++;break;case 123:te[r]=125,r++;break;case 93:case 125:case 41:r>0&&s===te[r-1]&&r--;break}}return i.push(e.slice(n)),i}import yt from"node:fs/promises";import jr,{extname as Ir}from"node:path";import{Scanner as kr}from"@tailwindcss/oxide";import Ye from"string-byte-slice";async function He(e,t="html"){let i=new kr({}).getCandidatesWithPositions({content:e,extension:t}),n=[];for(let{candidate:l,position:a}of i)n.push({rawCandidate:l,start:a,end:a+l.length});return n}function k(e,t){let r=[];for(let n of t.variants)r.unshift(Qe(n));e.theme.prefix&&r.unshift(e.theme.prefix);let i="";return(t.kind==="static"||t.kind==="functional")&&t.negative&&(i+="-"),t.kind==="static"&&(i+=t.root),t.kind==="functional"&&(i+=t.root,t.value&&(t.value.kind==="arbitrary"?t.value===null?i+="":t.value.dataType?i+=`-[${t.value.dataType}:${O(t.value.value)}]`:i+=`-[${O(t.value.value)}]`:t.value.kind==="named"&&(i+=`-${t.value.value}`))),t.kind==="arbitrary"&&(i+=`[${t.property}:${O(t.value)}]`),(t.kind==="arbitrary"||t.kind==="functional")&&t.modifier&&(t.modifier.kind==="arbitrary"?i+=`/[${O(t.modifier.value)}]`:t.modifier.kind==="named"&&(i+=`/${t.modifier.value}`)),t.important&&(i+="!"),r.push(i),r.join(":")}function Qe(e){if(e.kind==="static")return e.root;if(e.kind==="arbitrary")return`[${O(e.selector)}]`;let t="";return e.kind==="functional"&&(t+=e.root,e.value&&(e.value.kind==="arbitrary"?t+=`-[${O(e.value.value)}]`:e.value.kind==="named"&&(t+=`-${e.value.value}`))),e.kind==="compound"&&(t+=e.root,t+="-",t+=Qe(e.variant)),(e.kind==="functional"||e.kind==="compound")&&e.modifier&&(e.modifier.kind==="arbitrary"?t+=`/[${O(e.modifier.value)}]`:e.modifier.kind==="named"&&(t+=`/${e.modifier.value}`)),t}function O(e){return e.replaceAll("_",String.raw`\_`).replaceAll(" ","_")}function Ze(e,t,r,i){return Ye(e,0,r)+t+Ye(e,i)}var Xe=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],re=["anchor-size"],et=new RegExp(`(${re.join("|")})\\(`,"g");function tt(e){if(e.indexOf("(")===-1||!Xe.some(n=>e.includes(n)))return e;let t=!1;re.some(n=>e.includes(n))&&(et.lastIndex=0,e=e.replace(et,(n,l)=>(t=!0,`$${re.indexOf(l)}$(`)));let r="",i=[];for(let n=0;n<e.length;n++){let l=e[n];if(l==="("){r+=l;let a=n;for(let s=n-1;s>=0;s--){let u=e.charCodeAt(s);if(u>=48&&u<=57)a=s;else if(u>=97&&u<=122)a=s;else break}let o=e.slice(a,n);if(Xe.includes(o)){i.unshift(!0);continue}else if(i[0]&&o===""){i.unshift(!0);continue}i.unshift(!1);continue}else if(l===")")r+=l,i.shift();else if(l===","&&i[0]){r+=", ";continue}else{if(l===" "&&i[0]&&r[r.length-1]===" ")continue;if((l==="+"||l==="*"||l==="/"||l==="-")&&i[0]){let a=r.trimEnd(),o=a[a.length-1];if(o==="+"||o==="*"||o==="/"||o==="-"){r+=l;continue}else if(o==="("||o===","){r+=l;continue}else e[n-1]===" "?r+=`${l} `:r+=` ${l} `}else if(i[0]&&e.startsWith("to-zero",n)){let a=n;n+=7,r+=e.slice(a,n+1)}else r+=l}}return t?r.replace(/\$(\d+)\$/g,(n,l)=>re[l]??n):r}function ie(e){return e.startsWith("url(")||(e=xr(e),e=tt(e)),e}function xr(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];i==="\\"&&e[r+1]==="_"?(t+="_",r+=1):i==="_"?t+=" ":t+=i}return t}var Cr=58,rt=45,it=97,nt=122;function*D(e,t){let r=y(e,":");if(t.theme.prefix){if(r.length===1||r[0]!==t.theme.prefix)return null;r.shift()}let i=r.pop(),n=[];for(let p=r.length-1;p>=0;--p){let c=t.parseVariant(r[p]);if(c===null)return;n.push(c)}let l=!1,a=!1;i[i.length-1]==="!"?(l=!0,i=i.slice(0,-1)):i[0]==="!"&&(l=!0,i=i.slice(1)),i[0]==="-"&&(a=!0,i=i.slice(1)),t.utilities.has(i,"static")&&!i.includes("[")&&(yield{kind:"static",root:i,variants:n,negative:a,important:l,raw:e});let[o,s=null,u]=y(i,"/");if(u)return;if(o[0]==="["){if(o[o.length-1]!=="]")return;let p=o.charCodeAt(1);if(p!==rt&&!(p>=it&&p<=nt))return;o=o.slice(1,-1);let c=o.indexOf(":");if(c===-1||c===0||c===o.length-1)return;let m=o.slice(0,c),d=ie(o.slice(c+1));yield{kind:"arbitrary",property:m,value:d,modifier:s===null?null:ot(s),variants:n,important:l,raw:e};return}let f;if(o[o.length-1]==="]"){let p=o.indexOf("-[");if(p===-1)return;let c=o.slice(0,p);if(!t.utilities.has(c,"functional"))return;let m=o.slice(p+1);f=[[c,m]]}else f=Ar(o,p=>t.utilities.has(p,"functional"));for(let[p,c]of f){let m={kind:"functional",root:p,modifier:s===null?null:ot(s),value:null,variants:n,negative:a,important:l,raw:e};if(c===null){yield m;continue}{let d=c.indexOf("[");if(d!==-1){let h=c.slice(d+1,-1),b="";for(let A=0;A<h.length;A++){let H=h.charCodeAt(A);if(H===Cr){b=h.slice(0,A),h=h.slice(A+1);break}if(!(H===rt||H>=it&&H<=nt))break}m.value={kind:"arbitrary",dataType:b||null,value:ie(h)}}else{let h=s===null||m.modifier?.kind==="arbitrary"?null:`${c}/${s}`;m.value={kind:"named",value:c,fraction:h}}}yield m}}function ot(e){if(e[0]==="["&&e[e.length-1]==="]"){let t=e.slice(1,-1);return{kind:"arbitrary",value:ie(t)}}return{kind:"named",value:e}}function*Ar(e,t){t(e)&&(yield[e,null]);let r=e.lastIndexOf("-");if(r===-1){e[0]==="@"&&t("@")&&(yield["@",e.slice(1)]);return}do{let i=e.slice(0,r);if(t(i)){let n=[i,e.slice(r+1)];if(n[1]==="")break;yield n}r=e.lastIndexOf("-",r-1)}while(r>0)}var j=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,Pn=new RegExp(`^${j.source}$`);var On=new RegExp(`^${j.source}%$`);var Sr=["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"],Dn=new RegExp(`^${j.source}(${Sr.join("|")})$`);var $r=["deg","rad","grad","turn"],jn=new RegExp(`^${j.source}(${$r.join("|")})$`);var In=new RegExp(`^${j.source} +${j.source} +${j.source}$`);function B(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===String(e)}function lt(e,t,r){for(let i of D(r,e)){let n=structuredClone(i),l=!1;if(n.kind==="functional"&&n.value?.kind==="arbitrary"&&n.value.dataType===null&&n.root==="font-stretch"){if(n.value.value.endsWith("%")&&B(n.value.value.slice(0,-1))){let a=parseInt(n.value.value);a>=50&&a<=200&&(l=!0,n.value={kind:"named",value:n.value.value,fraction:null})}}else if(n.kind==="functional"&&n.value?.kind==="arbitrary"&&n.value.dataType===null){let a=y(n.value.value,"/");if(a.every(o=>B(o))){l=!0;let o=n.value,s=n.modifier;a.length===1?n.value={kind:"named",value:n.value.value,fraction:null}:(n.value={kind:"named",value:a[0],fraction:n.value.value},n.modifier={kind:"named",value:a[1]}),e.compileAstNodes(n).length===0&&(n.value=o,n.modifier=s,l=!1)}}for(let a of Tr(n))if(a.kind==="functional"&&a.root==="data"&&a.value?.kind==="arbitrary"&&!a.value.value.includes("="))l=!0,a.value={kind:"named",value:a.value.value};else if(a.kind==="functional"&&a.root==="aria"&&a.value?.kind==="arbitrary"&&(a.value.value.endsWith("=true")||a.value.value.endsWith('="true"')||a.value.value.endsWith("='true'"))){let[o,s]=y(a.value.value,"=");if(o[o.length-1]==="~"||o[o.length-1]==="|"||o[o.length-1]==="^"||o[o.length-1]==="$"||o[o.length-1]==="*")continue;l=!0,a.value={kind:"named",value:a.value.value.slice(0,a.value.value.indexOf("="))}}else a.kind==="functional"&&a.root==="supports"&&a.value?.kind==="arbitrary"&&/^[a-z-][a-z0-9-]*$/i.test(a.value.value)&&(l=!0,a.value={kind:"named",value:a.value.value});return l?k(e,n):r}return r}function*Tr(e){function*t(r){yield r,r.kind==="compound"&&(yield*t(r.variant))}for(let r of e.variants)yield*t(r)}function w(e,t){return{kind:"rule",selector:e,nodes:t}}function N(e,t){return{kind:"declaration",property:e,value:t,important:!1}}function T(e,t,r=null,i={}){for(let n=0;n<e.length;n++){let l=e[n];if(l.kind==="context"){T(l.nodes,t,r,{...i,...l.context});continue}let a=t(l,{parent:r,replaceWith(o){e.splice(n,1,...Array.isArray(o)?o:[o]),n--},context:i})??0;if(a===2)return;a!==1&&l.kind==="rule"&&T(l.nodes,t,l,i)}}function Ce(e){let t="",r=new Set,i=[],n=[];function l(u,f=0){let p="",c=" ".repeat(f);if(u.kind==="rule"){if(u.selector==="@tailwind utilities"){for(let m of u.nodes)p+=l(m,f);return p}if(u.selector[0]==="@"&&u.nodes.length===0)return`${c}${u.selector};
|
|
5
|
+
`;if(u.selector[0]==="@"&&u.selector.startsWith("@property ")&&f===0){if(r.has(u.selector))return"";let m=u.selector.replace(/@property\s*/g,""),d=null,g=!1;for(let h of u.nodes)h.kind==="declaration"&&(h.property==="initial-value"?d=h.value:h.property==="inherits"&&(g=h.value==="true"));g?i.push(N(m,d??"initial")):n.push(N(m,d??"initial")),r.add(u.selector)}p+=`${c}${u.selector} {
|
|
6
|
+
`;for(let m of u.nodes)p+=l(m,f+1);p+=`${c}}
|
|
7
|
+
`}else if(u.kind==="comment")p+=`${c}/*${u.value}*/
|
|
8
|
+
`;else if(u.kind==="context")for(let m of u.nodes)p+=l(m,f);else if(u.kind==="at-root"){for(let m of u.nodes)t+=l(m,0);return p}else u.property!=="--tw-sort"&&u.value!==void 0&&u.value!==null&&(p+=`${c}${u.property}: ${u.value}${u.important?" !important":""};
|
|
9
|
+
`);return p}let a="";for(let u of e){let f=l(u);f!==""&&(a+=f)}let o=[];i.length&&o.push(w(":root",i)),n.length&&o.push(w("*, ::before, ::after, ::backdrop",n));let s="";return o.length&&(s=l(w("@supports (-moz-orient: inline)",[w("@layer base",o)]))),`${a}${s}${t}`}function st(e,t,r){for(let i of e.parseCandidate(r)){let n=structuredClone(i),l=!1;if("modifier"in n&&n.modifier?.kind==="arbitrary"&&!oe(e,n,n.modifier.value)){let{value:a,didChange:o}=ne(n.modifier.value);n.modifier.value=a,l||=o}for(let a of n.variants)ut(e,a)&&(l=!0);if(n.kind==="arbitrary"&&!oe(e,n,n.value)){let{value:a,didChange:o}=ne(n.value);n.value=a,l||=o}if(n.kind==="functional"&&n.value&&n.value.kind==="arbitrary"&&!oe(e,n,n.value.value)){let{value:a,didChange:o}=ne(n.value.value);n.value.value=a,l||=o}if(l)return k(e,n)}return r}function ne(e){let t=!1;return e.startsWith("--")?(e=`var(${e})`,t=!0):e.startsWith(" --")&&(e=e.slice(1),t=!0),{value:e,didChange:t}}function ut(e,t){let r=!1;if(t.kind==="functional"&&t.value&&t.value.kind==="arbitrary"&&!oe(e,Nr(t),t.value.value)){let{value:i,didChange:n}=ne(t.value.value);t.value.value=i,r||=n}return t.kind==="compound"&&ut(e,t.variant)&&(r=!0),r}function Nr(e){return{kind:"arbitrary",property:"color",value:"red",modifier:null,variants:[e],important:!1,raw:"candidate"}}var _r=new Set(["scroll-timeline-name","timeline-scope","view-timeline-name","font-palette","anchor-name","anchor-scope","position-anchor","position-try-options","scroll-timeline","animation-timeline","view-timeline","position-try"]);function oe(e,t,r){let i=e.compileAstNodes(t).map(l=>l.node),n=!1;return T(i,l=>{if(l.kind==="declaration"&&_r.has(l.property)&&l.value==r)return n=!0,2}),n}var Vr=["t","tr","r","br","b","bl","l","tl"];function ft(e,t,r){for(let i of e.parseCandidate(r))if(i.kind==="static"&&i.root.startsWith("bg-gradient-to-")){let n=i.root.slice(15);if(!Vr.includes(n))continue;return k(e,{...i,root:`bg-linear-to-${n}`})}return r}function ct(e,t,r){for(let i of D(r,e))if(i.important&&i.raw[i.raw.length-1]!=="!")return k(e,i);return r}function pt(e,t,r){if(!e.theme.prefix)return r;let i=Er(e,t,r);if(!i)return r;let n=e.theme.prefix,l=null;try{e.theme.prefix=null;let a=r.slice(0,i.start)+i.base+r.slice(i.end),o=[...D(a,e)];o.length>0&&(l=o[0])}finally{e.theme.prefix=n}return l?k(e,l):r}function Er(e,t,r){if(!e.theme.prefix)return null;if(!t.prefix)throw new Error("Could not find the Tailwind CSS v3 `prefix` configuration inside the JavaScript config.");let n=y(r,":").pop(),l=r.length-n.length,a=l+n.length,o=!1,s=!1;return n[n.length-1]==="!"?(o=!0,n=n.slice(0,-1)):n[0]==="!"&&(o=!0,n=n.slice(1)),n[0]==="-"&&(s=!0,n=n.slice(1)),!n.startsWith(t.prefix)&&n[0]!=="["?null:(n[0]!=="["&&(n=n.slice(t.prefix.length)),s&&(n="-"+n),o&&(n+="!"),{base:n,start:l,end:a})}var Kr=/([a-z]+)/;function dt(e){let t=Kr.exec(e.toLocaleLowerCase());return t?t[0]:(console.warn(`The prefix "${e} can not be used with Tailwind CSS v4 and cannot be converted to a valid one automatically. We've updated it to "tw" for you.`),"tw")}var Ae={"overflow-clip":"text-clip","overflow-ellipsis":"text-ellipsis","flex-grow-0":"grow-0","flex-shrink-0":"shrink-0","decoration-clone":"box-decoration-clone","decoration-slice":"box-decoration-slice"},mt=new WeakSet;function gt(e,t,r){if(!mt.has(e)){for(let i in Ae)e.utilities.static(i,()=>[]);mt.add(e)}for(let i of e.parseCandidate(r))if(i.kind==="static"&&Object.hasOwn(Ae,i.root))return k(e,{...i,root:Ae[i.root]});return r}function ht(e,t,r){for(let i of e.parseCandidate(r)){if(i.variants.length<=1)continue;let n=[],l=[],a=[],o=i.variants;for(let f of i.variants)Rr(e,f)?n.push(f):Or(e,f)?a.push(f):l.push(f);let s=l.some(f=>Pr(e,f)),u=[...a,...s?l.reverse():l,...n];if(!Dr(o,u))return k(e,{...i,variants:u})}return r}function Rr(e,t){return t.kind==="static"&&t.root==="dark"?!0:Se(e,t).every(i=>i.kind==="rule"&&i.selector[0]==="@")}function Pr(e,t){return Se(e,t).some(i=>i.kind==="rule"&&i.selector[0]!=="@"&&(i.selector.includes(" ")||i.selector.includes(">")||i.selector.includes("+")||i.selector.includes("~")))}function Or(e,t){return Se(e,t).some(i=>i.kind==="rule"&&(i.selector.includes("::after")||i.selector.includes("::backdrop")||i.selector.includes("::before")||i.selector.includes("::first-letter")||i.selector.includes("::first-line")||i.selector.includes("::marker")||i.selector.includes("::placeholder")||i.selector.includes("::selection")))}function Se(e,t){let r=[],i=e.compileAstNodes({kind:"arbitrary",property:"color",value:"red",modifier:null,variants:[t],important:!1,raw:"candidate"}).map(n=>n.node);return T(i,n=>{n.kind==="rule"&&n.selector===".candidate"||n.kind==="declaration"&&n.property==="color"&&n.value==="red"||r.push(n)}),r}function Dr(e,t){return e.length!==t.length?!1:e.every((r,i)=>t[i]===r)}var Fr=[pt,ct,st,ft,gt,lt,ht];function $e(e,t,r){for(let i of Fr)r=i(e,t,r);return r}async function vt(e,t,r,i){let n=await He(r,i);n.sort((a,o)=>o.start-a.start);let l=r;for(let{rawCandidate:a,start:o,end:s}of n){let u=$e(e,t,a);u!==a&&(l=Ze(l,u,o,s))}return l}async function wt(e,t,r){let i=jr.resolve(process.cwd(),r),n=await yt.readFile(i,"utf-8");await yt.writeFile(i,await vt(e,t,n,Ir(r)))}function bt({designSystem:e,userConfig:t}){function r(i){let n=i.params.split(/(\s+)/),l=n[n.length-1]==="!important"||n[n.length-1]==="#{!important}";l&&n.pop();let a=n.map(o=>{if(o.trim()==="")return o;let s=y(o,":"),u=s.pop();return l&&u[0]!=="!"&&u[u.length-1]!=="!"&&(u+="!"),[...s,u].join(":")});a=a.map(o=>$e(e,t,o)),i.params=a.join("").trim()}return{postcssPlugin:"@tailwindcss/upgrade/migrate-at-apply",OnceExit(i){i.walkAtRules("apply",r)}}}import"postcss";import ae from"postcss-selector-parser";import*as kt from"node:fs/promises";import*as le from"node:path";import*as xt from"node:util";import*as Te from"postcss";var I=class e{id;root;file=null;parents=new Set;children=new Set;canMigrate=!0;extension=null;static async load(t){t=le.resolve(process.cwd(),t);let r=await kt.readFile(t,"utf-8"),i=Te.parse(r,{from:t});return new e(i,t)}static async fromString(t){let r=Te.parse(t);return new e(r)}static async fromRoot(t,r){return new e(t,r)}constructor(t,r){this.id=Math.random().toString(36).slice(2),this.root=t,this.file=r??null,r&&(this.extension=le.extname(r))}get importRules(){let t=new Set;return this.root.walkAtRules("import",r=>{t.add(r)}),t}get isEmpty(){return this.root.toString().trim()===""}*ancestors(){for(let{item:t}of W(this,r=>r.parents))yield t}*descendants(){for(let{item:t}of W(this,r=>r.children))yield t}layers(){let t=new Set;for(let{item:r,path:i}of W(this,n=>n.parents))if(!(r.parents.size>0))for(let{meta:n}of i)for(let l of n.layers)t.add(l);return t}*pathsToRoot(){for(let{item:t,path:r}of W(this,i=>i.parents))t.parents.size>0||(yield r)}analyzeImportPaths(){let t=[],r=[];for(let i of this.pathsToRoot()){let n=!1;for(let{meta:l}of i)for(let a of l.layers)n||=a==="utilities"||a==="components";n?t.push(i):r.push(i)}return{convertablePaths:t,nonConvertablePaths:r}}[xt.inspect.custom](){return{...this,root:this.root.toString(),layers:Array.from(this.layers()),parents:Array.from(this.parents,t=>t.item.id),children:Array.from(this.children,t=>t.item.id),parentsMeta:Array.from(this.parents,t=>t.meta),childrenMeta:Array.from(this.children,t=>t.meta)}}};function*W(e,t,r=[]){for(let i of t(e)){let n=[...r,i];yield*W(i.item,t,n),yield{item:i.item,path:n}}}function Ct(e){function t(r){if(r.params!=="utilities"&&r.params!=="components")return;let i=r.clone();v(r,a=>{if(a.type!=="rule")return;let o=y(a.selector,",");if(o.length>1){let s=[];for(let u of o){let f=a.clone({selector:u});s.push(f)}a.replaceWith(s)}return 1});let n=new Set;v(r,a=>{if(a.type==="rule")return ae(o=>{o.each(s=>{v(s,u=>{if(u.type==="pseudo"&&u.value===":not")return 1;u.type==="class"&&n.add(u.value)})})}).processSync(a.selector,{updateSelector:!1}),1}),v(i,a=>{a.type==="rule"&&ae(o=>{o.each(s=>{v(s,u=>{if(u.type==="pseudo"&&u.value===":not")return 1;if(u.type==="class"&&n.has(u.value))return a.remove(),2})})}).processSync(a,{updateSelector:!0})});let l=[i];for(let a of n){let o=r.clone();l.push(o),v(o,s=>{if(s.type==="atrule"&&(!s.nodes||s.nodes?.length===0)&&s.remove(),s.type!=="rule")return;let u=!1;if(ae(f=>{f.each(p=>{v(p,c=>{if(c.type==="pseudo"&&c.value===":not")return 1;if(c.type==="class"&&c.value===a){u=!0;let m=p.atPosition(c.source.start.line,c.source.start.column),d=m.parent,g=(m.parent?.index(m)??0)-1;for(;g>=0&&d.at(g)?.type!=="combinator";){let h=d.at(g+1),b=d.at(g);d.at(g+1).replaceWith(b),d.at(g).replaceWith(h),g--}m.replaceWith(ae.nesting())}})})}).processSync(s,{updateSelector:!0}),!u){let f=[s],p=s.parent?.index(s)??null;if(p!==null)for(let c=p-1;c>=0&&s.parent?.nodes.at(c)?.type!=="rule";c--)s.parent?.nodes.at(c)?.type==="comment"&&f.push(s.parent?.nodes.at(c));for(let c of f)c.remove()}return 1}),o.name="utility",o.params=a,o.raws.tailwind_pretty=!0,o.raws.before=`${o.raws.before??""}
|
|
10
|
+
|
|
11
|
+
`}for(let a=l.length-1;a>=0;a--){let o=l[a];ke(o,s=>{if(o===i&&s.type==="comment"){let u=!1;for(let f of l)if(f!==i&&(v(f,p=>{if(p.type==="comment"&&p.source?.start?.offset===s.source?.start?.offset)return s.remove(),u=!0,2}),u))return 1}if((s.type==="rule"||s.type==="atrule")&&s.nodes?.length===0)s.remove();else if(s.type==="rule"&&s.selector==="&"){let u=s.parent,f=!1;for(;u;){if(u.type==="rule"){f=!0;break}u=u.parent}f||s.replaceWith(s.nodes)}}),o.nodes?.length===0&&l.splice(a,1)}r.replaceWith(l)}return{postcssPlugin:"@tailwindcss/upgrade/migrate-at-layer-utilities",OnceExit:(r,{atRule:i})=>{let n=e.layers(),l=n.has("utilities")||n.has("components");if(l){let a=i({name:"layer",params:"utilities"});a.append(r.nodes),r.append(a)}r.walkAtRules("layer",t);{let a=new Map;v(r,o=>{if(o.type==="atrule"&&o.name==="utility"){let s=a.get(o.params);s?(s.append(o.nodes),o.remove()):a.set(o.params,o)}})}l&&r.each(a=>{a.type==="atrule"&&a.name==="layer"&&a.params==="utilities"&&a.replaceWith(a.nodes??[])})}}}import se from"node:path";import Ur,{AtRule as St}from"postcss";function Lr(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var r=e.length;if(r<=1)return e;var i="";if(r>4&&e[3]==="\\"){var n=e[2];(n==="?"||n===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),i="//")}var l=e.split(/[/\\]+/);return t!==!1&&l[l.length-1]===""&&l.pop(),i+l.join("/")}function At(e){let t=Lr(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var $t=new WeakMap;function Tt(e,{configFilePath:t,jsConfigMigration:r}){function i(l){let a=$t.get(l);if(a&&a.includes(t))return;a?a.push(t):$t.set(l,[t]);let o=l.root;if(!l.file)return;let s=new St;if(r===null){{let f=!1;if(o.walkAtRules("config",()=>(f=!0,!1)),f)return}s.append(new St({name:"config",params:`'${Ne(l,t)}'`}))}else{let f=`
|
|
12
|
+
|
|
13
|
+
`;for(let p of r.sources){let c=se.resolve(p.base,p.pattern);f+=`@source '${Ne(l,c)}';
|
|
14
|
+
`}r.sources.length>0&&(f=f+`
|
|
15
|
+
`);for(let p of r.plugins){let c=p.path[0]==="."?Ne(l,se.resolve(p.base,p.path)):p.path;f+=`@plugin '${c}';
|
|
16
|
+
`}r.plugins.length>0&&(f=f+`
|
|
17
|
+
`),s.append(Ur.parse(f+r.css))}let u=null;v(o,f=>(f.type==="atrule"&&f.name==="import"&&(u=f),1));for(let f of s?.nodes??[])f.raws.tailwind_pretty=!0;u?u.name==="import"&&u.after(s.nodes):o.prepend(s.nodes)}function n(l){let a=!1,o=!1;if(l.walkAtRules("import",s=>{if(s.params.match(/['"]tailwindcss['"]/))return a=!0,o=!0,!1;s.params.match(/['"]tailwindcss\/.*?['"]/)&&(a=!0)}),!!a){if(o||e.parents.size<=0){i(e);return}if(e.parents.size>0)for(let s of e.ancestors())s.parents.size===0&&i(s)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-config",OnceExit:n}}function Ne(e,t){if(!e.file)throw new Error("Can not find a path for the stylesheet");let r=e.file,i=se.relative(se.dirname(r),t);return i[0]!=="."&&(i=`./${i}`),At(i)}import"postcss";var Nt={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}};function ue(e,t){if(t===null)return e;let r=Number(t);return Number.isNaN(r)?t[t.length-1]!=="%"&&(t=`calc(${t} * 100%)`):t=`${r*100}%`,`color-mix(in srgb, ${e} ${t}, transparent)`}function _e(e){let t=[];for(let r of y(e,".")){if(!r.includes("[")){t.push(r);continue}let i=0;for(;;){let n=r.indexOf("[",i),l=r.indexOf("]",n);if(n===-1||l===-1)break;n>i&&t.push(r.slice(i,n)),t.push(r.slice(n+1,l)),i=l+1}i<=r.length-1&&t.push(r.slice(i))}return t}function L(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function F(e,t,r,i=[]){for(let n of t)if(n!=null)for(let l of Reflect.ownKeys(n)){let a=[...i,l],o=r(e[l],n[l],a);o!==void 0?e[l]=o:!L(e[l])||!L(n[l])?e[l]=n[l]:e[l]=F({},[e[l],n[l]],r,a)}return e}function Ve(e,t,r){return function(n,l){let a=n.lastIndexOf("/"),o=null;a!==-1&&(o=n.slice(a+1).trim(),n=n.slice(0,a).trim());let s=(()=>{let u=_e(n),[f,p]=Wr(e.theme,u),c=r(Vt(t()??{},u)??null);if(typeof f!="object")return typeof p!="object"&&p&4?c??f:f;if(c!==null&&typeof c=="object"&&!Array.isArray(c)){let m=F({},[c],(d,g)=>g);if(f===null&&Object.hasOwn(c,"__CSS_VALUES__")){let d={};for(let g in c.__CSS_VALUES__)d[g]=c[g],delete m[g];f=d}for(let d in f)d!=="__CSS_VALUES__"&&(c?.__CSS_VALUES__?.[d]&4&&Vt(m,d.split("-"))!==void 0||(m[d]=f[d]));return m}if(Array.isArray(f)&&Array.isArray(p)&&Array.isArray(c)){let m=f[0],d=f[1];p[0]&4&&(m=c[0]??m);for(let g of Object.keys(d))p[1][g]&4&&(d[g]=c[1][g]??d[g]);return[m,d]}return f??c})();return o&&typeof s=="string"&&(s=ue(s,o)),s??l}}function Wr(e,t){if(t.length===1&&t[0].startsWith("--"))return[e.get([t[0]]),e.getOptions(t[0])];let r=t.map(f=>f==="1"?"":f).map(f=>f.replaceAll(".","_").replace(/([a-z])([A-Z])/g,(p,c,m)=>`${c}-${m.toLowerCase()}`)).filter((f,p)=>f!=="DEFAULT"||p!==t.length-1).join("-"),i=new Map,n=new S(()=>new Map),l=e.namespace(`--${r}`);if(l.size===0)return[null,0];let a=new Map;for(let[f,p]of l){if(!f||!f.includes("--")){i.set(f,p),a.set(f,e.getOptions(f?`--${r}-${f}`:`--${r}`));continue}let c=f.indexOf("--"),m=f.slice(0,c),d=f.slice(c+2);d=d.replace(/-([a-z])/g,(g,h)=>h.toUpperCase()),n.get(m===""?null:m).set(d,[p,e.getOptions(`--${r}${f}`)])}let o=e.getOptions(`--${r}`);for(let[f,p]of n){let c=i.get(f);if(typeof c!="string")continue;let m={},d={};for(let[g,[h,b]]of p)m[g]=h,d[g]=b;i.set(f,[c,m]),a.set(f,[o,d])}let s={},u={};for(let[f,p]of i)Et(s,[f??"DEFAULT"],p);for(let[f,p]of a)Et(u,[f??"DEFAULT"],p);return t[t.length-1]==="DEFAULT"?[s?.DEFAULT??null,u.DEFAULT??0]:"DEFAULT"in s&&Object.keys(s).length===1?[s.DEFAULT,u.DEFAULT??0]:(s.__CSS_VALUES__=u,[s,u])}function Vt(e,t){for(let r=0;r<t.length;++r){let i=t[r];if(e[i]===void 0){if(t[r+1]===void 0)return;t[r+1]=`${i}-${t[r+1]}`;continue}e=e[i]}return e}function Et(e,t,r){for(let i of t.slice(0,-1))e[i]===void 0&&(e[i]={}),e=e[i];e[t[t.length-1]]=r}var Jr={blocklist:[],prefix:"",important:!1,darkMode:null,theme:{},plugins:[],content:{files:[]}};function fe(e,t){let r={design:e,configs:[],plugins:[],content:{files:[]},theme:{},extend:{},result:structuredClone(Jr)};for(let i of t)Ee(r,i);for(let i of r.configs)"darkMode"in i&&i.darkMode!==void 0&&(r.result.darkMode=i.darkMode??null),"prefix"in i&&i.prefix!==void 0&&(r.result.prefix=i.prefix??""),"blocklist"in i&&i.blocklist!==void 0&&(r.result.blocklist=i.blocklist??[]),"important"in i&&i.important!==void 0&&(r.result.important=i.important??!1);return qr(r),{...r.result,content:r.content,theme:r.theme,plugins:r.plugins}}function Ke(e,t){if(Array.isArray(e)&&L(e[0]))return e.concat(t);if(Array.isArray(t)&&L(t[0])&&L(e))return[e,...t];if(Array.isArray(t))return t}function Ee(e,{config:t,base:r,path:i}){let n=[];for(let o of t.plugins??[])"__isOptionsFunction"in o?n.push(o()):"handler"in o?n.push(o):n.push({handler:o});if(Array.isArray(t.presets)&&t.presets.length===0)throw new Error("Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.");for(let o of t.presets??[])Ee(e,{path:i,base:r,config:o});for(let o of n)e.plugins.push(o),o.config&&Ee(e,{path:i,base:r,config:o.config});let l=t.content??[],a=Array.isArray(l)?l:l.files;for(let o of a)e.content.files.push(typeof o=="object"?o:{base:r,pattern:o});e.configs.push(t)}function qr(e){let t=Ve(e.design,()=>e.theme,i),r=Object.assign(t,{theme:t,colors:Nt});function i(n){return typeof n=="function"?n(r)??null:n??null}for(let n of e.configs){let l=n.theme??{},a=l.extend??{};Object.assign(e.theme,l);for(let o in a)e.extend[o]??=[],e.extend[o].push(a[o])}delete e.theme.extend;for(let n in e.extend){let l=[e.theme[n],...e.extend[n]];e.theme[n]=()=>{let a=l.map(i);return F({},a,Ke)}}for(let n in e.theme)e.theme[n]=i(e.theme[n]);if(e.theme.screens&&typeof e.theme.screens=="object")for(let n of Object.keys(e.theme.screens)){let l=e.theme.screens[n];l&&typeof l=="object"&&("raw"in l||"max"in l||"min"in l&&(e.theme.screens[n]=l.min))}}function Kt(e){return(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?{min:r}:r&&typeof r=="object"?r:null).map(r=>{if(r===null)return null;if("raw"in r)return r.raw;let i="";return r.max!==void 0&&(i+=`${r.max} >= `),i+="width",r.min!==void 0&&(i+=` >= ${r.min}`),`(${i})`}).filter(Boolean).join(", ")}function Rt({designSystem:e,userConfig:t}={}){function r(i){if(!e||!t)return;let l=fe(e,[{base:"",config:t}])?.theme?.screens||{},a=new S(o=>{let s=e?.resolveThemeValue(`--breakpoint-${o}`)??l?.[o];return typeof s=="string"?`(width >= theme(--breakpoint-${o}))`:s?Kt(s):null});i.walkAtRules(o=>{if(o.name!=="media")return;let s=o.params.match(/screen\(([^)]+)\)/);if(!s)return;let u=a.get(s[1]);u&&(o.params=u)})}return{postcssPlugin:"@tailwindcss/upgrade/migrate-media-screen",OnceExit:r}}import{AtRule as Gr}from"postcss";function Pt(){function e(t){let r="",i=[],n=[],l=null;t.each(a=>{if(a.type==="atrule"){if(a.name==="config"||a.name==="source"||a.name==="theme"||a.name==="utility"||a.name==="variant"){i.length>0&&n.push([r,i.splice(0)]);return}if(a.name==="tailwind"&&a.params==="base"||a.name==="import"&&a.params.match(/^["']tailwindcss\/base["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="base",r="base";return}if(a.name==="tailwind"&&a.params==="components"||a.name==="import"&&a.params.match(/^["']tailwindcss\/components["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="components",r="components";return}if(a.name==="tailwind"&&a.params==="utilities"||a.name==="import"&&a.params.match(/^["']tailwindcss\/utilities["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="utilities",r="utilities";return}if(a.name==="layer"){i.length>0&&n.push([r,i.splice(0)]);return}if(a.name==="import"){r!==""&&!a.params.includes("layer(")&&(a.params+=` layer(${r})`,a.raws.tailwind_injected_layer=!0),i.length>0&&n.push([r,i.splice(0)]);return}}r===""&&(a.type==="comment"||a.type==="atrule"&&!a.nodes||a.type==="atrule"&&a.name==="charset")||i.push(a)});for(let[a,o]of n){let s=a||l||"";if(s===""||o.every(p=>p.type==="comment"))continue;let u=o[0],f=new Gr({name:"layer",params:s,nodes:o.map(p=>p===u?p:p.remove()),raws:{tailwind_pretty:!0}});u.replaceWith(f)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-missing-layers",OnceExit:e}}import{AtRule as ce}from"postcss";var Re=["theme","base","components","utilities"];function Ot(e){let t=e.newPrefix?` prefix(${e.newPrefix})`:"";function r(i){let n=null,l=null,a=[],o=null,s=null,u=null,f=null,p=[];i.walkAtRules(c=>{c.name==="import"&&c.params.match(/^["']tailwindcss\/tailwind\.css["']$/)&&(c.params=c.params.replace("tailwindcss/tailwind.css","tailwindcss")),c.name==="import"&&c.params.match(/^["']tailwindcss["']/)?c.params+=t:c.name==="tailwind"&&c.params==="base"||c.name==="import"&&c.params.match(/^["']tailwindcss\/base["']$/)?(p.push("base"),a.push(c),n=c):c.name==="tailwind"&&c.params==="utilities"||c.name==="import"&&c.params.match(/^["']tailwindcss\/utilities["']$/)?(p.push("utilities"),a.push(c),l=c):(c.name==="tailwind"&&c.params==="components"||c.name==="tailwind"&&c.params==="screens"||c.name==="tailwind"&&c.params==="variants"||c.name==="import"&&c.params.match(/^["']tailwindcss\/components["']$/))&&c.remove()}),n!==null&&l!==null?(o||pe(a).before(new ce({name:"import",params:`'tailwindcss'${t}`})),n?.remove(),l?.remove()):l!==null?(s||pe(a).before(new ce({name:"import",params:"'tailwindcss/utilities' layer(utilities)"})),l?.remove()):n!==null&&(f||pe(a).before(new ce({name:"import",params:`'tailwindcss/theme' layer(theme)${t}`})),u||pe(a).before(new ce({name:"import",params:"'tailwindcss/preflight' layer(base)"})),n?.remove());{let c=p.toSorted((m,d)=>Re.indexOf(m)-Re.indexOf(d));if(p.some((m,d)=>m!==c[d])){let m=Re.toSorted((d,g)=>p.indexOf(d)-p.indexOf(g));i.prepend({name:"layer",params:m.join(", ")})}}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-tailwind-directives",OnceExit:r}}function pe(e){let t=e.at(0),r=t.prev();for(;r;){if(r.type==="rule"&&(t=r),r.type==="atrule")if(r.name==="charset"||r.name==="import"){r=r.prev();continue}else if(r.name==="layer"&&!r.nodes){r=r.prev();continue}else t=r;r=r.prev()}return t}async function Hr(e,t,r){return typeof e=="string"&&(e=await I.fromString(e),e.file=r??null),Pe().use(bt(t)).use(Rt(t)).use(Ct(e)).use(Pt()).use(Ot(t)).use(Tt(e,t)).process(e.root,{from:e.file??void 0})}async function Dt(e,t){if(!e.file)throw new Error("Cannot migrate a stylesheet without a file path");e.canMigrate&&await Hr(e,t)}async function jt(e){let t=new Map;for(let o of e)o.file&&t.set(o.file,o);let r=Pe([{postcssPlugin:"mark-import-nodes",AtRule:{import(o){let s=o.params.match(/['"](.*)['"]/)?.[1];if(!s)return;let u=o.source?.input.file?Yr.dirname(o.source.input.file):process.cwd(),f;try{f=qe(s,u)}catch(d){console.warn(`Failed to resolve import: ${s}. Skipping.`),console.error(d);return}if(!f)return;let p=t.get(f);if(!p)return;o.raws.tailwind_destination_sheet_id=p.id;let c=o.source?.input.file?t.get(o.source.input.file):void 0,m=[];for(let d of y(o.params," "))d.startsWith("layer(")&&d.endsWith(")")&&m.push(d.slice(6,-1).trim());if(c){let d={layers:m};p.parents.add({item:c,meta:d}),c.children.add({item:p,meta:d})}}}}]);for(let o of e)o.file&&await r.process(o.root,{from:o.file});let i=process.cwd();function n(o){let s=[];for(let u of o){if(!u.item.file)continue;let f=u.item.file.replace(i,""),p=u.meta.layers.join(", ");p.length>0?s.push(`${f} (layers: ${p})`):s.push(f)}return s.join(" <- ")}let l=[];for(let o of e){if(!o.file)continue;let{convertablePaths:s,nonConvertablePaths:u}=o.analyzeImportPaths();if(!(s.length>0&&u.length>0))continue;o.canMigrate=!1;let p=o.file.replace(i,"");for(let c of s)l.push(`- ${p} <- ${n(c)}`);for(let c of u)l.push(`- ${p} <- ${n(c)}`)}if(l.length===0)return;let a=`You have one or more stylesheets that are imported into a utility layer and non-utility layer.
|
|
18
|
+
`;throw a+=`We cannot convert stylesheets under these conditions. Please look at the following stylesheets:
|
|
19
|
+
`,new Error(a+l.join(`
|
|
20
|
+
`))}async function It(e){let t=new Map,r=new Map;for(let o of e)t.set(o.id,o),o.file&&r.set(o.file,o);let i=new Set;for(let o of e){let s=o.layers();(s.has("utilities")||s.has("components"))&&v(o.root,f=>{if(f.type==="atrule"&&f.name==="utility")return i.add(o),2})}let n=new Map;for(let o of e){if(!o.file||o.parents.size===0||!i.has(o)&&!Array.from(o.descendants()).some(c=>i.has(c)))continue;let s=Pe.root({raws:{tailwind_pretty:!0}});v(o.root,c=>{if(c.type==="atrule"&&c.name==="utility")return s.append(c),1});let u=o.file.replace(/\.css$/,".utilities.css"),f=0;for(;r.has(u);)f+=1,u=o.file.replace(/\.css$/,`.utilities.${f}.css`);let p=await I.fromRoot(s,u);p.extension=f>0?`.utilities.${f}.css`:".utilities.css",n.set(o,p),t.set(p.id,p)}for(let[o,s]of n){for(let u of o.parents){let f=n.get(u.item);f&&s.parents.add({item:f,meta:u.meta})}for(let u of o.children){let f=n.get(u.item);f&&s.children.add({item:f,meta:u.meta})}}for(let o of e){let s=n.get(o),u=new Set;for(let f of o.importRules){let p=f.raws.tailwind_destination_sheet_id;if(!p)continue;let c=t.get(p);if(!c)continue;let m=n.get(c);if(!m)continue;let d=f.params.match(/(['"])(.*)\1/);if(!d)return;let g=d[1],h=d[2],b=h.replace(/\.css$/,m.extension),A=f.clone({params:`${g}${b}${g}`,raws:{after:`
|
|
21
|
+
|
|
22
|
+
`,tailwind_original_params:`${g}${h}${g}`,tailwind_destination_sheet_id:m.id}});s?u.add(A):f.after(A)}s&&u.size>0&&s.root.prepend(Array.from(u))}let l=new S(()=>new Set);for(let o of t.values())for(let s of o.importRules){let u=s.raws.tailwind_destination_sheet_id;if(!u)continue;let f=t.get(u);f&&l.get(f).add(s)}let a=[];for(let o of e.slice()){for(let s of o.descendants())a.push(s);a.push(o)}for(let o of a){let s=n.get(o);if(s&&o.isEmpty){o.root=s.root;for(let u of l.get(s))u.params=u.raws.tailwind_original_params;for(let u of l.get(o))u.remove();n.delete(o)}}e.push(...n.values())}import mi from"node:fs/promises";import{dirname as gi}from"path";import hi from"tailwindcss/defaultTheme";import{fileURLToPath as yi}from"url";import de from"enhanced-resolve";import{createJiti as ri}from"jiti";import Jt from"node:fs";import Wl from"node:fs/promises";import ql,{dirname as Ut,extname as Gl}from"node:path";import{pathToFileURL as Mt}from"node:url";import{__unstable__loadDesignSystem as Ql,compile as Zl}from"tailwindcss";import Oe from"node:fs/promises";import J from"node:path";var Qr=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],Zr=[".js",".cjs",".mjs"],Xr=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],ei=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function ti(e,t){for(let r of t){let i=`${e}${r}`;if((await Oe.stat(i).catch(()=>null))?.isFile())return i}for(let r of t){let i=`${e}/index${r}`;if(await Oe.access(i).then(()=>!0,()=>!1))return i}return null}async function Ft(e,t,r,i){let n=Zr.includes(i)?Xr:ei,l=await ti(J.resolve(r,t),n);if(l===null||e.has(l))return;e.add(l),r=J.dirname(l),i=J.extname(l);let a=await Oe.readFile(l,"utf-8"),o=[];for(let s of Qr)for(let u of a.matchAll(s))u[1].startsWith(".")&&o.push(Ft(e,u[1],r,i));await Promise.all(o)}async function Lt(e){let t=new Set;return await Ft(t,e,J.dirname(e),J.extname(e)),Array.from(t)}async function me(e,t,r){if(e[0]!=="."){let a=await Wt(e,t);if(!a)throw new Error(`Could not resolve '${e}' from '${t}'`);let o=await Bt(Mt(a).href);return{base:Ut(a),module:o.default??o}}let i=await Wt(e,t);if(!i)throw new Error(`Could not resolve '${e}' from '${t}'`);let[n,l]=await Promise.all([Bt(Mt(i).href+"?id="+Date.now()),Lt(i)]);for(let a of l)r(a);return{base:Ut(i),module:n.default??n}}var zt=null;async function Bt(e){try{return await import(e)}catch{return zt??=ri(import.meta.url,{moduleCache:!1,fsCache:!1}),await zt.import(e)}}var ea=de.ResolverFactory.createResolver({fileSystem:new de.CachedInputFileSystem(Jt,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});var ii=de.ResolverFactory.createResolver({fileSystem:new de.CachedInputFileSystem(Jt,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"]});function Wt(e,t){return ni(ii,e,t)}function ni(e,t,r){return new Promise((i,n)=>e.resolve({},r,t,{},(l,a)=>{if(l)return n(l);i(a)}))}function De(e){let t=[];return qt(e,[],(r,i)=>{if(li(r))return t.push([i,r]),1;if(ai(r)){t.push([i,r[0]]);for(let n of Reflect.ownKeys(r[1]))t.push([[...i,`-${n}`],r[1][n]]);return 1}if(Array.isArray(r)&&r.every(n=>typeof n=="string"))return t.push([i,r.join(", ")]),1}),t}var oi=/^[a-zA-Z0-9-_]+$/;function je(e){e[0]==="colors"&&(e[0]="color"),e[0]==="screens"&&(e[0]="breakpoint"),e[0]==="borderRadius"&&(e[0]="radius"),e[0]==="boxShadow"&&(e[0]="shadow"),e[0]==="animation"&&(e[0]="animate");for(let t of e)if(!oi.test(t))return null;return e.map(t=>t==="1"?"":t).map(t=>t.replaceAll(".","_").replace(/([a-z])([A-Z])/g,(r,i,n)=>`${i}-${n.toLowerCase()}`)).filter((t,r)=>t!=="DEFAULT"||r!==e.length-1).join("-")}function li(e){return typeof e=="number"||typeof e=="string"}function ai(e){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string"&&typeof e[0]!="number"||e[1]===void 0||e[1]===null||typeof e[1]!="object")return!1;for(let t of Reflect.ownKeys(e[1]))if(typeof t!="string"||typeof e[1][t]!="string"&&typeof e[1][t]!="number")return!1;return!0}function qt(e,t=[],r){for(let i of Reflect.ownKeys(e)){let n=e[i];if(n==null)continue;let l=[...t,i],a=r(n,l)??0;if(a!==1){if(a===2)break;!Array.isArray(n)&&typeof n!="object"||qt(n,l,r)}}}function ge(e){let t=[];e=Array.isArray(e)?e:[e];let r=e.flatMap(i=>Object.entries(i));for(let[i,n]of r)if(typeof n!="object")!i.startsWith("--")&&n==="@slot"?t.push(w(i,[w("@slot",[])])):(i=i.replace(/([A-Z])/g,"-$1").toLowerCase(),t.push(N(i,String(n))));else if(Array.isArray(n))for(let l of n)typeof l=="string"?t.push(N(i,l)):t.push(w(i,ge(l)));else n!==null&&t.push(w(i,ge(n)));return t}function Yt(e,{theme:t}){if("keyframes"in t)for(let[r,i]of Object.entries(t.keyframes))e.push(w(`@keyframes ${r}`,ge(i)))}function Ht({addVariant:e,config:t}){let r=t("darkMode",null),[i,n=".dark"]=Array.isArray(r)?r:[r];if(i==="variant"){let l;if(Array.isArray(n)||typeof n=="function"?l=n:typeof n=="string"&&(l=[n]),Array.isArray(l))for(let a of l)a===".dark"?(i=!1,console.warn('When using `variant` for `darkMode`, you must provide a selector.\nExample: `darkMode: ["variant", ".your-selector &"]`')):a.includes("&")||(i=!1,console.warn('When using `variant` for `darkMode`, your selector must contain `&`.\nExample `darkMode: ["variant", ".your-selector &"]`'));n=l}i===null||(i==="selector"?e("dark",`&:where(${n}, ${n} *)`):i==="media"?e("dark","@media (prefers-color-scheme: dark)"):i==="variant"?e("dark",n):i==="class"&&e("dark",`&:is(${n} *)`))}import Ie from"tree-sitter";import Fe from"tree-sitter-typescript";var Le=new Ie;Le.setLanguage(Fe.typescript);var Qt=String.raw,ci=new Ie.Query(Fe.typescript,Qt`
|
|
23
|
+
; export default {}
|
|
24
|
+
(export_statement
|
|
25
|
+
value: (satisfies_expression (object
|
|
26
|
+
(pair
|
|
27
|
+
key: (property_identifier) @_name (#eq? @_name "plugins")
|
|
28
|
+
value: (array) @imports
|
|
29
|
+
)
|
|
30
|
+
))?
|
|
31
|
+
value: (as_expression (object
|
|
32
|
+
(pair
|
|
33
|
+
key: (property_identifier) @_name (#eq? @_name "plugins")
|
|
34
|
+
value: (array) @imports
|
|
35
|
+
)
|
|
36
|
+
))?
|
|
37
|
+
value: (object
|
|
38
|
+
(pair
|
|
39
|
+
key: (property_identifier) @_name (#eq? @_name "plugins")
|
|
40
|
+
value: (array) @imports
|
|
41
|
+
)
|
|
42
|
+
)?
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
; module.exports = {}
|
|
46
|
+
(expression_statement
|
|
47
|
+
(assignment_expression
|
|
48
|
+
left: (member_expression) @left (#eq? @left "module.exports")
|
|
49
|
+
right: (satisfies_expression (object
|
|
50
|
+
(pair
|
|
51
|
+
key: (property_identifier) @_name (#eq? @_name "plugins")
|
|
52
|
+
value: (array) @imports
|
|
53
|
+
)
|
|
54
|
+
))?
|
|
55
|
+
right: (as_expression (object
|
|
56
|
+
(pair
|
|
57
|
+
key: (property_identifier) @_name (#eq? @_name "plugins")
|
|
58
|
+
value: (array) @imports
|
|
59
|
+
)
|
|
60
|
+
))?
|
|
61
|
+
right: (object
|
|
62
|
+
(pair
|
|
63
|
+
key: (property_identifier) @_name (#eq? @_name "plugins")
|
|
64
|
+
value: (array) @imports
|
|
65
|
+
)
|
|
66
|
+
)?
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
`);function Ue(e){try{let r=Le.parse(e).rootNode,i=di(e),n=ci.matches(r),l=[];for(let a of n)for(let o of a.captures)if(o.name==="imports"){for(let s of o.node.children)if(!(s.type==="["||s.type==="]"||s.type===","))switch(s.type){case"identifier":let u=i[s.text];if(!u||u.export!==null&&u.export!=="*")return null;l.push(u.module);break;case"string":l.push(s.children[1].text);break;case"call_expression":if(s.children?.[0]?.text!=="require")return null;let f=s.children?.[1]?.children?.[1]?.children?.[1]?.text;if(typeof f!="string")return null;l.push(f);break;default:return null}}return l}catch(t){return console.error(t),null}}var pi=new Ie.Query(Fe.typescript,Qt`
|
|
70
|
+
; ESM import
|
|
71
|
+
(import_statement
|
|
72
|
+
(import_clause
|
|
73
|
+
(identifier)? @default
|
|
74
|
+
(named_imports
|
|
75
|
+
(import_specifier
|
|
76
|
+
name: (identifier) @imported-name
|
|
77
|
+
alias: (identifier)? @imported-alias
|
|
78
|
+
)
|
|
79
|
+
)?
|
|
80
|
+
(namespace_import (identifier) @imported-namespace)?
|
|
81
|
+
)
|
|
82
|
+
(string
|
|
83
|
+
(string_fragment) @imported-from)
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
; CJS require
|
|
87
|
+
(variable_declarator
|
|
88
|
+
name: (identifier)? @default
|
|
89
|
+
name: (object_pattern
|
|
90
|
+
(shorthand_property_identifier_pattern)? @imported-name
|
|
91
|
+
(pair_pattern
|
|
92
|
+
key: (property_identifier) @imported-name
|
|
93
|
+
value: (identifier) @imported-alias
|
|
94
|
+
)?
|
|
95
|
+
(rest_pattern
|
|
96
|
+
(identifier) @imported-namespace
|
|
97
|
+
)?
|
|
98
|
+
)?
|
|
99
|
+
value: (call_expression
|
|
100
|
+
function: (identifier) @_fn (#eq? @_fn "require")
|
|
101
|
+
arguments: (arguments
|
|
102
|
+
(string
|
|
103
|
+
(string_fragment) @imported-from
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
`);function di(e){let r=Le.parse(e).rootNode,i=pi.matches(r),n={};for(let l of i){let a=[],o="";for(let s=0;s<l.captures.length;s++){let u=l.captures[s];switch(u.name){case"default":a.push({name:u.node.text,export:null});break;case"imported-name":a.push({name:u.node.text,export:u.node.text});break;case"imported-from":o=u.node.text;break;case"imported-namespace":a.push({name:u.node.text,export:"*"});break;case"imported-alias":if(a.length<1)throw new Error("Unexpected alias: "+JSON.stringify(i,null,2));let f=a[a.length-1],p=f.name;f.export=p,f.name=u.node.text;break}}for(let{name:s,export:u}of a)n[s]={module:o,export:u}}return n}var vi=yi(import.meta.url),wi=gi(vi);async function Xt(e,t){let[r,i]=await Promise.all([me(e,wi,()=>{}).then(s=>s.module),mi.readFile(e,"utf-8")]);if(!Ai(r,i))return $("Your configuration file could not be automatically migrated to the new CSS configuration format, so your CSS has been updated to load your existing configuration file."),null;let n=[],l=[],a=[];if("darkMode"in r&&a.push(ki(r)),"content"in r&&(n=Ci(r,t)),"theme"in r){let s=await bi(r);s&&a.push(s)}let o=Ue(i);if(o!==null)for(let s of o)l.push({base:t,path:s});return{sources:n,plugins:l,css:a.join(`
|
|
109
|
+
`)}}async function bi(e){let{extend:t,...r}=e.theme,i=new Map;for(let[s,u]of De(r))typeof u!="string"&&typeof u!="number"||i.has(s[0])||i.set(s[0],!1);let n=F({},[r,t],Ke),l="",a="@theme {",o=!1;for(let[s,u]of De(n)){if(typeof u!="string"&&typeof u!="number"||s[0]==="keyframes")continue;o=!0;let f=xi(s);f!==l&&(a+=`
|
|
110
|
+
`,l=f),i.has(s[0])&&i.get(s[0])===!1&&(i.set(s[0],!0),a+=` --${je([s[0]])}-*: initial;
|
|
111
|
+
`),a+=` --${je(s)}: ${u};
|
|
112
|
+
`}return"keyframes"in n&&(o=!0,a+=`
|
|
113
|
+
`+$i(n.keyframes)),o?a+`}
|
|
114
|
+
`:null}function ki(e){let t="";return Ht({config:()=>e.darkMode,addVariant:(n,l)=>t=l}),t===""?"":`@variant dark (${t});
|
|
115
|
+
`}function xi(e){let t=[];for(let r=0;r<e.length-1;r++){let i=e[r];if(e[r+1][0]==="-")break;t.push(i)}return t.join("-")}function Ci(e,t){let r=[];for(let i of e.content){if(typeof i!="string")throw new Error("Unsupported content value: "+i);r.push({base:t,pattern:i})}return r}function Ai(e,t){if(t.includes("function")||t.includes(" => "))return!1;function r(o){return typeof o=="function"?!1:Array.isArray(o)?o.every(r):typeof o=="object"&&o!==null?Object.values(o).every(r):["string","number","boolean","undefined"].includes(typeof o)}let{plugins:i,...n}=e;if(!r(n))return!1;let l=["darkMode","content","theme","plugins","presets","prefix"];if(Object.keys(e).some(o=>!l.includes(o))||Ue(t)===null||e.presets&&e.presets.length>0)return!1;let a=e.theme;if(a&&typeof a=="object"){if(a.extend&&!Zt(a.extend))return!1;let{extend:o,...s}=a;if(!Zt(s))return!1}return!0}var Si=[...Object.keys(hi),"containers"];function Zt(e){for(let t of Object.keys(e))if(!Si.includes(t))return!1;return!0}function $i(e){let t=[];return Yt(t,{theme:{keyframes:e}}),Ce(t).trim()+`
|
|
116
|
+
`}import _ from"node:fs/promises";import G from"node:path";import{execSync as Ti}from"node:child_process";import U from"node:fs/promises";import{dirname as Ni,resolve as M}from"node:path";var er=!1;async function q(e,t){let r=await _i(t);if(!r){er||(er=!0,ee("Could not detect a package manager. Please manually update `tailwindcss` to v4."));return}return Ti(`${r} ${e}`,{cwd:t})}async function _i(e){do{let t=M(e,"package.json");try{let r=await U.readFile(t,"utf-8"),i=JSON.parse(r);if(i.packageManager){if(i.packageManager.includes("bun"))return"bun";if(i.packageManager.includes("yarn"))return"yarn";if(i.packageManager.includes("pnpm"))return"pnpm";if(i.packageManager.includes("npm"))return"npm"}}catch{}try{return await U.access(M(e,"bun.lockb")),"bun"}catch{}try{return await U.access(M(e,"bun.lock")),"bun"}catch{}try{return await U.access(M(e,"pnpm-lock.yaml")),"pnpm"}catch{}try{return await U.access(M(e,"yarn.lock")),"yarn"}catch{}try{return await U.access(M(e,"package-lock.json")),"npm"}catch{}e=Ni(e)}while(!0)}async function rr(e){let t=!1,r=!1,i=!1,n=!1,l=await Ki(e);if(l){let f=await Vi(e,l);f&&(t=!0,r=f.didAddPostcssClient,i=f.didRemoveAutoprefixer,n=f.didRemovePostCSSImport)}let a=G.resolve(e,"package.json"),o;try{o=JSON.parse(await _.readFile(a,"utf-8"))}catch{}if(!t&&o&&"postcss"in o){let f=await tr(e,o.postcss);f&&(await _.writeFile(a,JSON.stringify({...o,postcss:f?.json},null,2)),t=!0,r=f.didAddPostcssClient,i=f.didRemoveAutoprefixer,n=f.didRemovePostCSSImport)}let s=await Pi(e),u=null;if(!t&&s){try{u=JSON.parse(await _.readFile(s,"utf-8"))}catch{}if(u){let f=await tr(e,u);f&&(await _.writeFile(s,JSON.stringify(f.json,null,2)),t=!0,r=f.didAddPostcssClient,i=f.didRemoveAutoprefixer,n=f.didRemovePostCSSImport)}}if(!t){$("No PostCSS config found, skipping migration.");return}if(r)try{await q("add -D @tailwindcss/postcss@next",e)}catch{}if(i||n)try{let f=[i?"autoprefixer":null,n?"postcss-import":null].filter(Boolean).join(" ");await q(`remove ${f}`,e)}catch{}R("PostCSS config has been upgraded.")}async function Vi(e,t){function r(d){return/['"]?tailwindcss['"]?\: ?\{\}/.test(d)}function i(d){return/['"]?postcss-import['"]?\: ?\{\}/.test(d)}function n(d){return/['"]?autoprefixer['"]?\: ?\{\}/.test(d)}function l(d){return/['"]tailwindcss\/nesting['"]\: ?(\{\}|['"]postcss-nesting['"])/.test(d)}if($(`Attempt to upgrade the PostCSS config in file: ${t}`),!await Oi(e,t))return ee("The PostCSS config contains dynamic JavaScript and can not be automatically migrated."),null;let o=!1,s=!1,u=!1,f=G.resolve(e,t),c=(await _.readFile(f,"utf-8")).split(`
|
|
117
|
+
`),m=[];for(let d=0;d<c.length;d++){let g=c[d];if(r(g))o=!0,m.push(g.replace("tailwindcss:","'@tailwindcss/postcss':"));else if(n(g))s=!0;else if(i(g)){let h=!1;for(let b=d+1;b<c.length;b++){let A=c[b];if(r(A))break;if(!l(A)){h=!0;break}}h?m.push(g):u=!0}else if(l(g)){let h=c[d+1];r(h)||m.push(g)}else m.push(g)}return await _.writeFile(f,m.join(`
|
|
118
|
+
`)),{didAddPostcssClient:o,didRemoveAutoprefixer:s,didRemovePostCSSImport:u}}async function tr(e,t){function r(p,c){return p==="tailwindcss"&&he(c)}function i(p,c){return p==="postcss-import"&&he(c)}function n(p,c){return p==="autoprefixer"&&he(c)}function l(p,c){return p==="tailwindcss/nesting"&&(c==="postcss-nesting"||he(c))}let a=!1,o=!1,s=!1,u=Object.entries(t.plugins||{}),f=[];for(let p=0;p<u.length;p++){let[c,m]=u[p];if(r(c,m))a=!0,f.push(["@tailwindcss/postcss",m]);else if(n(c,m))o=!0;else if(i(c,m)){let d=!1;for(let g=p+1;g<u.length;g++){let[h,b]=u[g];if(r(h,b))break;if(!l(h,b)){d=!0;break}}d?f.push([c,m]):s=!0}else if(l(c,m)){let[d,g]=u[p+1];r(d,g)||f.push([c,m])}else f.push([c,m])}return{json:{...t,plugins:Object.fromEntries(f)},didAddPostcssClient:a,didRemoveAutoprefixer:o,didRemovePostCSSImport:s}}var Ei=[".postcssrc.js",".postcssrc.mjs",".postcssrc.cjs",".postcssrc.ts",".postcssrc.mts",".postcssrc.cts","postcss.config.js","postcss.config.mjs","postcss.config.cjs","postcss.config.ts","postcss.config.mts","postcss.config.cts"];async function Ki(e){for(let t of Ei){let r=G.resolve(e,t);try{return await _.access(r),t}catch{}}return null}var Ri=[".postcssrc",".postcssrc.json"];async function Pi(e){for(let t of Ri){let r=G.resolve(e,t);try{return await _.access(r),t}catch{}}return null}async function Oi(e,t){let r=G.resolve(e,t),i=await _.readFile(r,"utf-8");return i.includes("tailwindcss:")&&!(i.includes("require")||i.includes("import "))}function he(e){return typeof e=="object"&&e!==null&&Object.keys(e).length===0}import{__unstable__loadDesignSystem as ir,compile as Di}from"@tailwindcss/node";import ji from"node:fs/promises";import Me from"node:path";import{dirname as nr}from"path";import{fileURLToPath as Ii}from"url";var Fi=Ii(import.meta.url),Y=nr(Fi),or=String.raw;async function lr(e,t){try{e===null&&(e=await Mi(t.base));let r=Me.resolve(t.base,e),i=Me.relative(Y,r);i.startsWith(".")||(i="./"+i);let n=await Li(r),l=n.prefix?dt(n.prefix):null,a=or`
|
|
119
|
+
@import 'tailwindcss' ${l?`prefix(${l})`:""};
|
|
120
|
+
@config './${i}';
|
|
121
|
+
`,[o,s]=await Promise.all([Di(a,{base:Y,onDependency:()=>{}}),ir(a,{base:Y})]);return{designSystem:s,globs:o.globs,userConfig:n,newPrefix:l,configFilePath:r}}catch(r){V("Could not load the configuration file: "+r.message),process.exit(1)}}async function Li(e){let[t,r]=await Promise.all([ir(or`
|
|
10
122
|
@import 'tailwindcss';
|
|
11
|
-
`,{base:
|
|
123
|
+
`,{base:Y}),me(e,Y,()=>{}).then(i=>i.module)]);return fe(t,[{base:nr(e),config:r}])}var Ui=["./tailwind.config.js","./tailwind.config.cjs","./tailwind.config.mjs","./tailwind.config.ts","./tailwind.config.cts","./tailwind.config.mts"];async function Mi(e){for(let t of Ui){let r=Me.resolve(e,t);try{return await ji.access(r),t}catch{}}throw new Error("No configuration file found. Please provide a path to the Tailwind CSS v3 config file via the `--config` option.")}import zi from"mri";function sr(e,t=process.argv.slice(2)){let r=zi(t),i={_:r._};for(let[n,{type:l,alias:a,default:o=l==="boolean"?!1:null}]of Object.entries(e)){if(i[n]=o,a){let s=a.slice(1);r[s]!==void 0&&(i[n]=ar(r[s],l))}{let s=n.slice(2);r[s]!==void 0&&(i[n]=ar(r[s],l))}}return i}function ar(e,t){switch(t){case"string":return we(e);case"boolean":return ye(e);case"number":return ve(e);case"boolean | string":return ye(e)??we(e);case"number | string":return ve(e)??we(e);case"boolean | number":return ye(e)??ve(e);case"boolean | number | string":return ye(e)??ve(e)??we(e);default:throw new Error(`Unhandled type: ${t}`)}}function ye(e){if(e===!0||e===!1)return e;if(e==="true")return!0;if(e==="false")return!1}function ve(e){if(typeof e=="number")return e;{let t=Number(e);if(!Number.isNaN(t))return t}}function we(e){return`${e}`}import{execSync as Bi}from"node:child_process";function ze(){try{return Bi("git status --porcelain",{encoding:"utf-8"}).trim()!==""}catch(e){return!e?.toString?.().includes("not a git repository")}}var cr={"--config":{type:"string",description:"Path to the configuration file",alias:"-c"},"--help":{type:"boolean",description:"Display usage information",alias:"-h"},"--force":{type:"boolean",description:"Force the migration",alias:"-f"},"--version":{type:"boolean",description:"Display the version number",alias:"-v"}},be=sr(cr);be["--help"]&&(Ge({usage:["npx @tailwindcss/upgrade"],options:cr}),process.exit(0));async function qi(){let e=process.cwd();P(Z()),P(),be["--force"]||ze()&&(V("Git directory is not clean. Please stash or commit your changes before migrating."),$(`You may use the ${X("--force")} flag to silence this warning and perform the migration.`),process.exit(1));let t=await lr(be["--config"],{base:e});{$("Migrating templates using the provided configuration file.");let i=new Set;for(let{pattern:l,base:a}of t.globs){let o=await ur([l],{absolute:!0,gitignore:!0,cwd:a});for(let s of o)i.add(s)}let n=Array.from(i);n.sort(),await Promise.allSettled(n.map(l=>wt(t.designSystem,t.userConfig,l))),R("Template migration complete.")}$("Migrating JavaScript configuration files using the provided configuration file.");let r=await Xt(t.configFilePath,e);{let i=be._.map(o=>Wi.resolve(e,o));i.length===0&&($("No input stylesheets provided. Searching for CSS files in the current directory and its subdirectories\u2026"),i=await ur(["**/*.css"],{absolute:!0,gitignore:!0})),i=i.filter(o=>o.endsWith(".css"));let n=await Promise.allSettled(i.map(o=>I.load(o)));for(let o of n)o.status==="rejected"&&V(`${o.reason}`);let l=n.filter(o=>o.status==="fulfilled").map(o=>o.value);try{await jt(l)}catch(o){V(`${o}`)}let a=await Promise.allSettled(l.map(o=>Dt(o,{...t,jsConfigMigration:r})));for(let o of a)o.status==="rejected"&&V(`${o.reason}`);try{await It(l)}catch(o){V(`${o}`)}for(let o of l)await Ji([Be()]).process(o.root,{from:o.file});for(let o of l)o.file&&await fr.writeFile(o.file,o.root.toString());R("Stylesheet migration complete.")}await rr(e);try{await q("add tailwindcss@next",e)}catch{}r!==null&&await fr.rm(t.configFilePath),ze()?R("Verify the changes and commit them to your repository."):R("No changes were made to your repository.")}qi().then(()=>process.exit(0)).catch(e=>{console.error(e),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/upgrade",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.27",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
"postcss-selector-parser": "^6.1.2",
|
|
33
33
|
"prettier": "^3.3.3",
|
|
34
34
|
"string-byte-slice": "^3.0.0",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"tailwindcss": "4.0.0-alpha.
|
|
35
|
+
"tree-sitter": "^0.21.1",
|
|
36
|
+
"tree-sitter-typescript": "^0.23.0",
|
|
37
|
+
"@tailwindcss/oxide": "4.0.0-alpha.27",
|
|
38
|
+
"tailwindcss": "4.0.0-alpha.27",
|
|
39
|
+
"@tailwindcss/node": "4.0.0-alpha.27"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@types/node": "^20.14.8",
|