@tailwindcss/postcss 4.0.11 → 4.0.12
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.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
"use strict";var J=Object.create;var I=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var
|
1
|
+
"use strict";var J=Object.create;var I=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var L=(n,r)=>(r=Symbol[n])?r:Symbol.for("Symbol."+n),V=n=>{throw TypeError(n)};var re=(n,r,i,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of ee(r))!se.call(n,s)&&s!==i&&I(n,s,{get:()=>r[s],enumerable:!(e=Z(r,s))||e.enumerable});return n};var A=(n,r,i)=>(i=n!=null?J(te(n)):{},re(r||!n||!n.__esModule?I(i,"default",{value:n,enumerable:!0}):i,n));var K=(n,r,i)=>{if(r!=null){typeof r!="object"&&typeof r!="function"&&V("Object expected");var e,s;i&&(e=r[L("asyncDispose")]),e===void 0&&(e=r[L("dispose")],i&&(s=e)),typeof e!="function"&&V("Object not disposable"),s&&(e=function(){try{s.call(this)}catch(t){return Promise.reject(t)}}),n.push([i,e,r])}else i&&n.push([i]);return r},W=(n,r,i)=>{var e=typeof SuppressedError=="function"?SuppressedError:function(l,o,c,p){return p=Error(c),p.name="SuppressedError",p.error=l,p.suppressed=o,p},s=l=>r=i?new e(l,r,"An error was suppressed during disposal"):(i=!0,l),t=l=>{for(;l=n.pop();)try{var o=l[1]&&l[1].call(l[2]);if(l[0])return Promise.resolve(o).then(t,c=>(s(c),t()))}catch(c){s(c)}if(i)throw r};return t()};var B=A(require("@alloc/quick-lru")),m=require("@tailwindcss/node"),z=require("@tailwindcss/node/require-cache"),Q=require("@tailwindcss/oxide"),g=require("lightningcss"),G=A(require("fs")),d=A(require("path")),v=A(require("postcss"));var ie=32;var ne=40;function D(n,r=[]){for(let i=5;i<n.length;i++){let e=n.charCodeAt(i);if(e===ie||e===ne){let s=n.slice(0,i).trim(),t=n.slice(i).trim();return C(s,t,r)}}return C(n.trim(),"",r)}var oe=64;function ae(n,r=[]){return{kind:"rule",selector:n,nodes:r}}function C(n,r="",i=[]){return{kind:"at-rule",name:n,params:r,nodes:i}}function E(n,r=[]){return n.charCodeAt(0)===oe?D(n,r):ae(n,r)}function R(n,r,i=!1){return{kind:"declaration",property:n,value:r,important:i}}function P(n){return{kind:"comment",value:n}}function F(n){function r(e,s=0){let t="",l=" ".repeat(s);if(e.kind==="declaration")t+=`${l}${e.property}: ${e.value}${e.important?" !important":""};
|
2
2
|
`;else if(e.kind==="rule"){t+=`${l}${e.selector} {
|
3
3
|
`;for(let o of e.nodes)t+=r(o,s+1);t+=`${l}}
|
4
4
|
`}else if(e.kind==="at-rule"){if(e.nodes.length===0)return`${l}${e.name} ${e.params};
|
5
5
|
`;t+=`${l}${e.name}${e.params?` ${e.params} `:" "}{
|
6
6
|
`;for(let o of e.nodes)t+=r(o,s+1);t+=`${l}}
|
7
7
|
`}else if(e.kind==="comment")t+=`${l}/*${e.value}*/
|
8
|
-
`;else if(e.kind==="context"||e.kind==="at-root")return"";return t}let i="";for(let e of n){let s=r(e);s!==""&&(i+=s)}return i}var x=A(require("postcss"));var ue=33;function M(n,r){let i=x.default.root();i.source=r;function e(s,t){if(s.kind==="declaration"){let l=x.default.decl({prop:s.property,value:s.value??"",important:s.important});l.source=r,t.append(l)}else if(s.kind==="rule"){let l=x.default.rule({selector:s.selector});l.source=r,l.raws.semicolon=!0,t.append(l);for(let o of s.nodes)e(o,l)}else if(s.kind==="at-rule"){let l=x.default.atRule({name:s.name.slice(1),params:s.params});l.source=r,l.raws.semicolon=!0,t.append(l);for(let o of s.nodes)e(o,l)}else if(s.kind==="comment"){let l=x.default.comment({text:s.value});l.raws.left="",l.raws.right="",l.source=r,t.append(l)}else s.kind==="at-root"||s.kind}for(let s of n)e(s,i);return i}function _(n){function r(e,s){if(e.type==="decl")s.push(R(e.prop,e.value,e.important));else if(e.type==="rule"){let t=E(e.selector);e.each(l=>r(l,t.nodes)),s.push(t)}else if(e.type==="atrule"){let t=C(`@${e.name}`,e.params);e.each(l=>r(l,t.nodes)),s.push(t)}else if(e.type==="comment"){if(e.text.charCodeAt(0)!==ue)return;s.push(P(e.text))}}let i=[];return n.each(e=>r(e,i)),i}var b=require("@tailwindcss/node"),y=A(require("path")),T="'",w='"';function O(){let n=new WeakSet;function r(i){let e=i.root().source?.input.file;if(!e)return;let s=i.source?.input.file;if(!s||n.has(i))return;let t=i.params[0],l=t[0]===w&&t[t.length-1]===w?w:t[0]===T&&t[t.length-1]===T?T:null;if(!l)return;let o=i.params.slice(1,-1),c="";if(o.startsWith("!")&&(o=o.slice(1),c="!"),!o.startsWith("./")&&!o.startsWith("../"))return;let p=y.default.posix.join((0,b.normalizePath)(y.default.dirname(s)),o),N=y.default.posix.dirname((0,b.normalizePath)(e)),h=y.default.posix.relative(N,p);h.startsWith(".")||(h="./"+h),i.params=l+c+h+l,n.add(i)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(i){i.walkAtRules(/source|plugin|config/,r)}}}var a=m.env.DEBUG,$=new B.default({maxSize:50});function fe(n,r){let i=`${n}:${r.base??""}:${JSON.stringify(r.optimize)}`;if($.has(i))return $.get(i);let e={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:v.default.root(),optimizedPostCssAst:v.default.root(),fullRebuildPaths:[]};return $.set(i,e),e}function ce(n={}){let r=n.base??process.cwd(),i=n.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[O(),{postcssPlugin:"tailwindcss",async Once(e,{result:s}){var
|
8
|
+
`;else if(e.kind==="context"||e.kind==="at-root")return"";return t}let i="";for(let e of n){let s=r(e);s!==""&&(i+=s)}return i}var x=A(require("postcss"));var ue=33;function M(n,r){let i=x.default.root();i.source=r;function e(s,t){if(s.kind==="declaration"){let l=x.default.decl({prop:s.property,value:s.value??"",important:s.important});l.source=r,t.append(l)}else if(s.kind==="rule"){let l=x.default.rule({selector:s.selector});l.source=r,l.raws.semicolon=!0,t.append(l);for(let o of s.nodes)e(o,l)}else if(s.kind==="at-rule"){let l=x.default.atRule({name:s.name.slice(1),params:s.params});l.source=r,l.raws.semicolon=!0,t.append(l);for(let o of s.nodes)e(o,l)}else if(s.kind==="comment"){let l=x.default.comment({text:s.value});l.raws.left="",l.raws.right="",l.source=r,t.append(l)}else s.kind==="at-root"||s.kind}for(let s of n)e(s,i);return i}function _(n){function r(e,s){if(e.type==="decl")s.push(R(e.prop,e.value,e.important));else if(e.type==="rule"){let t=E(e.selector);e.each(l=>r(l,t.nodes)),s.push(t)}else if(e.type==="atrule"){let t=C(`@${e.name}`,e.params);e.each(l=>r(l,t.nodes)),s.push(t)}else if(e.type==="comment"){if(e.text.charCodeAt(0)!==ue)return;s.push(P(e.text))}}let i=[];return n.each(e=>r(e,i)),i}var b=require("@tailwindcss/node"),y=A(require("path")),T="'",w='"';function O(){let n=new WeakSet;function r(i){let e=i.root().source?.input.file;if(!e)return;let s=i.source?.input.file;if(!s||n.has(i))return;let t=i.params[0],l=t[0]===w&&t[t.length-1]===w?w:t[0]===T&&t[t.length-1]===T?T:null;if(!l)return;let o=i.params.slice(1,-1),c="";if(o.startsWith("!")&&(o=o.slice(1),c="!"),!o.startsWith("./")&&!o.startsWith("../"))return;let p=y.default.posix.join((0,b.normalizePath)(y.default.dirname(s)),o),N=y.default.posix.dirname((0,b.normalizePath)(e)),h=y.default.posix.relative(N,p);h.startsWith(".")||(h="./"+h),i.params=l+c+h+l,n.add(i)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(i){i.walkAtRules(/source|plugin|config/,r)}}}var a=m.env.DEBUG,$=new B.default({maxSize:50});function fe(n,r){let i=`${n}:${r.base??""}:${JSON.stringify(r.optimize)}`;if($.has(i))return $.get(i);let e={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:v.default.root(),optimizedPostCssAst:v.default.root(),fullRebuildPaths:[]};return $.set(i,e),e}function ce(n={}){let r=n.base??process.cwd(),i=n.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[O(),{postcssPlugin:"tailwindcss",async Once(e,{result:s}){var U=[];try{let t=K(U,new m.Instrumentation);let l=s.opts.from??"";a&&t.start(`[@tailwindcss/postcss] ${(0,d.relative)(r,l)}`);{a&&t.start("Quick bail check");let f=!0;if(e.walkAtRules(u=>{if(u.name==="import"||u.name==="reference"||u.name==="theme"||u.name==="variant"||u.name==="config"||u.name==="plugin"||u.name==="apply")return f=!1,!1}),f)return;a&&t.end("Quick bail check")}let o=fe(l,n);let c=d.default.dirname(d.default.resolve(l));async function p(){a&&t.start("Setup compiler"),o.fullRebuildPaths.length>0&&!N&&(0,z.clearRequireCache)(o.fullRebuildPaths),o.fullRebuildPaths=[],a&&t.start("PostCSS AST -> Tailwind CSS AST");let f=_(e);a&&t.end("PostCSS AST -> Tailwind CSS AST"),a&&t.start("Create compiler");let u=await(0,m.compileAst)(f,{base:c,shouldRewriteUrls:!0,onDependency:S=>{o.fullRebuildPaths.push(S)}});return a&&t.end("Create compiler"),a&&t.end("Setup compiler"),u}let N=o.compiler===null;o.compiler??=await p();if(o.compiler.features===m.Features.None)return;let h="incremental";a&&t.start("Register full rebuild paths");{for(let u of o.fullRebuildPaths)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:d.default.resolve(u),parent:s.opts.from});let f=s.messages.flatMap(u=>u.type!=="dependency"?[]:u.file);f.push(l);for(let u of f){let S=G.default.statSync(u,{throwIfNoEntry:!1})?.mtimeMs??null;if(S===null){u===l&&(h="full");continue}o.mtimes.get(u)!==S&&(h="full",o.mtimes.set(u,S))}}a&&t.end("Register full rebuild paths");h==="full"&&!N&&(o.compiler=await p());if(o.scanner===null||h==="full"){a&&t.start("Setup scanner");let f=(o.compiler.root==="none"?[]:o.compiler.root===null?[{base:r,pattern:"**/*"}]:[o.compiler.root]).concat(o.compiler.globs);o.scanner=new Q.Scanner({sources:f}),a&&t.end("Setup scanner")}a&&t.start("Scan for candidates");let H=o.compiler.features&m.Features.Utilities?o.scanner.scan():[];a&&t.end("Scan for candidates");if(o.compiler.features&m.Features.Utilities){a&&t.start("Register dependency messages");for(let f of o.scanner.files)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:d.default.resolve(f),parent:s.opts.from});for(let{base:f,pattern:u}of o.scanner.globs)u==="*"&&r===f||(u===""?s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:d.default.resolve(f),parent:s.opts.from}):s.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:d.default.resolve(f),glob:u,parent:s.opts.from}));a&&t.end("Register dependency messages")}a&&t.start("Build utilities");let k=o.compiler.build(H);a&&t.end("Build utilities");if(o.tailwindCssAst!==k)if(i){a&&t.start("Optimization"),a&&t.start("AST -> CSS");let f=F(k);a&&t.end("AST -> CSS"),a&&t.start("Lightning CSS");let u=pe(f,{minify:typeof i=="object"?i.minify:!0});a&&t.end("Lightning CSS"),a&&t.start("CSS -> PostCSS AST"),o.optimizedPostCssAst=v.default.parse(u,s.opts),a&&t.end("CSS -> PostCSS AST"),a&&t.end("Optimization")}else a&&t.start("Transform Tailwind CSS AST into PostCSS AST"),o.cachedPostCssAst=M(k,e.source),a&&t.end("Transform Tailwind CSS AST into PostCSS AST");o.tailwindCssAst=k;a&&t.start("Update PostCSS AST");e.removeAll();e.append(i?o.optimizedPostCssAst.clone().nodes:o.cachedPostCssAst.clone().nodes);e.raws.indent=" ";a&&t.end("Update PostCSS AST");a&&t.end(`[@tailwindcss/postcss] ${(0,d.relative)(r,l)}`)}catch(q){var X=q,Y=!0}finally{W(U,X,Y)}}}]}}function pe(n,{file:r="input.css",minify:i=!1}={}){function e(s){return(0,g.transform)({filename:r,code:s,minify:i,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:g.Features.Nesting,exclude:g.Features.LogicalProperties|g.Features.DirSelector|g.Features.LightDark,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7274496},errorRecovery:!0}).code}return e(e(Buffer.from(n))).toString()}var j=Object.assign(ce,{postcss:!0});module.exports=j;
|
package/dist/index.mjs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
var $=(o,r)=>(r=Symbol[o])?r:Symbol.for("Symbol."+o),
|
1
|
+
var $=(o,r)=>(r=Symbol[o])?r:Symbol.for("Symbol."+o),U=o=>{throw TypeError(o)};var L=(o,r,n)=>{if(r!=null){typeof r!="object"&&typeof r!="function"&&U("Object expected");var e,s;n&&(e=r[$("asyncDispose")]),e===void 0&&(e=r[$("dispose")],n&&(s=e)),typeof e!="function"&&U("Object not disposable"),s&&(e=function(){try{s.call(this)}catch(t){return Promise.reject(t)}}),o.push([n,e,r])}else n&&o.push([n]);return r},V=(o,r,n)=>{var e=typeof SuppressedError=="function"?SuppressedError:function(i,l,c,p){return p=Error(c),p.name="SuppressedError",p.error=i,p.suppressed=l,p},s=i=>r=n?new e(i,r,"An error was suppressed during disposal"):(n=!0,i),t=i=>{for(;i=o.pop();)try{var l=i[1]&&i[1].call(i[2]);if(i[0])return Promise.resolve(l).then(t,c=>(s(c),t()))}catch(c){s(c)}if(n)throw r};return t()};import J from"@alloc/quick-lru";import{compileAst as Z,env as ee,Features as T,Instrumentation as te}from"@tailwindcss/node";import{clearRequireCache as se}from"@tailwindcss/node/require-cache";import{Scanner as re}from"@tailwindcss/oxide";import{Features as y,transform as ie}from"lightningcss";import ne from"node:fs";import m,{relative as M}from"node:path";import b from"postcss";var G=32;var j=40;function I(o,r=[]){for(let n=5;n<o.length;n++){let e=o.charCodeAt(n);if(e===G||e===j){let s=o.slice(0,n).trim(),t=o.slice(n).trim();return g(s,t,r)}}return g(o.trim(),"",r)}var q=64;function X(o,r=[]){return{kind:"rule",selector:o,nodes:r}}function g(o,r="",n=[]){return{kind:"at-rule",name:o,params:r,nodes:n}}function N(o,r=[]){return o.charCodeAt(0)===q?I(o,r):X(o,r)}function k(o,r,n=!1){return{kind:"declaration",property:o,value:r,important:n}}function v(o){return{kind:"comment",value:o}}function K(o){function r(e,s=0){let t="",i=" ".repeat(s);if(e.kind==="declaration")t+=`${i}${e.property}: ${e.value}${e.important?" !important":""};
|
2
2
|
`;else if(e.kind==="rule"){t+=`${i}${e.selector} {
|
3
3
|
`;for(let l of e.nodes)t+=r(l,s+1);t+=`${i}}
|
4
4
|
`}else if(e.kind==="at-rule"){if(e.nodes.length===0)return`${i}${e.name} ${e.params};
|
5
5
|
`;t+=`${i}${e.name}${e.params?` ${e.params} `:" "}{
|
6
6
|
`;for(let l of e.nodes)t+=r(l,s+1);t+=`${i}}
|
7
7
|
`}else if(e.kind==="comment")t+=`${i}/*${e.value}*/
|
8
|
-
`;else if(e.kind==="context"||e.kind==="at-root")return"";return t}let n="";for(let e of o){let s=r(e);s!==""&&(n+=s)}return n}import A from"postcss";var Y=33;function W(o,r){let n=A.root();n.source=r;function e(s,t){if(s.kind==="declaration"){let i=A.decl({prop:s.property,value:s.value??"",important:s.important});i.source=r,t.append(i)}else if(s.kind==="rule"){let i=A.rule({selector:s.selector});i.source=r,i.raws.semicolon=!0,t.append(i);for(let l of s.nodes)e(l,i)}else if(s.kind==="at-rule"){let i=A.atRule({name:s.name.slice(1),params:s.params});i.source=r,i.raws.semicolon=!0,t.append(i);for(let l of s.nodes)e(l,i)}else if(s.kind==="comment"){let i=A.comment({text:s.value});i.raws.left="",i.raws.right="",i.source=r,t.append(i)}else s.kind==="at-root"||s.kind}for(let s of o)e(s,n);return n}function D(o){function r(e,s){if(e.type==="decl")s.push(k(e.prop,e.value,e.important));else if(e.type==="rule"){let t=N(e.selector);e.each(i=>r(i,t.nodes)),s.push(t)}else if(e.type==="atrule"){let t=g(`@${e.name}`,e.params);e.each(i=>r(i,t.nodes)),s.push(t)}else if(e.type==="comment"){if(e.text.charCodeAt(0)!==Y)return;s.push(v(e.text))}}let n=[];return o.each(e=>r(e,n)),n}import{normalizePath as F}from"@tailwindcss/node";import C from"node:path";var E="'",R='"';function P(){let o=new WeakSet;function r(n){let e=n.root().source?.input.file;if(!e)return;let s=n.source?.input.file;if(!s||o.has(n))return;let t=n.params[0],i=t[0]===R&&t[t.length-1]===R?R:t[0]===E&&t[t.length-1]===E?E:null;if(!i)return;let l=n.params.slice(1,-1),c="";if(l.startsWith("!")&&(l=l.slice(1),c="!"),!l.startsWith("./")&&!l.startsWith("../"))return;let p=C.posix.join(F(C.dirname(s)),l),x=C.posix.dirname(F(e)),d=C.posix.relative(x,p);d.startsWith(".")||(d="./"+d),n.params=i+c+d+i,o.add(n)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(n){n.walkAtRules(/source|plugin|config/,r)}}}var a=ee.DEBUG,w=new J({maxSize:50});function le(o,r){let n=`${o}:${r.base??""}:${JSON.stringify(r.optimize)}`;if(w.has(n))return w.get(n);let e={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:b.root(),optimizedPostCssAst:b.root(),fullRebuildPaths:[]};return w.set(n,e),e}function oe(o={}){let r=o.base??process.cwd(),n=o.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[P(),{postcssPlugin:"tailwindcss",async Once(e,{result:s}){var O=[];try{let t=
|
8
|
+
`;else if(e.kind==="context"||e.kind==="at-root")return"";return t}let n="";for(let e of o){let s=r(e);s!==""&&(n+=s)}return n}import A from"postcss";var Y=33;function W(o,r){let n=A.root();n.source=r;function e(s,t){if(s.kind==="declaration"){let i=A.decl({prop:s.property,value:s.value??"",important:s.important});i.source=r,t.append(i)}else if(s.kind==="rule"){let i=A.rule({selector:s.selector});i.source=r,i.raws.semicolon=!0,t.append(i);for(let l of s.nodes)e(l,i)}else if(s.kind==="at-rule"){let i=A.atRule({name:s.name.slice(1),params:s.params});i.source=r,i.raws.semicolon=!0,t.append(i);for(let l of s.nodes)e(l,i)}else if(s.kind==="comment"){let i=A.comment({text:s.value});i.raws.left="",i.raws.right="",i.source=r,t.append(i)}else s.kind==="at-root"||s.kind}for(let s of o)e(s,n);return n}function D(o){function r(e,s){if(e.type==="decl")s.push(k(e.prop,e.value,e.important));else if(e.type==="rule"){let t=N(e.selector);e.each(i=>r(i,t.nodes)),s.push(t)}else if(e.type==="atrule"){let t=g(`@${e.name}`,e.params);e.each(i=>r(i,t.nodes)),s.push(t)}else if(e.type==="comment"){if(e.text.charCodeAt(0)!==Y)return;s.push(v(e.text))}}let n=[];return o.each(e=>r(e,n)),n}import{normalizePath as F}from"@tailwindcss/node";import C from"node:path";var E="'",R='"';function P(){let o=new WeakSet;function r(n){let e=n.root().source?.input.file;if(!e)return;let s=n.source?.input.file;if(!s||o.has(n))return;let t=n.params[0],i=t[0]===R&&t[t.length-1]===R?R:t[0]===E&&t[t.length-1]===E?E:null;if(!i)return;let l=n.params.slice(1,-1),c="";if(l.startsWith("!")&&(l=l.slice(1),c="!"),!l.startsWith("./")&&!l.startsWith("../"))return;let p=C.posix.join(F(C.dirname(s)),l),x=C.posix.dirname(F(e)),d=C.posix.relative(x,p);d.startsWith(".")||(d="./"+d),n.params=i+c+d+i,o.add(n)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(n){n.walkAtRules(/source|plugin|config/,r)}}}var a=ee.DEBUG,w=new J({maxSize:50});function le(o,r){let n=`${o}:${r.base??""}:${JSON.stringify(r.optimize)}`;if(w.has(n))return w.get(n);let e={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:b.root(),optimizedPostCssAst:b.root(),fullRebuildPaths:[]};return w.set(n,e),e}function oe(o={}){let r=o.base??process.cwd(),n=o.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[P(),{postcssPlugin:"tailwindcss",async Once(e,{result:s}){var O=[];try{let t=L(O,new te);let i=s.opts.from??"";a&&t.start(`[@tailwindcss/postcss] ${M(r,i)}`);{a&&t.start("Quick bail check");let f=!0;if(e.walkAtRules(u=>{if(u.name==="import"||u.name==="reference"||u.name==="theme"||u.name==="variant"||u.name==="config"||u.name==="plugin"||u.name==="apply")return f=!1,!1}),f)return;a&&t.end("Quick bail check")}let l=le(i,o);let c=m.dirname(m.resolve(i));async function p(){a&&t.start("Setup compiler"),l.fullRebuildPaths.length>0&&!x&&se(l.fullRebuildPaths),l.fullRebuildPaths=[],a&&t.start("PostCSS AST -> Tailwind CSS AST");let f=D(e);a&&t.end("PostCSS AST -> Tailwind CSS AST"),a&&t.start("Create compiler");let u=await Z(f,{base:c,shouldRewriteUrls:!0,onDependency:h=>{l.fullRebuildPaths.push(h)}});return a&&t.end("Create compiler"),a&&t.end("Setup compiler"),u}let x=l.compiler===null;l.compiler??=await p();if(l.compiler.features===T.None)return;let d="incremental";a&&t.start("Register full rebuild paths");{for(let u of l.fullRebuildPaths)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:m.resolve(u),parent:s.opts.from});let f=s.messages.flatMap(u=>u.type!=="dependency"?[]:u.file);f.push(i);for(let u of f){let h=ne.statSync(u,{throwIfNoEntry:!1})?.mtimeMs??null;if(h===null){u===i&&(d="full");continue}l.mtimes.get(u)!==h&&(d="full",l.mtimes.set(u,h))}}a&&t.end("Register full rebuild paths");d==="full"&&!x&&(l.compiler=await p());if(l.scanner===null||d==="full"){a&&t.start("Setup scanner");let f=(l.compiler.root==="none"?[]:l.compiler.root===null?[{base:r,pattern:"**/*"}]:[l.compiler.root]).concat(l.compiler.globs);l.scanner=new re({sources:f}),a&&t.end("Setup scanner")}a&&t.start("Scan for candidates");let _=l.compiler.features&T.Utilities?l.scanner.scan():[];a&&t.end("Scan for candidates");if(l.compiler.features&T.Utilities){a&&t.start("Register dependency messages");for(let f of l.scanner.files)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:m.resolve(f),parent:s.opts.from});for(let{base:f,pattern:u}of l.scanner.globs)u==="*"&&r===f||(u===""?s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:m.resolve(f),parent:s.opts.from}):s.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:m.resolve(f),glob:u,parent:s.opts.from}));a&&t.end("Register dependency messages")}a&&t.start("Build utilities");let S=l.compiler.build(_);a&&t.end("Build utilities");if(l.tailwindCssAst!==S)if(n){a&&t.start("Optimization"),a&&t.start("AST -> CSS");let f=K(S);a&&t.end("AST -> CSS"),a&&t.start("Lightning CSS");let u=ae(f,{minify:typeof n=="object"?n.minify:!0});a&&t.end("Lightning CSS"),a&&t.start("CSS -> PostCSS AST"),l.optimizedPostCssAst=b.parse(u,s.opts),a&&t.end("CSS -> PostCSS AST"),a&&t.end("Optimization")}else a&&t.start("Transform Tailwind CSS AST into PostCSS AST"),l.cachedPostCssAst=W(S,e.source),a&&t.end("Transform Tailwind CSS AST into PostCSS AST");l.tailwindCssAst=S;a&&t.start("Update PostCSS AST");e.removeAll();e.append(n?l.optimizedPostCssAst.clone().nodes:l.cachedPostCssAst.clone().nodes);e.raws.indent=" ";a&&t.end("Update PostCSS AST");a&&t.end(`[@tailwindcss/postcss] ${M(r,i)}`)}catch(B){var z=B,Q=!0}finally{V(O,z,Q)}}}]}}function ae(o,{file:r="input.css",minify:n=!1}={}){function e(s){return ie({filename:r,code:s,minify:n,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:y.Nesting,exclude:y.LogicalProperties|y.DirSelector|y.LightDark,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7274496},errorRecovery:!0}).code}return e(e(Buffer.from(o))).toString()}var Xe=Object.assign(oe,{postcss:!0});export{Xe as default};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tailwindcss/postcss",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.12",
|
4
4
|
"description": "PostCSS plugin for Tailwind CSS, a utility-first CSS framework for rapidly building custom user interfaces",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -28,9 +28,9 @@
|
|
28
28
|
"@alloc/quick-lru": "^5.2.0",
|
29
29
|
"lightningcss": "^1.29.1",
|
30
30
|
"postcss": "^8.4.41",
|
31
|
-
"@tailwindcss/node": "4.0.
|
32
|
-
"@tailwindcss/oxide": "4.0.
|
33
|
-
"tailwindcss": "4.0.
|
31
|
+
"@tailwindcss/node": "4.0.12",
|
32
|
+
"@tailwindcss/oxide": "4.0.12",
|
33
|
+
"tailwindcss": "4.0.12"
|
34
34
|
},
|
35
35
|
"devDependencies": {
|
36
36
|
"@types/node": "^20.14.8",
|