@tailwindcss/postcss 4.0.0-alpha.8 → 4.0.0-beta.1
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.d.mts +11 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -3
- package/dist/index.mjs +1 -0
- package/package.json +14 -9
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
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:
|
9
|
+
declare const _default: PluginCreator<PluginOptions>;
|
10
10
|
|
11
11
|
export = _default;
|
package/dist/index.js
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty
|
2
|
-
|
3
|
-
module.exports = exports.default;
|
1
|
+
"use strict";var A=Object.create;var U=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var k=(s,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of M(n))!N.call(s,i)&&i!==t&&U(s,i,{get:()=>n[i],enumerable:!(o=T(n,i))||o.enumerable});return s};var d=(s,n,t)=>(t=s!=null?A(W(s)):{},k(n||!s||!s.__esModule?U(t,"default",{value:s,enumerable:!0}):t,s));var x=d(require("@alloc/quick-lru")),r=require("@tailwindcss/node"),v=require("@tailwindcss/node/require-cache"),D=require("@tailwindcss/oxide"),h=require("lightningcss"),z=d(require("fs")),B=d(require("path")),G=d(require("postcss"));var S=require("@tailwindcss/node"),g=d(require("path")),w="'",b='"';function E(){let s=new WeakSet;function n(t){let o=t.root().source?.input.file;if(!o)return;let i=t.source?.input.file;if(!i||s.has(t))return;let a=t.params[0],e=a[0]===b&&a[a.length-1]===b?b:a[0]===w&&a[a.length-1]===w?w:null;if(!e)return;let m=t.params.slice(1,-1),f="";if(m.startsWith("!")&&(m=m.slice(1),f="!"),!m.startsWith("./")&&!m.startsWith("../"))return;let y=g.default.posix.join((0,S.normalizePath)(g.default.dirname(i)),m),u=g.default.posix.dirname((0,S.normalizePath)(o)),p=g.default.posix.relative(u,y);p.startsWith(".")||(p="./"+p),t.params=e+f+p+e,s.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:n,plugin:n,config:n}}}var C=new x.default({maxSize:50});function F(s,n){let t=`${s}:${n.base??""}:${n.optimize??""}`;if(C.has(t))return C.get(t);let o={mtimes:new Map,compiler:null,scanner:null,css:"",optimizedCss:"",fullRebuildPaths:[]};return C.set(t,o),o}function L(s={}){let n=s.base??process.cwd(),t=s.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[E(),{postcssPlugin:"tailwindcss",async OnceExit(o,{result:i}){r.env.DEBUG&&console.time("[@tailwindcss/postcss] Total time in @tailwindcss/postcss");let a=i.opts.from??"",e=F(a,s),m=B.default.dirname(B.default.resolve(a));async function f(){r.env.DEBUG&&console.time("[@tailwindcss/postcss] Setup compiler"),(0,v.clearRequireCache)(e.fullRebuildPaths),e.fullRebuildPaths=[];let c=await(0,r.compile)(o.toString(),{base:m,onDependency:l=>{e.fullRebuildPaths.push(l)}});return r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Setup compiler"),c}let y=e.compiler===null;e.compiler??=await f();let u="incremental";{for(let l of e.fullRebuildPaths)i.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:l,parent:i.opts.from});let c=i.messages.flatMap(l=>l.type!=="dependency"?[]:l.file);c.push(a);for(let l of c){let P=z.default.statSync(l,{throwIfNoEntry:!1})?.mtimeMs??null;if(P===null){l===a&&(u="full");continue}e.mtimes.get(l)!==P&&(u="full",e.mtimes.set(l,P))}}let p="";if(u==="full"&&!y&&(e.compiler=await f()),e.scanner===null||u==="full"){let c=(e.compiler.root==="none"?[]:e.compiler.root===null?[{base:n,pattern:"**/*"}]:[e.compiler.root]).concat(e.compiler.globs);e.scanner=new D.Scanner({sources:c})}r.env.DEBUG&&console.time("[@tailwindcss/postcss] Scan for candidates");let R=e.scanner.scan();r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Scan for candidates");for(let c of e.scanner.files)i.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:c,parent:i.opts.from});for(let{base:c,pattern:l}of e.scanner.globs)l==="*"&&n===c||(l===""?i.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:c,parent:i.opts.from}):i.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:c,glob:l,parent:i.opts.from}));r.env.DEBUG&&console.time("[@tailwindcss/postcss] Build CSS"),p=e.compiler.build(R),r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Build CSS"),p!==e.css&&t&&(r.env.DEBUG&&console.time("[@tailwindcss/postcss] Optimize CSS"),e.optimizedCss=j(p,{minify:typeof t=="object"?t.minify:!0}),r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Optimize CSS")),e.css=p,r.env.DEBUG&&console.time("[@tailwindcss/postcss] Update PostCSS AST"),o.removeAll(),o.append(G.default.parse(t?e.optimizedCss:e.css,i.opts)),r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Update PostCSS AST"),r.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Total time in @tailwindcss/postcss")}}]}}function j(s,{file:n="input.css",minify:t=!1}={}){function o(i){return(0,h.transform)({filename:n,code:i,minify:t,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:h.Features.Nesting,exclude:h.Features.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code}return o(o(Buffer.from(s))).toString()}var O=Object.assign(L,{postcss:!0});module.exports=O;
|
package/dist/index.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
import U from"@alloc/quick-lru";import{compile as x,env as l}from"@tailwindcss/node";import{clearRequireCache as v}from"@tailwindcss/node/require-cache";import{Scanner as D}from"@tailwindcss/oxide";import{Features as E,transform as z}from"lightningcss";import G from"node:fs";import C from"node:path";import O from"postcss";import{normalizePath as S}from"@tailwindcss/node";import d from"node:path";var y="'",P='"';function w(){let a=new WeakSet;function r(t){let n=t.root().source?.input.file;if(!n)return;let s=t.source?.input.file;if(!s||a.has(t))return;let c=t.params[0],e=c[0]===P&&c[c.length-1]===P?P:c[0]===y&&c[c.length-1]===y?y:null;if(!e)return;let m=t.params.slice(1,-1),f="";if(m.startsWith("!")&&(m=m.slice(1),f="!"),!m.startsWith("./")&&!m.startsWith("../"))return;let g=d.posix.join(S(d.dirname(s)),m),u=d.posix.dirname(S(n)),p=d.posix.relative(u,g);p.startsWith(".")||(p="./"+p),t.params=e+f+p+e,a.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:r,plugin:r,config:r}}}var b=new U({maxSize:50});function R(a,r){let t=`${a}:${r.base??""}:${r.optimize??""}`;if(b.has(t))return b.get(t);let n={mtimes:new Map,compiler:null,scanner:null,css:"",optimizedCss:"",fullRebuildPaths:[]};return b.set(t,n),n}function A(a={}){let r=a.base??process.cwd(),t=a.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[w(),{postcssPlugin:"tailwindcss",async OnceExit(n,{result:s}){l.DEBUG&&console.time("[@tailwindcss/postcss] Total time in @tailwindcss/postcss");let c=s.opts.from??"",e=R(c,a),m=C.dirname(C.resolve(c));async function f(){l.DEBUG&&console.time("[@tailwindcss/postcss] Setup compiler"),v(e.fullRebuildPaths),e.fullRebuildPaths=[];let o=await x(n.toString(),{base:m,onDependency:i=>{e.fullRebuildPaths.push(i)}});return l.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Setup compiler"),o}let g=e.compiler===null;e.compiler??=await f();let u="incremental";{for(let i of e.fullRebuildPaths)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:i,parent:s.opts.from});let o=s.messages.flatMap(i=>i.type!=="dependency"?[]:i.file);o.push(c);for(let i of o){let h=G.statSync(i,{throwIfNoEntry:!1})?.mtimeMs??null;if(h===null){i===c&&(u="full");continue}e.mtimes.get(i)!==h&&(u="full",e.mtimes.set(i,h))}}let p="";if(u==="full"&&!g&&(e.compiler=await f()),e.scanner===null||u==="full"){let o=(e.compiler.root==="none"?[]:e.compiler.root===null?[{base:r,pattern:"**/*"}]:[e.compiler.root]).concat(e.compiler.globs);e.scanner=new D({sources:o})}l.DEBUG&&console.time("[@tailwindcss/postcss] Scan for candidates");let B=e.scanner.scan();l.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Scan for candidates");for(let o of e.scanner.files)s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:o,parent:s.opts.from});for(let{base:o,pattern:i}of e.scanner.globs)i==="*"&&r===o||(i===""?s.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:o,parent:s.opts.from}):s.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:o,glob:i,parent:s.opts.from}));l.DEBUG&&console.time("[@tailwindcss/postcss] Build CSS"),p=e.compiler.build(B),l.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Build CSS"),p!==e.css&&t&&(l.DEBUG&&console.time("[@tailwindcss/postcss] Optimize CSS"),e.optimizedCss=T(p,{minify:typeof t=="object"?t.minify:!0}),l.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Optimize CSS")),e.css=p,l.DEBUG&&console.time("[@tailwindcss/postcss] Update PostCSS AST"),n.removeAll(),n.append(O.parse(t?e.optimizedCss:e.css,s.opts)),l.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Update PostCSS AST"),l.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Total time in @tailwindcss/postcss")}}]}}function T(a,{file:r="input.css",minify:t=!1}={}){function n(s){return z({filename:r,code:s,minify:t,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:E.Nesting,exclude:E.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code}return n(n(Buffer.from(a))).toString()}var H=Object.assign(A,{postcss:!0});export{H as default};
|
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tailwindcss/postcss",
|
3
|
-
"version": "4.0.0-
|
3
|
+
"version": "4.0.0-beta.1",
|
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": "
|
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,22 +20,27 @@
|
|
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
|
-
"
|
28
|
-
"
|
29
|
-
"
|
28
|
+
"@alloc/quick-lru": "^5.2.0",
|
29
|
+
"lightningcss": "^1.26.0",
|
30
|
+
"postcss": "^8.4.41",
|
31
|
+
"@tailwindcss/node": "4.0.0-beta.1",
|
32
|
+
"@tailwindcss/oxide": "4.0.0-beta.1",
|
33
|
+
"tailwindcss": "4.0.0-beta.1"
|
30
34
|
},
|
31
35
|
"devDependencies": {
|
32
|
-
"@types/node": "^20.
|
33
|
-
"@types/postcss-import": "
|
34
|
-
"postcss": "
|
36
|
+
"@types/node": "^20.14.8",
|
37
|
+
"@types/postcss-import": "14.0.3",
|
38
|
+
"postcss-import": "^16.1.0",
|
39
|
+
"internal-example-plugin": "0.0.0"
|
35
40
|
},
|
36
41
|
"scripts": {
|
37
42
|
"lint": "tsc --noEmit",
|
38
|
-
"build": "tsup-node
|
43
|
+
"build": "tsup-node",
|
39
44
|
"dev": "pnpm run build -- --watch"
|
40
45
|
}
|
41
46
|
}
|