Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwind-variants

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-variants - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

8

dist/transformer.js

@@ -1,9 +0,9 @@

var v=["xs","sm","md","lg","xl","2xl"],a={tv:new RegExp(/tv\({[\s\S]*?}\)/g),tvContent:new RegExp(/\({[\s\S]*?}\)/g),comment:new RegExp(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm),blankLine:new RegExp(/^\s*$(?:\r\n?|\n)/gm)},n=t=>!!(!t||Array.isArray(t)&&t.length===0||typeof t=="string"&&t.length===0||typeof t=="object"&&Object.keys(t).length===0),p=t=>t.replace(a.comment,"$1").toString().replace(a.blankLine,"").toString().match(a.tv),d=content=>{let tvStrArray=p(content);if(!n(tvStrArray))return tvStrArray.map(item=>{let str=item.toString(),tv=str.match(a.tvContent).toString();return eval(tv.replaceAll("`",'"').replaceAll("'",'"').replaceAll(/\s{2,}/g," ").replaceAll(/(\r\n|\n|\r)/gm,"").trim())})},y=t=>{let{variants:s={}}=t;if(n(s))return;let e={};for(let[r,c]of Object.entries(s))if(!n(c)){e[r]={};for(let[o,l]of Object.entries(c)){if(n(l))continue;let m=l.split(" ");if(!n(m)){e[r][o]={};for(let u of v.values()){let f="";m.forEach(g=>{f+=`${u}:${g} `;}),e[r][o].original=l,e[r][o][u]=f.trimEnd();}}}}return e},i=t=>{try{if(!t.includes("tailwind-variants"))return t;let e=d(t);if(n(e))return t;let r=e.map(o=>y(o));return t.concat(`
var v=["xs","sm","md","lg","xl","2xl"],l={tv:/tv\({[\s\S]*?}\)/g,tvContent:/\({[\s\S]*?}\)/g,comment:/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,blankLine:/^\s*$(?:\r\n?|\n)/gm},u=t=>Array.isArray(t),s=t=>!!(!t||u(t)&&t.length===0||typeof t=="string"&&t.length===0||typeof t=="object"&&Object.keys(t).length===0),y=t=>t.replace(l.comment,"$1").toString().replace(l.blankLine,"").toString().match(l.tv),d=t=>{let n=y(t);if(!s(n))return n.map(e=>new Function(`return ${e.match(l.tvContent).toString()}`)())},p=t=>t.flatMap(n=>n).toString().replaceAll(","," ").split(" "),h=t=>{let n={};for(let[e,r]of Object.entries(t))n[e]={},n[e].original=r,!s(r)&&(n.temp=u(r)?p(r):r.split(" "),v.forEach(i=>{let o="";n.temp.forEach(c=>{o+=`${i}:${c} `;}),n[e][i]=o.trimEnd();}),delete n.temp);return n},b=t=>typeof t=="string"?t.split(" "):u(t)?p(t):t instanceof Object?h(t):t,j=t=>{let{variants:n={}}=t;if(s(n))return;let e={};for(let[r,i]of Object.entries(n))if(e[r]={},!s(i))for(let[o,c]of Object.entries(i)){if(e[r][o]={},e[r][o].original=c,s(c))continue;let f=b(c);if(!s(f)){if(!u(f)){e[r][o]=f;continue}v.forEach(m=>{let g="";f.forEach(C=>{g+=`${m}:${C} `;}),e[r][o][m]=g.trimEnd();});}}return e},a=t=>{try{if(!t.includes("tailwind-variants"))return t;let n=d(t);if(s(n))return t;let e=JSON.stringify(n.map(r=>j(r)),void 0,2);return t.concat(`
/*
${JSON.stringify(r,void 0,2)}
${e}
*/
`)}catch{return t}},C={tsx:t=>i(t),ts:t=>i(t),jsx:t=>i(t),js:t=>i(t)};
`)}catch{return t}},S={tsx:t=>a(t),ts:t=>a(t),jsx:t=>a(t),js:t=>a(t)};
export { C as transformer };
export { S as transformer };
{
"name": "tailwind-variants",
"version": "0.0.24",
"version": "0.0.25",
"description": "🦄 Tailwindcss first-class variant API",

@@ -30,6 +30,3 @@ "author": "Junior Garcia <jrgarciadev@gmail.com>",

"build": "tsup && node copy-types.cjs",
"dev": "pnpm build:fast -- --watch",
"clean": "rimraf dist .turbo",
"typecheck": "tsc --noEmit",
"dry-run": "node ./scripts/dry-run.js",
"prepack": "clean-package",

@@ -65,6 +62,6 @@ "postpack": "clean-package restore",

"eslint-plugin-promise": "^6.0.0",
"jest": "28.1.1",
"prettier": "^2.2.1",
"prettier-eslint": "^12.0.0",
"prettier-eslint-cli": "^5.0.1",
"jest": "28.1.1",
"ts-node": "^10.9.1",

@@ -71,0 +68,0 @@ "tslib": "^2.4.1",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc