@tailwindcss/vite 4.0.0-alpha.2 → 4.0.0-alpha.21
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 +2 -1
- package/package.json +22 -7
package/dist/index.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{compile as z}from"@tailwindcss/node";import{clearRequireCache as D}from"@tailwindcss/node/require-cache";import{Scanner as B}from"@tailwindcss/oxide";import P from"node:path";function j(n,r){if(typeof n!="string")throw new TypeError("expected path to be a string");if(n==="\\"||n==="/")return"/";var l=n.length;if(l<=1)return n;var f="";if(l>4&&n[3]==="\\"){var c=n[2];(c==="?"||c===".")&&n.slice(0,2)==="\\\\"&&(n=n.slice(2),f="//")}var u=n.split(/[/\\]+/);return r!==!1&&u[u.length-1]===""&&u.pop(),f+u.join("/")}function S(n){let r=j(n);return n.startsWith("\\\\")&&r.startsWith("/")&&!r.startsWith("//")?`/${r}`:r}var b="'",x='"';function R(){let n=new WeakSet;function r(l){let f=l.root().source?.input.file;if(!f)return;let c=l.source?.input.file;if(!c||n.has(l))return;let u=l.params[0],d=u[0]===x&&u[u.length-1]===x?x:u[0]===b&&u[u.length-1]===b?b:null;if(!d)return;let p=l.params.slice(1,-1),v="";if(p.startsWith("!")&&(p=p.slice(1),v="!"),!p.startsWith("./")&&!p.startsWith("../"))return;let w=P.posix.join(S(P.dirname(c)),p),C=P.posix.dirname(S(f)),m=P.posix.relative(C,w);m.startsWith(".")||(m="./"+m),l.params=d+v+m+d,n.add(l)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:r,plugin:r,config:r}}}import{Features as M,transform as I}from"lightningcss";import y from"path";import O from"postcss-load-config";function T(){let n=null,r=null,l=null,f=[],c=new Set,u=[],d={},p=!1,v=!1,w=[];function C(t){if(!n)return;let e=[];for(let s of Object.keys(d)){let i=n.moduleGraph.getModuleById(s);if(!i){t||delete d[s];continue}n.moduleGraph.invalidateModule(i),e.push({type:`${i.type}-update`,path:i.url,acceptedPath:i.url,timestamp:Date.now()})}e.length>0&&n.hot.send({type:"update",updates:e})}function m(t,e){let s=!1;if(l===null)return f.push({content:t,extension:e}),s;for(let i of l.scanFiles([{content:t,extension:e}]))s=!0,c.add(i);return s}async function F(t,e,s){let i=y.dirname(y.resolve(e));D(u),u=[];let{build:o,globs:h}=await z(t,{base:i,onDependency(a){s(a),u.push(a)}});l=new B({sources:h.map(a=>({base:i,pattern:a}))});for(let a of l.scan())c.add(a);if(f.length>0)for(let a of l.scanFiles(f.splice(0)))c.add(a);for(let a of l.files)s(a);for(let a of l.globs){if(a.pattern[0]==="!")continue;let g=y.relative(r.root,a.base);g[0]!=="."&&(g="./"+g),g=S(g),s(y.posix.join(g,a.pattern))}return o(Array.from(c))}async function E(t,e,s){return q(await F(t,e,s),{minify:v})}async function W(t,e,s){let i={...t,getCombinedSourcemap:()=>{throw new Error("getCombinedSourcemap not implemented")}};for(let o of w){if(!o.transform)continue;let h="handler"in o.transform?o.transform.handler:o.transform;try{let a=await h.call(i,s,e);if(!a)continue;typeof a=="string"?s=a:a.code&&(s=a.code)}catch{console.error(`Error running ${o.name} on Tailwind CSS output. Skipping.`)}}return s}return[{name:"@tailwindcss/vite:scan",enforce:"pre",configureServer(t){n=t},async configResolved(t){r=t,v=r.build.cssMinify!==!1,p=r.build.ssr!==!1&&r.build.ssr!==void 0;let e=["vite:css",...r.command==="build"?["vite:css-post"]:[]];w=r.plugins.filter(s=>e.includes(s.name))},async config(t){let e=t.css?.postcss;if(typeof e=="string"){let s=typeof e=="string"?e:t.root,i=await O({},s).catch(o=>{if(!o.message.includes("No PostCSS Config found"))if(o instanceof Error){let{name:h,message:a,stack:g}=o;throw o.name="Failed to load PostCSS config",o.message=`Failed to load PostCSS config (searchPath: ${s}): [${h}] ${a}
|
|
2
|
+
${g}`,o.stack="",o}else throw new Error(`Failed to load PostCSS config: ${o}`);return null});i!==null?e={options:i.options,plugins:i.plugins}:e={},t.css={postcss:e}}typeof e!="string"&&(!e||!e?.plugins?(t.css=t.css||{},t.css.postcss=e||{},t.css.postcss.plugins=[R()]):e.plugins.push(R()))},transformIndexHtml(t){m(t,"html")&&C(p)},transform(t,e,s){if(e.includes("/.vite/"))return;let i=k(e);i===""||i==="css"||(m(t,i),C(s?.ssr??!1))}},{name:"@tailwindcss/vite:generate:serve",apply:"serve",async transform(t,e,s){return $(e,t)?(d[e]={content:"",handled:!0},s?.ssr||await n?.waitForRequestsIdle?.(e),{code:await W(this,e,await F(t,e,o=>this.addWatchFile(o)))}):void 0}},{name:"@tailwindcss/vite:generate:build",apply:"build",transform(t,e){$(e,t)&&(d[e]={content:t,handled:!1})},async renderChunk(t,e){for(let[s,i]of Object.entries(d)){if(i.handled)continue;let o=await E(i.content,s,h=>this.addWatchFile(h));await W(this,s,o),i.handled=!0}}}]}function k(n){let[r]=n.split("?",2);return y.extname(r).slice(1)}function $(n,r){let l=k(n);return(l==="css"||l==="vue"&&n.includes("&lang.css"))&&r.includes("@tailwind")}function q(n,{file:r="input.css",minify:l=!1}={}){return I({filename:r,code:Buffer.from(n),minify:l,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:M.Nesting,exclude:M.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code.toString()}export{T as default};
|
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/vite",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.21",
|
|
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,22 @@
|
|
|
16
24
|
}
|
|
17
25
|
},
|
|
18
26
|
"dependencies": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
27
|
+
"lightningcss": "^1.26.0",
|
|
28
|
+
"postcss-load-config": "^6.0.1",
|
|
29
|
+
"@tailwindcss/node": "4.0.0-alpha.21",
|
|
30
|
+
"@tailwindcss/oxide": "4.0.0-alpha.21",
|
|
31
|
+
"tailwindcss": "4.0.0-alpha.21"
|
|
21
32
|
},
|
|
22
33
|
"devDependencies": {
|
|
23
|
-
"@types/node": "^20.
|
|
24
|
-
"vite": "^5.0
|
|
34
|
+
"@types/node": "^20.14.8",
|
|
35
|
+
"vite": "^5.4.0",
|
|
36
|
+
"internal-postcss-fix-relative-paths": "0.0.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"vite": "^5.2.0"
|
|
25
40
|
},
|
|
26
41
|
"scripts": {
|
|
27
|
-
"build": "tsup-node
|
|
42
|
+
"build": "tsup-node",
|
|
28
43
|
"dev": "pnpm run build -- --watch"
|
|
29
44
|
}
|
|
30
45
|
}
|