@tailwindcss/postcss 4.0.0-alpha.2 → 4.0.0-alpha.21
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 +21 -8
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 B=Object.create;var C=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var L=(e,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of F(i))!q.call(e,n)&&n!==t&&C(e,n,{get:()=>i[n],enumerable:!(o=D(i,n))||o.enumerable});return e};var d=(e,i,t)=>(t=e!=null?B(I(e)):{},L(i||!e||!e.__esModule?C(t,"default",{value:e,enumerable:!0}):t,e));var W=require("@tailwindcss/node"),O=require("@tailwindcss/node/require-cache"),M=require("@tailwindcss/oxide"),V=d(require("fs"));var g=d(require("path"),1);function _(e,i){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var t=e.length;if(t<=1)return e;var o="";if(t>4&&e[3]==="\\"){var n=e[2];(n==="?"||n===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),o="//")}var r=e.split(/[/\\]+/);return i!==!1&&r[r.length-1]===""&&r.pop(),o+r.join("/")}function S(e){let i=_(e);return e.startsWith("\\\\")&&i.startsWith("/")&&!i.startsWith("//")?`/${i}`:i}var v="'",x='"';function z(){let e=new WeakSet;function i(t){let o=t.root().source?.input.file;if(!o)return;let n=t.source?.input.file;if(!n||e.has(t))return;let r=t.params[0],p=r[0]===x&&r[r.length-1]===x?x:r[0]===v&&r[r.length-1]===v?v:null;if(!p)return;let l=t.params.slice(1,-1),f="";if(l.startsWith("!")&&(l=l.slice(1),f="!"),!l.startsWith("./")&&!l.startsWith("../"))return;let s=g.default.posix.join(S(g.default.dirname(n)),l),y=g.default.posix.dirname(S(o)),u=g.default.posix.relative(y,s);u.startsWith(".")||(u="./"+u),t.params=p+f+u+p,e.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:i,plugin:i,config:i}}}var h=require("lightningcss"),R=d(require("path")),E=d(require("postcss")),j=d(require("postcss-import")),T=class extends Map{constructor(t){super();this.factory=t}get(t){let o=super.get(t);return o===void 0&&(o=this.factory(t,this),this.set(t,o)),o}};function $(e={}){let i=e.base??process.cwd(),t=e.optimize??process.env.NODE_ENV==="production",o=new T(()=>({mtimes:new Map,compiler:null,css:"",optimizedCss:"",fullRebuildPaths:[]})),n,r;return{postcssPlugin:"@tailwindcss/postcss",plugins:[(0,j.default)(),z(),{postcssPlugin:"tailwindcss",Once(){n=!1,r=!1},AtRule(p){p.name==="apply"?n=!0:p.name==="tailwind"&&(n=!0,r=!0)},async OnceExit(p,{result:l}){let f=l.opts.from??"",s=o.get(f),y=R.default.dirname(R.default.resolve(f));async function u(){return(0,O.clearRequireCache)(s.fullRebuildPaths),s.fullRebuildPaths=[],(0,W.compile)(p.toString(),{base:y,onDependency:c=>{s.fullRebuildPaths.push(c)}})}s.compiler??=await u();let b="incremental";{for(let a of s.fullRebuildPaths)l.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:a,parent:l.opts.from});let c=l.messages.flatMap(a=>a.type!=="dependency"?[]:a.file);c.push(f);for(let a of c){let P=V.default.statSync(a,{throwIfNoEntry:!1})?.mtimeMs??null;if(P===null){a===f&&(b="full");continue}s.mtimes.get(a)!==P&&(b="full",s.mtimes.set(a,P))}}if(!r&&!n)return;let m="",w=new M.Scanner({detectSources:{base:i},sources:s.compiler.globs.map(c=>({base:y,pattern:c}))}),A=w.scan();for(let c of w.files)l.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:c,parent:l.opts.from});for(let{base:c,pattern:a}of w.globs)l.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:c,glob:a,parent:l.opts.from});b==="full"?(s.compiler=await u(),m=s.compiler.build(r?A:[])):b==="incremental"&&(m=s.compiler.build(A)),m!==s.css&&t&&(s.optimizedCss=k(m,{minify:typeof t=="object"?t.minify:!0})),s.css=m,p.removeAll(),p.append(E.default.parse(t?s.optimizedCss:s.css,l.opts))}}]}}function k(e,{file:i="input.css",minify:t=!1}={}){return(0,h.transform)({filename:i,code:Buffer.from(e),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 N=Object.assign($,{postcss:!0});module.exports=N;
|
package/dist/index.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
import{compile as z}from"@tailwindcss/node";import{clearRequireCache as W}from"@tailwindcss/node/require-cache";import{Scanner as O}from"@tailwindcss/oxide";import M from"fs";import h from"node:path";function S(e,r){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var t=e.length;if(t<=1)return e;var l="";if(t>4&&e[3]==="\\"){var a=e[2];(a==="?"||a===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),l="//")}var s=e.split(/[/\\]+/);return r!==!1&&s[s.length-1]===""&&s.pop(),l+s.join("/")}function R(e){let r=S(e);return e.startsWith("\\\\")&&r.startsWith("/")&&!r.startsWith("//")?`/${r}`:r}var P="'",w='"';function T(){let e=new WeakSet;function r(t){let l=t.root().source?.input.file;if(!l)return;let a=t.source?.input.file;if(!a||e.has(t))return;let s=t.params[0],p=s[0]===w&&s[s.length-1]===w?w:s[0]===P&&s[s.length-1]===P?P:null;if(!p)return;let n=t.params.slice(1,-1),u="";if(n.startsWith("!")&&(n=n.slice(1),u="!"),!n.startsWith("./")&&!n.startsWith("../"))return;let i=h.posix.join(R(h.dirname(a)),n),d=h.posix.dirname(R(l)),f=h.posix.relative(d,i);f.startsWith(".")||(f="./"+f),t.params=p+u+f+p,e.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:r,plugin:r,config:r}}}import{Features as A,transform as V}from"lightningcss";import C from"path";import E from"postcss";import j from"postcss-import";var v=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 N(e={}){let r=e.base??process.cwd(),t=e.optimize??process.env.NODE_ENV==="production",l=new v(()=>({mtimes:new Map,compiler:null,css:"",optimizedCss:"",fullRebuildPaths:[]})),a,s;return{postcssPlugin:"@tailwindcss/postcss",plugins:[j(),T(),{postcssPlugin:"tailwindcss",Once(){a=!1,s=!1},AtRule(p){p.name==="apply"?a=!0:p.name==="tailwind"&&(a=!0,s=!0)},async OnceExit(p,{result:n}){let u=n.opts.from??"",i=l.get(u),d=C.dirname(C.resolve(u));async function f(){return W(i.fullRebuildPaths),i.fullRebuildPaths=[],z(p.toString(),{base:d,onDependency:c=>{i.fullRebuildPaths.push(c)}})}i.compiler??=await f();let g="incremental";{for(let o of i.fullRebuildPaths)n.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:o,parent:n.opts.from});let c=n.messages.flatMap(o=>o.type!=="dependency"?[]:o.file);c.push(u);for(let o of c){let b=M.statSync(o,{throwIfNoEntry:!1})?.mtimeMs??null;if(b===null){o===u&&(g="full");continue}i.mtimes.get(o)!==b&&(g="full",i.mtimes.set(o,b))}}if(!s&&!a)return;let m="",y=new O({detectSources:{base:r},sources:i.compiler.globs.map(c=>({base:d,pattern:c}))}),x=y.scan();for(let c of y.files)n.messages.push({type:"dependency",plugin:"@tailwindcss/postcss",file:c,parent:n.opts.from});for(let{base:c,pattern:o}of y.globs)n.messages.push({type:"dir-dependency",plugin:"@tailwindcss/postcss",dir:c,glob:o,parent:n.opts.from});g==="full"?(i.compiler=await f(),m=i.compiler.build(s?x:[])):g==="incremental"&&(m=i.compiler.build(x)),m!==i.css&&t&&(i.optimizedCss=B(m,{minify:typeof t=="object"?t.minify:!0})),i.css=m,p.removeAll(),p.append(E.parse(t?i.optimizedCss:i.css,n.opts))}}]}}function B(e,{file:r="input.css",minify:t=!1}={}){return V({filename:r,code:Buffer.from(e),minify:t,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:A.Nesting,exclude:A.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code.toString()}var U=Object.assign(N,{postcss:!0});export{U 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.21",
|
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
|
-
"tailwindcss": "4.0.0-alpha.
|
28
|
+
"lightningcss": "^1.26.0",
|
29
|
+
"postcss-import": "^16.1.0",
|
30
|
+
"@tailwindcss/node": "4.0.0-alpha.21",
|
31
|
+
"@tailwindcss/oxide": "4.0.0-alpha.21",
|
32
|
+
"tailwindcss": "4.0.0-alpha.21"
|
22
33
|
},
|
23
34
|
"devDependencies": {
|
24
|
-
"@types/node": "^20.
|
35
|
+
"@types/node": "^20.14.8",
|
25
36
|
"@types/postcss-import": "^14.0.3",
|
26
|
-
"postcss": "8.4.
|
37
|
+
"postcss": "^8.4.41",
|
38
|
+
"internal-example-plugin": "0.0.0",
|
39
|
+
"internal-postcss-fix-relative-paths": "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
|
}
|