@salty-css/core 0.0.1-alpha.279 → 0.0.1-alpha.280
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/bin/main.cjs +1 -1
- package/bin/main.js +2 -2
- package/cache/resolve-dynamic-config-cache.cjs +1 -0
- package/cache/resolve-dynamic-config-cache.d.ts +1 -0
- package/cache/resolve-dynamic-config-cache.js +10 -0
- package/compiler/index.cjs +1 -1
- package/compiler/index.js +1 -1
- package/index-BgHtTuZf.cjs +41 -0
- package/index-CXjwv_Dc.js +519 -0
- package/package.json +4 -4
- package/parsers/parse-styles.d.ts +1 -1
- package/server/index.cjs +1 -1
- package/server/index.js +1 -1
- package/{should-restart-CfoDl2WZ.js → should-restart-BELKpXEw.js} +1 -1
- package/{should-restart-CapzIWDV.cjs → should-restart-CBwAaej8.cjs} +1 -1
- package/types/config-types.d.ts +1 -0
- package/cache/get-config-cache.cjs +0 -1
- package/cache/get-config-cache.d.ts +0 -3
- package/cache/get-config-cache.js +0 -6
- package/index-B5Z3hZJn.cjs +0 -41
- package/index-CI0AEQ1k.js +0 -517
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=()=>({test:"works"});exports.getConfigCache=e;
|
package/index-B5Z3hZJn.cjs
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
"use strict";const Te=require("esbuild"),_e=require("child_process"),_=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),Se=require("fs/promises"),ae=require("./parse-styles-Bdgw_4ME.cjs"),he=require("./parsers/index.cjs"),Q=require("winston"),J=require("./css/merge.cjs"),Oe=require("./define-templates-Cunsb_Tr.cjs"),ce=require("typescript");var re=typeof document<"u"?document.currentScript:null;function ve(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 be=ve(Te),je=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=i.join(e,"package.json");return c.existsSync(t)?t:je(i.join(e,".."))},Ee=async e=>{const t=je(e);return await Se.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Ve=async e=>{const t=await Ee(e);if(t)return t.type};let H;const Fe=async e=>{if(H)return H;const t=await Ve(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("index-B5Z3hZJn.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},B=Q.createLogger({level:"debug",format:Q.format.combine(Q.format.colorize(),Q.format.cli()),transports:[new Q.transports.Console({})]}),Re=e=>{B.error(e)};function $e(e){return e?typeof e!="string"?$e(String(e)):e.replace(/[^\d\w]/g,"."):""}const Me={"*, *::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"}},Je=(e,t)=>new Promise((s,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},100),l=ce.createSourceFile("temp.ts",e,ce.ScriptTarget.Latest,!0);function o(y){if(ce.isVariableDeclaration(y)&&y.name.getText()===t){const S=y.getStart(),d=y.getEnd();clearTimeout(r),s([S,d])}y.forEachChild(o)}o(l)}),v={externalModules:[],rcFile:void 0,destDir:void 0},Ce=e=>{if(v.externalModules.length>0)return v.externalModules;const s=c.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(r=>r.replace(/['"`]/g,"").trim());return v.externalModules=n,n},q=async e=>{if(v.destDir)return v.destDir;const t=await fe(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return v.destDir=s,s},le=["salty","css","styles","styled"],Pe=(e=[])=>new RegExp(`\\.(${[...le,...e].join("|")})\\.`),Z=(e,t=[])=>Pe(t).test(e),Ne=async e=>{if(v.rcFile)return v.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=i.join(e,".saltyrc.json"),s=await Se.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(v.rcFile=s,s):Ne(i.join(e,".."))},fe=async e=>{var n,r;const t=await Ne(e),s=(n=t.projects)==null?void 0:n.find(l=>e.endsWith(l.dir||""));return s||((r=t.projects)==null?void 0:r.find(l=>l.dir===t.defaultProject))},qe=async e=>{const t=await fe(e),s=await q(e),n=i.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),r=i.join(s,"salty.config.js"),l=await Fe(e),o=Ce(n);await be.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:r,format:l,external:o});const y=Date.now(),{config:S}=await import(`${r}?t=${y}`);return{config:S,path:r}},xe=async(e,t)=>{var me,ye;const s=await q(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async w=>{const{contents:F,outputFilePath:K}=await U(e,w,s);Object.entries(F).forEach(([D,P])=>{P.isMedia?n.mediaQueries.push([D,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${D};;${K}`))})}));const{config:r,path:l}=await qe(e),o={...r},{mediaQueries:y}=n;o.mediaQueries=Object.fromEntries(y.map(([w,F])=>[`@${w}`,F]));const S=y.map(([w])=>`'@${w}'`).join(" | "),d=new Set,a=async(w,F=[])=>{if(!w)return[];const K=Object.entries(w).map(async([P,M])=>{const L=async T=>{if(!T)return;if(T instanceof Promise)return await L(await T);if(typeof T=="function")return await L(await T());if(typeof T=="object")return await a(T,[...F,P]);const ne=$e(P),oe=_.dashCase(P),ie=[...F,ne].join(".");d.add(`"${ie}"`);const Y=[...F.map(_.dashCase),oe].join("-"),ge=ae.parseVariableTokens(T);return ge?`--${Y}: ${ge.transformed};`:`--${Y}: ${T};`};return await L(M)});return(await Promise.all(K)).flat()},g=async w=>{if(!w)return[];const F=Object.entries(w).map(async([D,P])=>{const M=await a(P);return D==="base"?M.join(""):o.mediaQueries[D]?`${o.mediaQueries[D]} { ${M.join("")} }`:`${D} { ${M.join("")} }`});return(await Promise.all(F)).flat()},m=async w=>{if(!w)return[];const F=Object.entries(w).map(async([D,P])=>{const M=Object.entries(P).map(async([T,ne])=>{const oe=await a(ne,[D]),ie=`.${D}-${T}, [data-${D}="${T}"]`,Y=oe.join("");return`${ie} { ${Y} }`});return(await Promise.all(M)).flat()});return(await Promise.all(F)).flat()},h=w=>({...w,responsive:void 0,conditional:void 0}),p=w=>n.variables.map(F=>w==="static"?h(F._current):F._current[w]),$=J.mergeObjects(h(r.variables),p("static")),x=await a($),k=J.mergeObjects((me=r.variables)==null?void 0:me.responsive,p("responsive")),E=await g(k),z=J.mergeObjects((ye=r.variables)==null?void 0:ye.conditional,p("conditional")),A=await m(z),de=i.join(s,"css/_variables.css"),V=`:root { ${x.join("")} ${E.join("")} } ${A.join("")}`;c.writeFileSync(de,V),o.staticVariables=$;const ee=i.join(s,"css/_global.css"),u=J.mergeObjects(r.global,n.globalStyles),b=await ae.parseAndJoinStyles(u,"");c.writeFileSync(ee,`@layer global { ${b} }`);const j=i.join(s,"css/_reset.css"),C=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:Me,N=await ae.parseAndJoinStyles(C,"");c.writeFileSync(j,`@layer reset { ${N} }`);const O=i.join(s,"css/_templates.css"),R=J.mergeObjects(r.templates,n.templates),W=await he.parseTemplates(R),I=he.getTemplateTypes(R);c.writeFileSync(O,`@layer templates { ${W} }`),o.templates=R;const X=r.templates?[Oe.defineTemplates(r.templates)._setPath(`config;;${l}`)]:[],te=J.mergeFactories(n.templates,X);o.templatePaths=Object.fromEntries(Object.entries(te).map(([w,F])=>[w,F._path]));const G=i.join(s,"types/css-tokens.d.ts"),ke=`
|
2
|
-
// Variable types
|
3
|
-
type VariableTokens = ${[...d].join("|")};
|
4
|
-
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
5
|
-
|
6
|
-
// Template types
|
7
|
-
type TemplateTokens = {
|
8
|
-
${Object.entries(I).map(([w,F])=>`${w}?: ${F}`).join(`
|
9
|
-
`)}
|
10
|
-
}
|
11
|
-
|
12
|
-
// Media query types
|
13
|
-
type MediaQueryKeys = ${S||"''"};
|
14
|
-
`;c.writeFileSync(G,ke);const De=i.join(s,"cache/config-cache.json");c.writeFileSync(De,JSON.stringify(o,null,2))},we=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const r=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!r.test(e))return t;const o=r.exec(e);if(o){const y=o.at(1);if(le.some(d=>y==null?void 0:y.includes(d)))return t}return"styled('div',"}),ze=(e,t)=>{try{const s=c.readFileSync(i.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
|
15
|
-
|
16
|
-
${e}`:`globalThis.saltyConfig = {};
|
17
|
-
|
18
|
-
${e}`}catch{return e}},U=async(e,t,s)=>{const n=_.toHash(t),r=i.join(s,"./temp");c.existsSync(r)||c.mkdirSync(r);const l=i.parse(t);let o=c.readFileSync(t,"utf8");o=we(o),o=ze(o,e);const y=i.join(s,"js",n+".js"),S=await fe(e),d=i.join(e,(S==null?void 0:S.configDir)||"","salty.config.ts"),a=Ce(d),g=await Fe(e);await be.build({stdin:{contents:o,sourcefile:l.base,resolveDir:l.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:y,format:g,target:["node20"],keepNames:!0,external:a,packages:"external",plugins:[{name:"test",setup:p=>{p.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},$=>{const x=c.readFileSync($.path,"utf8");return{contents:we(x),loader:"ts"}})}}]});const m=Date.now();return{contents:await import(`${y}?t=${m}`),outputFilePath:y}},He=async e=>{const t=await q(e),s=i.join(t,"cache/config-cache.json"),n=c.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},ue=async e=>{const t=await He(e),s=await q(e),n=i.join(s,"salty.config.js"),r=Date.now(),{config:l}=await import(`${n}?t=${r}`);return J.mergeObjects(l,t)},pe=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},We=async(e,t=pe(),s=!0)=>{try{const n=Date.now();t?B.info("Generating CSS in production mode! 🔥"):B.info("Generating CSS in development mode! 🚀");const r=[],l=[],o=await q(e),y=i.join(o,"index.css");s&&(()=>{c.existsSync(o)&&_e.execSync("rm -rf "+o),c.mkdirSync(o,{recursive:!0}),c.mkdirSync(i.join(o,"css")),c.mkdirSync(i.join(o,"types")),c.mkdirSync(i.join(o,"js")),c.mkdirSync(i.join(o,"cache"))})();const d=new Set,a=new Set;async function g(u){const b=["node_modules","saltygen"],j=c.statSync(u);if(j.isDirectory()){const f=c.readdirSync(u);if(b.some(N=>u.includes(N)))return;await Promise.all(f.map(N=>g(i.join(u,N))))}else if(j.isFile()&&Z(u)){d.add(u);const C=c.readFileSync(u,"utf8");/define[\w\d]+\(/.test(C)&&a.add(u)}}await g(e),await xe(e,a);const m={keyframes:[],components:[],classNames:[]};await Promise.all([...d].map(async u=>{const{contents:b}=await U(e,u,o);for(let[j,f]of Object.entries(b))f instanceof Promise&&(f=await f),f.isKeyframes?m.keyframes.push({value:f,src:u,name:j}):f.isClassName?m.classNames.push({...f,src:u,name:j}):f.generator&&m.components.push({...f,src:u,name:j})}));const h=await ue(e);for(const u of m.keyframes){const{value:b}=u,j=`a_${b.animationName}.css`,f=`css/${j}`,C=i.join(o,f);r.push(j),c.writeFileSync(C,b.css)}const p={};for(const u of m.components){const{src:b,name:j}=u;p[b]||(p[b]=[]);const f=u.generator._withBuildContext({callerName:j,isProduction:t,config:h});l[f.priority]||(l[f.priority]=[]);const C=await f.css;if(!C)continue;l[f.priority].push(f.cssFileName);const N=`css/${f.cssFileName}`,O=i.join(o,N);c.writeFileSync(O,C),h.importStrategy==="component"&&p[b].push(f.cssFileName)}for(const u of m.classNames){const{src:b,name:j}=u;p[b]||(p[b]=[]);const f=u.generator._withBuildContext({callerName:j,isProduction:t,config:h}),C=await f.css;if(!C)continue;l[f.priority]||(l[f.priority]=[]),l[f.priority].push(f.cssFileName);const N=`css/${f.cssFileName}`,O=i.join(o,N);c.writeFileSync(O,C),h.importStrategy==="component"&&p[b].push(f.cssFileName)}h.importStrategy==="component"&&Object.entries(p).forEach(([u,b])=>{const j=b.map(R=>`@import url('./${R}');`).join(`
|
19
|
-
`),f=_.toHash(u,6),C=i.parse(u),N=_.dashCase(C.name),O=i.join(o,`css/f_${N}-${f}.css`);c.writeFileSync(O,j||"/* Empty file */")});const $=r.map(u=>`@import url('./css/${u}');`).join(`
|
20
|
-
`);let A=`/*!
|
21
|
-
* Generated with Salty CSS (https://salty-css.dev)
|
22
|
-
* Do not edit this file directly
|
23
|
-
*/
|
24
|
-
@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
25
|
-
|
26
|
-
${["_variables.css","_reset.css","_global.css","_templates.css"].filter(u=>{try{return c.readFileSync(i.join(o,"css",u),"utf8").length>0}catch{return!1}}).map(u=>`@import url('./css/${u}');`).join(`
|
27
|
-
`)}
|
28
|
-
${$}`;if(h.importStrategy!=="component"){const u=l.reduce((b,j,f)=>{const C=j.reduce((W,I)=>{var se;const X=i.join(o,"css",I),te=c.readFileSync(X,"utf8"),G=((se=/.*-([^-]+)-\d+.css/.exec(I))==null?void 0:se.at(1))||_.toHash(X,6);return W.includes(G)?W:`${W}
|
29
|
-
/*start:${G}-${I}*/
|
30
|
-
${te}
|
31
|
-
/*end:${G}*/
|
32
|
-
`},""),N=`l_${f}.css`,O=i.join(o,"css",N),R=`@layer l${f} { ${C}
|
33
|
-
}`;return c.writeFileSync(O,R),`${b}
|
34
|
-
@import url('./css/${N}');`},"");A+=u}c.writeFileSync(y,A);const V=Date.now()-n,ee=V<200?"🔥":V<500?"🚀":V<1e3?"🎉":V<2e3?"🚗":V<5e3?"🤔":"🥴";B.info(`Generated CSS in ${V}ms! ${ee}`)}catch(n){console.error(n)}},Ie=async(e,t,s=pe())=>{try{const n=await q(e);if(Z(t)){const l=[],o=await ue(e),{contents:y}=await U(e,t,n);for(const[S,d]of Object.entries(y)){if(d.isKeyframes&&d.css){const $=`css/${`a_${d.animationName}.css`}`,x=i.join(n,$);c.writeFileSync(x,await d.css);continue}if(d.isClassName){const p=d.generator._withBuildContext({callerName:S,isProduction:s,config:o}),$=await p.css;if(!$)continue;l[p.priority]||(l[p.priority]=[]),l[p.priority].push(p.cssFileName);const x=`css/${p.cssFileName}`,k=i.join(n,x);c.writeFileSync(k,$);continue}if(!d.generator)continue;const a=d.generator._withBuildContext({callerName:S,isProduction:s,config:o}),g=await a.css;if(!g)continue;const m=`css/${a.cssFileName}`,h=i.join(n,m);c.writeFileSync(h,g),l[a.priority]||(l[a.priority]=[]),l[a.priority].push(a.cssFileName)}if(o.importStrategy!=="component")l.forEach((S,d)=>{const a=`l_${d}.css`,g=i.join(n,"css",a);let m=c.readFileSync(g,"utf8");S.forEach(h=>{var k;const p=i.join(n,"css",h),$=((k=/.*-([^-]+)-\d+.css/.exec(h))==null?void 0:k.at(1))||_.toHash(p,6);if(!m.includes($)){const E=c.readFileSync(p,"utf8"),z=`/*start:${$}-${h}*/
|
35
|
-
${E}
|
36
|
-
/*end:${$}*/
|
37
|
-
`;m=`${m.replace(/\}$/,"")}
|
38
|
-
${z}
|
39
|
-
}`}}),c.writeFileSync(g,m)});else{const S=l.flat().map(h=>`@import url('./${h}');`).join(`
|
40
|
-
`),d=_.toHash(t,6),a=i.parse(t),g=_.dashCase(a.name),m=i.join(n,`css/f_${g}-${d}.css`);c.writeFileSync(m,S||"/* Empty file */")}}}catch(n){console.error(n)}},Ge=async(e,t,s=pe())=>{var n,r;try{const l=await q(e);if(Z(t)){const y=c.readFileSync(t,"utf8"),S=await ue(e),{contents:d}=await U(e,t,l);let a=y;for(const[g,m]of Object.entries(d)){if(m.isKeyframes||!m.generator)continue;const h=m.generator._withBuildContext({callerName:g,isProduction:s,config:S}),[p,$]=await Je(a,g),x=a.slice(p,$);if(m.isClassName){const k=a,E=` ${g} = className("${h.classNames}")`;a=a.replace(x,E),k===a&&console.error("Minimize file failed to change content",{name:g})}if(x.includes("styled")){const k=(r=(n=/styled\(([^,]+),/.exec(x))==null?void 0:n.at(1))==null?void 0:r.trim(),E=a,z=` ${g} = styled(${k}, "${h.classNames}", ${JSON.stringify(h.clientProps)})`;a=a.replace(x,z),E===a&&console.error("Minimize file failed to change content",{name:g,tagName:k})}}if(S.importStrategy==="component"){const g=_.toHash(t,6),m=i.parse(t);a=`import '../../saltygen/css/${`f_${_.dashCase(m.name)}-${g}.css`}';
|
41
|
-
${a}`}return a=a.replace("@salty-css/react/class-name","@salty-css/react/class-name-client"),a=a.replace("{ styled }","{ styledClient as styled }"),a=a.replace("@salty-css/react/styled","@salty-css/react/styled-client"),a}}catch(l){console.error("Error in minimizeFile:",l)}};exports.compileSaltyFile=U;exports.generateConfigStyles=xe;exports.generateCss=We;exports.generateFile=Ie;exports.isSaltyFile=Z;exports.logError=Re;exports.logger=B;exports.minimizeFile=Ge;exports.saltyFileExtensions=le;exports.saltyFileRegExp=Pe;
|
package/index-CI0AEQ1k.js
DELETED
@@ -1,517 +0,0 @@
|
|
1
|
-
import * as St from "esbuild";
|
2
|
-
import { execSync as _t } from "child_process";
|
3
|
-
import { t as I, d as A } from "./dash-case-DBThphLm.js";
|
4
|
-
import { join as i, parse as tt } from "path";
|
5
|
-
import { existsSync as ft, writeFileSync as F, mkdirSync as G, readFileSync as _, statSync as Vt, readdirSync as vt } from "fs";
|
6
|
-
import { readFile as Ct } from "fs/promises";
|
7
|
-
import { p as $t, a as Et } from "./parse-styles-C1E6ETeH.js";
|
8
|
-
import { parseTemplates as Ot, getTemplateTypes as Mt } from "./parsers/index.js";
|
9
|
-
import { createLogger as Rt, format as rt, transports as Jt } from "winston";
|
10
|
-
import { mergeObjects as H, mergeFactories as zt } from "./css/merge.js";
|
11
|
-
import { d as Wt } from "./define-templates-4A2yHcMF.js";
|
12
|
-
import lt from "typescript";
|
13
|
-
const Ft = (t) => {
|
14
|
-
if (!t || t === "/") throw new Error("Could not find package.json file");
|
15
|
-
const e = i(t, "package.json");
|
16
|
-
return ft(e) ? e : Ft(i(t, ".."));
|
17
|
-
}, Gt = async (t) => {
|
18
|
-
const e = Ft(t);
|
19
|
-
return await Ct(e, "utf-8").then(JSON.parse).catch(() => {
|
20
|
-
});
|
21
|
-
}, Ht = async (t) => {
|
22
|
-
const e = await Gt(t);
|
23
|
-
if (e)
|
24
|
-
return e.type;
|
25
|
-
};
|
26
|
-
let W;
|
27
|
-
const Pt = async (t) => {
|
28
|
-
if (W) return W;
|
29
|
-
const e = await Ht(t);
|
30
|
-
return e === "module" ? W = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (W = "cjs"), W || "esm";
|
31
|
-
}, Z = Rt({
|
32
|
-
level: "debug",
|
33
|
-
format: rt.combine(rt.colorize(), rt.cli()),
|
34
|
-
transports: [new Jt.Console({})]
|
35
|
-
}), ce = (t) => {
|
36
|
-
Z.error(t);
|
37
|
-
};
|
38
|
-
function jt(t) {
|
39
|
-
return t ? typeof t != "string" ? jt(String(t)) : t.replace(/[^\d\w]/g, ".") : "";
|
40
|
-
}
|
41
|
-
const It = {
|
42
|
-
/** Set box model to border-box */
|
43
|
-
"*, *::before, *::after": {
|
44
|
-
boxSizing: "border-box"
|
45
|
-
},
|
46
|
-
/** Remove default margin and padding */
|
47
|
-
"*": {
|
48
|
-
margin: 0
|
49
|
-
},
|
50
|
-
/** Remove adjust font properties */
|
51
|
-
html: {
|
52
|
-
lineHeight: 1.15,
|
53
|
-
textSizeAdjust: "100%",
|
54
|
-
WebkitFontSmoothing: "antialiased"
|
55
|
-
},
|
56
|
-
/** Make media elements responsive */
|
57
|
-
"img, picture, video, canvas, svg": {
|
58
|
-
display: "block",
|
59
|
-
maxWidth: "100%"
|
60
|
-
},
|
61
|
-
/** Avoid overflow of text */
|
62
|
-
"p, h1, h2, h3, h4, h5, h6": {
|
63
|
-
overflowWrap: "break-word"
|
64
|
-
},
|
65
|
-
/** Improve text wrapping */
|
66
|
-
p: {
|
67
|
-
textWrap: "pretty"
|
68
|
-
},
|
69
|
-
"h1, h2, h3, h4, h5, h6": {
|
70
|
-
textWrap: "balance"
|
71
|
-
},
|
72
|
-
/** Improve link color */
|
73
|
-
a: {
|
74
|
-
color: "currentColor"
|
75
|
-
},
|
76
|
-
/** Improve button line height */
|
77
|
-
button: {
|
78
|
-
lineHeight: "1em",
|
79
|
-
color: "currentColor"
|
80
|
-
},
|
81
|
-
/** Improve form elements */
|
82
|
-
"input, optgroup, select, textarea": {
|
83
|
-
fontFamily: "inherit",
|
84
|
-
fontSize: "100%",
|
85
|
-
lineHeight: "1.15em"
|
86
|
-
}
|
87
|
-
}, Kt = (t, e) => new Promise((s, n) => {
|
88
|
-
const c = setTimeout(() => {
|
89
|
-
n(new Error("Timeout"));
|
90
|
-
}, 100), r = lt.createSourceFile("temp.ts", t, lt.ScriptTarget.Latest, !0);
|
91
|
-
function o(d) {
|
92
|
-
if (lt.isVariableDeclaration(d) && d.name.getText() === e) {
|
93
|
-
const w = d.getStart(), p = d.getEnd();
|
94
|
-
clearTimeout(c), s([w, p]);
|
95
|
-
}
|
96
|
-
d.forEachChild(o);
|
97
|
-
}
|
98
|
-
o(r);
|
99
|
-
}), v = {
|
100
|
-
externalModules: [],
|
101
|
-
rcFile: void 0,
|
102
|
-
destDir: void 0
|
103
|
-
}, Nt = (t) => {
|
104
|
-
if (v.externalModules.length > 0) return v.externalModules;
|
105
|
-
const s = _(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
|
106
|
-
if (!s) return [];
|
107
|
-
const n = s[1].split(",").map((c) => c.replace(/['"`]/g, "").trim());
|
108
|
-
return v.externalModules = n, n;
|
109
|
-
}, J = async (t) => {
|
110
|
-
if (v.destDir) return v.destDir;
|
111
|
-
const e = await pt(t), s = i(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
|
112
|
-
return v.destDir = s, s;
|
113
|
-
}, xt = ["salty", "css", "styles", "styled"], Qt = (t = []) => new RegExp(`\\.(${[...xt, ...t].join("|")})\\.`), mt = (t, e = []) => Qt(e).test(t), Dt = async (t) => {
|
114
|
-
if (v.rcFile) return v.rcFile;
|
115
|
-
if (t === "/") throw new Error("Could not find .saltyrc.json file");
|
116
|
-
const e = i(t, ".saltyrc.json"), s = await Ct(e, "utf-8").then(JSON.parse).catch(() => {
|
117
|
-
});
|
118
|
-
return s ? (v.rcFile = s, s) : Dt(i(t, ".."));
|
119
|
-
}, pt = async (t) => {
|
120
|
-
var n, c;
|
121
|
-
const e = await Dt(t), s = (n = e.projects) == null ? void 0 : n.find((r) => t.endsWith(r.dir || ""));
|
122
|
-
return s || ((c = e.projects) == null ? void 0 : c.find((r) => r.dir === e.defaultProject));
|
123
|
-
}, Bt = async (t) => {
|
124
|
-
const e = await pt(t), s = await J(t), n = i(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), c = i(s, "salty.config.js"), r = await Pt(t), o = Nt(n);
|
125
|
-
await St.build({
|
126
|
-
entryPoints: [n],
|
127
|
-
minify: !0,
|
128
|
-
treeShaking: !0,
|
129
|
-
bundle: !0,
|
130
|
-
outfile: c,
|
131
|
-
format: r,
|
132
|
-
external: o
|
133
|
-
});
|
134
|
-
const d = Date.now(), { config: w } = await import(`${c}?t=${d}`);
|
135
|
-
return { config: w, path: c };
|
136
|
-
}, Lt = async (t, e) => {
|
137
|
-
var gt, ht;
|
138
|
-
const s = await J(t), n = {
|
139
|
-
mediaQueries: [],
|
140
|
-
globalStyles: [],
|
141
|
-
variables: [],
|
142
|
-
templates: []
|
143
|
-
};
|
144
|
-
await Promise.all(
|
145
|
-
[...e].map(async (h) => {
|
146
|
-
const { contents: S, outputFilePath: L } = await et(t, h, s);
|
147
|
-
Object.entries(S).forEach(([k, j]) => {
|
148
|
-
j.isMedia ? n.mediaQueries.push([k, j]) : j.isGlobalDefine ? n.globalStyles.push(j) : j.isDefineVariables ? n.variables.push(j) : j.isDefineTemplates && n.templates.push(j._setPath(`${k};;${L}`));
|
149
|
-
});
|
150
|
-
})
|
151
|
-
);
|
152
|
-
const { config: c, path: r } = await Bt(t), o = { ...c }, { mediaQueries: d } = n;
|
153
|
-
o.mediaQueries = Object.fromEntries(d.map(([h, S]) => [`@${h}`, S]));
|
154
|
-
const w = d.map(([h]) => `'@${h}'`).join(" | "), p = /* @__PURE__ */ new Set(), a = async (h, S = []) => {
|
155
|
-
if (!h) return [];
|
156
|
-
const L = Object.entries(h).map(async ([j, R]) => {
|
157
|
-
const q = async (T) => {
|
158
|
-
if (!T) return;
|
159
|
-
if (T instanceof Promise) return await q(await T);
|
160
|
-
if (typeof T == "function") return await q(await T());
|
161
|
-
if (typeof T == "object") return await a(T, [...S, j]);
|
162
|
-
const at = jt(j), it = A(j), ct = [...S, at].join(".");
|
163
|
-
p.add(`"${ct}"`);
|
164
|
-
const Y = [...S.map(A), it].join("-"), wt = Et(T);
|
165
|
-
return wt ? `--${Y}: ${wt.transformed};` : `--${Y}: ${T};`;
|
166
|
-
};
|
167
|
-
return await q(R);
|
168
|
-
});
|
169
|
-
return (await Promise.all(L)).flat();
|
170
|
-
}, y = async (h) => {
|
171
|
-
if (!h) return [];
|
172
|
-
const S = Object.entries(h).map(async ([k, j]) => {
|
173
|
-
const R = await a(j);
|
174
|
-
return k === "base" ? R.join("") : o.mediaQueries[k] ? `${o.mediaQueries[k]} { ${R.join("")} }` : `${k} { ${R.join("")} }`;
|
175
|
-
});
|
176
|
-
return (await Promise.all(S)).flat();
|
177
|
-
}, u = async (h) => {
|
178
|
-
if (!h) return [];
|
179
|
-
const S = Object.entries(h).map(async ([k, j]) => {
|
180
|
-
const R = Object.entries(j).map(async ([T, at]) => {
|
181
|
-
const it = await a(at, [k]), ct = `.${k}-${T}, [data-${k}="${T}"]`, Y = it.join("");
|
182
|
-
return `${ct} { ${Y} }`;
|
183
|
-
});
|
184
|
-
return (await Promise.all(R)).flat();
|
185
|
-
});
|
186
|
-
return (await Promise.all(S)).flat();
|
187
|
-
}, g = (h) => ({ ...h, responsive: void 0, conditional: void 0 }), m = (h) => n.variables.map((S) => h === "static" ? g(S._current) : S._current[h]), C = H(g(c.variables), m("static")), x = await a(C), D = H((gt = c.variables) == null ? void 0 : gt.responsive, m("responsive")), E = await y(D), z = H((ht = c.variables) == null ? void 0 : ht.conditional, m("conditional")), U = await u(z), yt = i(s, "css/_variables.css"), O = `:root { ${x.join("")} ${E.join("")} } ${U.join("")}`;
|
188
|
-
F(yt, O), o.staticVariables = C;
|
189
|
-
const st = i(s, "css/_global.css"), f = H(c.global, n.globalStyles), $ = await $t(f, "");
|
190
|
-
F(st, `@layer global { ${$} }`);
|
191
|
-
const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : It, N = await $t(P, "");
|
192
|
-
F(b, `@layer reset { ${N} }`);
|
193
|
-
const V = i(s, "css/_templates.css"), M = H(c.templates, n.templates), K = await Ot(M), Q = Mt(M);
|
194
|
-
F(V, `@layer templates { ${K} }`), o.templates = M;
|
195
|
-
const X = c.templates ? [Wt(c.templates)._setPath(`config;;${r}`)] : [], nt = zt(n.templates, X);
|
196
|
-
o.templatePaths = Object.fromEntries(Object.entries(nt).map(([h, S]) => [h, S._path]));
|
197
|
-
const B = i(s, "types/css-tokens.d.ts"), kt = `
|
198
|
-
// Variable types
|
199
|
-
type VariableTokens = ${[...p].join("|")};
|
200
|
-
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
201
|
-
|
202
|
-
// Template types
|
203
|
-
type TemplateTokens = {
|
204
|
-
${Object.entries(Q).map(([h, S]) => `${h}?: ${S}`).join(`
|
205
|
-
`)}
|
206
|
-
}
|
207
|
-
|
208
|
-
// Media query types
|
209
|
-
type MediaQueryKeys = ${w || "''"};
|
210
|
-
`;
|
211
|
-
F(B, kt);
|
212
|
-
const Tt = i(s, "cache/config-cache.json");
|
213
|
-
F(Tt, JSON.stringify(o, null, 2));
|
214
|
-
}, bt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
|
215
|
-
if (/^['"`]/.test(s)) return e;
|
216
|
-
const c = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
|
217
|
-
if (!c.test(t)) return e;
|
218
|
-
const o = c.exec(t);
|
219
|
-
if (o) {
|
220
|
-
const d = o.at(1);
|
221
|
-
if (xt.some((p) => d == null ? void 0 : d.includes(p))) return e;
|
222
|
-
}
|
223
|
-
return "styled('div',";
|
224
|
-
}), qt = (t, e) => {
|
225
|
-
try {
|
226
|
-
const s = _(i(e, "saltygen/cache/config-cache.json"), "utf8");
|
227
|
-
return s ? `globalThis.saltyConfig = ${s};
|
228
|
-
|
229
|
-
${t}` : `globalThis.saltyConfig = {};
|
230
|
-
|
231
|
-
${t}`;
|
232
|
-
} catch {
|
233
|
-
return t;
|
234
|
-
}
|
235
|
-
}, et = async (t, e, s) => {
|
236
|
-
const n = I(e), c = i(s, "./temp");
|
237
|
-
ft(c) || G(c);
|
238
|
-
const r = tt(e);
|
239
|
-
let o = _(e, "utf8");
|
240
|
-
o = bt(o), o = qt(o, t);
|
241
|
-
const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a = Nt(p), y = await Pt(t);
|
242
|
-
await St.build({
|
243
|
-
stdin: {
|
244
|
-
contents: o,
|
245
|
-
sourcefile: r.base,
|
246
|
-
resolveDir: r.dir,
|
247
|
-
loader: "tsx"
|
248
|
-
},
|
249
|
-
minify: !1,
|
250
|
-
treeShaking: !0,
|
251
|
-
bundle: !0,
|
252
|
-
outfile: d,
|
253
|
-
format: y,
|
254
|
-
target: ["node20"],
|
255
|
-
keepNames: !0,
|
256
|
-
external: a,
|
257
|
-
packages: "external",
|
258
|
-
plugins: [
|
259
|
-
{
|
260
|
-
name: "test",
|
261
|
-
setup: (m) => {
|
262
|
-
m.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (C) => {
|
263
|
-
const x = _(C.path, "utf8");
|
264
|
-
return { contents: bt(x), loader: "ts" };
|
265
|
-
});
|
266
|
-
}
|
267
|
-
}
|
268
|
-
]
|
269
|
-
});
|
270
|
-
const u = Date.now();
|
271
|
-
return { contents: await import(`${d}?t=${u}`), outputFilePath: d };
|
272
|
-
}, At = async (t) => {
|
273
|
-
const e = await J(t), s = i(e, "cache/config-cache.json"), n = _(s, "utf8");
|
274
|
-
if (!n) throw new Error("Could not find config cache file");
|
275
|
-
return JSON.parse(n);
|
276
|
-
}, ut = async (t) => {
|
277
|
-
const e = await At(t), s = await J(t), n = i(s, "salty.config.js"), c = Date.now(), { config: r } = await import(`${n}?t=${c}`);
|
278
|
-
return H(r, e);
|
279
|
-
}, dt = () => {
|
280
|
-
try {
|
281
|
-
return process.env.NODE_ENV === "production";
|
282
|
-
} catch {
|
283
|
-
return !1;
|
284
|
-
}
|
285
|
-
}, re = async (t, e = dt(), s = !0) => {
|
286
|
-
try {
|
287
|
-
const n = Date.now();
|
288
|
-
e ? Z.info("Generating CSS in production mode! 🔥") : Z.info("Generating CSS in development mode! 🚀");
|
289
|
-
const c = [], r = [], o = await J(t), d = i(o, "index.css");
|
290
|
-
s && (() => {
|
291
|
-
ft(o) && _t("rm -rf " + o), G(o, { recursive: !0 }), G(i(o, "css")), G(i(o, "types")), G(i(o, "js")), G(i(o, "cache"));
|
292
|
-
})();
|
293
|
-
const p = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
294
|
-
async function y(f) {
|
295
|
-
const $ = ["node_modules", "saltygen"], b = Vt(f);
|
296
|
-
if (b.isDirectory()) {
|
297
|
-
const l = vt(f);
|
298
|
-
if ($.some((N) => f.includes(N))) return;
|
299
|
-
await Promise.all(l.map((N) => y(i(f, N))));
|
300
|
-
} else if (b.isFile() && mt(f)) {
|
301
|
-
p.add(f);
|
302
|
-
const P = _(f, "utf8");
|
303
|
-
/define[\w\d]+\(/.test(P) && a.add(f);
|
304
|
-
}
|
305
|
-
}
|
306
|
-
await y(t), await Lt(t, a);
|
307
|
-
const u = {
|
308
|
-
keyframes: [],
|
309
|
-
components: [],
|
310
|
-
classNames: []
|
311
|
-
};
|
312
|
-
await Promise.all(
|
313
|
-
[...p].map(async (f) => {
|
314
|
-
const { contents: $ } = await et(t, f, o);
|
315
|
-
for (let [b, l] of Object.entries($))
|
316
|
-
l instanceof Promise && (l = await l), l.isKeyframes ? u.keyframes.push({
|
317
|
-
value: l,
|
318
|
-
src: f,
|
319
|
-
name: b
|
320
|
-
}) : l.isClassName ? u.classNames.push({
|
321
|
-
...l,
|
322
|
-
src: f,
|
323
|
-
name: b
|
324
|
-
}) : l.generator && u.components.push({
|
325
|
-
...l,
|
326
|
-
src: f,
|
327
|
-
name: b
|
328
|
-
});
|
329
|
-
})
|
330
|
-
);
|
331
|
-
const g = await ut(t);
|
332
|
-
for (const f of u.keyframes) {
|
333
|
-
const { value: $ } = f, b = `a_${$.animationName}.css`, l = `css/${b}`, P = i(o, l);
|
334
|
-
c.push(b), F(P, $.css);
|
335
|
-
}
|
336
|
-
const m = {};
|
337
|
-
for (const f of u.components) {
|
338
|
-
const { src: $, name: b } = f;
|
339
|
-
m[$] || (m[$] = []);
|
340
|
-
const l = f.generator._withBuildContext({
|
341
|
-
callerName: b,
|
342
|
-
isProduction: e,
|
343
|
-
config: g
|
344
|
-
});
|
345
|
-
r[l.priority] || (r[l.priority] = []);
|
346
|
-
const P = await l.css;
|
347
|
-
if (!P) continue;
|
348
|
-
r[l.priority].push(l.cssFileName);
|
349
|
-
const N = `css/${l.cssFileName}`, V = i(o, N);
|
350
|
-
F(V, P), g.importStrategy === "component" && m[$].push(l.cssFileName);
|
351
|
-
}
|
352
|
-
for (const f of u.classNames) {
|
353
|
-
const { src: $, name: b } = f;
|
354
|
-
m[$] || (m[$] = []);
|
355
|
-
const l = f.generator._withBuildContext({
|
356
|
-
callerName: b,
|
357
|
-
isProduction: e,
|
358
|
-
config: g
|
359
|
-
}), P = await l.css;
|
360
|
-
if (!P) continue;
|
361
|
-
r[l.priority] || (r[l.priority] = []), r[l.priority].push(l.cssFileName);
|
362
|
-
const N = `css/${l.cssFileName}`, V = i(o, N);
|
363
|
-
F(V, P), g.importStrategy === "component" && m[$].push(l.cssFileName);
|
364
|
-
}
|
365
|
-
g.importStrategy === "component" && Object.entries(m).forEach(([f, $]) => {
|
366
|
-
const b = $.map((M) => `@import url('./${M}');`).join(`
|
367
|
-
`), l = I(f, 6), P = tt(f), N = A(P.name), V = i(o, `css/f_${N}-${l}.css`);
|
368
|
-
F(V, b || "/* Empty file */");
|
369
|
-
});
|
370
|
-
const C = c.map((f) => `@import url('./css/${f}');`).join(`
|
371
|
-
`);
|
372
|
-
let U = `/*!
|
373
|
-
* Generated with Salty CSS (https://salty-css.dev)
|
374
|
-
* Do not edit this file directly
|
375
|
-
*/
|
376
|
-
@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
377
|
-
|
378
|
-
${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((f) => {
|
379
|
-
try {
|
380
|
-
return _(i(o, "css", f), "utf8").length > 0;
|
381
|
-
} catch {
|
382
|
-
return !1;
|
383
|
-
}
|
384
|
-
}).map((f) => `@import url('./css/${f}');`).join(
|
385
|
-
`
|
386
|
-
`
|
387
|
-
)}
|
388
|
-
${C}`;
|
389
|
-
if (g.importStrategy !== "component") {
|
390
|
-
const f = r.reduce(($, b, l) => {
|
391
|
-
const P = b.reduce((K, Q) => {
|
392
|
-
var ot;
|
393
|
-
const X = i(o, "css", Q), nt = _(X, "utf8"), B = ((ot = /.*-([^-]+)-\d+.css/.exec(Q)) == null ? void 0 : ot.at(1)) || I(X, 6);
|
394
|
-
return K.includes(B) ? K : `${K}
|
395
|
-
/*start:${B}-${Q}*/
|
396
|
-
${nt}
|
397
|
-
/*end:${B}*/
|
398
|
-
`;
|
399
|
-
}, ""), N = `l_${l}.css`, V = i(o, "css", N), M = `@layer l${l} { ${P}
|
400
|
-
}`;
|
401
|
-
return F(V, M), `${$}
|
402
|
-
@import url('./css/${N}');`;
|
403
|
-
}, "");
|
404
|
-
U += f;
|
405
|
-
}
|
406
|
-
F(d, U);
|
407
|
-
const O = Date.now() - n, st = O < 200 ? "🔥" : O < 500 ? "🚀" : O < 1e3 ? "🎉" : O < 2e3 ? "🚗" : O < 5e3 ? "🤔" : "🥴";
|
408
|
-
Z.info(`Generated CSS in ${O}ms! ${st}`);
|
409
|
-
} catch (n) {
|
410
|
-
console.error(n);
|
411
|
-
}
|
412
|
-
}, le = async (t, e, s = dt()) => {
|
413
|
-
try {
|
414
|
-
const n = await J(t);
|
415
|
-
if (mt(e)) {
|
416
|
-
const r = [], o = await ut(t), { contents: d } = await et(t, e, n);
|
417
|
-
for (const [w, p] of Object.entries(d)) {
|
418
|
-
if (p.isKeyframes && p.css) {
|
419
|
-
const C = `css/${`a_${p.animationName}.css`}`, x = i(n, C);
|
420
|
-
F(x, await p.css);
|
421
|
-
continue;
|
422
|
-
}
|
423
|
-
if (p.isClassName) {
|
424
|
-
const m = p.generator._withBuildContext({
|
425
|
-
callerName: w,
|
426
|
-
isProduction: s,
|
427
|
-
config: o
|
428
|
-
}), C = await m.css;
|
429
|
-
if (!C) continue;
|
430
|
-
r[m.priority] || (r[m.priority] = []), r[m.priority].push(m.cssFileName);
|
431
|
-
const x = `css/${m.cssFileName}`, D = i(n, x);
|
432
|
-
F(D, C);
|
433
|
-
continue;
|
434
|
-
}
|
435
|
-
if (!p.generator) continue;
|
436
|
-
const a = p.generator._withBuildContext({
|
437
|
-
callerName: w,
|
438
|
-
isProduction: s,
|
439
|
-
config: o
|
440
|
-
}), y = await a.css;
|
441
|
-
if (!y) continue;
|
442
|
-
const u = `css/${a.cssFileName}`, g = i(n, u);
|
443
|
-
F(g, y), r[a.priority] || (r[a.priority] = []), r[a.priority].push(a.cssFileName);
|
444
|
-
}
|
445
|
-
if (o.importStrategy !== "component")
|
446
|
-
r.forEach((w, p) => {
|
447
|
-
const a = `l_${p}.css`, y = i(n, "css", a);
|
448
|
-
let u = _(y, "utf8");
|
449
|
-
w.forEach((g) => {
|
450
|
-
var D;
|
451
|
-
const m = i(n, "css", g), C = ((D = /.*-([^-]+)-\d+.css/.exec(g)) == null ? void 0 : D.at(1)) || I(m, 6);
|
452
|
-
if (!u.includes(C)) {
|
453
|
-
const E = _(m, "utf8"), z = `/*start:${C}-${g}*/
|
454
|
-
${E}
|
455
|
-
/*end:${C}*/
|
456
|
-
`;
|
457
|
-
u = `${u.replace(/\}$/, "")}
|
458
|
-
${z}
|
459
|
-
}`;
|
460
|
-
}
|
461
|
-
}), F(y, u);
|
462
|
-
});
|
463
|
-
else {
|
464
|
-
const w = r.flat().map((g) => `@import url('./${g}');`).join(`
|
465
|
-
`), p = I(e, 6), a = tt(e), y = A(a.name), u = i(n, `css/f_${y}-${p}.css`);
|
466
|
-
F(u, w || "/* Empty file */");
|
467
|
-
}
|
468
|
-
}
|
469
|
-
} catch (n) {
|
470
|
-
console.error(n);
|
471
|
-
}
|
472
|
-
}, fe = async (t, e, s = dt()) => {
|
473
|
-
var n, c;
|
474
|
-
try {
|
475
|
-
const r = await J(t);
|
476
|
-
if (mt(e)) {
|
477
|
-
const d = _(e, "utf8"), w = await ut(t), { contents: p } = await et(t, e, r);
|
478
|
-
let a = d;
|
479
|
-
for (const [y, u] of Object.entries(p)) {
|
480
|
-
if (u.isKeyframes || !u.generator) continue;
|
481
|
-
const g = u.generator._withBuildContext({
|
482
|
-
callerName: y,
|
483
|
-
isProduction: s,
|
484
|
-
config: w
|
485
|
-
}), [m, C] = await Kt(a, y), x = a.slice(m, C);
|
486
|
-
if (u.isClassName) {
|
487
|
-
const D = a, E = ` ${y} = className("${g.classNames}")`;
|
488
|
-
a = a.replace(x, E), D === a && console.error("Minimize file failed to change content", { name: y });
|
489
|
-
}
|
490
|
-
if (x.includes("styled")) {
|
491
|
-
const D = (c = (n = /styled\(([^,]+),/.exec(x)) == null ? void 0 : n.at(1)) == null ? void 0 : c.trim(), E = a, z = ` ${y} = styled(${D}, "${g.classNames}", ${JSON.stringify(g.clientProps)})`;
|
492
|
-
a = a.replace(x, z), E === a && console.error("Minimize file failed to change content", { name: y, tagName: D });
|
493
|
-
}
|
494
|
-
}
|
495
|
-
if (w.importStrategy === "component") {
|
496
|
-
const y = I(e, 6), u = tt(e);
|
497
|
-
a = `import '../../saltygen/css/${`f_${A(u.name)}-${y}.css`}';
|
498
|
-
${a}`;
|
499
|
-
}
|
500
|
-
return a = a.replace("@salty-css/react/class-name", "@salty-css/react/class-name-client"), a = a.replace("{ styled }", "{ styledClient as styled }"), a = a.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), a;
|
501
|
-
}
|
502
|
-
} catch (r) {
|
503
|
-
console.error("Error in minimizeFile:", r);
|
504
|
-
}
|
505
|
-
};
|
506
|
-
export {
|
507
|
-
ce as a,
|
508
|
-
le as b,
|
509
|
-
Qt as c,
|
510
|
-
Lt as d,
|
511
|
-
et as e,
|
512
|
-
re as g,
|
513
|
-
mt as i,
|
514
|
-
Z as l,
|
515
|
-
fe as m,
|
516
|
-
xt as s
|
517
|
-
};
|