@tailwindcss/postcss 4.0.0-beta.4 → 4.0.0-beta.5
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 +8 -1
- package/dist/index.mjs +8 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -1 +1,8 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var I=Object.create;var U=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var H=(o,l,i,e)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of K(l))!Q.call(o,s)&&s!==i&&U(o,s,{get:()=>l[s],enumerable:!(e=F(l,s))||e.enumerable});return o};var d=(o,l,i)=>(i=o!=null?I(j(o)):{},H(l||!o||!o.__esModule?U(i,"default",{value:o,enumerable:!0}):i,o));var L=d(require("@alloc/quick-lru")),r=require("@tailwindcss/node"),_=require("@tailwindcss/node/require-cache"),z=require("@tailwindcss/oxide"),C=require("lightningcss"),M=d(require("fs")),T=d(require("path")),S=d(require("postcss"));var q=32;var V=40;function B(o,l=[]){for(let i=5;i<o.length;i++){let e=o.charCodeAt(i);if(e===q||e===V){let s=o.slice(0,i).trim(),n=o.slice(i).trim();return A(s,n,l)}}return A(o.trim(),"",l)}var X=64;function Y(o,l=[]){return{kind:"rule",selector:o,nodes:l}}function A(o,l="",i=[]){return{kind:"at-rule",name:o,params:l,nodes:i}}function k(o,l=[]){return o.charCodeAt(0)===X?B(o,l):Y(o,l)}function R(o,l,i=!1){return{kind:"declaration",property:o,value:l,important:i}}function w(o){return{kind:"comment",value:o}}function D(o){function l(e,s=0){let n="",t=" ".repeat(s);if(e.kind==="declaration")n+=`${t}${e.property}: ${e.value}${e.important?" !important":""};
|
2
|
+
`;else if(e.kind==="rule"){n+=`${t}${e.selector} {
|
3
|
+
`;for(let a of e.nodes)n+=l(a,s+1);n+=`${t}}
|
4
|
+
`}else if(e.kind==="at-rule"){if(e.nodes.length===0)return`${t}${e.name} ${e.params};
|
5
|
+
`;n+=`${t}${e.name}${e.params?` ${e.params} `:" "}{
|
6
|
+
`;for(let a of e.nodes)n+=l(a,s+1);n+=`${t}}
|
7
|
+
`}else if(e.kind==="comment")n+=`${t}/*${e.value}*/
|
8
|
+
`;else if(e.kind==="context"||e.kind==="at-root")return"";return n}let i="";for(let e of o){let s=l(e);s!==""&&(i+=s)}return i}var m=d(require("postcss"));var J=33;function $(o,l){let i=m.default.root();i.source=l;function e(s,n){if(s.kind==="declaration"){let t=m.default.decl({prop:s.property,value:s.value??"",important:s.important});t.source=l,n.append(t)}else if(s.kind==="rule"){let t=m.default.rule({selector:s.selector});t.source=l,t.raws.semicolon=!0,n.append(t);for(let a of s.nodes)e(a,t)}else if(s.kind==="at-rule"){let t=m.default.atRule({name:s.name.slice(1),params:s.params});t.source=l,t.raws.semicolon=!0,n.append(t);for(let a of s.nodes)e(a,t)}else if(s.kind==="comment"){let t=m.default.comment({text:s.value});t.raws.left="",t.raws.right="",t.source=l,n.append(t)}else s.kind==="at-root"||s.kind}for(let s of o)e(s,i);return i}function G(o){function l(e,s){if(e.type==="decl")s.push(R(e.prop,e.value,e.important));else if(e.type==="rule"){let n=k(e.selector);e.each(t=>l(t,n.nodes)),s.push(n)}else if(e.type==="atrule"){let n=A(`@${e.name}`,e.params);e.each(t=>l(t,n.nodes)),s.push(n)}else if(e.type==="comment"){if(e.text.charCodeAt(0)!==J)return;s.push(w(e.text))}}let i=[];return o.each(e=>l(e,i)),i}var b=require("@tailwindcss/node"),g=d(require("path")),P="'",E='"';function v(){let o=new WeakSet;function l(i){let e=i.root().source?.input.file;if(!e)return;let s=i.source?.input.file;if(!s||o.has(i))return;let n=i.params[0],t=n[0]===E&&n[n.length-1]===E?E:n[0]===P&&n[n.length-1]===P?P:null;if(!t)return;let a=i.params.slice(1,-1),h="";if(a.startsWith("!")&&(a=a.slice(1),h="!"),!a.startsWith("./")&&!a.startsWith("../"))return;let x=g.default.posix.join((0,b.normalizePath)(g.default.dirname(s)),a),f=g.default.posix.dirname((0,b.normalizePath)(e)),u=g.default.posix.relative(f,x);u.startsWith(".")||(u="./"+u),i.params=t+h+u+t,o.add(i)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(i){i.walkAtRules(/source|plugin|config/,l)}}}var O=new L.default({maxSize:50});function Z(o,l){let i=`${o}:${l.base??""}:${JSON.stringify(l.optimize)}`;if(O.has(i))return O.get(i);let e={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:S.default.root(),optimizedPostCssAst:S.default.root(),fullRebuildPaths:[]};return O.set(i,e),e}function ee(o={}){let l=o.base??process.cwd(),i=o.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[v(),{postcssPlugin:"tailwindcss",async Once(e,{result:s}){r.env.DEBUG&&console.time("[@tailwindcss/postcss] Total time in @tailwindcss/postcss");let n=s.opts.from??"",t=Z(n,o),a=T.default.dirname(T.default.resolve(n));async function h(){r.env.DEBUG&&console.time("[@tailwindcss/postcss] Setup compiler"),t.fullRebuildPaths.length>0&&!x&&(0,_.clearRequireCache)(t.fullRebuildPaths),t.fullRebuildPaths=[];let p=await(0,r.compileAst)(G(e),{base:a,onDependency:c=>{t.fullRebuildPaths.push(c)}});return r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Setup compiler"),p}let x=t.compiler===null;if(t.compiler??=await h(),t.compiler.features===r.Features.None)return;let f="incremental";{for(let c of t.fullRebuildPaths)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:c,parent:s.opts.from});let p=s.messages.flatMap(c=>c.type!=="dependency"?[]:c.file);p.push(n);for(let c of p){let N=M.default.statSync(c,{throwIfNoEntry:!1})?.mtimeMs??null;if(N===null){c===n&&(f="full");continue}t.mtimes.get(c)!==N&&(f="full",t.mtimes.set(c,N))}}if(f==="full"&&!x&&(t.compiler=await h()),t.scanner===null||f==="full"){let p=(t.compiler.root==="none"?[]:t.compiler.root===null?[{base:l,pattern:"**/*"}]:[t.compiler.root]).concat(t.compiler.globs);t.scanner=new z.Scanner({sources:p})}r.env.DEBUG&&console.time("[@tailwindcss/postcss] Scan for candidates");let u=t.compiler.features&r.Features.Utilities?t.scanner.scan():[];if(r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Scan for candidates"),t.compiler.features&r.Features.Utilities){for(let p of t.scanner.files)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:p,parent:s.opts.from});for(let{base:p,pattern:c}of t.scanner.globs)c==="*"&&l===p||(c===""?s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:p,parent:s.opts.from}):s.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:p,glob:c,parent:s.opts.from}))}r.env.DEBUG&&console.time("[@tailwindcss/postcss] Build AST");let y=t.compiler.build(u);r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Build AST"),t.tailwindCssAst!==y&&(i?(r.env.DEBUG&&console.time("[@tailwindcss/postcss] Optimize CSS"),t.optimizedPostCssAst=S.default.parse(te(D(y),{minify:typeof i=="object"?i.minify:!0}),s.opts),r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Optimize CSS")):(r.env.DEBUG&&console.time("[@tailwindcss/postcss] Transform CSS AST into PostCSS AST"),t.cachedPostCssAst=$(y,e.source),r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Transform CSS AST into PostCSS AST"))),t.tailwindCssAst=y,r.env.DEBUG&&console.time("[@tailwindcss/postcss] Update PostCSS AST"),e.removeAll(),e.append(i?t.optimizedPostCssAst.clone().nodes:t.cachedPostCssAst.clone().nodes),e.raws.indent=" ",r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Update PostCSS AST"),r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Total time in @tailwindcss/postcss")}}]}}function te(o,{file:l="input.css",minify:i=!1}={}){function e(s){return(0,C.transform)({filename:l,code:s,minify:i,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:C.Features.Nesting,exclude:C.Features.LogicalProperties,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7864320},errorRecovery:!0}).code}return e(e(Buffer.from(o))).toString()}var W=Object.assign(ee,{postcss:!0});module.exports=W;
|
package/dist/index.mjs
CHANGED
@@ -1 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import W from"@alloc/quick-lru";import{compileAst as I,env as c,Features as P}from"@tailwindcss/node";import{clearRequireCache as F}from"@tailwindcss/node/require-cache";import{Scanner as K}from"@tailwindcss/oxide";import{Features as D,transform as j}from"lightningcss";import Q from"node:fs";import $ from"node:path";import b from"postcss";var G=32;var L=40;function v(l,o=[]){for(let i=5;i<l.length;i++){let t=l.charCodeAt(i);if(t===G||t===L){let s=l.slice(0,i).trim(),n=l.slice(i).trim();return m(s,n,o)}}return m(l.trim(),"",o)}var _=64;function z(l,o=[]){return{kind:"rule",selector:l,nodes:o}}function m(l,o="",i=[]){return{kind:"at-rule",name:l,params:o,nodes:i}}function y(l,o=[]){return l.charCodeAt(0)===_?v(l,o):z(l,o)}function S(l,o,i=!1){return{kind:"declaration",property:l,value:o,important:i}}function N(l){return{kind:"comment",value:l}}function O(l){function o(t,s=0){let n="",e=" ".repeat(s);if(t.kind==="declaration")n+=`${e}${t.property}: ${t.value}${t.important?" !important":""};
|
2
|
+
`;else if(t.kind==="rule"){n+=`${e}${t.selector} {
|
3
|
+
`;for(let r of t.nodes)n+=o(r,s+1);n+=`${e}}
|
4
|
+
`}else if(t.kind==="at-rule"){if(t.nodes.length===0)return`${e}${t.name} ${t.params};
|
5
|
+
`;n+=`${e}${t.name}${t.params?` ${t.params} `:" "}{
|
6
|
+
`;for(let r of t.nodes)n+=o(r,s+1);n+=`${e}}
|
7
|
+
`}else if(t.kind==="comment")n+=`${e}/*${t.value}*/
|
8
|
+
`;else if(t.kind==="context"||t.kind==="at-root")return"";return n}let i="";for(let t of l){let s=o(t);s!==""&&(i+=s)}return i}import h from"postcss";var M=33;function T(l,o){let i=h.root();i.source=o;function t(s,n){if(s.kind==="declaration"){let e=h.decl({prop:s.property,value:s.value??"",important:s.important});e.source=o,n.append(e)}else if(s.kind==="rule"){let e=h.rule({selector:s.selector});e.source=o,e.raws.semicolon=!0,n.append(e);for(let r of s.nodes)t(r,e)}else if(s.kind==="at-rule"){let e=h.atRule({name:s.name.slice(1),params:s.params});e.source=o,e.raws.semicolon=!0,n.append(e);for(let r of s.nodes)t(r,e)}else if(s.kind==="comment"){let e=h.comment({text:s.value});e.raws.left="",e.raws.right="",e.source=o,n.append(e)}else s.kind==="at-root"||s.kind}for(let s of l)t(s,i);return i}function U(l){function o(t,s){if(t.type==="decl")s.push(S(t.prop,t.value,t.important));else if(t.type==="rule"){let n=y(t.selector);t.each(e=>o(e,n.nodes)),s.push(n)}else if(t.type==="atrule"){let n=m(`@${t.name}`,t.params);t.each(e=>o(e,n.nodes)),s.push(n)}else if(t.type==="comment"){if(t.text.charCodeAt(0)!==M)return;s.push(N(t.text))}}let i=[];return l.each(t=>o(t,i)),i}import{normalizePath as B}from"@tailwindcss/node";import C from"node:path";var k="'",R='"';function w(){let l=new WeakSet;function o(i){let t=i.root().source?.input.file;if(!t)return;let s=i.source?.input.file;if(!s||l.has(i))return;let n=i.params[0],e=n[0]===R&&n[n.length-1]===R?R:n[0]===k&&n[n.length-1]===k?k:null;if(!e)return;let r=i.params.slice(1,-1),d="";if(r.startsWith("!")&&(r=r.slice(1),d="!"),!r.startsWith("./")&&!r.startsWith("../"))return;let A=C.posix.join(B(C.dirname(s)),r),f=C.posix.dirname(B(t)),u=C.posix.relative(f,A);u.startsWith(".")||(u="./"+u),i.params=e+d+u+e,l.add(i)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(i){i.walkAtRules(/source|plugin|config/,o)}}}var E=new W({maxSize:50});function H(l,o){let i=`${l}:${o.base??""}:${JSON.stringify(o.optimize)}`;if(E.has(i))return E.get(i);let t={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:b.root(),optimizedPostCssAst:b.root(),fullRebuildPaths:[]};return E.set(i,t),t}function q(l={}){let o=l.base??process.cwd(),i=l.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[w(),{postcssPlugin:"tailwindcss",async Once(t,{result:s}){c.DEBUG&&console.time("[@tailwindcss/postcss] Total time in @tailwindcss/postcss");let n=s.opts.from??"",e=H(n,l),r=$.dirname($.resolve(n));async function d(){c.DEBUG&&console.time("[@tailwindcss/postcss] Setup compiler"),e.fullRebuildPaths.length>0&&!A&&F(e.fullRebuildPaths),e.fullRebuildPaths=[];let p=await I(U(t),{base:r,onDependency:a=>{e.fullRebuildPaths.push(a)}});return c.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Setup compiler"),p}let A=e.compiler===null;if(e.compiler??=await d(),e.compiler.features===P.None)return;let f="incremental";{for(let a of e.fullRebuildPaths)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:a,parent:s.opts.from});let p=s.messages.flatMap(a=>a.type!=="dependency"?[]:a.file);p.push(n);for(let a of p){let x=Q.statSync(a,{throwIfNoEntry:!1})?.mtimeMs??null;if(x===null){a===n&&(f="full");continue}e.mtimes.get(a)!==x&&(f="full",e.mtimes.set(a,x))}}if(f==="full"&&!A&&(e.compiler=await d()),e.scanner===null||f==="full"){let p=(e.compiler.root==="none"?[]:e.compiler.root===null?[{base:o,pattern:"**/*"}]:[e.compiler.root]).concat(e.compiler.globs);e.scanner=new K({sources:p})}c.DEBUG&&console.time("[@tailwindcss/postcss] Scan for candidates");let u=e.compiler.features&P.Utilities?e.scanner.scan():[];if(c.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Scan for candidates"),e.compiler.features&P.Utilities){for(let p of e.scanner.files)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:p,parent:s.opts.from});for(let{base:p,pattern:a}of e.scanner.globs)a==="*"&&o===p||(a===""?s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:p,parent:s.opts.from}):s.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:p,glob:a,parent:s.opts.from}))}c.DEBUG&&console.time("[@tailwindcss/postcss] Build AST");let g=e.compiler.build(u);c.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Build AST"),e.tailwindCssAst!==g&&(i?(c.DEBUG&&console.time("[@tailwindcss/postcss] Optimize CSS"),e.optimizedPostCssAst=b.parse(V(O(g),{minify:typeof i=="object"?i.minify:!0}),s.opts),c.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Optimize CSS")):(c.DEBUG&&console.time("[@tailwindcss/postcss] Transform CSS AST into PostCSS AST"),e.cachedPostCssAst=T(g,t.source),c.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Transform CSS AST into PostCSS AST"))),e.tailwindCssAst=g,c.DEBUG&&console.time("[@tailwindcss/postcss] Update PostCSS AST"),t.removeAll(),t.append(i?e.optimizedPostCssAst.clone().nodes:e.cachedPostCssAst.clone().nodes),t.raws.indent=" ",c.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Update PostCSS AST"),c.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Total time in @tailwindcss/postcss")}}]}}function V(l,{file:o="input.css",minify:i=!1}={}){function t(s){return j({filename:o,code:s,minify:i,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:D.Nesting,exclude:D.LogicalProperties,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7864320},errorRecovery:!0}).code}return t(t(Buffer.from(l))).toString()}var Ce=Object.assign(q,{postcss:!0});export{Ce as default};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tailwindcss/postcss",
|
3
|
-
"version": "4.0.0-beta.
|
3
|
+
"version": "4.0.0-beta.5",
|
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.26.0",
|
30
30
|
"postcss": "^8.4.41",
|
31
|
-
"
|
32
|
-
"@tailwindcss/
|
33
|
-
"tailwindcss": "4.0.0-beta.
|
31
|
+
"tailwindcss": "4.0.0-beta.5",
|
32
|
+
"@tailwindcss/node": "4.0.0-beta.5",
|
33
|
+
"@tailwindcss/oxide": "4.0.0-beta.5"
|
34
34
|
},
|
35
35
|
"devDependencies": {
|
36
36
|
"@types/node": "^20.14.8",
|