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