@tailwindcss/cli 4.0.0-alpha.17 → 4.0.0-alpha.19
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 +7 -7
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
`)}function
|
|
4
|
-
`)}import
|
|
5
|
-
@import '${
|
|
6
|
-
`,t["--input"]??e),
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import ft from"mri";function E(t,e=process.argv.slice(2)){let i=ft(e),n={_:i._};for(let[s,{type:r,alias:a,default:u=r==="boolean"?!1:null}]of Object.entries(t)){if(n[s]=u,a){let o=a.slice(1);i[o]!==void 0&&(n[s]=V(i[o],r))}{let o=s.slice(2);i[o]!==void 0&&(n[s]=V(i[o],r))}}return n}function V(t,e){switch(e){case"string":return R(t);case"boolean":return A(t);case"number":return W(t);case"boolean | string":return A(t)??R(t);case"number | string":return W(t)??R(t);case"boolean | number":return A(t)??W(t);case"boolean | number | string":return A(t)??W(t)??R(t);default:throw new Error(`Unhandled type: ${e}`)}}function A(t){if(t===!0||t===!1)return t;if(t==="true")return!0;if(t==="false")return!1}function W(t){if(typeof t=="number")return t;{let e=Number(t);if(!Number.isNaN(e))return e}}function R(t){return`${t}`}import bt from"@parcel/watcher";import{clearCache as yt,scanDir as tt}from"@tailwindcss/oxide";import F from"node:path";function ct(t,e){if(typeof t!="string")throw new TypeError("expected path to be a string");if(t==="\\"||t==="/")return"/";var i=t.length;if(i<=1)return t;var n="";if(i>4&&t[3]==="\\"){var s=t[2];(s==="?"||s===".")&&t.slice(0,2)==="\\\\"&&(t=t.slice(2),n="//")}var r=t.split(/[/\\]+/);return e!==!1&&r[r.length-1]===""&&r.pop(),n+r.join("/")}function G(t){let e=ct(t);return t.startsWith("\\\\")&&e.startsWith("/")&&!e.startsWith("//")?`/${e}`:e}var j="'",I='"';function J(){let t=new WeakSet;function e(i){let n=i.root().source?.input.file;if(!n)return;let s=i.source?.input.file;if(!s||t.has(i))return;let r=i.params[0],a=r[0]===I&&r[r.length-1]===I?I:r[0]===j&&r[r.length-1]===j?j:null;if(!a)return;let u=i.params.slice(1,-1),o="";if(u.startsWith("!")&&(u=u.slice(1),o="!"),!u.startsWith("./")&&!u.startsWith("../"))return;let p=F.posix.join(G(F.dirname(s)),u),l=F.posix.dirname(G(n)),f=F.posix.relative(l,p);f.startsWith(".")||(f="./"+f),i.params=a+o+f+a,t.add(i)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:e,plugin:e}}}import{Features as et,transform as wt}from"lightningcss";import{existsSync as xt}from"node:fs";import K from"node:fs/promises";import $ from"node:path";import{pathToFileURL as $t}from"node:url";import Tt from"postcss";import vt from"postcss-import";import*as ot from"tailwindcss";var T=class{#t=new Set([]);queueMacrotask(e){let i=setTimeout(e,0);return this.add(()=>{clearTimeout(i)})}add(e){return this.#t.add(e),()=>{this.#t.delete(e),e()}}dispose(){for(let e of this.#t)e();this.#t.clear()}};import mt from"node:fs";import Y from"node:path";import{stripVTControlCharacters as ht}from"node:util";import g from"picocolors";import{createRequire as dt}from"node:module";var v=dt(import.meta.url).resolve;function Q(t){let e=typeof t=="number"?BigInt(t):t;return e<1000n?`${e}ns`:(e/=1000n,e<1000n?`${e}\xB5s`:(e/=1000n,e<1000n?`${e}ms`:(e/=1000n,e<60n?`${e}s`:(e/=60n,e<60n?`${e}m`:(e/=60n,e<24n?`${e}h`:(e/=24n,`${e}d`))))))}var O={indent:2};function C(){let{version:t}=JSON.parse(mt.readFileSync(v("tailwindcss/package.json"),"utf-8"));return`${g.italic(g.bold(g.blue("\u2248")))} tailwindcss ${g.blue(`v${t}`)}`}function N(t){return`${g.dim(g.blue("`"))}${g.blue(t)}${g.dim(g.blue("`"))}`}function H(t,e=process.cwd(),{preferAbsoluteIfShorter:i=!0}={}){let n=Y.relative(e,t);return n.startsWith("..")||(n=`.${Y.sep}${n}`),i&&n.length>t.length?t:n}function M(t,e){let i=t.split(" "),n=[],s="",r=0;for(let a of i){let u=ht(a).length;r+u+1>e&&(n.push(s),s="",r=0),s+=(r?" ":"")+a,r+=u+(r?1:0)}return r&&n.push(s),n}function B(t){let e=Q(t);return t<=50*1e6?g.green(e):t<=300*1e6?g.blue(e):t<=1e3*1e6?g.yellow(e):g.red(e)}function k(t,e=0){return`${" ".repeat(e+O.indent)}${t}`}function b(t=""){process.stderr.write(`${t}
|
|
3
|
+
`)}function m(t=""){process.stdout.write(`${t}
|
|
4
|
+
`)}import L from"node:fs/promises";import gt from"node:path";function X(){return new Promise((t,e)=>{let i="";process.stdin.on("data",n=>{i+=n}),process.stdin.on("end",()=>t(i)),process.stdin.on("error",n=>e(n))})}async function Z(t,e){try{if(await L.readFile(t,"utf8")===e)return}catch{}await L.mkdir(gt.dirname(t),{recursive:!0}),await L.writeFile(t,e,"utf8")}var it=String.raw;function _(){return{"--input":{type:"string",description:"Input file",alias:"-i"},"--output":{type:"string",description:"Output file",alias:"-o"},"--watch":{type:"boolean | string",description:"Watch for changes and rebuild as needed",alias:"-w"},"--minify":{type:"boolean",description:"Optimize and minify the output",alias:"-m"},"--optimize":{type:"boolean",description:"Optimize the output without minifying"},"--cwd":{type:"string",description:"The current working directory",default:"."}}}async function lt(t){let e=$.resolve(t["--cwd"]);t["--output"]&&(t["--output"]=$.resolve(e,t["--output"])),t["--input"]&&t["--input"]!=="-"&&(t["--input"]=$.resolve(e,t["--input"]),xt(t["--input"])||(b(C()),b(),b(`Specified input file ${N(H(t["--input"]))} does not exist.`),process.exit(1)));let i=process.hrtime.bigint(),[n,s]=await st(t["--input"]?t["--input"]==="-"?await X():await K.readFile(t["--input"],"utf-8"):it`
|
|
5
|
+
@import '${v("tailwindcss/index.css")}';
|
|
6
|
+
`,t["--input"]??e),r={css:"",optimizedCss:""};async function a(h,d){let c=h;if(d["--minify"]||d["--optimize"])if(h!==r.css){let y=Ct(h,{file:d["--input"]??"input.css",minify:d["--minify"]??!1});r.css=h,r.optimizedCss=y,c=y}else c=r.optimizedCss;d["--output"]?await Z(d["--output"],c):m(c)}let u=t["--input"]&&t["--input"]!=="-"?t["--input"]:process.cwd(),o=$.dirname($.resolve(u));function p(h){return ot.compile(h,{loadPlugin:async d=>d[0]==="."?import($t($.resolve(o,d)).href).then(c=>c.default??c):import(d).then(c=>c.default??c)})}let l=await p(n),f=tt({base:e,sources:l.globs.map(h=>({base:o,pattern:h}))});if(t["--watch"]){let h=await rt(nt(e,f),async function d(c){try{if(c.length===1&&c[0]===t["--output"])return;let y=[],D="incremental";for(let w of c){if(s.includes(w)){D="full";break}y.push({file:w,extension:$.extname(w).slice(1)})}let ut=process.hrtime.bigint(),P="";if(D==="full")h(),yt(),[n,s]=await st(t["--input"]?await K.readFile(t["--input"],"utf-8"):it`
|
|
7
|
+
@import '${v("tailwindcss/index.css")}';
|
|
8
|
+
`,t["--input"]??e),l=await p(n),f=tt({base:e,sources:l.globs.map(w=>({base:o,pattern:w}))}),h=await rt(nt(e,f),d),P=l.build(f.candidates);else if(D==="incremental"){let w=f.scanFiles(y);if(w.length===0)return;P=l.build(w)}await a(P,t);let pt=process.hrtime.bigint();b(`Done in ${B(pt-ut)}`)}catch(y){y instanceof Error&&b(y.toString())}});t["--watch"]!=="always"&&process.stdin.on("end",()=>{h(),process.exit(0)}),process.stdin.resume()}await a(l.build(f.candidates),t);let S=process.hrtime.bigint();b(C()),b(),b(`Done in ${B(S-i)}`)}function nt(t,e){return[t].concat(e.globs.flatMap(i=>i.pattern[0]==="!"?[]:i.base.startsWith(t)?[]:i.base))}async function rt(t,e){let i=new T,n=new Set,s=new T;function r(){s.dispose(),s.queueMacrotask(()=>{e(Array.from(n)),n.clear()})}for(let a of t){let{unsubscribe:u}=await bt.subscribe(a,async(o,p)=>{if(o){console.error(o);return}await Promise.all(p.map(async l=>{l.type==="delete"||(await K.lstat(l.path)).isDirectory()||n.add(l.path)})),r()});i.add(u)}return()=>{i.dispose(),s.dispose()}}function st(t,e){return t.includes("@import")?Tt().use(vt()).use(J()).process(t,{from:e}).then(i=>[i.css,[e].concat(i.messages.filter(n=>n.type==="dependency").map(n=>n.file))]):[t,[e]]}function Ct(t,{file:e="input.css",minify:i=!1}={}){return wt({filename:e,code:Buffer.from(t),minify:i,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:et.Nesting,exclude:et.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code.toString()}import x from"picocolors";function U({invalid:t,usage:e,options:i}){let n=process.stdout.columns;if(m(C()),t&&(m(),m(`${x.dim("Invalid command:")} ${t}`)),e&&e.length>0){m(),m(x.dim("Usage:"));for(let[s,r]of e.entries()){let a=r.slice(0,r.indexOf("[")),u=r.slice(r.indexOf("["));u=u.replace(/\[.*?\]/g,l=>x.dim(l));let p=M(u,n-O.indent-a.length-1);p.length>1&&s!==0&&m(),m(k(`${a}${p.shift()}`));for(let l of p)m(k(l,a.length))}}if(i){let s=0;for(let{alias:o}of Object.values(i))o&&(s=Math.max(s,o.length));let r=[],a=0;for(let[o,{alias:p}]of Object.entries(i)){let l=[p&&`${p.padStart(s)}`,p?o:" ".repeat(s+2)+o].filter(Boolean).join(", ");r.push(l),a=Math.max(a,l.length)}m(),m(x.dim("Options:"));let u=8;for(let{description:o,default:p=null}of Object.values(i)){let l=r.shift(),f=u+(a-l.length),S=2,h=n-l.length-f-S-O.indent,d=M(p!==null?`${o} ${x.dim(`[default:\u202F${N(`${p}`)}]`)}`:o,h);m(k(`${x.blue(l)} ${x.dim(x.gray("\xB7")).repeat(f)} ${d.shift()}`));for(let c of d)m(k(`${" ".repeat(l.length+f+S)}${c}`))}}}var q={"--help":{type:"boolean",description:"Display usage information",alias:"-h"}},z=E({..._(),...q}),at=z._[0];at&&(U({invalid:at,usage:["tailwindcss [options]"],options:{..._(),...q}}),process.exit(1));(process.stdout.isTTY&&!z["--output"]||z["--help"])&&(U({usage:["tailwindcss [--input input.css] [--output output.css] [--watch] [options\u2026]"],options:{..._(),...q}}),process.exit(0));lt(z);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/cli",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.19",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -25,20 +25,21 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@parcel/watcher": "^2.4.1",
|
|
28
|
-
"lightningcss": "^1.
|
|
28
|
+
"lightningcss": "^1.26.0",
|
|
29
29
|
"mri": "^1.2.0",
|
|
30
30
|
"picocolors": "^1.0.1",
|
|
31
|
-
"postcss": "8.4.
|
|
31
|
+
"postcss": "^8.4.41",
|
|
32
32
|
"postcss-import": "^16.1.0",
|
|
33
|
-
"
|
|
34
|
-
"tailwindcss": "4.0.0-alpha.
|
|
33
|
+
"tailwindcss": "4.0.0-alpha.19",
|
|
34
|
+
"@tailwindcss/oxide": "4.0.0-alpha.19"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/postcss-import": "^14.0.3"
|
|
37
|
+
"@types/postcss-import": "^14.0.3",
|
|
38
|
+
"internal-postcss-fix-relative-paths": "0.0.0"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"lint": "tsc --noEmit",
|
|
41
|
-
"build": "tsup-node
|
|
42
|
+
"build": "tsup-node",
|
|
42
43
|
"dev": "pnpm run build -- --watch"
|
|
43
44
|
}
|
|
44
45
|
}
|