@tailwindcss/cli 4.0.0-alpha.24 → 4.0.0-alpha.25
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 +4 -10
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import le from"mri";function E(e,t=process.argv.slice(2)){let n=le(t),i={_:n._};for(let[r,{type:o,alias:u,default:f=o==="boolean"?!1:null}]of Object.entries(e)){if(i[r]=f,u){let s=u.slice(1);n[s]!==void 0&&(i[r]=V(n[s],o))}{let s=r.slice(2);n[s]!==void 0&&(i[r]=V(n[s],o))}}return i}function V(e,t){switch(t){case"string":return k(e);case"boolean":return C(e);case"number":return F(e);case"boolean | string":return C(e)??k(e);case"number | string":return F(e)??k(e);case"boolean | number":return C(e)??F(e);case"boolean | number | string":return C(e)??F(e)??k(e);default:throw new Error(`Unhandled type: ${t}`)}}function C(e){if(e===!0||e===!1)return e;if(e==="true")return!0;if(e==="false")return!1}function F(e){if(typeof e=="number")return e;{let t=Number(e);if(!Number.isNaN(t))return t}}function k(e){return`${e}`}import he from"@parcel/watcher";import{compile as ge}from"@tailwindcss/node";import{clearRequireCache as be}from"@tailwindcss/node/require-cache";import{Scanner as Z}from"@tailwindcss/oxide";import{Features as ee,transform as ye}from"lightningcss";import{existsSync as we}from"node:fs";import P from"node:fs/promises";import $ from"node:path";var T=class{#e=new Set([]);queueMacrotask(t){let n=setTimeout(t,0);return this.add(()=>{clearTimeout(n)})}add(t){return this.#e.add(t),()=>{this.#e.delete(t),t()}}dispose(){for(let t of this.#e)t();this.#e.clear()}};import fe from"node:fs";import Y from"node:path";import{stripVTControlCharacters as ce}from"node:util";import d from"picocolors";import G from"enhanced-resolve";import ue from"node:fs";import{createRequire as ae}from"node:module";var pe=ae(import.meta.url).resolve;function J(e){if(typeof globalThis.__tw_resolve=="function"){let t=globalThis.__tw_resolve(e);if(t)return t}return pe(e)}var ke=G.ResolverFactory.createResolver({fileSystem:new G.CachedInputFileSystem(ue,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});function Q(e){let t=typeof e=="number"?BigInt(e):e;return t<1000n?`${t}ns`:(t/=1000n,t<1000n?`${t}\xB5s`:(t/=1000n,t<1000n?`${t}ms`:(t/=1000n,t<60n?`${t}s`:(t/=60n,t<60n?`${t}m`:(t/=60n,t<24n?`${t}h`:(t/=24n,`${t}d`))))))}var R={indent:2};function _(){return`${d.italic(d.bold(d.blue("\u2248")))} tailwindcss ${d.blue(`v${de()}`)}`}function A(e){return`${d.dim(d.blue("`"))}${d.blue(e)}${d.dim(d.blue("`"))}`}function H(e,t=process.cwd(),{preferAbsoluteIfShorter:n=!0}={}){let i=Y.relative(t,e);return i.startsWith("..")||(i=`.${Y.sep}${i}`),n&&i.length>e.length?e:i}function M(e,t){let n=e.split(" "),i=[],r="",o=0;for(let u of n){let f=ce(u).length;o+f+1>t&&(i.push(r),r="",o=0),r+=(o?" ":"")+u,o+=f+(o?1:0)}return o&&i.push(r),i}function N(e){let t=Q(e);return e<=50*1e6?d.green(t):e<=300*1e6?d.blue(t):e<=1e3*1e6?d.yellow(t):d.red(t)}function v(e,t=0){return`${" ".repeat(t+R.indent)}${e}`}function b(e=""){process.stderr.write(`${e}
|
|
3
|
+
`)}function p(e=""){process.stdout.write(`${e}
|
|
4
|
+
`)}function de(){if(typeof globalThis.__tw_version=="string")return globalThis.__tw_version;let{version:e}=JSON.parse(fe.readFileSync(J("tailwindcss/package.json"),"utf-8"));return e}import j from"node:fs/promises";import me from"node:path";function B(){return new Promise((e,t)=>{let n="";process.stdin.on("data",i=>{n+=i}),process.stdin.on("end",()=>e(n)),process.stdin.on("error",i=>t(i))})}async function X(e,t){try{if(await j.readFile(e,"utf8")===t)return}catch{}await j.mkdir(me.dirname(e),{recursive:!0}),await j.writeFile(e,t,"utf8")}var te=String.raw;function O(){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 re(e){let t=$.resolve(e["--cwd"]);e["--output"]&&(e["--output"]=$.resolve(t,e["--output"])),e["--input"]&&e["--input"]!=="-"&&(e["--input"]=$.resolve(t,e["--input"]),we(e["--input"])||(b(_()),b(),b(`Specified input file ${A(H(e["--input"]))} does not exist.`),process.exit(1)));let n=process.hrtime.bigint(),i=e["--input"]?e["--input"]==="-"?await B():await P.readFile(e["--input"],"utf-8"):te`
|
|
5
|
+
@import 'tailwindcss';
|
|
6
|
+
`,r={css:"",optimizedCss:""};async function o(m,c){let g=m;if(c["--minify"]||c["--optimize"])if(m!==r.css){let y=xe(m,{file:c["--input"]??"input.css",minify:c["--minify"]??!1});r.css=m,r.optimizedCss=y,g=y}else g=r.optimizedCss;c["--output"]?await X(c["--output"],g):p(g)}let u=e["--input"]&&e["--input"]!=="-"?e["--input"]:process.cwd(),f=$.dirname($.resolve(u)),s=[];function a(m){return ge(m,{base:f,onDependency(c){s.push(c)}})}let l=await a(i),h=new Z({detectSources:{base:t},sources:l.globs});if(e["--watch"]){let m=await ie(ne(t,h),async function c(g){try{if(g.length===1&&g[0]===e["--output"])return;let y=[],D="incremental",L=s;for(let w of g){if(L.includes(w)){D="full";break}y.push({file:w,extension:$.extname(w).slice(1)})}let U=process.hrtime.bigint(),W="";if(D==="full"){m();let w=e["--input"]?e["--input"]==="-"?await B():await P.readFile(e["--input"],"utf-8"):te`
|
|
7
|
+
@import 'tailwindcss';
|
|
8
|
+
`;be(L),s=[],l=await a(w),h=new Z({detectSources:{base:t},sources:l.globs});let I=h.scan();m=await ie(ne(t,h),c),W=l.build(I)}else if(D==="incremental"){let w=h.scanFiles(y);if(w.length<=0){let I=process.hrtime.bigint();b(`Done in ${N(I-U)}`);return}W=l.build(w)}await o(W,e);let se=process.hrtime.bigint();b(`Done in ${N(se-U)}`)}catch(y){y instanceof Error&&b(y.toString())}});e["--watch"]!=="always"&&process.stdin.on("end",()=>{m(),process.exit(0)}),process.stdin.resume()}await o(l.build(h.scan()),e);let S=process.hrtime.bigint();b(_()),b(),b(`Done in ${N(S-n)}`)}function ne(e,t){return[e].concat(t.globs.flatMap(n=>n.pattern[0]==="!"?[]:n.base.startsWith(e)?[]:n.base))}async function ie(e,t){let n=new T,i=new Set,r=new T;function o(){r.dispose(),r.queueMacrotask(()=>{t(Array.from(i)),i.clear()})}for(let u of e){let{unsubscribe:f}=await he.subscribe(u,async(s,a)=>{if(s){console.error(s);return}await Promise.all(a.map(async l=>{l.type==="delete"||(await P.lstat(l.path)).isDirectory()||i.add(l.path)})),o()});n.add(f)}return()=>{n.dispose(),r.dispose()}}function xe(e,{file:t="input.css",minify:n=!1}={}){return ye({filename:t,code:Buffer.from(e),minify:n,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:ee.Nesting,exclude:ee.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code.toString()}import x from"picocolors";function q({invalid:e,usage:t,options:n}){let i=process.stdout.columns;if(p(_()),e&&(p(),p(`${x.dim("Invalid command:")} ${e}`)),t&&t.length>0){p(),p(x.dim("Usage:"));for(let[r,o]of t.entries()){let u=o.slice(0,o.indexOf("[")),f=o.slice(o.indexOf("["));f=f.replace(/\[.*?\]/g,l=>x.dim(l));let a=M(f,i-R.indent-u.length-1);a.length>1&&r!==0&&p(),p(v(`${u}${a.shift()}`));for(let l of a)p(v(l,u.length))}}if(n){let r=0;for(let{alias:s}of Object.values(n))s&&(r=Math.max(r,s.length));let o=[],u=0;for(let[s,{alias:a}]of Object.entries(n)){let l=[a&&`${a.padStart(r)}`,a?s:" ".repeat(r+2)+s].filter(Boolean).join(", ");o.push(l),u=Math.max(u,l.length)}p(),p(x.dim("Options:"));let f=8;for(let{description:s,default:a=null}of Object.values(n)){let l=o.shift(),h=f+(u-l.length),S=2,m=i-l.length-h-S-R.indent,c=M(a!==null?`${s} ${x.dim(`[default:\u202F${A(`${a}`)}]`)}`:s,m);p(v(`${x.blue(l)} ${x.dim(x.gray("\xB7")).repeat(h)} ${c.shift()}`));for(let g of c)p(v(`${" ".repeat(l.length+h+S)}${g}`))}}}var K={"--help":{type:"boolean",description:"Display usage information",alias:"-h"}},z=E({...O(),...K}),oe=z._[0];oe&&(q({invalid:oe,usage:["tailwindcss [options]"],options:{...O(),...K}}),process.exit(1));(process.stdout.isTTY&&!z["--output"]||z["--help"])&&(q({usage:["tailwindcss [--input input.css] [--output output.css] [--watch] [options\u2026]"],options:{...O(),...K}}),process.exit(0));re(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.25",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,15 +29,9 @@
|
|
|
29
29
|
"lightningcss": "^1.26.0",
|
|
30
30
|
"mri": "^1.2.0",
|
|
31
31
|
"picocolors": "^1.0.1",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@tailwindcss/oxide": "4.0.0-alpha.24",
|
|
36
|
-
"tailwindcss": "4.0.0-alpha.24"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@types/postcss-import": "^14.0.3",
|
|
40
|
-
"internal-postcss-fix-relative-paths": "0.0.0"
|
|
32
|
+
"@tailwindcss/node": "4.0.0-alpha.25",
|
|
33
|
+
"@tailwindcss/oxide": "4.0.0-alpha.25",
|
|
34
|
+
"tailwindcss": "4.0.0-alpha.25"
|
|
41
35
|
},
|
|
42
36
|
"scripts": {
|
|
43
37
|
"lint": "tsc --noEmit",
|