@tailwindcss/postcss 4.0.0-alpha.9 → 4.0.0-beta.10

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.
@@ -0,0 +1,11 @@
1
+ import { PluginCreator } from 'postcss';
2
+
3
+ type PluginOptions = {
4
+ base?: string;
5
+ optimize?: boolean | {
6
+ minify?: boolean;
7
+ };
8
+ };
9
+ declare const _default: PluginCreator<PluginOptions>;
10
+
11
+ export { type PluginOptions, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import postcss from 'postcss';
1
+ import { PluginCreator } from 'postcss';
2
2
 
3
3
  type PluginOptions = {
4
4
  base?: string;
@@ -6,6 +6,6 @@ type PluginOptions = {
6
6
  minify?: boolean;
7
7
  };
8
8
  };
9
- declare const _default: postcss.PluginCreator<PluginOptions>;
9
+ declare const _default: PluginCreator<PluginOptions>;
10
10
 
11
11
  export = _default;
package/dist/index.js CHANGED
@@ -1,3 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _oxide = require('@tailwindcss/oxide');var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);var _lightningcss = require('lightningcss');var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);var _postcssimport = require('postcss-import'); var _postcssimport2 = _interopRequireDefault(_postcssimport);var _tailwindcss = require('tailwindcss');var g=class extends Map{constructor(t){super();this.factory=t}get(t){let l=super.get(t);return l===void 0&&(l=this.factory(t,this),this.set(t,l)),l}};function S(r={}){let p=_nullishCoalesce(r.base, () => (process.cwd())),t=_nullishCoalesce(r.optimize, () => (process.env.NODE_ENV==="production")),l=new g(()=>({mtimes:new Map,build:null,css:"",optimizedCss:""}));return{postcssPlugin:"@tailwindcss/postcss",plugins:[_postcssimport2.default.call(void 0, ),(a,n)=>{let c=_nullishCoalesce(n.opts.from, () => ("")),i=l.get(c),f="incremental";{let e=n.messages.flatMap(s=>s.type!=="dependency"?[]:s.file);e.push(c);for(let s of e){let d=_nullishCoalesce(_optionalChain([_fs2.default, 'access', _ => _.statSync, 'call', _2 => _2(s,{throwIfNoEntry:!1}), 'optionalAccess', _3 => _3.mtimeMs]), () => (null));if(d===null){s===c&&(f="full");continue}i.mtimes.get(s)!==d&&(f="full",i.mtimes.set(s,d))}}let u=!1,m=!1;if(a.walkAtRules(e=>{if(e.name==="apply")u=!0;else if(e.name==="tailwind")return u=!0,m=!0,!1}),!m&&!u)return;let o="",{candidates:y,files:h,globs:w}=_oxide.scanDir.call(void 0, {base:p,globs:!0});for(let e of h)n.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:e,parent:n.opts.from});for(let{base:e,glob:s}of w)n.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:e,glob:s,parent:n.opts.from});if(f==="full"){let{build:e}=_tailwindcss.compile.call(void 0, a.toString());i.build=e,o=e(m?y:[])}else f==="incremental"&&(o=i.build(y));o!==i.css&&t&&(i.optimizedCss=V(o,{minify:typeof t=="object"?t.minify:!0})),i.css=o,a.removeAll(),a.append(_postcss2.default.parse(t?i.optimizedCss:i.css,n.opts))}]}}function V(r,{file:p="input.css",minify:t=!1}={}){return _lightningcss.transform.call(void 0, {filename:p,code:Buffer.from(r),minify:t,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:_lightningcss.Features.Nesting,exclude:_lightningcss.Features.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code.toString()}var D=Object.assign(S,{postcss:!0});exports.default = D;
2
-
3
- module.exports = exports.default;
1
+ "use strict";var V=Object.create;var _=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var B=(o,i)=>(i=Symbol[o])?i:Symbol.for("Symbol."+o),U=o=>{throw TypeError(o)};var ie=(o,i,r,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of ee(i))!se.call(o,s)&&s!==r&&_(o,s,{get:()=>i[s],enumerable:!(e=Z(i,s))||e.enumerable});return o};var h=(o,i,r)=>(r=o!=null?V(te(o)):{},ie(i||!o||!o.__esModule?_(r,"default",{value:o,enumerable:!0}):r,o));var D=(o,i,r)=>{if(i!=null){typeof i!="object"&&typeof i!="function"&&U("Object expected");var e,s;r&&(e=i[B("asyncDispose")]),e===void 0&&(e=i[B("dispose")],r&&(s=e)),typeof e!="function"&&U("Object not disposable"),s&&(e=function(){try{s.call(this)}catch(t){return Promise.reject(t)}}),o.push([r,e,i])}else r&&o.push([r]);return i},z=(o,i,r)=>{var e=typeof SuppressedError=="function"?SuppressedError:function(n,l,u,p){return p=Error(u),p.name="SuppressedError",p.error=n,p.suppressed=l,p},s=n=>i=r?new e(n,i,"An error was suppressed during disposal"):(r=!0,n),t=n=>{for(;n=o.pop();)try{var l=n[1]&&n[1].call(n[2]);if(n[0])return Promise.resolve(l).then(t,u=>(s(u),t()))}catch(u){s(u)}if(r)throw i};return t()};var K=h(require("@alloc/quick-lru")),m=require("@tailwindcss/node"),Q=require("@tailwindcss/node/require-cache"),j=require("@tailwindcss/oxide"),g=require("lightningcss"),F=h(require("fs")),d=h(require("path")),P=h(require("postcss"));var re=32;var oe=40;function M(o,i=[]){for(let r=5;r<o.length;r++){let e=o.charCodeAt(r);if(e===re||e===oe){let s=o.slice(0,r).trim(),t=o.slice(r).trim();return x(s,t,i)}}return x(o.trim(),"",i)}var ne=64;function le(o,i=[]){return{kind:"rule",selector:o,nodes:i}}function x(o,i="",r=[]){return{kind:"at-rule",name:o,params:i,nodes:r}}function R(o,i=[]){return o.charCodeAt(0)===ne?M(o,i):le(o,i)}function w(o,i,r=!1){return{kind:"declaration",property:o,value:i,important:r}}function b(o){return{kind:"comment",value:o}}function I(o){function i(e,s=0){let t="",n=" ".repeat(s);if(e.kind==="declaration")t+=`${n}${e.property}: ${e.value}${e.important?" !important":""};
2
+ `;else if(e.kind==="rule"){t+=`${n}${e.selector} {
3
+ `;for(let l of e.nodes)t+=i(l,s+1);t+=`${n}}
4
+ `}else if(e.kind==="at-rule"){if(e.nodes.length===0)return`${n}${e.name} ${e.params};
5
+ `;t+=`${n}${e.name}${e.params?` ${e.params} `:" "}{
6
+ `;for(let l of e.nodes)t+=i(l,s+1);t+=`${n}}
7
+ `}else if(e.kind==="comment")t+=`${n}/*${e.value}*/
8
+ `;else if(e.kind==="context"||e.kind==="at-root")return"";return t}let r="";for(let e of o){let s=i(e);s!==""&&(r+=s)}return r}var C=h(require("postcss"));var ae=33;function W(o,i){let r=C.default.root();r.source=i;function e(s,t){if(s.kind==="declaration"){let n=C.default.decl({prop:s.property,value:s.value??"",important:s.important});n.source=i,t.append(n)}else if(s.kind==="rule"){let n=C.default.rule({selector:s.selector});n.source=i,n.raws.semicolon=!0,t.append(n);for(let l of s.nodes)e(l,n)}else if(s.kind==="at-rule"){let n=C.default.atRule({name:s.name.slice(1),params:s.params});n.source=i,n.raws.semicolon=!0,t.append(n);for(let l of s.nodes)e(l,n)}else if(s.kind==="comment"){let n=C.default.comment({text:s.value});n.raws.left="",n.raws.right="",n.source=i,t.append(n)}else s.kind==="at-root"||s.kind}for(let s of o)e(s,r);return r}function G(o){function i(e,s){if(e.type==="decl")s.push(w(e.prop,e.value,e.important));else if(e.type==="rule"){let t=R(e.selector);e.each(n=>i(n,t.nodes)),s.push(t)}else if(e.type==="atrule"){let t=x(`@${e.name}`,e.params);e.each(n=>i(n,t.nodes)),s.push(t)}else if(e.type==="comment"){if(e.text.charCodeAt(0)!==ae)return;s.push(b(e.text))}}let r=[];return o.each(e=>i(e,r)),r}var v=require("@tailwindcss/node"),y=h(require("path")),E="'",T='"';function O(){let o=new WeakSet;function i(r){let e=r.root().source?.input.file;if(!e)return;let s=r.source?.input.file;if(!s||o.has(r))return;let t=r.params[0],n=t[0]===T&&t[t.length-1]===T?T:t[0]===E&&t[t.length-1]===E?E:null;if(!n)return;let l=r.params.slice(1,-1),u="";if(l.startsWith("!")&&(l=l.slice(1),u="!"),!l.startsWith("./")&&!l.startsWith("../"))return;let p=y.default.posix.join((0,v.normalizePath)(y.default.dirname(s)),l),k=y.default.posix.dirname((0,v.normalizePath)(e)),A=y.default.posix.relative(k,p);A.startsWith(".")||(A="./"+A),r.params=n+u+A+n,o.add(r)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(r){r.walkAtRules(/source|plugin|config/,i)}}}var a=m.env.DEBUG,$=new K.default({maxSize:50});function ce(o,i){let r=`${o}:${i.base??""}:${JSON.stringify(i.optimize)}`;if($.has(r))return $.get(r);let e={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:P.default.root(),optimizedPostCssAst:P.default.root(),fullRebuildPaths:[]};return $.set(r,e),e}function fe(o={}){let i=o.base??process.cwd(),r=o.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[O(),{postcssPlugin:"tailwindcss",async Once(e,{result:s}){var L=[];try{let t=D(L,new m.Instrumentation);let n=s.opts.from??"";a&&t.start(`[@tailwindcss/postcss] ${(0,d.relative)(i,n)}`);{a&&t.start("Quick bail check");let f=!0;if(e.walkAtRules(c=>{if(c.name==="import"||c.name==="theme"||c.name==="config"||c.name==="plugin"||c.name==="apply")return f=!1,!1}),f)return;a&&t.end("Quick bail check")}let l=ce(n,o);let u=d.default.dirname(d.default.resolve(n));async function p(){a&&t.start("Setup compiler"),l.fullRebuildPaths.length>0&&!k&&(0,Q.clearRequireCache)(l.fullRebuildPaths),l.fullRebuildPaths=[],a&&t.start("PostCSS AST -> Tailwind CSS AST");let f=G(e);a&&t.end("PostCSS AST -> Tailwind CSS AST"),a&&t.start("Create compiler");let c=await(0,m.compileAst)(f,{base:u,onDependency:S=>{l.fullRebuildPaths.push(S)}});return a&&t.end("Create compiler"),a&&t.end("Setup compiler"),c}let k=l.compiler===null;l.compiler??=await p();if(l.compiler.features===m.Features.None)return;let A="incremental";a&&t.start("Register full rebuild paths");{for(let c of l.fullRebuildPaths)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:d.default.resolve(c),parent:s.opts.from});let f=s.messages.flatMap(c=>c.type!=="dependency"?[]:c.file);f.push(n);for(let c of f){let S=F.default.statSync(c,{throwIfNoEntry:!1})?.mtimeMs??null;if(S===null){c===n&&(A="full");continue}l.mtimes.get(c)!==S&&(A="full",l.mtimes.set(c,S))}}a&&t.end("Register full rebuild paths");A==="full"&&!k&&(l.compiler=await p());if(l.scanner===null||A==="full"){a&&t.start("Setup scanner");let f=(l.compiler.root==="none"?[]:l.compiler.root===null?[{base:i,pattern:"**/*"}]:[l.compiler.root]).concat(l.compiler.globs);l.scanner=new j.Scanner({sources:f}),a&&t.end("Setup scanner")}a&&t.start("Scan for candidates");let q=l.compiler.features&m.Features.Utilities?l.scanner.scan():[];a&&t.end("Scan for candidates");if(l.compiler.features&m.Features.Utilities){a&&t.start("Register dependency messages");for(let f of l.scanner.files)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:d.default.resolve(f),parent:s.opts.from});for(let{base:f,pattern:c}of l.scanner.globs)c==="*"&&i===f||(c===""?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:c,parent:s.opts.from}));a&&t.end("Register dependency messages")}a&&t.start("Build utilities");let N=l.compiler.build(q);a&&t.end("Build utilities");if(l.tailwindCssAst!==N)if(r){a&&t.start("Optimization"),a&&t.start("AST -> CSS");let f=I(N);a&&t.end("AST -> CSS"),a&&t.start("Lightning CSS");let c=ue(f,{minify:typeof r=="object"?r.minify:!0});a&&t.end("Lightning CSS"),a&&t.start("CSS -> PostCSS AST"),l.optimizedPostCssAst=P.default.parse(c,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(N,e.source),a&&t.end("Transform Tailwind CSS AST into PostCSS AST");l.tailwindCssAst=N;a&&t.start("Update PostCSS AST");e.removeAll();e.append(r?l.optimizedPostCssAst.clone().nodes:l.cachedPostCssAst.clone().nodes);e.raws.indent=" ";a&&t.end("Update PostCSS AST");a&&t.end(`[@tailwindcss/postcss] ${(0,d.relative)(i,n)}`)}catch(X){var Y=X,J=!0}finally{z(L,Y,J)}}}]}}function ue(o,{file:i="input.css",minify:r=!1}={}){function e(s){return(0,g.transform)({filename:i,code:s,minify:r,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(o))).toString()}var H=Object.assign(fe,{postcss:!0});module.exports=H;
package/dist/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ var $=(l,i)=>(i=Symbol[l])?i:Symbol.for("Symbol."+l),L=l=>{throw TypeError(l)};var B=(l,i,n)=>{if(i!=null){typeof i!="object"&&typeof i!="function"&&L("Object expected");var e,s;n&&(e=i[$("asyncDispose")]),e===void 0&&(e=i[$("dispose")],n&&(s=e)),typeof e!="function"&&L("Object not disposable"),s&&(e=function(){try{s.call(this)}catch(t){return Promise.reject(t)}}),l.push([n,e,i])}else n&&l.push([n]);return i},U=(l,i,n)=>{var e=typeof SuppressedError=="function"?SuppressedError:function(r,o,u,p){return p=Error(u),p.name="SuppressedError",p.error=r,p.suppressed=o,p},s=r=>i=n?new e(r,i,"An error was suppressed during disposal"):(n=!0,r),t=r=>{for(;r=l.pop();)try{var o=r[1]&&r[1].call(r[2]);if(r[0])return Promise.resolve(o).then(t,u=>(s(u),t()))}catch(u){s(u)}if(n)throw i};return t()};import J from"@alloc/quick-lru";import{compileAst as V,env as Z,Features as E,Instrumentation as ee}from"@tailwindcss/node";import{clearRequireCache as te}from"@tailwindcss/node/require-cache";import{Scanner as se}from"@tailwindcss/oxide";import{Features as y,transform as ie}from"lightningcss";import re from"node:fs";import m,{relative as W}from"node:path";import v from"postcss";var F=32;var H=40;function _(l,i=[]){for(let n=5;n<l.length;n++){let e=l.charCodeAt(n);if(e===F||e===H){let s=l.slice(0,n).trim(),t=l.slice(n).trim();return g(s,t,i)}}return g(l.trim(),"",i)}var q=64;function X(l,i=[]){return{kind:"rule",selector:l,nodes:i}}function g(l,i="",n=[]){return{kind:"at-rule",name:l,params:i,nodes:n}}function k(l,i=[]){return l.charCodeAt(0)===q?_(l,i):X(l,i)}function N(l,i,n=!1){return{kind:"declaration",property:l,value:i,important:n}}function P(l){return{kind:"comment",value:l}}function D(l){function i(e,s=0){let t="",r=" ".repeat(s);if(e.kind==="declaration")t+=`${r}${e.property}: ${e.value}${e.important?" !important":""};
2
+ `;else if(e.kind==="rule"){t+=`${r}${e.selector} {
3
+ `;for(let o of e.nodes)t+=i(o,s+1);t+=`${r}}
4
+ `}else if(e.kind==="at-rule"){if(e.nodes.length===0)return`${r}${e.name} ${e.params};
5
+ `;t+=`${r}${e.name}${e.params?` ${e.params} `:" "}{
6
+ `;for(let o of e.nodes)t+=i(o,s+1);t+=`${r}}
7
+ `}else if(e.kind==="comment")t+=`${r}/*${e.value}*/
8
+ `;else if(e.kind==="context"||e.kind==="at-root")return"";return t}let n="";for(let e of l){let s=i(e);s!==""&&(n+=s)}return n}import h from"postcss";var Y=33;function z(l,i){let n=h.root();n.source=i;function e(s,t){if(s.kind==="declaration"){let r=h.decl({prop:s.property,value:s.value??"",important:s.important});r.source=i,t.append(r)}else if(s.kind==="rule"){let r=h.rule({selector:s.selector});r.source=i,r.raws.semicolon=!0,t.append(r);for(let o of s.nodes)e(o,r)}else if(s.kind==="at-rule"){let r=h.atRule({name:s.name.slice(1),params:s.params});r.source=i,r.raws.semicolon=!0,t.append(r);for(let o of s.nodes)e(o,r)}else if(s.kind==="comment"){let r=h.comment({text:s.value});r.raws.left="",r.raws.right="",r.source=i,t.append(r)}else s.kind==="at-root"||s.kind}for(let s of l)e(s,n);return n}function M(l){function i(e,s){if(e.type==="decl")s.push(N(e.prop,e.value,e.important));else if(e.type==="rule"){let t=k(e.selector);e.each(r=>i(r,t.nodes)),s.push(t)}else if(e.type==="atrule"){let t=g(`@${e.name}`,e.params);e.each(r=>i(r,t.nodes)),s.push(t)}else if(e.type==="comment"){if(e.text.charCodeAt(0)!==Y)return;s.push(P(e.text))}}let n=[];return l.each(e=>i(e,n)),n}import{normalizePath as I}from"@tailwindcss/node";import x from"node:path";var R="'",w='"';function b(){let l=new WeakSet;function i(n){let e=n.root().source?.input.file;if(!e)return;let s=n.source?.input.file;if(!s||l.has(n))return;let t=n.params[0],r=t[0]===w&&t[t.length-1]===w?w:t[0]===R&&t[t.length-1]===R?R:null;if(!r)return;let o=n.params.slice(1,-1),u="";if(o.startsWith("!")&&(o=o.slice(1),u="!"),!o.startsWith("./")&&!o.startsWith("../"))return;let p=x.posix.join(I(x.dirname(s)),o),C=x.posix.dirname(I(e)),d=x.posix.relative(C,p);d.startsWith(".")||(d="./"+d),n.params=r+u+d+r,l.add(n)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(n){n.walkAtRules(/source|plugin|config/,i)}}}var a=Z.DEBUG,T=new J({maxSize:50});function ne(l,i){let n=`${l}:${i.base??""}:${JSON.stringify(i.optimize)}`;if(T.has(n))return T.get(n);let e={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:v.root(),optimizedPostCssAst:v.root(),fullRebuildPaths:[]};return T.set(n,e),e}function oe(l={}){let i=l.base??process.cwd(),n=l.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[b(),{postcssPlugin:"tailwindcss",async Once(e,{result:s}){var O=[];try{let t=B(O,new ee);let r=s.opts.from??"";a&&t.start(`[@tailwindcss/postcss] ${W(i,r)}`);{a&&t.start("Quick bail check");let f=!0;if(e.walkAtRules(c=>{if(c.name==="import"||c.name==="theme"||c.name==="config"||c.name==="plugin"||c.name==="apply")return f=!1,!1}),f)return;a&&t.end("Quick bail check")}let o=ne(r,l);let u=m.dirname(m.resolve(r));async function p(){a&&t.start("Setup compiler"),o.fullRebuildPaths.length>0&&!C&&te(o.fullRebuildPaths),o.fullRebuildPaths=[],a&&t.start("PostCSS AST -> Tailwind CSS AST");let f=M(e);a&&t.end("PostCSS AST -> Tailwind CSS AST"),a&&t.start("Create compiler");let c=await V(f,{base:u,onDependency:A=>{o.fullRebuildPaths.push(A)}});return a&&t.end("Create compiler"),a&&t.end("Setup compiler"),c}let C=o.compiler===null;o.compiler??=await p();if(o.compiler.features===E.None)return;let d="incremental";a&&t.start("Register full rebuild paths");{for(let c of o.fullRebuildPaths)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:m.resolve(c),parent:s.opts.from});let f=s.messages.flatMap(c=>c.type!=="dependency"?[]:c.file);f.push(r);for(let c of f){let A=re.statSync(c,{throwIfNoEntry:!1})?.mtimeMs??null;if(A===null){c===r&&(d="full");continue}o.mtimes.get(c)!==A&&(d="full",o.mtimes.set(c,A))}}a&&t.end("Register full rebuild paths");d==="full"&&!C&&(o.compiler=await p());if(o.scanner===null||d==="full"){a&&t.start("Setup scanner");let f=(o.compiler.root==="none"?[]:o.compiler.root===null?[{base:i,pattern:"**/*"}]:[o.compiler.root]).concat(o.compiler.globs);o.scanner=new se({sources:f}),a&&t.end("Setup scanner")}a&&t.start("Scan for candidates");let G=o.compiler.features&E.Utilities?o.scanner.scan():[];a&&t.end("Scan for candidates");if(o.compiler.features&E.Utilities){a&&t.start("Register dependency messages");for(let f of o.scanner.files)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:m.resolve(f),parent:s.opts.from});for(let{base:f,pattern:c}of o.scanner.globs)c==="*"&&i===f||(c===""?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:c,parent:s.opts.from}));a&&t.end("Register dependency messages")}a&&t.start("Build utilities");let S=o.compiler.build(G);a&&t.end("Build utilities");if(o.tailwindCssAst!==S)if(n){a&&t.start("Optimization"),a&&t.start("AST -> CSS");let f=D(S);a&&t.end("AST -> CSS"),a&&t.start("Lightning CSS");let c=le(f,{minify:typeof n=="object"?n.minify:!0});a&&t.end("Lightning CSS"),a&&t.start("CSS -> PostCSS AST"),o.optimizedPostCssAst=v.parse(c,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=z(S,e.source),a&&t.end("Transform Tailwind CSS AST into PostCSS AST");o.tailwindCssAst=S;a&&t.start("Update PostCSS AST");e.removeAll();e.append(n?o.optimizedPostCssAst.clone().nodes:o.cachedPostCssAst.clone().nodes);e.raws.indent=" ";a&&t.end("Update PostCSS AST");a&&t.end(`[@tailwindcss/postcss] ${W(i,r)}`)}catch(K){var Q=K,j=!0}finally{U(O,Q,j)}}}]}}function le(l,{file:i="input.css",minify:n=!1}={}){function e(s){return ie({filename:i,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(l))).toString()}var Oe=Object.assign(oe,{postcss:!0});export{Oe as default};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@tailwindcss/postcss",
3
- "version": "4.0.0-alpha.9",
3
+ "version": "4.0.0-beta.10",
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": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/tailwindlabs/tailwindcss.git",
8
+ "url": "https://github.com/tailwindlabs/tailwindcss.git",
9
9
  "directory": "packages/@tailwindcss-postcss"
10
10
  },
11
11
  "bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
@@ -20,23 +20,28 @@
20
20
  "exports": {
21
21
  ".": {
22
22
  "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.mjs",
23
24
  "require": "./dist/index.js"
24
25
  }
25
26
  },
26
27
  "dependencies": {
27
- "lightningcss": "^1.24.0",
28
- "postcss-import": "^16.0.0",
29
- "tailwindcss": "4.0.0-alpha.9",
30
- "@tailwindcss/oxide": "4.0.0-alpha.9"
28
+ "@alloc/quick-lru": "^5.2.0",
29
+ "lightningcss": "^1.29.1",
30
+ "postcss": "^8.4.41",
31
+ "@tailwindcss/node": "4.0.0-beta.10",
32
+ "@tailwindcss/oxide": "4.0.0-beta.10",
33
+ "tailwindcss": "4.0.0-beta.10"
31
34
  },
32
35
  "devDependencies": {
33
- "@types/node": "^20.11.17",
34
- "@types/postcss-import": "^14.0.3",
35
- "postcss": "8.4.24"
36
+ "@types/node": "^20.14.8",
37
+ "@types/postcss-import": "14.0.3",
38
+ "dedent": "1.5.3",
39
+ "postcss-import": "^16.1.0",
40
+ "internal-example-plugin": "0.0.0"
36
41
  },
37
42
  "scripts": {
38
43
  "lint": "tsc --noEmit",
39
- "build": "tsup-node ./src/index.ts --format cjs --dts --cjsInterop --splitting --minify --clean",
44
+ "build": "tsup-node",
40
45
  "dev": "pnpm run build -- --watch"
41
46
  }
42
47
  }