@tailwindcss/vite 0.0.0-development.4 → 0.0.0-insiders.0589d7d
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 +1 -115
- package/package.json +20 -7
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
CHANGED
|
@@ -1,115 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { IO, Parsing, scanFiles } from "@tailwindcss/oxide";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { compile, optimizeCss } from "tailwindcss";
|
|
5
|
-
function tailwindcss() {
|
|
6
|
-
let server = null;
|
|
7
|
-
let candidates = /* @__PURE__ */ new Set();
|
|
8
|
-
let cssModules = /* @__PURE__ */ new Set();
|
|
9
|
-
function updateCssModules() {
|
|
10
|
-
if (!server)
|
|
11
|
-
return;
|
|
12
|
-
let updates = [];
|
|
13
|
-
for (let id of cssModules) {
|
|
14
|
-
let cssModule = server.moduleGraph.getModuleById(id);
|
|
15
|
-
if (!cssModule) {
|
|
16
|
-
console.log("Could not find css module", id);
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
server.moduleGraph.invalidateModule(cssModule);
|
|
20
|
-
updates.push({
|
|
21
|
-
type: `${cssModule.type}-update`,
|
|
22
|
-
path: cssModule.url,
|
|
23
|
-
acceptedPath: cssModule.url,
|
|
24
|
-
timestamp: Date.now()
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
if (updates.length > 0) {
|
|
28
|
-
server.ws.send({ type: "update", updates });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function scan(src, extension) {
|
|
32
|
-
for (let candidate of scanFiles(
|
|
33
|
-
[{ content: src, extension }],
|
|
34
|
-
IO.Sequential | Parsing.Sequential
|
|
35
|
-
)) {
|
|
36
|
-
if (candidate.includes("${")) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
candidates.add(candidate);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function generateCss(css) {
|
|
43
|
-
return optimizeCss(compile(css, Array.from(candidates)));
|
|
44
|
-
}
|
|
45
|
-
let initialScan = function() {
|
|
46
|
-
let delayInMs = 100;
|
|
47
|
-
let timer;
|
|
48
|
-
let resolve;
|
|
49
|
-
let resolved = false;
|
|
50
|
-
return {
|
|
51
|
-
tick() {
|
|
52
|
-
if (resolved)
|
|
53
|
-
return;
|
|
54
|
-
timer && clearTimeout(timer);
|
|
55
|
-
timer = setTimeout(resolve, delayInMs);
|
|
56
|
-
},
|
|
57
|
-
complete: new Promise((_resolve) => {
|
|
58
|
-
resolve = () => {
|
|
59
|
-
resolved = true;
|
|
60
|
-
_resolve();
|
|
61
|
-
};
|
|
62
|
-
})
|
|
63
|
-
};
|
|
64
|
-
}();
|
|
65
|
-
return [
|
|
66
|
-
{
|
|
67
|
-
// Step 1: Scan source files for candidates
|
|
68
|
-
name: "@tailwindcss/vite:scan",
|
|
69
|
-
enforce: "pre",
|
|
70
|
-
configureServer(_server) {
|
|
71
|
-
server = _server;
|
|
72
|
-
},
|
|
73
|
-
// Scan index.html for candidates
|
|
74
|
-
transformIndexHtml(html) {
|
|
75
|
-
initialScan.tick();
|
|
76
|
-
scan(html, "html");
|
|
77
|
-
if (server) {
|
|
78
|
-
updateCssModules();
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
// Scan all other files for candidates
|
|
82
|
-
transform(src, id) {
|
|
83
|
-
if (id.includes("/.vite/"))
|
|
84
|
-
return;
|
|
85
|
-
let [filename] = id.split("?", 2);
|
|
86
|
-
let extension = path.extname(filename).slice(1);
|
|
87
|
-
if (extension === "" || extension === "css")
|
|
88
|
-
return;
|
|
89
|
-
initialScan.tick();
|
|
90
|
-
scan(src, extension);
|
|
91
|
-
if (server) {
|
|
92
|
-
updateCssModules();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
// Step 2: Generate CSS
|
|
98
|
-
name: "@tailwindcss/vite:generate",
|
|
99
|
-
async transform(src, id) {
|
|
100
|
-
let [filename] = id.split("?", 2);
|
|
101
|
-
let extension = path.extname(filename).slice(1);
|
|
102
|
-
if (extension !== "css")
|
|
103
|
-
return;
|
|
104
|
-
if (!src.includes("@tailwind"))
|
|
105
|
-
return;
|
|
106
|
-
cssModules.add(id);
|
|
107
|
-
await initialScan.complete;
|
|
108
|
-
return { code: generateCss(src) };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
|
-
export {
|
|
114
|
-
tailwindcss as default
|
|
115
|
-
};
|
|
1
|
+
var B=(a,e)=>(e=Symbol[a])?e:Symbol.for("Symbol."+a),I=a=>{throw TypeError(a)};var R=(a,e,n)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&I("Object expected");var i,d;n&&(i=e[B("asyncDispose")]),i===void 0&&(i=e[B("dispose")],n&&(d=i)),typeof i!="function"&&I("Object not disposable"),d&&(i=function(){try{d.call(this)}catch(h){return Promise.reject(h)}}),a.push([n,i,e])}else n&&a.push([n]);return e},y=(a,e,n)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(o,p,c,g){return g=Error(c),g.name="SuppressedError",g.error=o,g.suppressed=p,g},d=o=>e=n?new i(o,e,"An error was suppressed during disposal"):(n=!0,o),h=o=>{for(;o=a.pop();)try{var p=o[1]&&o[1].call(o[2]);if(o[0])return Promise.resolve(p).then(h,c=>(d(c),h()))}catch(c){d(c)}if(n)throw e};return h()};import{compile as q,env as z,Features as C,Instrumentation as U,normalizePath as M}from"@tailwindcss/node";import{clearRequireCache as $}from"@tailwindcss/node/require-cache";import{Scanner as T}from"@tailwindcss/oxide";import{Features as P,transform as J}from"lightningcss";import K from"node:fs/promises";import S from"node:path";var v=z.DEBUG,L=/[?&](raw|url)\b/,W=["tailwind-merge"];function N(){let a=[],e=null,n=!1,i=!1,d=new E(()=>new Set),h=new T({}),o=new E(t=>{let r=e.createResolver({...e.resolve,extensions:[".css"],mainFields:["style"],conditions:["style","development|production"],tryIndex:!1,preferRelative:!0});function l(m,f){return r(m,f,!0,n)}let u=e.createResolver(e.resolve);function s(m,f){return u(m,f,!0,n)}return new G(t,()=>d,e.base,l,s)});function p(t,r,l){for(let s of W)if(t.includes(`.vite/deps/${s}.js`)||t.includes(`/node_modules/${s}/`))return;let u=!1;for(let s of h.scanFiles([{content:r,extension:l}]))u=!0,d.get(t).add(s);u&&c()}function c(){for(let t of a){let r=[];for(let[l]of o.entries()){let u=t.moduleGraph.getModuleById(l);u&&(o.get(l).requiresRebuild=!1,t.moduleGraph.invalidateModule(u),r.push({type:`${u.type}-update`,path:u.url,acceptedPath:u.url,timestamp:Date.now()}))}r.length>0&&t.hot.send({type:"update",updates:r})}}async function g(t,r,l){let u=t.lastContent,s=await t.generate(u,r,l);if(s===!1)return;v&&l.start("Optimize CSS");let m=O(s,{minify:i});return v&&l.end("Optimize CSS"),m}async function b(t,r,l){let u={...t,getCombinedSourcemap:()=>{throw new Error("getCombinedSourcemap not implemented")}};for(let s of e.plugins){if(!s.transform||s.name.startsWith("@tailwindcss/"))continue;if(s.name.startsWith("vite:")&&s.name!=="vite:css"&&s.name!=="vite:css-post"&&s.name!=="vite:vue")continue;if(s.name==="ssr-styles")continue;let m="handler"in s.transform?s.transform.handler:s.transform;try{let f=await m.call(u,l,r);if(!f)continue;typeof f=="string"?l=f:f.code&&(l=f.code)}catch{console.error(`Error running ${s.name} on Tailwind CSS output. Skipping.`)}}return l}return[{name:"@tailwindcss/vite:scan",enforce:"pre",configureServer(t){a.push(t)},async configResolved(t){e=t,i=e.build.cssMinify!==!1,n=e.build.ssr!==!1&&e.build.ssr!==void 0},transformIndexHtml(t,{path:r}){r&&p(r,t,"html")},transform(t,r,l){let u=_(r);A(r)||p(r,t,u)}},{name:"@tailwindcss/vite:generate:serve",apply:"serve",enforce:"pre",async transform(t,r,l){var f=[];try{if(!A(r))return;let u=R(f,new U);u.start("[@tailwindcss/vite] Generate CSS (serve)");let s=o.get(r);l?.ssr||await Promise.all(a.map(F=>F.waitForRequestsIdle(r)));let m=await s.generate(t,F=>this.addWatchFile(F),u);if(!m)return o.delete(r),t;return{code:m}}catch(w){var D=w,x=!0}finally{y(f,D,x)}}},{name:"@tailwindcss/vite:generate:build",apply:"build",enforce:"pre",async transform(t,r){var m=[];try{if(!A(r))return;let l=R(m,new U);l.start("[@tailwindcss/vite] Generate CSS (build)");let u=o.get(r);let s=await u.generate(t,x=>this.addWatchFile(x),l);if(!s)return o.delete(r),t;return{code:s}}catch(f){var w=f,D=!0}finally{y(m,w,D)}},async renderStart(){var r=[];try{let t=R(r,new U);t.start("[@tailwindcss/vite] (render start)");for(let[m,f]of o.entries()){let w=await g(f,()=>{},t);if(!w){o.delete(m);continue}await b(this,m,w)}}catch(l){var u=l,s=!0}finally{y(r,u,s)}}}]}function _(a){let[e]=a.split("?",2);return S.extname(e).slice(1)}function A(a){return a.includes("/.vite/")?void 0:(_(a)==="css"||a.includes("&lang.css"))&&!L.test(a)}function O(a,{file:e="input.css",minify:n=!1}={}){function i(d){return J({filename:e,code:d,minify:n,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:P.Nesting,exclude:P.LogicalProperties|P.DirSelector|P.LightDark,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7274496},errorRecovery:!0}).code}return i(i(Buffer.from(a))).toString()}function V(a){return S.resolve(a.replace(/\?.*$/,""))}var E=class extends Map{constructor(n){super();this.factory=n}get(n){let i=super.get(n);return i===void 0&&(i=this.factory(n,this),this.set(n,i)),i}},G=class{constructor(e,n,i,d,h){this.id=e;this.getSharedCandidates=n;this.base=i;this.customCssResolver=d;this.customJsResolver=h}lastContent="";compiler;requiresRebuild=!0;scanner;candidates=new Set;dependencies=new Set;basePath=null;overwriteCandidates=null;async generate(e,n,i){this.lastContent=e;let d=V(this.id),h=S.dirname(S.resolve(d));if(!this.compiler||!this.scanner||this.requiresRebuild){$(Array.from(this.dependencies)),this.dependencies=new Set([V(d)]),v&&i.start("Setup compiler"),this.compiler=await q(e,{base:h,shouldRewriteUrls:!0,onDependency:c=>{n(c),this.dependencies.add(c)},customCssResolver:this.customCssResolver,customJsResolver:this.customJsResolver}),v&&i.end("Setup compiler");let p=(this.compiler.root==="none"?[]:this.compiler.root===null?[]:[this.compiler.root]).concat(this.compiler.globs);this.scanner=new T({sources:p})}if(!(this.compiler.features&(C.AtApply|C.JsPluginCompat|C.ThemeFunction|C.Utilities)))return!1;if(!this.overwriteCandidates||this.compiler.features&C.Utilities){v&&i.start("Scan for candidates");for(let p of this.scanner.scan())this.candidates.add(p);v&&i.end("Scan for candidates")}if(this.compiler.features&C.Utilities){for(let p of this.scanner.files)n(p);for(let p of this.scanner.globs){if(p.pattern[0]==="!")continue;let c=S.relative(this.base,p.base);c[0]!=="."&&(c="./"+c),c=M(c),n(S.posix.join(c,p.pattern));let g=this.compiler.root;if(g!=="none"&&g!==null){let b=M(S.resolve(g.base,g.pattern));if(!await K.stat(b).then(r=>r.isDirectory(),()=>!1))throw new Error(`The path given to \`source(\u2026)\` must be a directory but got \`source(${b})\` instead.`);this.basePath=b}else g===null&&(this.basePath=null)}}this.requiresRebuild=!0,v&&i.start("Build CSS");let o=this.compiler.build(this.overwriteCandidates?this.overwriteCandidates:[...this.sharedCandidates(),...this.candidates]);return v&&i.end("Build CSS"),o}sharedCandidates(){if(!this.compiler)return new Set;if(this.compiler.root==="none")return new Set;let e=/^[A-Z]:/,n=d=>this.basePath===null||d.startsWith(this.basePath)?!0:e.test(d)?!1:!d.startsWith("/"),i=new Set;for(let[d,h]of this.getSharedCandidates())if(n(d))for(let o of h)i.add(o);return i}};export{N as default};
|
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/vite",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-insiders.0589d7d",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/tailwindlabs/tailwindcss.git",
|
|
9
|
+
"directory": "packages/@tailwindcss-vite"
|
|
10
|
+
},
|
|
7
11
|
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
|
|
8
12
|
"homepage": "https://tailwindcss.com",
|
|
9
13
|
"files": [
|
|
10
14
|
"dist/"
|
|
11
15
|
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"provenance": true,
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
12
20
|
"exports": {
|
|
13
21
|
".": {
|
|
14
22
|
"types": "./dist/index.d.mts",
|
|
@@ -16,15 +24,20 @@
|
|
|
16
24
|
}
|
|
17
25
|
},
|
|
18
26
|
"dependencies": {
|
|
19
|
-
"
|
|
20
|
-
"tailwindcss": "
|
|
27
|
+
"lightningcss": "^1.29.1",
|
|
28
|
+
"@tailwindcss/node": "0.0.0-insiders.0589d7d",
|
|
29
|
+
"@tailwindcss/oxide": "0.0.0-insiders.0589d7d",
|
|
30
|
+
"tailwindcss": "0.0.0-insiders.0589d7d"
|
|
21
31
|
},
|
|
22
32
|
"devDependencies": {
|
|
23
|
-
"@types/node": "^20.
|
|
24
|
-
"vite": "^
|
|
33
|
+
"@types/node": "^20.14.8",
|
|
34
|
+
"vite": "^6.0.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"vite": "^5.2.0 || ^6"
|
|
25
38
|
},
|
|
26
39
|
"scripts": {
|
|
27
|
-
"build": "tsup-node
|
|
40
|
+
"build": "tsup-node",
|
|
28
41
|
"dev": "pnpm run build -- --watch"
|
|
29
42
|
}
|
|
30
43
|
}
|