@tailwindcss/vite 4.0.0-alpha.21 → 4.0.0-alpha.23
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 +1 -2
- package/package.json +7 -5
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{compile as z}from"@tailwindcss/node";import{clearRequireCache as
|
|
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};
|
|
1
|
+
import{compile as z}from"@tailwindcss/node";import{clearRequireCache as A}from"@tailwindcss/node/require-cache";import{Scanner as q}from"@tailwindcss/oxide";import w from"node:path";function K(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var r=e.length;if(r<=1)return e;var o="";if(r>4&&e[3]==="\\"){var c=e[2];(c==="?"||c===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),o="//")}var a=e.split(/[/\\]+/);return t!==!1&&a[a.length-1]===""&&a.pop(),o+a.join("/")}function b(e){let t=K(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var C="'",P='"';function W(){let e=new WeakSet;function t(r){let o=r.root().source?.input.file;if(!o)return;let c=r.source?.input.file;if(!c||e.has(r))return;let a=r.params[0],d=a[0]===P&&a[a.length-1]===P?P:a[0]===C&&a[a.length-1]===C?C:null;if(!d)return;let n=r.params.slice(1,-1),m="";if(n.startsWith("!")&&(n=n.slice(1),m="!"),!n.startsWith("./")&&!n.startsWith("../"))return;let y=w.posix.join(b(w.dirname(c)),n),S=w.posix.dirname(b(o)),h=w.posix.relative(S,y);h.startsWith(".")||(h="./"+h),r.params=d+m+h+d,e.add(r)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:t,plugin:t,config:t}}}import{Features as M,transform as E}from"lightningcss";import G from"node:fs/promises";import p from"path";import I from"postcss";import T from"postcss-import";function $(){let e=[],t=null,r=!1,o=!1,c=[],a=new Set,d=new q({}),n=new x(s=>new F(s,()=>a,t.base));function m(s,i,l,f){let u=!1;for(let g of d.scanFiles([{content:i,extension:l}]))u=!0,a.add(g);u&&y(f)}function y(s){for(let i of e){let l=[];for(let f of n.keys()){let u=i.moduleGraph.getModuleById(f);if(!u){s||n.delete(f);continue}n.get(f).requiresRebuild=!1,i.moduleGraph.invalidateModule(u),l.push({type:`${u.type}-update`,path:u.url,acceptedPath:u.url,timestamp:Date.now()})}l.length>0&&i.hot.send({type:"update",updates:l})}}async function S(s,i){let l=s.lastContent,f=await s.generate(l,i);if(f!==!1)return B(f,{minify:o})}async function h(s,i,l){let f={...s,getCombinedSourcemap:()=>{throw new Error("getCombinedSourcemap not implemented")}};for(let u of c){if(!u.transform)continue;let g="handler"in u.transform?u.transform.handler:u.transform;try{let v=await g.call(f,l,i);if(!v)continue;typeof v=="string"?l=v:v.code&&(l=v.code)}catch{console.error(`Error running ${u.name} on Tailwind CSS output. Skipping.`)}}return l}return[{name:"@tailwindcss/vite:scan",enforce:"pre",configureServer(s){e.push(s)},async configResolved(s){t=s,o=t.build.cssMinify!==!1,r=t.build.ssr!==!1&&t.build.ssr!==void 0;let i=["vite:css",...t.command==="build"?["vite:css-post"]:[]];c=t.plugins.filter(l=>i.includes(l.name))},transformIndexHtml(s,{path:i}){m(i,s,"html",r)},transform(s,i,l){let f=D(i);R(i)||m(i,s,f,l?.ssr??!1)}},{name:"@tailwindcss/vite:generate:serve",apply:"serve",enforce:"pre",async transform(s,i,l){if(!R(i))return;let f=n.get(i);l?.ssr||await Promise.all(e.map(g=>g.waitForRequestsIdle(i)));let u=await f.generate(s,g=>this.addWatchFile(g));return u?{code:u}:(n.delete(i),s)}},{name:"@tailwindcss/vite:generate:build",apply:"build",enforce:"pre",async transform(s,i){if(!R(i))return;let f=await n.get(i).generate(s,u=>this.addWatchFile(u));return f?{code:f}:(n.delete(i),s)},async renderStart(){for(let[s,i]of n.entries()){let l=await S(i,()=>{});if(!l){n.delete(s);continue}await h(this,s,l)}}}]}function D(e){let[t]=e.split("?",2);return p.extname(t).slice(1)}function R(e){let t=D(e);return t==="css"||t==="vue"&&e.includes("&lang.css")||t==="astro"&&e.includes("&lang.css")}function j(e){return e.includes("@tailwind")||e.includes("@config")||e.includes("@plugin")||e.includes("@apply")||e.includes("@theme")||e.includes("@variant")||e.includes("@utility")}function B(e,{file:t="input.css",minify:r=!1}={}){return E({filename:t,code:Buffer.from(e),minify:r,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:M.Nesting,exclude:M.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code.toString()}function V(e){return p.resolve(e.replace(/\?.*$/,""))}var x=class extends Map{constructor(r){super();this.factory=r}get(r){let o=super.get(r);return o===void 0&&(o=this.factory(r,this),this.set(r,o)),o}},F=class{constructor(t,r,o){this.id=t;this.getSharedCandidates=r;this.base=o}lastContent="";compiler;requiresRebuild=!0;scanner;candidates=new Set;dependencies=new Set;async generate(t,r){this.lastContent=t;let o=V(this.id),c=p.dirname(p.resolve(o));if(!this.compiler||!this.scanner||this.requiresRebuild){A(Array.from(this.dependencies)),this.dependencies=new Set([V(o)]);let d=(await I([T({load:n=>(this.dependencies.add(n),r(n),G.readFile(n,"utf8"))}),W()]).process(t,{from:o,to:o})).css;if(!j(d))return!1;this.compiler=await z(d,{base:c,onDependency:n=>{r(n),this.dependencies.add(n)}}),this.scanner=new q({sources:this.compiler.globs.map(({origin:n,pattern:m})=>({base:n?p.dirname(p.resolve(c,n)):c,pattern:m}))})}for(let a of this.scanner.scan())this.candidates.add(a);for(let a of this.scanner.files)r(a);for(let a of this.scanner.globs){if(a.pattern[0]==="!")continue;let d=p.relative(this.base,a.base);d[0]!=="."&&(d="./"+d),d=b(d),r(p.posix.join(d,a.pattern))}return this.requiresRebuild=!0,this.compiler.build([...this.getSharedCandidates(),...this.candidates])}};export{$ as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/vite",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.23",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -25,13 +25,15 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"lightningcss": "^1.26.0",
|
|
28
|
-
"postcss
|
|
29
|
-
"
|
|
30
|
-
"@tailwindcss/
|
|
31
|
-
"tailwindcss": "4.0.0-alpha.
|
|
28
|
+
"postcss": "^8.4.41",
|
|
29
|
+
"postcss-import": "^16.1.0",
|
|
30
|
+
"@tailwindcss/node": "4.0.0-alpha.23",
|
|
31
|
+
"@tailwindcss/oxide": "4.0.0-alpha.23",
|
|
32
|
+
"tailwindcss": "4.0.0-alpha.23"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@types/node": "^20.14.8",
|
|
36
|
+
"@types/postcss-import": "^14.0.3",
|
|
35
37
|
"vite": "^5.4.0",
|
|
36
38
|
"internal-postcss-fix-relative-paths": "0.0.0"
|
|
37
39
|
},
|