@tailwindcss/cli 4.1.12 → 4.1.14
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 +5 -5
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var se=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),le=e=>{throw TypeError(e)};var q=(e,t,n)=>{if(t!=null){typeof t!="object"&&typeof t!="function"&&le("Object expected");var i,o;n&&(i=t[se("asyncDispose")]),i===void 0&&(i=t[se("dispose")],n&&(o=i)),typeof i!="function"&&le("Object not disposable"),o&&(i=function(){try{o.call(this)}catch(r){return Promise.reject(r)}}),e.push([n,i,t])}else n&&e.push([n]);return t},K=(e,t,n)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(u,s,l,p){return p=Error(l),p.name="SuppressedError",p.error=u,p.suppressed=s,p},o=u=>t=n?new i(u,t,"An error was suppressed during disposal"):(n=!0,u),r=u=>{for(;u=e.pop();)try{var s=u[1]&&u[1].call(u[2]);if(u[0])return Promise.resolve(s).then(r,l=>(o(l),r()))}catch(l){o(l)}if(n)throw t};return r()};import Ae from"mri";function ue(e,t=process.argv.slice(2)){for(let[o,r]of t.entries())r==="-"&&(t[o]="__IO_DEFAULT_VALUE__");let n=Ae(t);for(let o in n)n[o]==="__IO_DEFAULT_VALUE__"&&(n[o]="-");let i={_:n._};for(let[o,{type:r,alias:u,default:s=r==="boolean"?!1:null}]of Object.entries(e)){if(i[o]=s,u){let l=u.slice(1);n[l]!==void 0&&(i[o]=ae(n[l],r))}{let l=o.slice(2);n[l]!==void 0&&(i[o]=ae(n[l],r))}}return i}function ae(e,t){switch(t){case"string":return
|
|
2
|
+
var se=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),le=e=>{throw TypeError(e)};var q=(e,t,n)=>{if(t!=null){typeof t!="object"&&typeof t!="function"&&le("Object expected");var i,o;n&&(i=t[se("asyncDispose")]),i===void 0&&(i=t[se("dispose")],n&&(o=i)),typeof i!="function"&&le("Object not disposable"),o&&(i=function(){try{o.call(this)}catch(r){return Promise.reject(r)}}),e.push([n,i,t])}else n&&e.push([n]);return t},K=(e,t,n)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(u,s,l,p){return p=Error(l),p.name="SuppressedError",p.error=u,p.suppressed=s,p},o=u=>t=n?new i(u,t,"An error was suppressed during disposal"):(n=!0,u),r=u=>{for(;u=e.pop();)try{var s=u[1]&&u[1].call(u[2]);if(u[0])return Promise.resolve(s).then(r,l=>(o(l),r()))}catch(l){o(l)}if(n)throw t};return r()};import Ae from"mri";function ue(e,t=process.argv.slice(2)){for(let[o,r]of t.entries())r==="-"&&(t[o]="__IO_DEFAULT_VALUE__");let n=Ae(t);for(let o in n)n[o]==="__IO_DEFAULT_VALUE__"&&(n[o]="-");let i={_:n._};for(let[o,{type:r,alias:u,default:s=r==="boolean"?!1:null}]of Object.entries(e)){if(i[o]=s,u){let l=u.slice(1);n[l]!==void 0&&(i[o]=ae(n[l],r))}{let l=o.slice(2);n[l]!==void 0&&(i[o]=ae(n[l],r))}}return i}function ae(e,t){switch(t){case"string":return z(e);case"boolean":return O(e);case"number":return R(e);case"boolean | string":return O(e)??z(e);case"number | string":return R(e)??z(e);case"boolean | number":return O(e)??R(e);case"boolean | number | string":return O(e)??R(e)??z(e);default:throw new Error(`Unhandled type: ${t}`)}}function O(e){if(e===!0||e===!1)return e;if(e==="true")return!0;if(e==="false")return!1}function R(e){if(typeof e=="number")return e;{let t=Number(e);if(!Number.isNaN(t))return t}}function z(e){return`${e}`}import We from"@parcel/watcher";import{compile as Ee,env as Ue,Instrumentation as me,optimize as Pe,toSourceMap as he}from"@tailwindcss/node";import{clearRequireCache as Le}from"@tailwindcss/node/require-cache";import{Scanner as je}from"@tailwindcss/oxide";import{existsSync as Ie}from"fs";import X from"fs/promises";import C from"path";var k=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()}}async dispose(){for(let t of this.#e)await t();this.#e.clear()}};import Re from"fs";import de from"path";import{stripVTControlCharacters as ze}from"util";import w from"picocolors";import pe from"enhanced-resolve";import Me from"fs";import{createRequire as Be}from"module";var Oe=Be(import.meta.url).resolve;function ce(e){if(typeof globalThis.__tw_resolve=="function"){let t=globalThis.__tw_resolve(e);if(t)return t}return Oe(e)}var Xe=pe.ResolverFactory.createResolver({fileSystem:new pe.CachedInputFileSystem(Me,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});function fe(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 D={indent:2};function N(){return`${w.italic(w.bold(w.blue("\u2248")))} tailwindcss ${w.blue(`v${De()}`)}`}function F(e){return`${w.dim(w.blue("`"))}${w.blue(e)}${w.dim(w.blue("`"))}`}function W(e,t=process.cwd(),{preferAbsoluteIfShorter:n=!0}={}){let i=de.relative(t,e);return i.startsWith("..")||(i=`.${de.sep}${i}`),n&&i.length>e.length?e:i}function G(e,t){let n=e.split(" "),i=[],o="",r=0;for(let u of n){let s=ze(u).length;r+s+1>t&&(i.push(o),o="",r=0),o+=(r?" ":"")+u,r+=s+(r?1:0)}return r&&i.push(o),i}function E(e){let t=fe(e);return e<=50*1e6?w.green(t):e<=300*1e6?w.blue(t):e<=1e3*1e6?w.yellow(t):w.red(t)}function A(e,t=0){return`${" ".repeat(t+D.indent)}${e}`}function x(e=""){process.stderr.write(`${e}
|
|
3
3
|
`)}function h(e=""){process.stdout.write(`${e}
|
|
4
|
-
`)}function
|
|
4
|
+
`)}function De(){if(typeof globalThis.__tw_version=="string")return globalThis.__tw_version;let{version:e}=JSON.parse(Re.readFileSync(ce("tailwindcss/package.json"),"utf-8"));return e}import J from"fs/promises";import Ne from"path";function Q(){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 Y(e,t){try{if(await J.readFile(e,"utf8")===t)return}catch{}await J.mkdir(Ne.dirname(e),{recursive:!0}),await J.writeFile(e,t,"utf8")}var ye=String.raw,a=Ue.DEBUG;function U(){return{"--input":{type:"string",description:"Input file",alias:"-i"},"--output":{type:"string",description:"Output file",alias:"-o",default:"-"},"--watch":{type:"boolean | string",description:"Watch for changes and rebuild as needed, and use `always` to keep watching when stdin is closed",alias:"-w",values:["always"]},"--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:"."},"--map":{type:"boolean | string",description:"Generate a source map",default:!1}}}async function H(e){try{return await e()}catch(t){t instanceof Error&&x(t.toString()),process.exit(1)}}async function ge(e){var ne=[];try{x(N());x();let t=q(ne,new me);a&&t.start("[@tailwindcss/cli] (initial build)");let n=C.resolve(e["--cwd"]);e["--output"]&&e["--output"]!=="-"&&(e["--output"]=C.resolve(n,e["--output"]));e["--input"]&&e["--input"]!=="-"&&(e["--input"]=C.resolve(n,e["--input"]),Ie(e["--input"])||(x(`Specified input file ${F(W(e["--input"]))} does not exist.`),process.exit(1)));e["--input"]===e["--output"]&&e["--input"]!=="-"&&(x(`Specified input file ${F(W(e["--input"]))} and output file ${F(W(e["--output"]))} are identical.`),process.exit(1));e["--map"]==="-"&&(x("Use --map without a value to inline the source map"),process.exit(1));e["--map"]&&e["--map"]!==!0&&(e["--map"]=C.resolve(n,e["--map"]));let i=process.hrtime.bigint();let o=e["--input"]?e["--input"]==="-"?await Q():await X.readFile(e["--input"],"utf-8"):ye`
|
|
5
5
|
@import 'tailwindcss';
|
|
6
|
-
`;let r={css:"",optimizedCss:""};async function u(
|
|
7
|
-
`,$+=
|
|
6
|
+
`;let r={css:"",optimizedCss:""};async function u(g,b,f,S){let $=g;if(f["--minify"]||f["--optimize"])if(g!==r.css){a&&S.start("Optimize CSS");let T=Pe(g,{file:f["--input"]??"input.css",minify:f["--minify"]??!1,map:b?.raw??void 0});a&&S.end("Optimize CSS"),r.css=g,r.optimizedCss=T.code,T.map&&(b=he(T.map)),$=T.code}else $=r.optimizedCss;b&&(f["--map"]===!0?($+=`
|
|
7
|
+
`,$+=b.inline):typeof f["--map"]=="string"&&(a&&S.start("Write source map"),await Y(f["--map"],b.raw),a&&S.end("Write source map"))),a&&S.start("Write output"),f["--output"]&&f["--output"]!=="-"?await Y(f["--output"],$):h($),a&&S.end("Write output")}let s=e["--input"]&&e["--input"]!=="-"?C.resolve(e["--input"]):null;let l=s?C.dirname(s):process.cwd();let p=s?[s]:[];async function m(g,b){a&&b.start("Setup compiler");let f=await Ee(g,{from:e["--output"]?s??"stdin.css":void 0,base:l,onDependency(T){p.push(T)}}),S=(f.root==="none"?[]:f.root===null?[{base:n,pattern:"**/*",negated:!1}]:[{...f.root,negated:!1}]).concat(f.sources),$=new je({sources:S});return a&&b.end("Setup compiler"),[f,$]}let[d,y]=await H(()=>m(o,t));if(e["--watch"]){let g=[];g.push(await we(be(y),async function b(f){try{var S=[];try{if(f.length===1&&f[0]===e["--output"])return;let c=q(S,new me);a&&c.start("[@tailwindcss/cli] (watcher)");let ie=process.hrtime.bigint();let re=[];let L="incremental";let oe=p;for(let _ of f){if(oe.includes(_)){L="full";break}re.push({file:_,extension:C.extname(_).slice(1)})}let j="";let I=null;if(L==="full"){let _=e["--input"]?e["--input"]==="-"?await Q():await X.readFile(e["--input"],"utf-8"):ye`
|
|
8
8
|
@import 'tailwindcss';
|
|
9
|
-
`;Le(oe),p=s?[s]:[],[d,y]=await m(_,c),a&&c.start("Scan for candidates");let V=y.scan();a&&c.end("Scan for candidates"),a&&c.start("Setup new watchers");let
|
|
9
|
+
`;Le(oe),p=s?[s]:[],[d,y]=await m(_,c),a&&c.start("Scan for candidates");let V=y.scan();a&&c.end("Scan for candidates"),a&&c.start("Setup new watchers");let Fe=await we(be(y),b);a&&c.end("Setup new watchers"),a&&c.start("Cleanup old watchers"),await Promise.all(g.splice(0).map(ke=>ke())),a&&c.end("Cleanup old watchers"),g.push(Fe),a&&c.start("Build CSS"),j=d.build(V),a&&c.end("Build CSS"),e["--map"]&&(a&&c.start("Build Source Map"),I=d.buildSourceMap(),a&&c.end("Build Source Map"))}else if(L==="incremental"){a&&c.start("Scan for candidates");let _=y.scanFiles(re);if(a&&c.end("Scan for candidates"),_.length<=0){let V=process.hrtime.bigint();x(`Done in ${E(V-ie)}`);return}a&&c.start("Build CSS"),j=d.build(_),a&&c.end("Build CSS"),e["--map"]&&(a&&c.start("Build Source Map"),I=d.buildSourceMap(),a&&c.end("Build Source Map"))}await u(j,I,e,c);let Ce=process.hrtime.bigint();x(`Done in ${E(Ce-ie)}`)}catch($){var T=$,ve=!0}finally{K(S,T,ve)}}catch(c){c instanceof Error&&x(c.toString())}})),e["--watch"]!=="always"&&process.stdin.on("end",()=>{Promise.all(g.map(b=>b())).then(()=>process.exit(0),()=>process.exit(1))}),process.stdin.resume()}a&&t.start("Scan for candidates");let P=y.scan();a&&t.end("Scan for candidates");a&&t.start("Build CSS");let M=await H(()=>d.build(P));a&&t.end("Build CSS");let B=null;e["--map"]&&(a&&t.start("Build Source Map"),B=await H(()=>he(d.buildSourceMap())),a&&t.end("Build Source Map"));await u(M,B,e,t);let xe=process.hrtime.bigint();x(`Done in ${E(xe-i)}`)}catch($e){var Te=$e,_e=!0}finally{K(ne,Te,_e)}}async function we(e,t){e=e.sort((s,l)=>s.length-l.length);let n=[];for(let s=0;s<e.length;++s)for(let l=0;l<s;++l)e[s].startsWith(`${e[l]}/`)&&n.push(e[s]);e=e.filter(s=>!n.includes(s));let i=new k,o=new Set,r=new k;async function u(){await r.dispose(),r.queueMacrotask(()=>{t(Array.from(o)),o.clear()})}for(let s of e){let{unsubscribe:l}=await We.subscribe(s,async(p,m)=>{if(p){console.error(p);return}await Promise.all(m.map(async d=>{if(d.type==="delete")return;let y=null;try{y=await X.lstat(d.path)}catch{}!y?.isFile()&&!y?.isSymbolicLink()||o.add(d.path)})),await u()});i.add(l)}return async()=>{await i.dispose(),await r.dispose()}}function be(e){return[...new Set(e.normalizedSources.flatMap(t=>t.base))]}import v from"picocolors";function Z({invalid:e,usage:t,options:n}){let i=process.stdout.columns;if(h(N()),e&&(h(),h(`${v.dim("Invalid command:")} ${e}`)),t&&t.length>0){h(),h(v.dim("Usage:"));for(let[o,r]of t.entries()){let u=r.slice(0,r.indexOf("[")),s=r.slice(r.indexOf("["));s=s.replace(/\[.*?\]/g,m=>v.dim(m));let p=G(s,i-D.indent-u.length-1);p.length>1&&o!==0&&h(),h(A(`${u}${p.shift()}`));for(let m of p)h(A(m,u.length))}}if(n){let o=0;for(let{alias:l}of Object.values(n))l&&(o=Math.max(o,l.length));let r=[],u=0;for(let[l,{alias:p,values:m}]of Object.entries(n)){m?.length&&(l+=`[=${m.join(", ")}]`);let d=[p&&`${p.padStart(o)}`,p?l:" ".repeat(o+2)+l].filter(Boolean).join(", ");r.push(d),u=Math.max(u,d.length)}h(),h(v.dim("Options:"));let s=8;for(let{description:l,default:p=null}of Object.values(n)){let m=r.shift(),d=s+(u-m.length),y=2,P=i-m.length-d-y-D.indent,M=G(p!==null?`${l} ${v.dim(`[default:\u202F${F(`${p}`)}]`)}`:l,P);h(A(`${v.blue(m)} ${v.dim(v.gray("\xB7")).repeat(d)} ${M.shift()}`));for(let B of M)h(A(`${" ".repeat(m.length+d+y)}${B}`))}}}var ee={"--help":{type:"boolean",description:"Display usage information",alias:"-h"}},te=ue({...U(),...ee}),Se=te._[0];Se&&(Z({invalid:Se,usage:["tailwindcss [options]"],options:{...U(),...ee}}),process.exit(1));(process.stdout.isTTY&&process.argv[2]===void 0||te["--help"])&&(Z({usage:["tailwindcss [--input input.css] [--output output.css] [--watch] [options\u2026]"],options:{...U(),...ee}}),process.exit(0));ge(te);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/cli",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.14",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"enhanced-resolve": "^5.18.3",
|
|
29
29
|
"mri": "^1.2.0",
|
|
30
30
|
"picocolors": "^1.1.1",
|
|
31
|
-
"@tailwindcss/node": "4.1.
|
|
32
|
-
"@tailwindcss/oxide": "4.1.
|
|
33
|
-
"tailwindcss": "4.1.
|
|
31
|
+
"@tailwindcss/node": "4.1.14",
|
|
32
|
+
"@tailwindcss/oxide": "4.1.14",
|
|
33
|
+
"tailwindcss": "4.1.14"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"lint": "tsc --noEmit",
|