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