@salty-css/vite 0.0.1-alpha.132 → 0.0.1-alpha.133

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.
Files changed (3) hide show
  1. package/index.cjs +8 -8
  2. package/index.js +6 -1
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const fe=require("esbuild"),ue=require("child_process"),c=require("path"),u=require("fs"),G=require("fs/promises"),J=require("winston");var Z=typeof document<"u"?document.currentScript:null;function pe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const X=pe(fe),U=e=>String.fromCharCode(e+(e>25?39:97)),de=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=U(n%52)+s;return s=U(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},ye=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},I=(e,t=5)=>{const s=ye(5381,JSON.stringify(e))>>>0;return de(s,t)};function D(e){return e?typeof e!="string"?D(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?"-":"")+t.toLowerCase()):""}const ge=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:r}=n;e=e.replace(i,y=>{const{value:f,css:h}=r(y);return h&&s.push(h),f})}),{result:e,additionalCss:s}},Y=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${D(n[1].replaceAll(".","-"))})`)}:{result:e},O=(e,t,s,n)=>{if(!e)return"";const i=[],r=Object.entries(e).reduce((f,[h,o])=>{const a=h.trim();if(typeof o=="function"&&(o=o()),typeof o=="object"){if(!o)return f;if(a==="variants")return Object.entries(o).forEach(([d,$])=>{$&&Object.entries($).forEach(([C,P])=>{if(!P)return;const T=`${t}.${d}-${C}`,p=O(P,T);i.push(p)})}),f;if(a==="defaultVariants")return f;if(a==="compoundVariants")return o.forEach(d=>{const{css:$,...C}=d,P=Object.entries(C).reduce((p,[g,w])=>`${p}.${g}-${w}`,t),T=O($,P);i.push(T)}),f;if(a.startsWith("@")){const d=O(o,t),$=`${a} {
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const fe=require("esbuild"),ue=require("child_process"),c=require("path"),u=require("fs"),G=require("fs/promises"),J=require("winston");var Z=typeof document<"u"?document.currentScript:null;function pe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const X=pe(fe),U=e=>String.fromCharCode(e+(e>25?39:97)),de=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=U(n%52)+s;return s=U(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},ye=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},I=(e,t=5)=>{const s=ye(5381,JSON.stringify(e))>>>0;return de(s,t)};function D(e){return e?typeof e!="string"?D(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?"-":"")+t.toLowerCase()):""}const ge=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:r}=n;e=e.replace(i,y=>{const{value:f,css:h}=r(y);return h&&s.push(h),f})}),{result:e,additionalCss:s}},Y=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${D(n[1].replaceAll(".","-"))})`)}:{result:e},O=(e,t,s,n)=>{if(!e)return"";const i=[],r=Object.entries(e).reduce((f,[h,o])=>{const a=h.trim();if(typeof o=="function"&&(o=o()),typeof o=="object"){if(!o)return f;if(a==="variants")return Object.entries(o).forEach(([d,$])=>{$&&Object.entries($).forEach(([k,P])=>{if(!P)return;const T=`${t}.${d}-${k}`,p=O(P,T);i.push(p)})}),f;if(a==="defaultVariants")return f;if(a==="compoundVariants")return o.forEach(d=>{const{css:$,...k}=d,P=Object.entries(k).reduce((p,[g,w])=>`${p}.${g}-${w}`,t),T=O($,P);i.push(T)}),f;if(a.startsWith("@")){const d=O(o,t),$=`${a} {
2
2
  ${d.replace(`
3
3
  `,`
4
4
  `)}
5
- }`;return i.push($),f}const m=h.includes("&")?a.replace("&",t):a.startsWith(":")?`${t}${a}`:`${t} ${a}`,l=O(o,m);return i.push(l),f}const F=a.startsWith("-")?a:D(a),x=(m,l=";")=>f=`${f}${m}${l}`,b=m=>x(`${F}:${m}`);if(typeof o=="number")return b(o);if(typeof o!="string")if("toString"in o)o=o.toString();else return f;const{modifiers:k}={},j=function*(){yield Y(o),yield ge(o,k)}();for(const{result:m,additionalCss:l=[]}of j)o=m,l.forEach(d=>{const $=O(d,"");x($,"")});return b(o)},"");if(!r)return i.join(`
5
+ }`;return i.push($),f}const m=h.includes("&")?a.replace("&",t):a.startsWith(":")?`${t}${a}`:`${t} ${a}`,l=O(o,m);return i.push(l),f}const F=a.startsWith("-")?a:D(a),x=(m,l=";")=>f=`${f}${m}${l}`,b=m=>x(`${F}:${m}`);if(typeof o=="number")return b(o);if(typeof o!="string")if("toString"in o)o=o.toString();else return f;const{modifiers:C}={},j=function*(){yield Y(o),yield ge(o,C)}();for(const{result:m,additionalCss:l=[]}of j)o=m,l.forEach(d=>{const $=O(d,"");x($,"")});return b(o)},"");if(!r)return i.join(`
6
6
  `);if(!t)return r;let y="";return y=`${t} { ${r} }`,[y,...i].join(`
7
7
  `)},Q=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([i,r])=>{if(typeof r=="object"){if(!r)return;const y=i.trim(),f=Q(r,[...t,y]);s.push(f)}else n[i]=r}),Object.keys(n).length){const i=t.map(D).join("-"),r=O(n,`.${i}`);s.push(r)}return s.join(`
8
- `)},me=e=>Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=v(n).map(i=>`"${i}"`).join(" | ")),t),{}),v=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const r=t?`${t}.${n}`:n;return typeof i=="object"?v(i,r,s):s.add(t)}),[...s]):[],ee=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return u.existsSync(t)?t:ee(c.join(e,".."))},he=async e=>{const t=ee(e);return await G.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},be=async e=>{const t=await he(e);if(t)return t.type};let V;const te=async e=>{if(V)return V;const t=await be(e);return t==="module"?V="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:Z&&Z.tagName.toUpperCase()==="SCRIPT"&&Z.src||new URL("index.cjs",document.baseURI).href).endsWith(".cjs"))&&(V="cjs"),V||"esm"},q=J.createLogger({level:"debug",format:J.format.combine(J.format.colorize(),J.format.cli()),transports:[new J.transports.Console({})]});function se(e){return e?typeof e!="string"?se(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const je={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},button:{lineHeight:"1em"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},H={externalModules:[]},ne=e=>{if(H.externalModules.length>0)return H.externalModules;const t=c.join(e,"salty.config.ts"),n=u.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const i=n[1].split(",").map(r=>r.replace(/['"`]/g,"").trim());return H.externalModules=i,i},W=e=>c.join(e,"./saltygen"),Se=["salty","css","styles","styled"],$e=(e=[])=>new RegExp(`\\.(${[...Se,...e].join("|")})\\.`),z=(e,t=[])=>$e(t).test(e),we=async e=>{const t=W(e),s=c.join(e,"salty.config.ts"),n=c.join(t,"salty.config.js"),i=await te(e),r=ne(e);await X.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:i,external:r});const y=Date.now(),{config:f}=await import(`${n}?t=${y}`);return f},Fe=async e=>{const t=await we(e),s=new Set,n=(p,g=[])=>p?Object.entries(p).flatMap(([w,S])=>{if(!S)return;if(typeof S=="object")return n(S,[...g,w]);const A=se(w),R=D(w),E=[...g,A].join(".");s.add(`"${E}"`);const N=[...g.map(D),R].join("-"),{result:_}=Y(S);return`--${N}: ${_};`}):[],i=p=>p?Object.entries(p).flatMap(([g,w])=>{const S=n(w);return g==="base"?S.join(""):`${g} { ${S.join("")} }`}):[],r=p=>p?Object.entries(p).flatMap(([g,w])=>Object.entries(w).flatMap(([S,A])=>{const R=n(A,[g]),E=`.${g}-${S}, [data-${g}="${S}"]`,N=R.join("");return`${E} { ${N} }`})):[],y=n(t.variables),f=i(t.responsiveVariables),h=r(t.conditionalVariables),o=W(e),a=c.join(o,"css/_variables.css"),F=`:root { ${y.join("")} ${f.join("")} } ${h.join("")}`;u.writeFileSync(a,F);const x=c.join(o,"css/_global.css"),b=O(t.global,"");u.writeFileSync(x,`@layer global { ${b} }`);const k=c.join(o,"css/_reset.css"),j=t.reset==="none"?{}:typeof t.reset=="object"?t.reset:je,m=O(j,"");u.writeFileSync(k,`@layer reset { ${m} }`);const l=c.join(o,"css/_templates.css"),d=Q(t.templates),$=me(t.templates);u.writeFileSync(l,d);const C=c.join(o,"types/css-tokens.d.ts"),T=`
8
+ `)},me=e=>Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=v(n).map(i=>`"${i}"`).join(" | ")),t),{}),v=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const r=t?`${t}.${n}`:n;return typeof i=="object"?v(i,r,s):s.add(t)}),[...s]):[],ee=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return u.existsSync(t)?t:ee(c.join(e,".."))},he=async e=>{const t=ee(e);return await G.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},be=async e=>{const t=await he(e);if(t)return t.type};let V;const te=async e=>{if(V)return V;const t=await be(e);return t==="module"?V="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:Z&&Z.tagName.toUpperCase()==="SCRIPT"&&Z.src||new URL("index.cjs",document.baseURI).href).endsWith(".cjs"))&&(V="cjs"),V||"esm"},q=J.createLogger({level:"debug",format:J.format.combine(J.format.colorize(),J.format.cli()),transports:[new J.transports.Console({})]});function se(e){return e?typeof e!="string"?se(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const je={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},a:{color:"currentColor"},button:{lineHeight:"1em",color:"currentColor"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},H={externalModules:[]},ne=e=>{if(H.externalModules.length>0)return H.externalModules;const t=c.join(e,"salty.config.ts"),n=u.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const i=n[1].split(",").map(r=>r.replace(/['"`]/g,"").trim());return H.externalModules=i,i},W=e=>c.join(e,"./saltygen"),Se=["salty","css","styles","styled"],$e=(e=[])=>new RegExp(`\\.(${[...Se,...e].join("|")})\\.`),z=(e,t=[])=>$e(t).test(e),we=async e=>{const t=W(e),s=c.join(e,"salty.config.ts"),n=c.join(t,"salty.config.js"),i=await te(e),r=ne(e);await X.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:i,external:r});const y=Date.now(),{config:f}=await import(`${n}?t=${y}`);return f},Fe=async e=>{const t=await we(e),s=new Set,n=(p,g=[])=>p?Object.entries(p).flatMap(([w,S])=>{if(!S)return;if(typeof S=="object")return n(S,[...g,w]);const A=se(w),R=D(w),E=[...g,A].join(".");s.add(`"${E}"`);const N=[...g.map(D),R].join("-"),{result:_}=Y(S);return`--${N}: ${_};`}):[],i=p=>p?Object.entries(p).flatMap(([g,w])=>{const S=n(w);return g==="base"?S.join(""):`${g} { ${S.join("")} }`}):[],r=p=>p?Object.entries(p).flatMap(([g,w])=>Object.entries(w).flatMap(([S,A])=>{const R=n(A,[g]),E=`.${g}-${S}, [data-${g}="${S}"]`,N=R.join("");return`${E} { ${N} }`})):[],y=n(t.variables),f=i(t.responsiveVariables),h=r(t.conditionalVariables),o=W(e),a=c.join(o,"css/_variables.css"),F=`:root { ${y.join("")} ${f.join("")} } ${h.join("")}`;u.writeFileSync(a,F);const x=c.join(o,"css/_global.css"),b=O(t.global,"");u.writeFileSync(x,`@layer global { ${b} }`);const C=c.join(o,"css/_reset.css"),j=t.reset==="none"?{}:typeof t.reset=="object"?t.reset:je,m=O(j,"");u.writeFileSync(C,`@layer reset { ${m} }`);const l=c.join(o,"css/_templates.css"),d=Q(t.templates),$=me(t.templates);u.writeFileSync(l,d);const k=c.join(o,"types/css-tokens.d.ts"),T=`
9
9
  // Variable types
10
10
  type VariableTokens = ${[...s].join("|")};
11
11
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -15,14 +15,14 @@
15
15
  ${Object.entries($).map(([p,g])=>`${p}?: ${g}`).join(`
16
16
  `)}
17
17
  }
18
- `;u.writeFileSync(C,T)},B=async(e,t,s)=>{const n=I(t),i=c.join(s,"./temp");u.existsSync(i)||u.mkdirSync(i);const r=c.parse(t);let y=u.readFileSync(t,"utf8");y=y.replace(/styled\([^"'`{,]+,/g,"styled('div',");const f=c.join(s,"js",n+".js"),h=ne(e),o=await te(e);await X.build({stdin:{contents:y,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:f,format:o,target:["node20"],keepNames:!0,external:h,packages:"external"});const a=Date.now();return await import(`${f}?t=${a}`)},K=async e=>{const t=W(e),s=c.join(t,"salty.config.js"),n=Date.now(),{config:i}=await import(`${s}?t=${n}`);return i},oe=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},xe=async(e,t=oe())=>{try{const s=Date.now();t?q.info("Generating CSS in production mode! 🔥"):q.info("Generating CSS in development mode! 🚀");const n=[],i=[],r=W(e),y=c.join(r,"index.css");(()=>{u.existsSync(r)&&ue.execSync("rm -rf "+r),u.mkdirSync(r),u.mkdirSync(c.join(r,"css")),u.mkdirSync(c.join(r,"types"))})(),await Fe(e);const h=await K(e);async function o(l,d){const $=["node_modules","saltygen"],C=u.statSync(l);if(C.isDirectory()){const P=u.readdirSync(l);if($.some(p=>l.includes(p)))return;await Promise.all(P.map(p=>o(c.join(l,p),c.join(d,p))))}else if(C.isFile()&&z(l)){const T=await B(e,l,r),p=[];Object.entries(T).forEach(([E,N])=>{if(N.isKeyframes&&N.css){const L=`a_${N.animationName}.css`,ae=`css/${L}`,le=c.join(r,ae);n.push(L),u.writeFileSync(le,N.css);return}if(!N.generator)return;const _=N.generator._withBuildContext({name:E,config:h,prod:t});i[_.priority]||(i[_.priority]=[]),i[_.priority].push(_.cssFileName),p.push(_.cssFileName);const ie=`css/${_.cssFileName}`,ce=c.join(r,ie);u.writeFileSync(ce,_.css)});const g=p.map(E=>`@import url('./${E}');`).join(`
18
+ `;u.writeFileSync(k,T)},B=async(e,t,s)=>{const n=I(t),i=c.join(s,"./temp");u.existsSync(i)||u.mkdirSync(i);const r=c.parse(t);let y=u.readFileSync(t,"utf8");y=y.replace(/styled\([^"'`{,]+,/g,"styled('div',");const f=c.join(s,"js",n+".js"),h=ne(e),o=await te(e);await X.build({stdin:{contents:y,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:f,format:o,target:["node20"],keepNames:!0,external:h,packages:"external"});const a=Date.now();return await import(`${f}?t=${a}`)},K=async e=>{const t=W(e),s=c.join(t,"salty.config.js"),n=Date.now(),{config:i}=await import(`${s}?t=${n}`);return i},oe=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},xe=async(e,t=oe())=>{try{const s=Date.now();t?q.info("Generating CSS in production mode! 🔥"):q.info("Generating CSS in development mode! 🚀");const n=[],i=[],r=W(e),y=c.join(r,"index.css");(()=>{u.existsSync(r)&&ue.execSync("rm -rf "+r),u.mkdirSync(r),u.mkdirSync(c.join(r,"css")),u.mkdirSync(c.join(r,"types"))})(),await Fe(e);const h=await K(e);async function o(l,d){const $=["node_modules","saltygen"],k=u.statSync(l);if(k.isDirectory()){const P=u.readdirSync(l);if($.some(p=>l.includes(p)))return;await Promise.all(P.map(p=>o(c.join(l,p),c.join(d,p))))}else if(k.isFile()&&z(l)){const T=await B(e,l,r),p=[];Object.entries(T).forEach(([E,N])=>{if(N.isKeyframes&&N.css){const L=`a_${N.animationName}.css`,ae=`css/${L}`,le=c.join(r,ae);n.push(L),u.writeFileSync(le,N.css);return}if(!N.generator)return;const _=N.generator._withBuildContext({name:E,config:h,prod:t});i[_.priority]||(i[_.priority]=[]),i[_.priority].push(_.cssFileName),p.push(_.cssFileName);const ie=`css/${_.cssFileName}`,ce=c.join(r,ie);u.writeFileSync(ce,_.css)});const g=p.map(E=>`@import url('./${E}');`).join(`
19
19
  `),w=I(l,6),S=c.parse(l),A=D(S.name),R=c.join(r,`css/f_${A}-${w}.css`);u.writeFileSync(R,g)}}await o(e,r);const a=n.map(l=>`@import url('./css/${l}');`).join(`
20
- `);let k=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
20
+ `);let C=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
21
21
 
22
22
  ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(l=>{try{return u.readFileSync(c.join(r,"css",l),"utf8").length>0}catch{return!1}}).map(l=>`@import url('./css/${l}');`).join(`
23
23
  `)}
24
24
  ${a}`;if(h.importStrategy!=="component"){const l=i.flat().map(d=>`@import url('./css/${d}');`).join(`
25
- `);k+=l}u.writeFileSync(y,k);const j=Date.now()-s,m=j<200?"🔥":j<500?"🚀":j<1e3?"🎉":j<2e3?"🚗":j<5e3?"🤔":"🥴";q.info(`Generated CSS in ${j}ms! ${m}`)}catch(s){console.error(s)}},ke=async(e,t)=>{try{const s=[],n=c.join(e,"./saltygen"),i=c.join(n,"index.css");if(z(t)){const y=await K(e),f=await B(e,t,n);Object.entries(f).forEach(([x,b])=>{if(b.isKeyframes&&b.css){const l=`css/${`a_${b.animationName}.css`}`,d=c.join(n,l);u.writeFileSync(d,b.css);return}if(!b.generator)return;const k=b.generator._withBuildContext({name:x,config:y}),M=`css/${k.cssFileName}`,j=c.join(n,M);s.push(k.cssFileName),u.writeFileSync(j,k.css)});const h=u.readFileSync(i,"utf8").split(`
25
+ `);C+=l}u.writeFileSync(y,C);const j=Date.now()-s,m=j<200?"🔥":j<500?"🚀":j<1e3?"🎉":j<2e3?"🚗":j<5e3?"🤔":"🥴";q.info(`Generated CSS in ${j}ms! ${m}`)}catch(s){console.error(s)}},Ce=async(e,t)=>{try{const s=[],n=c.join(e,"./saltygen"),i=c.join(n,"index.css");if(z(t)){const y=await K(e),f=await B(e,t,n);Object.entries(f).forEach(([x,b])=>{if(b.isKeyframes&&b.css){const l=`css/${`a_${b.animationName}.css`}`,d=c.join(n,l);u.writeFileSync(d,b.css);return}if(!b.generator)return;const C=b.generator._withBuildContext({name:x,config:y}),M=`css/${C.cssFileName}`,j=c.join(n,M);s.push(C.cssFileName),u.writeFileSync(j,C.css)});const h=u.readFileSync(i,"utf8").split(`
26
26
  `),o=s.map(x=>`@import url('../saltygen/css/${x}');`),F=[...new Set([...h,...o])].join(`
27
- `);u.writeFileSync(i,F)}}catch(s){console.error(s)}},Ce=async(e,t,s=oe())=>{try{const n=c.join(e,"./saltygen");if(z(t)){const r=u.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,a=>`export ${a}`)!==r&&await G.writeFile(t,r);const f=await K(e),h=await B(e,t,n);let o=r;if(Object.entries(h).forEach(([a,F])=>{var w;if(F.isKeyframes||!F.generator)return;const x=F.generator._withBuildContext({name:a,config:f,prod:s}),b=new RegExp(`\\s${a}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!b)return console.error("Could not find the original declaration");const k=(w=b.at(1))==null?void 0:w.trim(),M=new RegExp(`\\s${a}[=\\s]+styled\\(`,"g").exec(o);if(!M)return console.error("Could not find the original declaration");const{index:j}=M;let m=!1;const l=setTimeout(()=>m=!0,5e3);let d=0,$=!1,C=0;for(;!$&&!m;){const S=o[j+d];S==="("&&C++,S===")"&&C--,C===0&&S===")"&&($=!0),d>o.length&&(m=!0),d++}if(!m)clearTimeout(l);else throw new Error("Failed to find the end of the styled call and timed out");const P=j+d,T=o.slice(j,P),p=o,g=` ${a} = styled(${k}, "${x.classNames}", ${JSON.stringify(x.props)});`;o=o.replace(T,g),p===o&&console.error("Minimize file failed to change content",{name:a,tagName:k})}),f.importStrategy==="component"){const a=I(t,6),F=c.parse(t);o=`import '../../saltygen/css/${`f_${D(F.name)}-${a}.css`}';
28
- ${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(n){console.error("Error in minimizeFile:",n)}},re=e=>({name:"stylegen",buildStart:()=>xe(e),load:async t=>{if(z(t))return await Ce(e,t)},handleHotUpdate:async({file:t,server:s})=>{t.includes("salty.config")&&await s.restart()},watchChange:{handler:async t=>{z(t)&&await ke(e,t)}}});exports.default=re;exports.saltyPlugin=re;
27
+ `);u.writeFileSync(i,F)}}catch(s){console.error(s)}},ke=async(e,t,s=oe())=>{try{const n=c.join(e,"./saltygen");if(z(t)){const r=u.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,a=>`export ${a}`)!==r&&await G.writeFile(t,r);const f=await K(e),h=await B(e,t,n);let o=r;if(Object.entries(h).forEach(([a,F])=>{var w;if(F.isKeyframes||!F.generator)return;const x=F.generator._withBuildContext({name:a,config:f,prod:s}),b=new RegExp(`\\s${a}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!b)return console.error("Could not find the original declaration");const C=(w=b.at(1))==null?void 0:w.trim(),M=new RegExp(`\\s${a}[=\\s]+styled\\(`,"g").exec(o);if(!M)return console.error("Could not find the original declaration");const{index:j}=M;let m=!1;const l=setTimeout(()=>m=!0,5e3);let d=0,$=!1,k=0;for(;!$&&!m;){const S=o[j+d];S==="("&&k++,S===")"&&k--,k===0&&S===")"&&($=!0),d>o.length&&(m=!0),d++}if(!m)clearTimeout(l);else throw new Error("Failed to find the end of the styled call and timed out");const P=j+d,T=o.slice(j,P),p=o,g=` ${a} = styled(${C}, "${x.classNames}", ${JSON.stringify(x.props)});`;o=o.replace(T,g),p===o&&console.error("Minimize file failed to change content",{name:a,tagName:C})}),f.importStrategy==="component"){const a=I(t,6),F=c.parse(t);o=`import '../../saltygen/css/${`f_${D(F.name)}-${a}.css`}';
28
+ ${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(n){console.error("Error in minimizeFile:",n)}},re=e=>({name:"stylegen",buildStart:()=>xe(e),load:async t=>{if(z(t))return await ke(e,t)},handleHotUpdate:async({file:t,server:s})=>{t.includes("salty.config")&&await s.restart()},watchChange:{handler:async t=>{z(t)&&await Ce(e,t)}}});exports.default=re;exports.saltyPlugin=re;
package/index.js CHANGED
@@ -159,9 +159,14 @@ const xt = {
159
159
  "h1, h2, h3, h4, h5, h6": {
160
160
  textWrap: "balance"
161
161
  },
162
+ /** Improve link color */
163
+ a: {
164
+ color: "currentColor"
165
+ },
162
166
  /** Improve button line height */
163
167
  button: {
164
- lineHeight: "1em"
168
+ lineHeight: "1em",
169
+ color: "currentColor"
165
170
  },
166
171
  /** Improve form elements */
167
172
  "input, optgroup, select, textarea": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/vite",
3
- "version": "0.0.1-alpha.132",
3
+ "version": "0.0.1-alpha.133",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -34,6 +34,6 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@salty-css/core": "^0.0.1-alpha.132"
37
+ "@salty-css/core": "^0.0.1-alpha.133"
38
38
  }
39
39
  }