prettier-plugin-tailwind-styled-components 2.0.0 → 2.0.2
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.mjs +2 -2
- package/package.json +16 -15
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,6 @@ import {fileURLToPath} from 'url'
|
|
|
4
4
|
const require=__global__createRequire__(import.meta.url)
|
|
5
5
|
const __filename=fileURLToPath(import.meta.url)
|
|
6
6
|
const __dirname=__global__dirname__(__filename)
|
|
7
|
-
var
|
|
7
|
+
var w=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});import*as O from"prettier/plugins/acorn";import*as f from"prettier/plugins/babel";import*as k from"prettier/plugins/flow";import*as S from"prettier/plugins/meriyah";import*as T from"prettier/plugins/typescript";var q=(r,t)=>{let s=(e,i,l,p,a={})=>{if(typeof t=="function"){if(t(e,i,l,p,a)===!1)return}else if(e.type in t&&t[e.type](e,i,l,p,a)===!1)return;let n=Object.keys(e);for(let c=0;c<n.length;c++){let o=e[n[c]];if(Array.isArray(o))for(let u=0;u<o.length;u++)o[u]!==null&&s(o[u],e,n[c],u,{...a});else typeof(o==null?void 0:o.type)=="string"&&s(o,e,n[c],c,{...a})}};s(r)},A=r=>(r==null?void 0:r.type)==="TemplateLiteral"||(r==null?void 0:r.type)==="Template"&&typeof r.value=="string",m=r=>r.replace(/\r\n\t/g," ").replace(/\s+/g," ").trim(),B=(r,t)=>{var s,e;return(r.tag.type==="MemberExpression"&&((s=r.tag.object)==null?void 0:s.type)==="Identifier"&&r.tag.object.name===t||r.tag.type==="CallExpression"&&((e=r.tag.callee)==null?void 0:e.type)==="Identifier"&&r.tag.callee.name===t)&&A(r.quasi)},g=r=>r.endOfLine==="lf"?`
|
|
8
8
|
`:r.endOfLine==="cr"?"\r":r.endOfLine==="crlf"?`\r
|
|
9
|
-
`:"",
|
|
9
|
+
`:"",P=r=>r.useTabs?" ":" ".repeat(r.tabWidth),$=(r,t)=>{let s=g(t),e=P(t);return r.startsWith(s)?r:`${s}${e}${r}`},d=(r,t,s)=>{let e=g(t);if(!r.endsWith(e)){if(s){let i=P(t);return`${r}${e}${i}`}return`${r}${e}`}return r},h=(r,t,s)=>{let e=g(t),i=P(t),l=r.split(" ");return s.splice(0,l.length).join(`${e}${i}`)},j=r=>/[\S]/g.exec(r),C=(r,t,s,e)=>{if(j(r)){let i=m(r);return i=h(i,t,s),i=$(i,t),i=d(i,t,e),i}if(e){let i=m(r);return i=d(i,t,e),i}return r},x=(r,t,s)=>{if(Array.isArray(r.quasis))for(let e=0;e<r.quasis.length;e++){let i=r.quasis[e];i.value&&(i.value.raw=C(i.value.raw,t,s.rawClassList,!i.tail),i.value.cooked=C(i.value.cooked,t,s.cookedClassList,!i.tail))}},z=r=>{if(Array.isArray(r.quasis)){let t=r.quasis.map(a=>{var n;return((n=a.value)==null?void 0:n.raw)||""}).join(""),s=r.quasis.map(a=>{var n;return((n=a.value)==null?void 0:n.cooked)||""}).join(""),i=m(t).split(" "),p=m(s).split(" ");return{rawClassList:i,cookedClassList:p}}return{rawClassList:[],cookedClassList:[]}},_=(r,t)=>e=>{if(!(!e.quasi||!e.tag)&&B(e,t)){let i=z(e.quasi);x(e.quasi,r,i)}},V=(r,t)=>{var l,p;if(!Array.isArray(r.body))return;let s=t.tailwindStyledComponentsImport||"tailwind-styled-components",i=(((l=r.body.find(a=>{var n;return a.type==="ImportDeclaration"&&((n=a.source)==null?void 0:n.value)===s}))==null?void 0:l.specifiers)||[]).find(a=>{var n;return a.type==="ImportDefaultSpecifier"||a.type==="ImportSpecifier"&&((n=a.imported)==null?void 0:n.name)==="default"});return(p=i==null?void 0:i.local)==null?void 0:p.name},I=async(r,t)=>{let s=V(r,t);s&&q(r,_(t,s))},b=r=>r==null?void 0:r.toLocaleLowerCase().replaceAll("\\","/"),L=(r,t)=>{var n;if(!t.plugins)return r;let s={...r},e="prettier-plugin-tailwindcss",i=null;try{i=w.resolve(e)}catch{return s}let l=b(i),p=`file:///${l}`,a=t.plugins.find(c=>{let o=b(c.name);return o===e||o===l||o===p});return a&&Object.assign(s,(n=a.parsers)==null?void 0:n.typescript),s},y=async r=>({...r,preprocess(t,s){let e=L(r,s);return e.preprocess?e.preprocess(t,s):t},async parse(t,s){let i=await L(r,s).parse(t,s);return await I(i,s),i}}),F={babel:y(f.parsers.babel),"babel-flow":y(f.parsers["babel-flow"]),flow:y(k.parsers.flow),typescript:y(T.parsers.typescript),"babel-ts":y(f.parsers["babel-ts"]),acorn:y(O.parsers.acorn),meriyah:y(S.parsers.meriyah),__js_expression:y(f.parsers.__js_expression)},v={},R={tailwindStyledComponentsImport:{type:"string",default:"tailwind-styled-components",category:"Tailwind Styled Components",description:"Tailwind styled components import"}};export{y as createParser,R as options,F as parsers,v as printers};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "prettier-plugin-tailwind-styled-components",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "A Prettier plugin for sorting and formatting Tailwind CSS classes when using Tailwind Styled-Components.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.mjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"tailwind-styled-components"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"_pre": "rimraf dist
|
|
25
|
+
"_pre": "rimraf dist",
|
|
26
26
|
"_esbuild": "node build.mjs",
|
|
27
27
|
"prebuild": "yarn _pre",
|
|
28
28
|
"build": "yarn _esbuild --minify",
|
|
@@ -33,29 +33,30 @@
|
|
|
33
33
|
"format": "prettier \"src/**/*.js\" \"tests/test.js\" --write --print-width 100 --single-quote --no-semi --plugin-search-dir ./tests"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"eslint": "^9.38.0",
|
|
36
|
+
"@types/node": "^25.2.0",
|
|
37
|
+
"esbuild": "^0.27.2",
|
|
38
|
+
"eslint": "^9.39.2",
|
|
40
39
|
"eslint-config-prettier": "^10.1.8",
|
|
41
|
-
"prettier": "^3.
|
|
42
|
-
"prettier-plugin-tailwindcss": "0.7.
|
|
43
|
-
"react": "^19.2.
|
|
44
|
-
"react-dom": "^19.2.
|
|
45
|
-
"rimraf": "^6.
|
|
46
|
-
"styled-components": "^6.
|
|
40
|
+
"prettier": "^3.8.1",
|
|
41
|
+
"prettier-plugin-tailwindcss": "0.7.2",
|
|
42
|
+
"react": "^19.2.4",
|
|
43
|
+
"react-dom": "^19.2.4",
|
|
44
|
+
"rimraf": "^6.1.2",
|
|
45
|
+
"styled-components": "^6.3.8",
|
|
47
46
|
"tailwind-styled-components": "^2.2.0",
|
|
48
|
-
"tailwindcss": "^4.1.
|
|
47
|
+
"tailwindcss": "^4.1.18",
|
|
49
48
|
"ts-node": "^10.9.2",
|
|
50
49
|
"typescript": "^5.9.3",
|
|
51
|
-
"vitest": "^
|
|
50
|
+
"vitest": "^4.0.18"
|
|
52
51
|
},
|
|
53
52
|
"peerDependencies": {
|
|
54
53
|
"prettier": "^3.0",
|
|
55
54
|
"prettier-plugin-tailwindcss": "^0.7"
|
|
56
55
|
},
|
|
57
56
|
"optionalDependencies": {
|
|
58
|
-
"tailwind-styled-components": "^2.2.0"
|
|
57
|
+
"tailwind-styled-components": "^2.2.0",
|
|
58
|
+
"react": "^19.2.0",
|
|
59
|
+
"react-dom": "^19.2.0"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
|
61
62
|
"node": ">=20.19"
|