@tailwindcss/postcss 0.0.0-development.5 → 0.0.0-insiders.0589d7d

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Tailwind Labs, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ <p align="center">
2
+ <a href="https://tailwindcss.com" target="_blank">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-dark.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg">
6
+ <img alt="Tailwind CSS" src="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
7
+ </picture>
8
+ </a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ A utility-first CSS framework for rapidly building custom user interfaces.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=next" alt="Build Status"></a>
17
+ <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
18
+ <a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
19
+ <a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
20
+ </p>
21
+
22
+ ---
23
+
24
+ ## Documentation
25
+
26
+ For full documentation, visit [tailwindcss.com](https://tailwindcss.com).
27
+
28
+ ## Community
29
+
30
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
31
+
32
+ [Discuss Tailwind CSS on GitHub](https://github.com/tailwindcss/tailwindcss/discussions)
33
+
34
+ For chatting with others using the framework:
35
+
36
+ [Join the Tailwind CSS Discord Server](https://discord.gg/7NF8GNe)
37
+
38
+ ## Contributing
39
+
40
+ If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/next/.github/CONTRIBUTING.md) **before submitting a pull request**.
@@ -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,8 +1,11 @@
1
- import postcss from 'postcss';
1
+ import { PluginCreator } from 'postcss';
2
2
 
3
3
  type PluginOptions = {
4
4
  base?: string;
5
+ optimize?: boolean | {
6
+ minify?: boolean;
7
+ };
5
8
  };
6
- declare const _default: postcss.PluginCreator<PluginOptions>;
9
+ declare const _default: PluginCreator<PluginOptions>;
7
10
 
8
11
  export = _default;
package/dist/index.js CHANGED
@@ -1,63 +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(); } }// src/index.ts
2
- var _oxide = require('@tailwindcss/oxide');
3
- var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
4
- var _postcssimport = require('postcss-import'); var _postcssimport2 = _interopRequireDefault(_postcssimport);
5
- var _tailwindcss = require('tailwindcss');
6
- function tailwindcss(opts = {}) {
7
- let base = _nullishCoalesce(opts.base, () => ( process.cwd()));
8
- return {
9
- postcssPlugin: "tailwindcss-v4",
10
- plugins: [
11
- // We need to run `postcss-import` first to handle `@import` rules.
12
- _postcssimport2.default.call(void 0, ),
13
- function(root, result) {
14
- let hasApply = false;
15
- let hasTailwind = false;
16
- root.walkAtRules((rule) => {
17
- if (rule.name === "apply") {
18
- hasApply = true;
19
- } else if (rule.name === "tailwind") {
20
- hasApply = true;
21
- hasTailwind = true;
22
- return false;
23
- }
24
- });
25
- if (!hasTailwind && !hasApply)
26
- return;
27
- function replaceCss(css) {
28
- root.removeAll();
29
- root.append(_postcss2.default.parse(_tailwindcss.optimizeCss.call(void 0, css), result.opts));
30
- }
31
- if (!hasTailwind) {
32
- replaceCss(_tailwindcss.compile.call(void 0, root.toString(), []));
33
- return;
34
- }
35
- let { candidates, files, globs } = _oxide.scanDir.call(void 0, { base, globs: true });
36
- for (let file of files) {
37
- result.messages.push({
38
- type: "dependency",
39
- plugin: "tailwindcss-v4",
40
- file,
41
- parent: result.opts.from
42
- });
43
- }
44
- for (let { base: base2, glob } of globs) {
45
- result.messages.push({
46
- type: "dir-dependency",
47
- plugin: "tailwindcss-v4",
48
- dir: base2,
49
- glob,
50
- parent: result.opts.from
51
- });
52
- }
53
- replaceCss(_tailwindcss.compile.call(void 0, root.toString(), candidates));
54
- }
55
- ]
56
- };
57
- }
58
- var src_default = Object.assign(tailwindcss, { postcss: true });
59
-
60
-
61
- exports.default = src_default;
62
-
63
- 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=(n,i)=>(i=Symbol[n])?i:Symbol.for("Symbol."+n),U=n=>{throw TypeError(n)};var ie=(n,i,r,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of ee(i))!se.call(n,s)&&s!==r&&_(n,s,{get:()=>i[s],enumerable:!(e=Z(i,s))||e.enumerable});return n};var h=(n,i,r)=>(r=n!=null?V(te(n)):{},ie(i||!n||!n.__esModule?_(r,"default",{value:n,enumerable:!0}):r,n));var D=(n,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)}}),n.push([r,e,i])}else r&&n.push([r]);return i},z=(n,i,r)=>{var e=typeof SuppressedError=="function"?SuppressedError:function(o,l,u,p){return p=Error(u),p.name="SuppressedError",p.error=o,p.suppressed=l,p},s=o=>i=r?new e(o,i,"An error was suppressed during disposal"):(r=!0,o),t=o=>{for(;o=n.pop();)try{var l=o[1]&&o[1].call(o[2]);if(o[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 ne=40;function M(n,i=[]){for(let r=5;r<n.length;r++){let e=n.charCodeAt(r);if(e===re||e===ne){let s=n.slice(0,r).trim(),t=n.slice(r).trim();return x(s,t,i)}}return x(n.trim(),"",i)}var oe=64;function le(n,i=[]){return{kind:"rule",selector:n,nodes:i}}function x(n,i="",r=[]){return{kind:"at-rule",name:n,params:i,nodes:r}}function R(n,i=[]){return n.charCodeAt(0)===oe?M(n,i):le(n,i)}function w(n,i,r=!1){return{kind:"declaration",property:n,value:i,important:r}}function b(n){return{kind:"comment",value:n}}function I(n){function i(e,s=0){let t="",o=" ".repeat(s);if(e.kind==="declaration")t+=`${o}${e.property}: ${e.value}${e.important?" !important":""};
2
+ `;else if(e.kind==="rule"){t+=`${o}${e.selector} {
3
+ `;for(let l of e.nodes)t+=i(l,s+1);t+=`${o}}
4
+ `}else if(e.kind==="at-rule"){if(e.nodes.length===0)return`${o}${e.name} ${e.params};
5
+ `;t+=`${o}${e.name}${e.params?` ${e.params} `:" "}{
6
+ `;for(let l of e.nodes)t+=i(l,s+1);t+=`${o}}
7
+ `}else if(e.kind==="comment")t+=`${o}/*${e.value}*/
8
+ `;else if(e.kind==="context"||e.kind==="at-root")return"";return t}let r="";for(let e of n){let s=i(e);s!==""&&(r+=s)}return r}var C=h(require("postcss"));var ae=33;function W(n,i){let r=C.default.root();r.source=i;function e(s,t){if(s.kind==="declaration"){let o=C.default.decl({prop:s.property,value:s.value??"",important:s.important});o.source=i,t.append(o)}else if(s.kind==="rule"){let o=C.default.rule({selector:s.selector});o.source=i,o.raws.semicolon=!0,t.append(o);for(let l of s.nodes)e(l,o)}else if(s.kind==="at-rule"){let o=C.default.atRule({name:s.name.slice(1),params:s.params});o.source=i,o.raws.semicolon=!0,t.append(o);for(let l of s.nodes)e(l,o)}else if(s.kind==="comment"){let o=C.default.comment({text:s.value});o.raws.left="",o.raws.right="",o.source=i,t.append(o)}else s.kind==="at-root"||s.kind}for(let s of n)e(s,r);return r}function G(n){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(o=>i(o,t.nodes)),s.push(t)}else if(e.type==="atrule"){let t=x(`@${e.name}`,e.params);e.each(o=>i(o,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 n.each(e=>i(e,r)),r}var v=require("@tailwindcss/node"),y=h(require("path")),E="'",T='"';function O(){let n=new WeakSet;function i(r){let e=r.root().source?.input.file;if(!e)return;let s=r.source?.input.file;if(!s||n.has(r))return;let t=r.params[0],o=t[0]===T&&t[t.length-1]===T?T:t[0]===E&&t[t.length-1]===E?E:null;if(!o)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=o+u+A+o,n.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(n,i){let r=`${n}:${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(n={}){let i=n.base??process.cwd(),r=n.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 o=s.opts.from??"";a&&t.start(`[@tailwindcss/postcss] ${(0,d.relative)(i,o)}`);{a&&t.start("Quick bail check");let f=!0;if(e.walkAtRules(c=>{if(c.name==="import"||c.name==="reference"||c.name==="theme"||c.name==="variant"||c.name==="config"||c.name==="plugin"||c.name==="apply")return f=!1,!1}),f)return;a&&t.end("Quick bail check")}let l=ce(o,n);let u=d.default.dirname(d.default.resolve(o));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(o);for(let c of f){let S=F.default.statSync(c,{throwIfNoEntry:!1})?.mtimeMs??null;if(S===null){c===o&&(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,o)}`)}catch(X){var Y=X,J=!0}finally{z(L,Y,J)}}}]}}function ue(n,{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(n))).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==="reference"||c.name==="theme"||c.name==="variant"||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,33 +1,47 @@
1
1
  {
2
2
  "name": "@tailwindcss/postcss",
3
- "version": "0.0.0-development.5",
3
+ "version": "0.0.0-insiders.0589d7d",
4
4
  "description": "PostCSS plugin for Tailwind CSS, a utility-first CSS framework for rapidly building custom user interfaces",
5
5
  "license": "MIT",
6
- "repository": "https://github.com/tailwindlabs/tailwindcss.git",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/tailwindlabs/tailwindcss.git",
9
+ "directory": "packages/@tailwindcss-postcss"
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.ts",
23
+ "import": "./dist/index.mjs",
15
24
  "require": "./dist/index.js"
16
25
  }
17
26
  },
18
27
  "dependencies": {
19
- "postcss-import": "^16.0.0",
20
- "@tailwindcss/oxide": "^0.0.0-development.5",
21
- "tailwindcss": "^0.0.0-development.5"
28
+ "@alloc/quick-lru": "^5.2.0",
29
+ "lightningcss": "^1.29.1",
30
+ "postcss": "^8.4.41",
31
+ "@tailwindcss/node": "0.0.0-insiders.0589d7d",
32
+ "tailwindcss": "0.0.0-insiders.0589d7d",
33
+ "@tailwindcss/oxide": "0.0.0-insiders.0589d7d"
22
34
  },
23
35
  "devDependencies": {
24
- "@types/node": "^20.11.17",
25
- "@types/postcss-import": "^14.0.3",
26
- "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"
27
41
  },
28
42
  "scripts": {
29
43
  "lint": "tsc --noEmit",
30
- "build": "tsup-node ./src/index.ts --format cjs --dts --cjsInterop --splitting",
44
+ "build": "tsup-node",
31
45
  "dev": "pnpm run build -- --watch"
32
46
  }
33
47
  }