@tailwindcss/cli 0.0.0-insiders.77b3cb5 → 0.0.0-insiders.7811d74

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/README.md CHANGED
@@ -13,10 +13,10 @@
13
13
  </p>
14
14
 
15
15
  <p align="center">
16
- <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=next" alt="Build Status"></a>
16
+ <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=main" alt="Build Status"></a>
17
17
  <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
18
- <a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
19
- <a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
18
+ <a href="https://github.com/tailwindlabs/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
19
+ <a href="https://github.com/tailwindlabs/tailwindcss/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
20
20
  </p>
21
21
 
22
22
  ---
@@ -29,8 +29,8 @@ For full documentation, visit [tailwindcss.com](https://tailwindcss.com).
29
29
 
30
30
  For help, discussion about best practices, or feature ideas:
31
31
 
32
- [Discuss Tailwind CSS on GitHub](https://github.com/tailwindcss/tailwindcss/discussions)
32
+ [Discuss Tailwind CSS on GitHub](https://github.com/tailwindlabs/tailwindcss/discussions)
33
33
 
34
34
  ## Contributing
35
35
 
36
- If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/next/.github/CONTRIBUTING.md) **before submitting a pull request**.
36
+ If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindlabs/tailwindcss/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**.
package/dist/index.mjs CHANGED
@@ -1,9 +1,28 @@
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 W(e);case"boolean":return O(e);case"number":return R(e);case"boolean | string":return O(e)??W(e);case"number | string":return R(e)??W(e);case"boolean | number":return O(e)??R(e);case"boolean | number | string":return O(e)??R(e)??W(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 W(e){return`${e}`}import De from"@parcel/watcher";import{compile as Ne,env as Ee,Instrumentation as me,optimize as Ue,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 A=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 Oe from"fs";import de from"path";import{stripVTControlCharacters as Re}from"util";import w from"picocolors";import pe from"enhanced-resolve";import Fe from"fs";import{createRequire as Me}from"module";var Be=Me(import.meta.url).resolve;function ce(e){if(typeof globalThis.__tw_resolve=="function"){let t=globalThis.__tw_resolve(e);if(t)return t}return Be(e)}var He=pe.ResolverFactory.createResolver({fileSystem:new pe.CachedInputFileSystem(Fe,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 z={indent:2};function D(){return`${w.italic(w.bold(w.blue("\u2248")))} tailwindcss ${w.blue(`v${We()}`)}`}function k(e){return`${w.dim(w.blue("`"))}${w.blue(e)}${w.dim(w.blue("`"))}`}function N(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=Re(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 F(e,t=0){return`${" ".repeat(t+z.indent)}${e}`}function g(e=""){process.stderr.write(`${e}
3
- `)}function h(e=""){process.stdout.write(`${e}
4
- `)}function We(){if(typeof globalThis.__tw_version=="string")return globalThis.__tw_version;let{version:e}=JSON.parse(Oe.readFileSync(ce("tailwindcss/package.json"),"utf-8"));return e}import J from"fs/promises";import ze 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(ze.dirname(e),{recursive:!0}),await J.writeFile(e,t,"utf8")}var ye=String.raw,a=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, 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&&g(t.toString()),process.exit(1)}}async function ge(e){var ne=[];try{g(D());g();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"])||(g(`Specified input file ${k(N(e["--input"]))} does not exist.`),process.exit(1)));e["--input"]===e["--output"]&&e["--input"]!=="-"&&(g(`Specified input file ${k(N(e["--input"]))} and output file ${k(N(e["--output"]))} are identical.`),process.exit(1));e["--map"]==="-"&&(g("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`
2
+ var ye=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Se=e=>{throw TypeError(e)};var J=(e,t,n)=>{if(t!=null){typeof t!="object"&&typeof t!="function"&&Se("Object expected");var i,r;n&&(i=t[ye("asyncDispose")]),i===void 0&&(i=t[ye("dispose")],n&&(r=i)),typeof i!="function"&&Se("Object not disposable"),r&&(i=function(){try{r.call(this)}catch(s){return Promise.reject(s)}}),e.push([n,i,t])}else n&&e.push([n]);return t},Q=(e,t,n)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(o,a,l,c){return c=Error(l),c.name="SuppressedError",c.error=o,c.suppressed=a,c},r=o=>t=n?new i(o,t,"An error was suppressed during disposal"):(n=!0,o),s=o=>{for(;o=e.pop();)try{var a=o[1]&&o[1].call(o[2]);if(o[0])return Promise.resolve(a).then(s,l=>(r(l),s()))}catch(l){r(l)}if(n)throw t};return s()};import qe from"mri";function k(e,t=process.argv.slice(2)){for(let[r,s]of t.entries())s==="-"&&(t[r]="__IO_DEFAULT_VALUE__");let n=qe(t);for(let r in n){let s=n[r];r!=="_"&&Array.isArray(s)&&(s=s[s.length-1]),s==="__IO_DEFAULT_VALUE__"&&(s="-"),n[r]=s}let i={_:n._};for(let[r,{type:s,alias:o,default:a=s==="boolean"?!1:null}]of Object.entries(e)){if(i[r]=a,o){let l=o.slice(1);n[l]!==void 0&&(i[r]=xe(n[l],s))}{let l=r.slice(2);n[l]!==void 0&&(i[r]=xe(n[l],s))}}return i}function xe(e,t){switch(t){case"string":return X(e);case"boolean":return H(e);case"number":return Z(e);case"boolean | string":return H(e)??X(e);case"number | string":return Z(e)??X(e);case"boolean | number":return H(e)??Z(e);case"boolean | number | string":return H(e)??Z(e)??X(e);default:throw new Error(`Unhandled type: ${t}`)}}function H(e){if(e===!0||e===!1)return e;if(e==="true")return!0;if(e==="false")return!1}function Z(e){if(typeof e=="number")return e;{let t=Number(e);if(!Number.isNaN(t))return t}}function X(e){return`${e}`}import{compile as nt,env as it,Instrumentation as pe,optimize as rt,toSourceMap as M}from"@tailwindcss/node";import{clearRequireCache as Ee}from"@tailwindcss/node/require-cache";import{Scanner as st}from"@tailwindcss/oxide";import{existsSync as ot}from"fs";import j from"fs/promises";import x from"path";var I=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 Ze from"fs";import $e from"path";import{stripVTControlCharacters as Xe}from"util";import $ from"picocolors";import Ce from"enhanced-resolve";import Je from"fs";import{createRequire as Qe}from"module";var He=Qe(import.meta.url).resolve;function Te(e){if(typeof globalThis.__tw_resolve=="function"){let t=globalThis.__tw_resolve(e);if(t)return t}return He(e)}var It=Ce.ResolverFactory.createResolver({fileSystem:new Ce.CachedInputFileSystem(Je,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});function _e(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 ee={indent:2};function te(){return`${$.italic($.bold($.blue("\u2248")))} tailwindcss ${$.blue(`v${et()}`)}`}function F(e){return`${$.dim($.blue("`"))}${$.blue(e)}${$.dim($.blue("`"))}`}function ne(e,t=process.cwd(),{preferAbsoluteIfShorter:n=!0}={}){let i=$e.relative(t,e);return i.startsWith("..")||(i=`.${$e.sep}${i}`),n&&i.length>e.length?e:i}function z(e,t){let n=e.split(" "),i=[],r="",s=0;for(let o of n){let a=Xe(o).length;s>0&&s+a+1>t&&(i.push(r),r="",s=0),r+=(s?" ":"")+o,s+=a+(s?1:0)}return s&&i.push(r),i}function O(e){let t=_e(e);return e<=50*1e6?$.green(t):e<=300*1e6?$.blue(t):e<=1e3*1e6?$.yellow(t):$.red(t)}function W(e,t=0){return`${" ".repeat(t+ee.indent)}${e}`}function T(e=""){process.stderr.write(`${e}
3
+ `)}function ie(e=""){process.stdout.write(`${e}
4
+ `)}function et(){if(typeof globalThis.__tw_version=="string")return globalThis.__tw_version;let{version:e}=JSON.parse(Ze.readFileSync(Te("tailwindcss/package.json"),"utf-8"));return e}import re from"fs/promises";import tt from"path";function se(){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 ce(e,t){if(!await re.stat(e).then(i=>i.isCharacterDevice()||i.isFIFO()).catch(()=>!1))try{if(await re.readFile(e,"utf8")===t)return}catch{}await re.mkdir(tt.dirname(e),{recursive:!0}),await re.writeFile(e,t,"utf8")}var de=String.raw,u=it.DEBUG,lt=250;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"]},"--poll":{type:"boolean | number",description:"Use polling instead of filesystem events when watching",default:!1,values:["ms"]},"--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},"--silent":{type:"boolean",description:"Suppress non-error output"}}}function fe(e){let t=new Set;function n(i,r){let s=" ".repeat(r),o=(process.stderr.columns??1/0)-2*(r+1),a=[`${s}${ut(r===0?"Error:":"Caused by:")}`,`${s}${G("\u250C")}`];for(let l of`${i}`.split(`
5
+ `)){let c=z(l,o);c.length===0&&(c=[""]);for(let m of c)a.push(`${s}${G("\u2502")} ${m}`)}return a.push(`${s}${G("\u2514")}`),typeof i=="object"&&i!==null&&"cause"in i&&i.cause!=null&&(t.add(i).has(i.cause)||a.push(...n(i.cause,r+1))),a}return n(e,0).join(`
6
+ `)}async function oe(e){try{return await e()}catch(t){T(fe(t)),process.exit(1)}}async function me(e){var be=[];try{e["--silent"]||T(te());e["--silent"]||T();let t=J(be,new pe);u&&t.start("[@tailwindcss/cli] (initial build)");let n=x.resolve(e["--cwd"]);e["--output"]&&e["--output"]!=="-"&&(e["--output"]=x.resolve(n,e["--output"]));e["--input"]&&e["--input"]!=="-"&&(e["--input"]=x.resolve(n,e["--input"]),ot(e["--input"])||(T(`Specified input file ${F(ne(e["--input"]))} does not exist.`),process.exit(1)));e["--input"]===e["--output"]&&e["--input"]!=="-"&&(T(`Specified input file ${F(ne(e["--input"]))} and output file ${F(ne(e["--output"]))} are identical.`),process.exit(1));e["--map"]==="-"&&(T("Use --map without a value to inline the source map."),process.exit(1));e["--poll"]===void 0&&(T("Use --poll with a non-zero value in milliseconds."),process.exit(1));let i=e["--poll"]===!0?lt:e["--poll"];i!==!1&&i<=0&&(T("Specified polling interval must be a positive number."),process.exit(1));e["--map"]&&e["--map"]!==!0&&(e["--map"]=x.resolve(n,e["--map"]));let r=process.hrtime.bigint();let s=e["--input"]?e["--input"]==="-"?await se():await j.readFile(e["--input"],"utf-8"):de`
5
7
  @import 'tailwindcss';
6
- `;let r={css:"",optimizedCss:""};async function u(S,x,f,b){let $=S;if(f["--minify"]||f["--optimize"])if(S!==r.css){a&&b.start("Optimize CSS");let T=Ue(S,{file:f["--input"]??"input.css",minify:f["--minify"]??!1,map:x?.raw??void 0});a&&b.end("Optimize CSS"),r.css=S,r.optimizedCss=T.code,T.map&&(x=he(T.map)),$=T.code}else $=r.optimizedCss;x&&(f["--map"]===!0?($+=`
7
- `,$+=x.inline):typeof f["--map"]=="string"&&(a&&b.start("Write source map"),await Y(f["--map"],x.raw),a&&b.end("Write source map"))),a&&b.start("Write output"),f["--output"]&&f["--output"]!=="-"?await Y(f["--output"],$):h($),a&&b.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(S,x){a&&x.start("Setup compiler");let f=await Ne(S,{from:e["--output"]?s??"stdin.css":void 0,base:l,onDependency(T){p.push(T)}}),b=(f.root==="none"?[]:f.root===null?[{base:n,pattern:"**/*",negated:!1}]:[{...f.root,negated:!1}]).concat(f.sources),$=new je({sources:b});return a&&x.end("Setup compiler"),[f,$]}let[d,y]=await H(()=>m(o,t));if(e["--watch"]){let S=await we(be(y),async function x(f){try{var b=[];try{if(f.length===1&&f[0]===e["--output"])return;let c=q(b,new me);a&&c.start("[@tailwindcss/cli] (watcher)");let ie=process.hrtime.bigint();let re=[];let j="incremental";let oe=p;for(let _ of f){if(oe.includes(_)){j="full";break}re.push({file:_,extension:C.extname(_).slice(1)})}let I="";let P=null;if(j==="full"){let _=e["--input"]?e["--input"]==="-"?await Q():await X.readFile(e["--input"],"utf-8"):ye`
8
+ `;let o={css:"",optimizedCss:"",output:null};async function a(_,S,g,d){let h=_;if(g["--minify"]||g["--optimize"])if(_!==o.css){u&&d.start("Optimize CSS");let p=rt(_,{file:g["--input"]??"input.css",minify:g["--minify"]??!1,map:S?.raw??void 0});u&&d.end("Optimize CSS"),o.css=_,o.optimizedCss=p.code,p.map&&(S=M(p.map)),h=p.code}else h=o.optimizedCss;if(S){if(g["--map"]===!0)h+=`
9
+ `,h+=S.inline;else if(typeof g["--map"]=="string"){let p=g["--output"]&&g["--output"]!=="-"?x.dirname(x.resolve(g["--output"])):process.cwd(),E=x.resolve(g["--map"]),B=x.relative(p,E);h+=`
10
+ `,h+=S.comment(B),u&&d.start("Write source map"),await ce(g["--map"],S.raw),u&&d.end("Write source map")}}let C=h!==o.output;return u&&d.start("Write output"),g["--output"]&&g["--output"]!=="-"?await ce(g["--output"],h):C&&ie(h),u&&d.end("Write output"),o.output=h,C}let l=e["--input"]&&e["--input"]!=="-"?x.resolve(e["--input"]):null;let c=l?x.dirname(l):process.cwd();let m=l?[l]:[];let b=m;async function w(_,S){u&&S.start("Setup compiler");let g=await nt(_,{from:e["--output"]?l??"stdin.css":void 0,base:c,onDependency(C){m.push(C)}}),d=(g.root==="none"?[]:g.root===null?[{base:n,pattern:"**/*",negated:!1}]:[{...g.root,negated:!1}]).concat(g.sources);d.push({base:x.dirname(process.execPath),pattern:x.basename(process.execPath),negated:!0}),l!==null&&d.push({base:x.dirname(l),pattern:x.basename(l),negated:!1});let h=new st({sources:d});return u&&S.end("Setup compiler"),[g,h]}let[f,y]=await oe(()=>w(s,t));let R=[];e["--watch"]&&i===!1&&(await oe(()=>Ae()),R.push(await Re(await Oe(y),async function _(S){try{var g=[];try{if(S.length===1&&S[0]===e["--output"])return;let p=J(g,new pe);u&&p.start("[@tailwindcss/cli] (watcher)");let E=process.hrtime.bigint();let B=m;let N=ve(S,B);let P="";let D=null;if(N.kind==="full"){let L=e["--input"]?e["--input"]==="-"?await se():await j.readFile(e["--input"],"utf-8"):de`
8
11
  @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 ke=await we(be(y),x);a&&c.end("Setup new watchers"),a&&c.start("Cleanup old watchers"),await S(),a&&c.end("Cleanup old watchers"),S=ke,a&&c.start("Build CSS"),I=d.build(V),a&&c.end("Build CSS"),e["--map"]&&(a&&c.start("Build Source Map"),P=d.buildSourceMap(),a&&c.end("Build Source Map"))}else if(j==="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();g(`Done in ${E(V-ie)}`);return}a&&c.start("Build CSS"),I=d.build(_),a&&c.end("Build CSS"),e["--map"]&&(a&&c.start("Build Source Map"),P=d.buildSourceMap(),a&&c.end("Build Source Map"))}await u(I,P,e,c);let Ce=process.hrtime.bigint();g(`Done in ${E(Ce-ie)}`)}catch($){var T=$,ve=!0}finally{K(b,T,ve)}}catch(c){c instanceof Error&&g(c.toString())}});e["--watch"]!=="always"&&process.stdin.on("end",()=>{S().then(()=>process.exit(0),()=>process.exit(1))}),process.stdin.resume()}a&&t.start("Scan for candidates");let L=y.scan();a&&t.end("Scan for candidates");a&&t.start("Build CSS");let M=await H(()=>d.build(L));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();g(`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 A,o=new Set,r=new A;async function u(){await r.dispose(),r.queueMacrotask(()=>{t(Array.from(o)),o.clear()})}for(let s of e){let{unsubscribe:l}=await De.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(D()),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-z.indent-u.length-1);p.length>1&&o!==0&&h(),h(F(`${u}${p.shift()}`));for(let m of p)h(F(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,L=i-m.length-d-y-z.indent,M=G(p!==null?`${l} ${v.dim(`[default:\u202F${k(`${p}`)}]`)}`:l,L);h(F(`${v.blue(m)} ${v.dim(v.gray("\xB7")).repeat(d)} ${M.shift()}`));for(let B of M)h(F(`${" ".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);
12
+ `;Ee(B),b=m.slice(),m=l?[l]:[],[f,y]=await w(L,p),b=m.slice(),u&&p.start("Scan for candidates");let v=y.scan();u&&p.end("Scan for candidates"),u&&p.start("Setup new watchers");let Ye=await Re(await Oe(y),_);u&&p.end("Setup new watchers"),u&&p.start("Cleanup old watchers"),await Promise.all(R.splice(0).map(Ve=>Ve())),u&&p.end("Cleanup old watchers"),R.push(Ye),u&&p.start("Build CSS"),P=f.build(v),u&&p.end("Build CSS"),e["--map"]&&(u&&p.start("Build Source Map"),D=M(f.buildSourceMap()),u&&p.end("Build Source Map"))}else if(N.kind==="incremental"){u&&p.start("Scan for candidates");let L=y.scanFiles(N.changedFiles);if(u&&p.end("Scan for candidates"),L.length<=0){let v=process.hrtime.bigint();e["--silent"]||T(`Done in ${O(v-E)}`);return}u&&p.start("Build CSS"),P=f.build(L),u&&p.end("Build CSS"),e["--map"]&&(u&&p.start("Build Source Map"),D=M(f.buildSourceMap()),u&&p.end("Build Source Map"))}await a(P,D,e,p);let ue=process.hrtime.bigint();e["--silent"]||T(`Done in ${O(ue-E)}`)}catch(d){var h=d,C=!0}finally{Q(g,h,C)}}catch(p){m=b,T(fe(p));let E=process.hrtime.bigint();e["--silent"]||T(`Done in ${O(E-r)}`)}})),e["--watch"]!=="always"&&process.stdin.on("end",()=>{Promise.all(R.map(_=>_())).then(()=>process.exit(0),()=>process.exit(1))}),process.stdin.resume());u&&t.start("Scan for candidates");let ae=y.scan();u&&t.end("Scan for candidates");u&&t.start("Build CSS");let V=await oe(()=>f.build(ae));u&&t.end("Build CSS");let q=null;e["--map"]&&(u&&t.start("Build Source Map"),q=await oe(()=>M(f.buildSourceMap())),u&&t.end("Build Source Map"));await a(V,q,e,t);let ze=process.hrtime.bigint();e["--silent"]||T(`Done in ${O(ze-r)}`);if(e["--watch"]&&i!==!1){let S=function(d){e["--silent"]||process.stderr.write("\r\x1B[2K"),T(d),e["--silent"]||process.stderr.write(`\r\x1B[2K${G("Polling for changes\u2026")}`)};var At=S;let _=()=>{};async function g(d){Ee(m),b=m.slice(),m=l?[l]:[];let h=e["--input"]?e["--input"]==="-"?await se():await j.readFile(e["--input"],"utf-8"):de`
13
+ @import 'tailwindcss';
14
+ `;[f,y]=await w(h,d),b=m.slice(),u&&d.start("Scan for candidates");let C=y.scan();u&&d.end("Scan for candidates"),u&&d.start("Build CSS");let p=f.build(C);u&&d.end("Build CSS");let E=null;e["--map"]&&(u&&d.start("Build Source Map"),E=M(f.buildSourceMap()),u&&d.end("Build Source Map")),await a(p,E,e,d)}if(!e["--silent"]){let h=function(){d||(d=!0,process.stderr.write("\r\x1B[2K\x1B[?25h"),process.off("exit",h),process.off("SIGINT",C),process.off("SIGTERM",p))},C=function(){h(),process.exit(130)},p=function(){h(),process.exit(143)};var Bt=h,Nt=C,Pt=p;let d=!1;process.stderr.write("\x1B[?25l"),process.on("exit",h),process.on("SIGINT",C),process.on("SIGTERM",p),_=h,R.push(async()=>_())}R.push(at(async()=>{var P=[];try{let d=J(P,new pe);u&&d.start("Scan for candidates");let h=y.scan();u&&d.end("Scan for candidates");let C=y.scannedFiles.filter(v=>v!==e["--output"]&&v!==e["--map"]);if(C.length<=0)return;let p=process.hrtime.bigint();let E=ve(C,m);if(E.kind==="full"){try{await g(d)}catch(v){m=b,S(fe(v))}e["--silent"]||S(`Done in ${O(process.hrtime.bigint()-p)}`);return}if(h.length<=0){e["--silent"]||S(`Done in ${O(process.hrtime.bigint()-p)}`);return}u&&d.start("Build CSS");let B=f.build(h);u&&d.end("Build CSS");let N=null;e["--map"]&&(u&&d.start("Build Source Map"),N=M(f.buildSourceMap()),u&&d.end("Build Source Map"));await a(B,N,e,d);e["--silent"]||S(`Done in ${O(process.hrtime.bigint()-p)}`)}catch(D){var ue=D,L=!0}finally{Q(P,ue,L)}},i)),e["--watch"]!=="always"&&process.stdin.on("end",()=>{Promise.all(R.map(d=>d())).then(()=>process.exit(0),()=>process.exit(1))}),process.stdin.resume(),e["--silent"]||process.stderr.write(`\r\x1B[2K${G("Polling for changes\u2026")}`)}}catch(We){var Ge=We,Ke=!0}finally{Q(be,Ge,Ke)}}async function Ae(){try{return(await import("@parcel/watcher")).default}catch(e){throw new Error("Failed to load the file watcher. Your platform may not be supported by `@parcel/watcher`. As a workaround, you can use polling instead by passing the `--watch --poll` flags.",{cause:e})}}async function Re(e,t){let n=await Ae();e=e.sort((l,c)=>l.length-c.length);let i=[];for(let l=0;l<e.length;++l)for(let c=0;c<l;++c)e[l].startsWith(`${e[c]}/`)&&i.push(e[l]);e=e.filter(l=>!i.includes(l));let r=new I,s=new Set,o=new I;async function a(){await o.dispose(),o.queueMacrotask(()=>{t(Array.from(s)),s.clear()})}for(let l of e){let{unsubscribe:c}=await n.subscribe(l,async(m,b)=>{if(m){console.error(m);return}await Promise.all(b.map(async w=>{if(w.type==="delete"){s.add(w.path);return}let f=null;try{f=await j.lstat(w.path)}catch{}!f?.isFile()&&!f?.isSymbolicLink()||s.add(w.path)})),await a()});r.add(c)}return async()=>{await r.dispose(),await o.dispose()}}function ve(e,t){let n=[];for(let i of e){if(t.includes(i))return{kind:"full"};n.push({file:i,extension:x.extname(i).slice(1)})}return{kind:"incremental",changedFiles:n}}function at(e,t){let n=!1,i=null;async function r(){if(!n)try{await e()}catch(s){console.error(s)}finally{n||(i=setTimeout(r,t))}}return i=setTimeout(r,t),async()=>{n=!0,i&&clearTimeout(i)}}async function Oe(e){let t=(await Promise.all(e.normalizedSources.map(async n=>{let i=x.resolve(n.base),r=await j.realpath(i).catch(()=>i);return j.stat(r).then(s=>s.isDirectory()?[r]:[]).catch(()=>[])}))).flat(1);return Array.from(new Set(t))}function G(e){return`\x1B[2m${e}\x1B[22m`}function ut(e){return`\x1B[31m${e}\x1B[39m`}import{__unstable__loadDesignSystem as Ne}from"@tailwindcss/node";import pt from"fs/promises";import Pe from"path";import{createInterface as dt}from"readline";function he(e,t){let n=e.length,i=t.length,r=n<i?n:i;for(let s=0;s<r;s++){let o=e.charCodeAt(s),a=t.charCodeAt(s);if(o>=48&&o<=57&&a>=48&&a<=57){let l=s,c=s+1,m=s,b=s+1;for(o=e.charCodeAt(c);o>=48&&o<=57;)o=e.charCodeAt(++c);for(a=t.charCodeAt(b);a>=48&&a<=57;)a=t.charCodeAt(++b);let w=e.slice(l,c),f=t.slice(m,b),y=Number(w)-Number(f);if(y)return y;if(w<f)return-1;if(w>f)return 1;continue}if(o!==a)return o-a}return e.length-t.length}var le=new Uint8Array(256);function Be(e,t){let n=0,i=[],r=0,s=e.length,o=t.charCodeAt(0);for(let a=0;a<s;a++){let l=e.charCodeAt(a);if(n===0&&l===o){i.push(e.slice(r,a)),r=a+1;continue}switch(l){case 92:a+=1;break;case 39:case 34:for(;++a<s;){let c=e.charCodeAt(a);if(c===92){a+=1;continue}if(c===l)break}break;case 40:le[n]=41,n++;break;case 91:le[n]=93,n++;break;case 123:le[n]=125,n++;break;case 93:case 125:case 41:n>0&&l===le[n-1]&&n--;break}}return i.push(e.slice(r)),i}import A from"picocolors";function K({render:e=!0,invalid:t,usage:n,options:i}){let r=process.stdout.columns??80,s=[],o=e?ie:(a="")=>{s.push(a)};if(o(te()),t&&(o(),o(`${A.dim("Invalid command:")} ${t}`)),n&&n.length>0){o(),o(A.dim("Usage:"));for(let[a,l]of n.entries()){let c=l.slice(0,l.indexOf("[")),m=l.slice(l.indexOf("["));m=m.replace(/\[.*?\]/g,f=>A.dim(f));let w=z(m,r-ee.indent-c.length-1);w.length>1&&a!==0&&o(),o(W(`${c}${w.shift()}`));for(let f of w)o(W(f,c.length))}}if(i){let a=0;for(let{alias:b}of Object.values(i))b&&(a=Math.max(a,b.length));let l=[],c=0;for(let[b,{alias:w,values:f}]of Object.entries(i)){f?.length&&(b+=`[=${f.join(", ")}]`);let y=[w&&`${w.padStart(a)}`,w?b:" ".repeat(a+2)+b].filter(Boolean).join(", ");l.push(y),c=Math.max(c,y.length)}o(),o(A.dim("Options:"));let m=8;for(let{description:b,default:w=null}of Object.values(i)){let f=l.shift(),y=m+(c-f.length),R=2,ae=r-f.length-y-R-ee.indent,V=z(w!==null?`${b} ${A.dim(`[default:\u202F${F(`${w}`)}]`)}`:b,ae);o(W(`${A.blue(f)} ${A.dim(A.gray("\xB7")).repeat(y)} ${V.shift()}`));for(let q of V)o(W(`${" ".repeat(f.length+y+R)}${q}`))}}if(!e)return s.join(`
15
+ `)}var ft=String.raw;function ge(){return"tailwindcss canonicalize [classes...]"}function mt(){return"tailwindcss canonicalize --css input.css [classes...]"}function ht(){return"tailwindcss canonicalize --stream [--css input.css]"}function ke(){return{"--css":{type:"string",description:'CSS entry file used to load the Tailwind design system (defaults to `@import "tailwindcss";`)'},"--format":{type:"string",description:"Output format",default:"text",values:["text","json","jsonl"]},"--stream":{type:"boolean",description:"Read candidate groups from stdin line by line and write results to stdout",default:!1}}}var Fe={"--help":{type:"boolean",description:"Display usage information",alias:"-h",default:!1}};async function Me({argv:e=process.argv.slice(2),cwd:t=process.cwd(),stdin:n=null,stdinIsTTY:i=process.stdin.isTTY,stdoutIsTTY:r=process.stdout.isTTY}={}){try{let s=k({...ke(),...Fe},e),o=xt(s["--format"]??"text");if(r&&e.length===0||s["--help"])return{exitCode:0,stdout:je()??"",stderr:""};if(s["--stream"])return await gt({css:s["--css"],cwd:t,format:o,input:process.stdin,output:process.stdout}),{exitCode:0,stdout:"",stderr:""};let a=s._.length>0?s._:await wt({stdin:n,stdinIsTTY:i});if(a.length===0)return Ct("No candidate groups provided");let l=await yt({css:s["--css"],cwd:t,inputs:a});return{exitCode:0,stdout:St(l,o),stderr:""}}catch(s){return{exitCode:1,stdout:"",stderr:s instanceof Error?s.message:String(s)}}}async function gt({css:e,cwd:t,format:n,input:i,output:r}){let s=await Ue(e,t),o=dt({input:i}),a=!0;n==="json"&&r.write("[");for await(let l of o){let c=De(s,l);switch(n){case"text":{r.write(c.output+`
16
+ `);break}case"jsonl":{r.write(JSON.stringify(c)+`
17
+ `);break}case"json":{a?r.write(`
18
+ `):r.write(`,
19
+ `),r.write($t(JSON.stringify(c,null,2),2)),a=!1;break}}}n==="json"&&r.write(a?"]":`
20
+ ]`)}function wt({stdin:e,stdinIsTTY:t}){return e!==null?Promise.resolve(Le(e)):t?Promise.resolve([]):bt().then(Le)}async function bt(){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 yt({css:e,cwd:t=process.cwd(),inputs:n}){let i=await Ue(e,t);return n.map(r=>De(i,r))}function St(e,t){switch(t){case"json":return JSON.stringify(e,null,2);case"jsonl":return e.map(n=>JSON.stringify(n)).join(`
21
+ `);case"text":return e.map(n=>n.output).join(`
22
+ `)}}function je(){return K({render:!1,usage:[ge(),mt(),ht()],options:{...ke(),...Fe}})}async function Ue(e,t){if(e===null)return Ne(ft`
23
+ @import 'tailwindcss';
24
+ `,{base:t});let n=Pe.resolve(t,e),i=await pt.readFile(n,"utf8");return Ne(i,{base:Pe.dirname(n)})}function Le(e){return e.split(/\r?\n/g).map(t=>t.trim()).filter(t=>t.length>0)}function xt(e){if(e==="text"||e==="json"||e==="jsonl")return e;throw new Error(`Invalid value for --format: ${e}`)}function Ct(e){return{exitCode:1,stdout:je()??"",stderr:e}}function Tt(e){let t=e.trim();return t.length===0?[]:Be(t," ").map(n=>n.trim()).filter(n=>n.length>0)}function _t(e,t){let n=Tt(t);return n=e.canonicalizeCandidates(n,{collapse:!0,logicalToPhysical:!0}),Et(e.getClassOrder(n)).join(" ")}function De(e,t){let n=_t(e,t);return{input:t,output:n,changed:n!==t}}function $t(e,t){let n=" ".repeat(t);return e.split(`
25
+ `).map(i=>n+i).join(`
26
+ `)}function Et(e){return e.slice().sort(([t,n],[i,r])=>n===r?he(t,i):n===null?-1:r===null?1:Rt(n-r)||he(t,i)).map(([t])=>t)}function Rt(e){return e>0n?1:e===0n?0:-1}var Y={"--help":{type:"boolean",description:"Display usage information",alias:"-h"}};function we(e="tailwindcss"){return`${e} [--input input.css] [--output output.css] [--watch] [--poll=ms] [options\u2026]`}function Ie({invalid:e}={}){K({invalid:e,usage:[we("tailwindcss"),we("tailwindcss build"),ge()],commands:{build:"Build your CSS",canonicalize:"Canonicalize candidate lists"},options:{...U(),...Y}})}async function Ot(){let e=process.argv.slice(2),t=e[0],n=k({...U(),...Y},e);if(t==="build"){let r=k({...U(),...Y},e.slice(1));(process.stdout.isTTY&&e.length===1||r["--help"])&&(K({usage:[we("tailwindcss build")],options:{...U(),...Y}}),process.exit(0)),await me(r);return}if(t==="canonicalize"){let r=await Me({argv:e.slice(1)});r.stdout.length>0&&process.stdout.write(`${r.stdout}
27
+ `),r.stderr.length>0&&process.stderr.write(`${r.stderr}
28
+ `),process.exitCode=r.exitCode;return}(process.stdout.isTTY&&t===void 0||n["--help"])&&(Ie(),process.exit(0)),t&&!t.startsWith("-")&&(Ie({invalid:t}),process.exit(1));let i=k({...U(),...Y});await me(i)}await Ot();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailwindcss/cli",
3
- "version": "0.0.0-insiders.77b3cb5",
3
+ "version": "0.0.0-insiders.7811d74",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,13 +24,13 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@parcel/watcher": "^2.5.1",
28
- "enhanced-resolve": "^5.18.3",
27
+ "@parcel/watcher": "2.5.1",
28
+ "enhanced-resolve": "^5.24.1",
29
29
  "mri": "^1.2.0",
30
30
  "picocolors": "^1.1.1",
31
- "@tailwindcss/node": "0.0.0-insiders.77b3cb5",
32
- "@tailwindcss/oxide": "0.0.0-insiders.77b3cb5",
33
- "tailwindcss": "0.0.0-insiders.77b3cb5"
31
+ "@tailwindcss/node": "0.0.0-insiders.7811d74",
32
+ "tailwindcss": "0.0.0-insiders.7811d74",
33
+ "@tailwindcss/oxide": "0.0.0-insiders.7811d74"
34
34
  },
35
35
  "scripts": {
36
36
  "lint": "tsc --noEmit",