@tailwindcss/postcss 4.0.0-alpha.3 → 4.0.0-alpha.30
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,i,t,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of M(i))!N.call(s,n)&&n!==t&&B(s,n,{get:()=>i[n],enumerable:!(r=T(i,n))||r.enumerable});return s};var d=(s,i,t)=>(t=s!=null?A(W(s)):{},k(i||!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 i(t){let r=t.root().source?.input.file;if(!r)return;let n=t.source?.input.file;if(!n||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 p=t.params.slice(1,-1),f="";if(p.startsWith("!")&&(p=p.slice(1),f="!"),!p.startsWith("./")&&!p.startsWith("../"))return;let P=g.default.posix.join((0,b.normalizePath)(g.default.dirname(n)),p),u=g.default.posix.dirname((0,b.normalizePath)(r)),a=g.default.posix.relative(u,P);a.startsWith(".")||(a="./"+a),t.params=e+f+a+e,s.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:i,plugin:i,config:i}}}var C=new U.default({maxSize:50});function F(s,i){let t=`${s}:${i.base??""}:${i.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 i=s.base??process.cwd(),t=s.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[E(),{postcssPlugin:"tailwindcss",async OnceExit(r,{result:n}){o.env.DEBUG&&console.time("[@tailwindcss/postcss] Total time in @tailwindcss/postcss");let c=n.opts.from??"",e=F(c,s),p=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 m=await(0,o.compile)(r.toString(),{base:p,onDependency:l=>{e.fullRebuildPaths.push(l)}});return o.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Setup compiler"),m}let P=e.compiler===null;e.compiler??=await f();let u="incremental";{for(let l of e.fullRebuildPaths)n.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:l,parent:n.opts.from});let m=n.messages.flatMap(l=>l.type!=="dependency"?[]:l.file);m.push(c);for(let l of m){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 a="";u==="full"&&!P&&(e.compiler=await f()),(e.scanner===null||u==="full")&&(e.scanner=new D.Scanner({detectSources:{base:i},sources:e.compiler.globs})),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 m of e.scanner.files)n.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:m,parent:n.opts.from});for(let{base:m,pattern:l}of e.scanner.globs)n.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:m,glob:l,parent:n.opts.from});o.env.DEBUG&&console.time("[@tailwindcss/postcss] Build CSS"),a=e.compiler.build(R),o.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Build CSS"),a!==e.css&&t&&(o.env.DEBUG&&console.time("[@tailwindcss/postcss] Optimize CSS"),e.optimizedCss=j(a,{minify:typeof t=="object"?t.minify:!0}),o.env.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Optimize CSS")),e.css=a,o.env.DEBUG&&console.time("[@tailwindcss/postcss] Update PostCSS AST"),r.removeAll(),r.append(z.default.parse(t?e.optimizedCss:e.css,n.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:i="input.css",minify:t=!1}={}){return(0,h.transform)({filename:i,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="'",w='"';function y(){let l=new WeakSet;function r(t){let c=t.root().source?.input.file;if(!c)return;let i=t.source?.input.file;if(!i||l.has(t))return;let o=t.params[0],e=o[0]===w&&o[o.length-1]===w?w:o[0]===P&&o[o.length-1]===P?P:null;if(!e)return;let p=t.params.slice(1,-1),f="";if(p.startsWith("!")&&(p=p.slice(1),f="!"),!p.startsWith("./")&&!p.startsWith("../"))return;let g=d.posix.join(b(d.dirname(i)),p),u=d.posix.dirname(b(c)),a=d.posix.relative(u,g);a.startsWith(".")||(a="./"+a),t.params=e+f+a+e,l.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:r,plugin:r,config:r}}}var S=new U({maxSize:50});function R(l,r){let t=`${l}:${r.base??""}:${r.optimize??""}`;if(S.has(t))return S.get(t);let c={mtimes:new Map,compiler:null,scanner:null,css:"",optimizedCss:"",fullRebuildPaths:[]};return S.set(t,c),c}function A(l={}){let r=l.base??process.cwd(),t=l.optimize??process.env.NODE_ENV==="production";return{postcssPlugin:"@tailwindcss/postcss",plugins:[y(),{postcssPlugin:"tailwindcss",async OnceExit(c,{result:i}){n.DEBUG&&console.time("[@tailwindcss/postcss] Total time in @tailwindcss/postcss");let o=i.opts.from??"",e=R(o,l),p=C.dirname(C.resolve(o));async function f(){n.DEBUG&&console.time("[@tailwindcss/postcss] Setup compiler"),v(e.fullRebuildPaths),e.fullRebuildPaths=[];let m=await x(c.toString(),{base:p,onDependency:s=>{e.fullRebuildPaths.push(s)}});return n.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Setup compiler"),m}let g=e.compiler===null;e.compiler??=await f();let u="incremental";{for(let s of e.fullRebuildPaths)i.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:s,parent:i.opts.from});let m=i.messages.flatMap(s=>s.type!=="dependency"?[]:s.file);m.push(o);for(let s of m){let h=G.statSync(s,{throwIfNoEntry:!1})?.mtimeMs??null;if(h===null){s===o&&(u="full");continue}e.mtimes.get(s)!==h&&(u="full",e.mtimes.set(s,h))}}let a="";u==="full"&&!g&&(e.compiler=await f()),(e.scanner===null||u==="full")&&(e.scanner=new D({detectSources:{base:r},sources:e.compiler.globs})),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 m of e.scanner.files)i.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:m,parent:i.opts.from});for(let{base:m,pattern:s}of e.scanner.globs)i.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:m,glob:s,parent:i.opts.from});n.DEBUG&&console.time("[@tailwindcss/postcss] Build CSS"),a=e.compiler.build(B),n.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Build CSS"),a!==e.css&&t&&(n.DEBUG&&console.time("[@tailwindcss/postcss] Optimize CSS"),e.optimizedCss=T(a,{minify:typeof t=="object"?t.minify:!0}),n.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Optimize CSS")),e.css=a,n.DEBUG&&console.time("[@tailwindcss/postcss] Update PostCSS AST"),c.removeAll(),c.append(O.parse(t?e.optimizedCss:e.css,i.opts)),n.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Update PostCSS AST"),n.DEBUG&&console.timeEnd("[@tailwindcss/postcss] Total time in @tailwindcss/postcss")}}]}}function T(l,{file:r="input.css",minify:t=!1}={}){return z({filename:r,code:Buffer.from(l),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.30",
|
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.30",
|
32
|
+
"@tailwindcss/oxide": "4.0.0-alpha.30",
|
33
|
+
"tailwindcss": "4.0.0-alpha.30"
|
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
|
}
|