@tailwindcss/cli 0.1.2 → 4.0.0-alpha.3
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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/index.mjs +8 -0
- package/package.json +28 -12
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://tailwindcss.com" target="_blank">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-dark.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg">
|
|
6
|
+
<img alt="Tailwind CSS" src="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
A utility-first CSS framework for rapidly building custom user interfaces.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
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>
|
|
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>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
For full documentation, visit [tailwindcss.com](https://tailwindcss.com).
|
|
27
|
+
|
|
28
|
+
## Community
|
|
29
|
+
|
|
30
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
|
31
|
+
|
|
32
|
+
[Discuss Tailwind CSS on GitHub](https://github.com/tailwindcss/tailwindcss/discussions)
|
|
33
|
+
|
|
34
|
+
For chatting with others using the framework:
|
|
35
|
+
|
|
36
|
+
[Join the Tailwind CSS Discord Server](https://discord.gg/7NF8GNe)
|
|
37
|
+
|
|
38
|
+
## Contributing
|
|
39
|
+
|
|
40
|
+
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**.
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import X from"mri";function F(t,e=process.argv.slice(2)){let i=X(e),n={_:i._};for(let[o,{type:r,alias:p,default:c=r==="boolean"?!1:null}]of Object.entries(t)){if(n[o]=c,p){let s=p.slice(1);i[s]!==void 0&&(n[o]=E(i[s],r))}{let s=o.slice(2);i[s]!==void 0&&(n[o]=E(i[s],r))}}return n}function E(t,e){switch(e){case"string":return k(t);case"boolean":return A(t);case"number":return S(t);case"boolean | string":return A(t)??k(t);case"number | string":return S(t)??k(t);case"boolean | number":return A(t)??S(t);case"boolean | number | string":return A(t)??S(t)??k(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 S(t){if(typeof t=="number")return t;{let e=Number(t);if(!Number.isNaN(e))return e}}function k(t){return`${t}`}import rt from"@parcel/watcher";import{IO as ot,Parsing as st,clearCache as lt,scanDir as L,scanFiles as pt}from"@tailwindcss/oxide";import{existsSync as ut}from"node:fs";import U from"node:fs/promises";import N from"node:path";import at from"postcss";import ft from"postcss-import";import{compile as M,optimizeCss as V}from"tailwindcss";import tt from"node:fs";import P from"node:path";import f from"picocolors";import{createRequire as Z}from"node:module";var b=Z(import.meta.url).resolve;function K(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 C={indent:2};function y(){let{version:t}=JSON.parse(tt.readFileSync(b("tailwindcss/package.json"),"utf-8"));return`${f.italic(f.bold(f.blue("\u2248")))} tailwindcss ${f.blue(`v${t}`)}`}function O(t){return`${f.dim(f.blue("`"))}${f.blue(t)}${f.dim(f.blue("`"))}`}function W(t,e=process.cwd(),{preferAbsoluteIfShorter:i=!0}={}){let n=P.relative(e,t);return n.startsWith("..")||(n=`.${P.sep}${n}`),i&&n.length>t.length?t:n}function v(t,e){let i=t.split(" "),n=[],o="",r=0;for(let p of i){let c=nt(p).length;r+c+1>e&&(n.push(o),o="",r=0),o+=(r?" ":"")+p,r+=c+(r?1:0)}return r&&n.push(o),n}var et=/((?:\x9B|\x1B\[)[0-?]*[ -\/]*[@-~])/g;function nt(t){return t.replace(et,"")}function I(t){let e=K(t);return t<=50*1e6?f.green(e):t<=300*1e6?f.blue(e):t<=1e3*1e6?f.yellow(e):f.red(e)}function w(t,e=0){return`${" ".repeat(e+C.indent)}${t}`}function m(t=""){process.stderr.write(`${t}
|
|
3
|
+
`)}function u(t=""){process.stdout.write(`${t}
|
|
4
|
+
`)}import R from"node:fs/promises";import it from"node:path";function q(){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 j(t,e){try{if(await R.readFile(t,"utf8")===e)return}catch{}await R.mkdir(it.dirname(t),{recursive:!0}),await R.writeFile(t,e,"utf8")}var z=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:"Minify the output",alias:"-m"},"--cwd":{type:"string",description:"The current working directory",default:"."}}}async function J(t){let e=N.resolve(t["--cwd"]);t["--output"]&&(t["--output"]=N.resolve(e,t["--output"])),t["--input"]&&t["--input"]!=="-"&&(t["--input"]=N.resolve(e,t["--input"]),ut(t["--input"])||(m(y()),m(),m(`Specified input file ${O(W(t["--input"]))} does not exist.`),process.exit(1)));let i=process.hrtime.bigint(),{candidates:n}=L({base:e}),[o,r]=await G(t["--input"]?t["--input"]==="-"?await q():await U.readFile(t["--input"],"utf-8"):z`
|
|
5
|
+
@import '${b("tailwindcss/index.css")}';
|
|
6
|
+
`,t["--input"]??e),p=V(M(o,n),{file:t["--input"]??"input.css",minify:t["--minify"]});t["--output"]?await j(t["--output"],p):u(p);let c=process.hrtime.bigint();m(y()),m(),m(`Done in ${I(c-i)}`),t["--watch"]&&(await rt.subscribe(e,async(s,a)=>{if(s){console.error(s);return}try{if(a.length===1&&a[0].path===t["--output"])return;let l=[],g="incremental";for(let d of a)if((d.type==="create"||d.type==="update")&&l.push({file:d.path,extension:N.extname(d.path).slice(1)}),r.includes(d.path)){g="full";break}let x=process.hrtime.bigint();if(g==="full")lt(),n=L({base:e}).candidates;else if(g==="incremental"){let d=new Set(n);for(let Q of pt(l,ot.Sequential|st.Sequential))d.add(Q);n=Array.from(d)}g==="full"&&([o,r]=await G(t["--input"]?await U.readFile(t["--input"],"utf-8"):z`
|
|
7
|
+
@import '${b("tailwindcss/index.css")}';
|
|
8
|
+
`,t["--input"]??e));let $=V(M(o,n),{file:t["--input"]??"input.css",minify:t["--minify"]});t["--output"]?await j(t["--output"],$):u($);let T=process.hrtime.bigint();m(`Done in ${I(T-x)}`)}catch(l){l instanceof Error&&m(l.toString())}}),t["--watch"]!=="always"&&process.stdin.on("end",()=>{process.exit(0)}),process.stdin.resume())}function G(t,e){return t.includes("@import")?at().use(ft()).process(t,{from:e}).then(i=>[i.css,i.messages.filter(n=>n.type==="postcss-import").map(n=>n.file)]):[t,[]]}import h from"picocolors";function B({invalid:t,usage:e,options:i}){let n=process.stdout.columns;if(u(y()),t&&(u(),u(`${h.dim("Invalid command:")} ${t}`)),e&&e.length>0){u(),u(h.dim("Usage:"));for(let[o,r]of e.entries()){let p=r.slice(0,r.indexOf("[")),c=r.slice(r.indexOf("["));c=c.replace(/\[.*?\]/g,l=>h.dim(l));let a=v(c,n-C.indent-p.length-1);a.length>1&&o!==0&&u(),u(w(`${p}${a.shift()}`));for(let l of a)u(w(l,p.length))}}if(i){let o=0;for(let{alias:s}of Object.values(i))s&&(o=Math.max(o,s.length));let r=[],p=0;for(let[s,{alias:a}]of Object.entries(i)){let l=[a&&`${a.padStart(o)}`,a?s:" ".repeat(o+2)+s].filter(Boolean).join(", ");r.push(l),p=Math.max(p,l.length)}u(),u(h.dim("Options:"));let c=8;for(let{description:s,default:a=null}of Object.values(i)){let l=r.shift(),g=c+(p-l.length),x=2,$=n-l.length-g-x-C.indent,T=v(a!==null?`${s} ${h.dim(`[default:\u202F${O(`${a}`)}]`)}`:s,$);u(w(`${h.blue(l)} ${h.dim(h.gray("\xB7")).repeat(g)} ${T.shift()}`));for(let d of T)u(w(`${" ".repeat(l.length+g+x)}${d}`))}}}var D={"--help":{type:"boolean",description:"Display usage information",alias:"-h"}},H=F(D),Y=H._[0];Y&&(B({invalid:Y,usage:["tailwindcss [options]"],options:{..._(),...D}}),process.exit(1));(process.stdout.isTTY&&!process.argv.slice(2).includes("-o")||H["--help"])&&(B({usage:["tailwindcss [--input input.css] [--output output.css] [--watch] [options\u2026]"],options:{..._(),...D}}),process.exit(0));J(F(_()));
|
package/package.json
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
|
+
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "https://github.com/tailwindlabs/tailwindcss.git",
|
|
7
|
+
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
|
|
8
|
+
"homepage": "https://tailwindcss.com",
|
|
6
9
|
"bin": {
|
|
7
|
-
"
|
|
10
|
+
"tailwindcss": "./dist/index.mjs"
|
|
8
11
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json"
|
|
11
14
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
14
18
|
"dependencies": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
19
|
+
"@parcel/watcher": "^2.4.1",
|
|
20
|
+
"mri": "^1.2.0",
|
|
21
|
+
"picocolors": "^1.0.0",
|
|
22
|
+
"postcss": "8.4.24",
|
|
23
|
+
"postcss-import": "^16.0.0",
|
|
24
|
+
"@tailwindcss/oxide": "4.0.0-alpha.3",
|
|
25
|
+
"tailwindcss": "4.0.0-alpha.3"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/postcss-import": "^14.0.3"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"lint": "tsc --noEmit",
|
|
32
|
+
"build": "tsup-node ./src/index.ts --format esm --minify --clean",
|
|
33
|
+
"dev": "pnpm run build -- --watch"
|
|
18
34
|
}
|
|
19
|
-
}
|
|
35
|
+
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('tailwindcss/lib/cli')
|