@salty-css/vite 0.0.1-alpha.7 → 0.0.1-alpha.9
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/README.md +22 -18
- package/index.cjs +10 -10
- package/index.js +40 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,8 +54,10 @@ export const IndexPage = () => {
|
|
|
54
54
|
import { styled } from '@salty-css/react/styled';
|
|
55
55
|
|
|
56
56
|
export const Wrapper = styled('div', {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
base: {
|
|
58
|
+
display: 'block',
|
|
59
|
+
padding: '2vw',
|
|
60
|
+
},
|
|
59
61
|
});
|
|
60
62
|
```
|
|
61
63
|
|
|
@@ -65,22 +67,24 @@ export const Wrapper = styled('div', {
|
|
|
65
67
|
import { styled } from '@salty-css/react/styled';
|
|
66
68
|
|
|
67
69
|
export const Button = styled('button', {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
base: {
|
|
71
|
+
display: 'block',
|
|
72
|
+
padding: `0.6em 1.2em`,
|
|
73
|
+
border: '1px solid currentColor',
|
|
74
|
+
background: 'transparent',
|
|
75
|
+
color: 'currentColor/40',
|
|
76
|
+
cursor: 'pointer',
|
|
77
|
+
transition: '200ms',
|
|
78
|
+
textDecoration: 'none',
|
|
79
|
+
'&:hover': {
|
|
80
|
+
background: 'black',
|
|
81
|
+
borderColor: 'black',
|
|
82
|
+
color: 'white',
|
|
83
|
+
},
|
|
84
|
+
'&:disabled': {
|
|
85
|
+
opacity: 0.25,
|
|
86
|
+
pointerEvents: 'none',
|
|
87
|
+
},
|
|
84
88
|
},
|
|
85
89
|
variants: {
|
|
86
90
|
variant: {
|
package/index.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("esbuild"),W=require("winston"),L=require("child_process"),y=require("path"),d=require("fs"),G=require("fs/promises");function R(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(s,e,n.get?n:{enumerable:!0,get:()=>t[e]})}}return s.default=t,Object.freeze(s)}const Z=R(K),x=R(W),q=t=>String.fromCharCode(t+(t>25?39:97)),U=(t,s)=>{let e="",n;for(n=Math.abs(t);n>52;n=n/52|0)e=q(n%52)+e;return e=q(n%52)+e,e.length<s?e=e.padStart(s,"a"):e.length>s&&(e=e.slice(-s)),e},X=(t,s)=>{let e=s.length;for(;e;)t=t*33^s.charCodeAt(--e);return t},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("esbuild"),W=require("winston"),L=require("child_process"),y=require("path"),d=require("fs"),G=require("fs/promises");function R(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(s,e,n.get?n:{enumerable:!0,get:()=>t[e]})}}return s.default=t,Object.freeze(s)}const Z=R(K),x=R(W),q=t=>String.fromCharCode(t+(t>25?39:97)),U=(t,s)=>{let e="",n;for(n=Math.abs(t);n>52;n=n/52|0)e=q(n%52)+e;return e=q(n%52)+e,e.length<s?e=e.padStart(s,"a"):e.length>s&&(e=e.slice(-s)),e},X=(t,s)=>{let e=s.length;for(;e;)t=t*33^s.charCodeAt(--e);return t},_=(t,s=3)=>{const e=X(5381,JSON.stringify(t))>>>0;return U(e,s)};function V(t){return t?typeof t!="string"?String(t):t.replace(/\s/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(s,e)=>(e>0?"-":"")+s.toLowerCase()):""}const Y=(t,s)=>{if(typeof t!="string")return{result:t};if(!s)return{result:t};const e=[];return Object.values(s).forEach(n=>{const{pattern:o,transform:g}=n;t=t.replace(o,$=>{const{value:a,css:f}=g($);return f&&e.push(f),a})}),{result:t,additionalCss:e}},I=t=>typeof t!="string"?{result:t}:/\{[^{}]+\}/g.test(t)?{result:t.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V(n[1].replaceAll(".","-"))})`)}:{result:t},N=(t,s,e,n)=>{const o=[],g=Object.entries(t).reduce((a,[f,r])=>{const i=f.trim();if(typeof r=="function"&&(r=r()),typeof r=="object"){if(!r)return a;if(i==="variants")return Object.entries(r).forEach(([u,c])=>{c&&Object.entries(c).forEach(([m,l])=>{if(!l)return;const O=`${s}.${u}-${m}`,P=N(l,O);o.push(P)})}),a;if(i==="defaultVariants")return a;if(i==="compoundVariants")return r.forEach(u=>{const{css:c,...m}=u,l=Object.entries(m).reduce((P,[D,k])=>`${P}.${D}-${k}`,s),O=N(c,l);o.push(O)}),a;if(i.startsWith("@")){const u=N(r,s),c=`${i} {
|
|
2
2
|
${u.replace(`
|
|
3
3
|
`,`
|
|
4
4
|
`)}
|
|
5
|
-
}`;return
|
|
6
|
-
`);if(!s)return g;let $="";return $=`${s} { ${g} }`,[$,...
|
|
7
|
-
`)},z=(t,s=[])=>{const e=[],n={};if(Object.entries(t).forEach(([
|
|
8
|
-
`)};x.createLogger({level:"info",format:x.format.combine(x.format.colorize(),x.format.cli()),transports:[new x.transports.Console({})]});const
|
|
9
|
-
`),F=
|
|
5
|
+
}`;return o.push(c),a}const h=f.includes("&")?i.replace("&",s):i.startsWith(":")?`${s}${i}`:`${s} ${i}`,F=N(r,h);return o.push(F),a}const p=i.startsWith("-")?i:V(i),b=(h,F=";")=>a=`${a}${h}${F}`,j=h=>b(`${p}:${h}`);if(typeof r=="number")return j(r);if(typeof r!="string")if("toString"in r)r=r.toString();else return a;const{modifiers:S}={},C=function*(){yield I(r),yield Y(r,S)}();for(const{result:h,additionalCss:F=[]}of C)r=h,F.forEach(u=>{const c=N(u,"");b(c,"")});return j(r)},"");if(!g)return o.join(`
|
|
6
|
+
`);if(!s)return g;let $="";return $=`${s} { ${g} }`,[$,...o].join(`
|
|
7
|
+
`)},z=(t,s=[])=>{const e=[],n={};if(Object.entries(t).forEach(([o,g])=>{if(typeof g=="object"){if(!g)return;const $=o.trim(),a=z(g,[...s,$]);e.push(a)}else n[o]=g}),Object.keys(n).length){const o=s.map(V).join("-"),g=N(n,`.${o}`);e.push(g)}return e.join(`
|
|
8
|
+
`)};x.createLogger({level:"info",format:x.format.combine(x.format.colorize(),x.format.cli()),transports:[new x.transports.Console({})]});const E=t=>y.join(t,"./saltygen"),Q=["salty","css","styles","styled"],T=t=>new RegExp(`\\.(${Q.join("|")})\\.`).test(t),v=async t=>{const s=E(t),e=y.join(t,"salty-config.ts"),n=y.join(s,"salty-config.js");await Z.build({entryPoints:[e],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:"esm",external:["react"]});const o=Date.now(),{config:g}=await import(`${n}?t=${o}`);return g},B=async t=>{const s=await v(t),e=new Set,n=(u,c=[])=>u?Object.entries(u).flatMap(([m,l])=>{if(!l)return;if(typeof l=="object")return n(l,[...c,m]);const O=[...c,m].join(".");e.add(`"${O}"`);const P=[...c.map(V),V(m)].join("-"),{result:D}=I(l);return`--${P}: ${D};`}):[],o=u=>u?Object.entries(u).flatMap(([c,m])=>{const l=n(m);return c==="base"?l.join(""):`${c} { ${l.join("")} }`}):[],g=u=>u?Object.entries(u).flatMap(([c,m])=>Object.entries(m).flatMap(([l,O])=>{const P=n(O,[c]),D=`.${c}-${l}, [data-${c}="${l}"]`,k=P.join("");return`${D} { ${k} }`})):[],$=n(s.variables),a=o(s.responsiveVariables),f=g(s.conditionalVariables),r=E(t),i=y.join(r,"css/variables.css"),p=`:root { ${$.join("")} ${a.join("")} } ${f.join("")}`;d.writeFileSync(i,p);const b=y.join(r,"types/css-tokens.d.ts"),S=`type VariableTokens = ${[...e].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;d.writeFileSync(b,S);const w=y.join(r,"css/global.css"),C=N(s.global,"");d.writeFileSync(w,C);const h=y.join(r,"css/templates.css"),F=z(s.templates);d.writeFileSync(h,F)},A=async(t,s)=>{const e=_(t),n=y.join(s,"js",e+".js");await Z.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:"esm",target:["es2022"],keepNames:!0,external:["react"]});const o=Date.now();return await import(`${n}?t=${o}`)},M=async t=>{const s=E(t),e=y.join(s,"salty-config.js"),{config:n}=await import(e);return n},tt=async t=>{try{const s=[],e=[],n=E(t),o=y.join(n,"index.css");(()=>{d.existsSync(n)&&L.execSync("rm -rf "+n),d.mkdirSync(n),d.mkdirSync(y.join(n,"css")),d.mkdirSync(y.join(n,"types"))})(),await B(t);const $=await M(t);async function a(p,b){const j=d.statSync(p);if(j.isDirectory()){const S=d.readdirSync(p);await Promise.all(S.map(w=>a(y.join(p,w),y.join(b,w))))}else if(j.isFile()&&T(p)){const w=await A(p,n),C=[];Object.entries(w).forEach(([c,m])=>{if(m.isKeyframes&&m.css){const k=`${m.animationName}.css`,H=`css/${k}`,J=y.join(n,H);s.push(k),d.writeFileSync(J,m.css);return}if(!m.generator)return;const l=m.generator._withBuildContext({name:c,config:$}),O=`${l.hash}-${l.priority}.css`;e[l.priority]||(e[l.priority]=[]),e[l.priority].push(O),C.push(O);const P=`css/${O}`,D=y.join(n,P);d.writeFileSync(D,l.css)});const h=C.map(c=>`@import url('./${c}');`).join(`
|
|
9
|
+
`),F=_(p,6),u=y.join(n,`css/${F}.css`);d.writeFileSync(u,h)}}await a(t,n);const f=s.map(p=>`@import url('./css/${p}');`).join(`
|
|
10
10
|
`);let i=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
11
11
|
|
|
12
12
|
${["@import url('./css/variables.css');","@import url('./css/global.css');","@import url('./css/templates.css');"].join(`
|
|
13
13
|
`)}
|
|
14
14
|
${f}`;if($.importStrategy!=="component"){const p=e.flat().map(b=>`@import url('./css/${b}');`).join(`
|
|
15
|
-
`);i+=p}d.writeFileSync(
|
|
16
|
-
`),
|
|
17
|
-
`);d.writeFileSync(
|
|
18
|
-
${f}`),f=f.replace("{ styled }","{ styledClient as styled }"),f=f.replace("@salty-css/react/styled","@salty-css/react/styled-client"),f}}catch(e){console.error(e)}},nt=t=>({name:"stylegen",buildStart:()=>tt(t),load:async s=>{if(s
|
|
15
|
+
`);i+=p}d.writeFileSync(o,i)}catch(s){console.error(s)}},st=async(t,s)=>{try{const e=[],n=y.join(t,"./saltygen"),o=y.join(n,"index.css");if(T(s)){const $=await M(t),a=await A(s,n);Object.entries(a).forEach(([b,j])=>{if(!j.generator)return;const S=j.generator._withBuildContext({name:b,config:$}),w=`${S.hash}-${S.priority}.css`,C=`css/${w}`,h=y.join(n,C);e.push(w),d.writeFileSync(h,S.css)});const f=d.readFileSync(o,"utf8").split(`
|
|
16
|
+
`),r=e.map(b=>`@import url('../saltygen/css/${b}');`),p=[...new Set([...f,...r])].join(`
|
|
17
|
+
`);d.writeFileSync(o,p)}}catch(e){console.error(e)}},et=async(t,s)=>{try{const e=y.join(t,"./saltygen");if(T(s)){let o=d.readFileSync(s,"utf8");o.replace(/^(?!export\s)const\s.*/gm,i=>`export ${i}`)!==o&&await G.writeFile(s,o);const $=await M(t),a=await A(s,e);let f=o;Object.entries(a).forEach(([i,p])=>{var u;if(p.isKeyframes){console.log("value",p);return}if(!p.generator)return;const b=p.generator._withBuildContext({name:i,config:$}),j=new RegExp(`${i}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(o);if(!j)return console.error("Could not find the original declaration");const S=(u=j.at(1))==null?void 0:u.trim(),{element:w,variantKeys:C}=b.props,h=`${i} = styled(${S}, "${b.classNames}", "${b._callerName}", ${JSON.stringify(w)}, ${JSON.stringify(C)});`,F=new RegExp(`${i}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`,"g");f=f.replace(F,h)});const r=_(s,6);return $.importStrategy==="component"&&(f=`import '../../saltygen/css/${r}.css';
|
|
18
|
+
${f}`),f=f.replace("{ styled }","{ styledClient as styled }"),f=f.replace("@salty-css/react/styled","@salty-css/react/styled-client"),f}}catch(e){console.error(e)}},nt=t=>({name:"stylegen",buildStart:()=>tt(t),load:async s=>{if(T(s))return await et(t,s)},watchChange:{handler:async s=>{T(s)&&await st(t,s),s.includes("salty-config")&&await B(t)}}});exports.saltyPlugin=nt;
|
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as I from "esbuild";
|
|
2
2
|
import * as P from "winston";
|
|
3
3
|
import { execSync as L } from "child_process";
|
|
4
|
-
import { join as
|
|
5
|
-
import { writeFileSync as x, existsSync as q, mkdirSync as
|
|
4
|
+
import { join as u } from "path";
|
|
5
|
+
import { writeFileSync as x, existsSync as q, mkdirSync as A, statSync as G, readdirSync as U, readFileSync as B } from "fs";
|
|
6
6
|
import { writeFile as X } from "fs/promises";
|
|
7
7
|
const Z = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), Y = (t, s) => {
|
|
8
8
|
let e = "", n;
|
|
@@ -12,7 +12,7 @@ const Z = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), Y = (t, s) => {
|
|
|
12
12
|
let e = s.length;
|
|
13
13
|
for (; e; ) t = t * 33 ^ s.charCodeAt(--e);
|
|
14
14
|
return t;
|
|
15
|
-
},
|
|
15
|
+
}, M = (t, s = 3) => {
|
|
16
16
|
const e = Q(5381, JSON.stringify(t)) >>> 0;
|
|
17
17
|
return Y(e, s);
|
|
18
18
|
};
|
|
@@ -36,23 +36,23 @@ const v = (t, s) => {
|
|
|
36
36
|
if (typeof o == "function" && (o = o()), typeof o == "object") {
|
|
37
37
|
if (!o) return a;
|
|
38
38
|
if (i === "variants")
|
|
39
|
-
return Object.entries(o).forEach(([
|
|
39
|
+
return Object.entries(o).forEach(([y, c]) => {
|
|
40
40
|
c && Object.entries(c).forEach(([m, l]) => {
|
|
41
41
|
if (!l) return;
|
|
42
|
-
const F = `${s}.${
|
|
42
|
+
const F = `${s}.${y}-${m}`, N = O(l, F);
|
|
43
43
|
r.push(N);
|
|
44
44
|
});
|
|
45
45
|
}), a;
|
|
46
46
|
if (i === "defaultVariants")
|
|
47
47
|
return a;
|
|
48
48
|
if (i === "compoundVariants")
|
|
49
|
-
return o.forEach((
|
|
50
|
-
const { css: c, ...m } =
|
|
49
|
+
return o.forEach((y) => {
|
|
50
|
+
const { css: c, ...m } = y, l = Object.entries(m).reduce((N, [D, V]) => `${N}.${D}-${V}`, s), F = O(c, l);
|
|
51
51
|
r.push(F);
|
|
52
52
|
}), a;
|
|
53
53
|
if (i.startsWith("@")) {
|
|
54
|
-
const
|
|
55
|
-
${
|
|
54
|
+
const y = O(o, s), c = `${i} {
|
|
55
|
+
${y.replace(`
|
|
56
56
|
`, `
|
|
57
57
|
`)}
|
|
58
58
|
}`;
|
|
@@ -70,8 +70,8 @@ const v = (t, s) => {
|
|
|
70
70
|
yield H(o), yield v(o, j);
|
|
71
71
|
}();
|
|
72
72
|
for (const { result: d, additionalCss: S = [] } of C)
|
|
73
|
-
o = d, S.forEach((
|
|
74
|
-
const c = O(
|
|
73
|
+
o = d, S.forEach((y) => {
|
|
74
|
+
const c = O(y, "");
|
|
75
75
|
h(c, "");
|
|
76
76
|
});
|
|
77
77
|
return b(o);
|
|
@@ -103,8 +103,8 @@ P.createLogger({
|
|
|
103
103
|
format: P.format.combine(P.format.colorize(), P.format.cli()),
|
|
104
104
|
transports: [new P.transports.Console({})]
|
|
105
105
|
});
|
|
106
|
-
const
|
|
107
|
-
const s =
|
|
106
|
+
const T = (t) => u(t, "./saltygen"), tt = ["salty", "css", "styles", "styled"], E = (t) => new RegExp(`\\.(${tt.join("|")})\\.`).test(t), st = async (t) => {
|
|
107
|
+
const s = T(t), e = u(t, "salty-config.ts"), n = u(s, "salty-config.js");
|
|
108
108
|
await I.build({
|
|
109
109
|
entryPoints: [e],
|
|
110
110
|
minify: !0,
|
|
@@ -117,29 +117,29 @@ const E = (t) => y(t, "./saltygen"), tt = ["salty", "css", "styles", "styled"],
|
|
|
117
117
|
const r = Date.now(), { config: g } = await import(`${n}?t=${r}`);
|
|
118
118
|
return g;
|
|
119
119
|
}, K = async (t) => {
|
|
120
|
-
const s = await st(t), e = /* @__PURE__ */ new Set(), n = (
|
|
120
|
+
const s = await st(t), e = /* @__PURE__ */ new Set(), n = (y, c = []) => y ? Object.entries(y).flatMap(([m, l]) => {
|
|
121
121
|
if (!l) return;
|
|
122
122
|
if (typeof l == "object") return n(l, [...c, m]);
|
|
123
123
|
const F = [...c, m].join(".");
|
|
124
124
|
e.add(`"${F}"`);
|
|
125
125
|
const N = [...c.map(k), k(m)].join("-"), { result: D } = H(l);
|
|
126
126
|
return `--${N}: ${D};`;
|
|
127
|
-
}) : [], r = (
|
|
127
|
+
}) : [], r = (y) => y ? Object.entries(y).flatMap(([c, m]) => {
|
|
128
128
|
const l = n(m);
|
|
129
129
|
return c === "base" ? l.join("") : `${c} { ${l.join("")} }`;
|
|
130
|
-
}) : [], g = (
|
|
130
|
+
}) : [], g = (y) => y ? Object.entries(y).flatMap(([c, m]) => Object.entries(m).flatMap(([l, F]) => {
|
|
131
131
|
const N = n(F, [c]), D = `.${c}-${l}, [data-${c}="${l}"]`, V = N.join("");
|
|
132
132
|
return `${D} { ${V} }`;
|
|
133
|
-
})) : [], $ = n(s.variables), a = r(s.responsiveVariables), f = g(s.conditionalVariables), o =
|
|
133
|
+
})) : [], $ = n(s.variables), a = r(s.responsiveVariables), f = g(s.conditionalVariables), o = T(t), i = u(o, "css/variables.css"), p = `:root { ${$.join("")} ${a.join("")} } ${f.join("")}`;
|
|
134
134
|
x(i, p);
|
|
135
|
-
const h =
|
|
135
|
+
const h = u(o, "types/css-tokens.d.ts"), j = `type VariableTokens = ${[...e].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;
|
|
136
136
|
x(h, j);
|
|
137
|
-
const w =
|
|
137
|
+
const w = u(o, "css/global.css"), C = O(s.global, "");
|
|
138
138
|
x(w, C);
|
|
139
|
-
const d =
|
|
139
|
+
const d = u(o, "css/templates.css"), S = J(s.templates);
|
|
140
140
|
x(d, S);
|
|
141
141
|
}, R = async (t, s) => {
|
|
142
|
-
const e =
|
|
142
|
+
const e = M(t), n = u(s, "js", e + ".js");
|
|
143
143
|
await I.build({
|
|
144
144
|
entryPoints: [t],
|
|
145
145
|
minify: !0,
|
|
@@ -154,25 +154,25 @@ const E = (t) => y(t, "./saltygen"), tt = ["salty", "css", "styles", "styled"],
|
|
|
154
154
|
const r = Date.now();
|
|
155
155
|
return await import(`${n}?t=${r}`);
|
|
156
156
|
}, _ = async (t) => {
|
|
157
|
-
const s =
|
|
157
|
+
const s = T(t), e = u(s, "salty-config.js"), { config: n } = await import(e);
|
|
158
158
|
return n;
|
|
159
159
|
}, et = async (t) => {
|
|
160
160
|
try {
|
|
161
|
-
const s = [], e = [], n =
|
|
161
|
+
const s = [], e = [], n = T(t), r = u(n, "index.css");
|
|
162
162
|
(() => {
|
|
163
|
-
q(n) && L("rm -rf " + n),
|
|
163
|
+
q(n) && L("rm -rf " + n), A(n), A(u(n, "css")), A(u(n, "types"));
|
|
164
164
|
})(), await K(t);
|
|
165
165
|
const $ = await _(t);
|
|
166
166
|
async function a(p, h) {
|
|
167
167
|
const b = G(p);
|
|
168
168
|
if (b.isDirectory()) {
|
|
169
169
|
const j = U(p);
|
|
170
|
-
await Promise.all(j.map((w) => a(
|
|
171
|
-
} else if (b.isFile() &&
|
|
170
|
+
await Promise.all(j.map((w) => a(u(p, w), u(h, w))));
|
|
171
|
+
} else if (b.isFile() && E(p)) {
|
|
172
172
|
const w = await R(p, n), C = [];
|
|
173
173
|
Object.entries(w).forEach(([c, m]) => {
|
|
174
174
|
if (m.isKeyframes && m.css) {
|
|
175
|
-
const V = `${m.animationName}.css`, W = `css/${V}`, z =
|
|
175
|
+
const V = `${m.animationName}.css`, W = `css/${V}`, z = u(n, W);
|
|
176
176
|
s.push(V), x(z, m.css);
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
@@ -182,12 +182,12 @@ const E = (t) => y(t, "./saltygen"), tt = ["salty", "css", "styles", "styled"],
|
|
|
182
182
|
config: $
|
|
183
183
|
}), F = `${l.hash}-${l.priority}.css`;
|
|
184
184
|
e[l.priority] || (e[l.priority] = []), e[l.priority].push(F), C.push(F);
|
|
185
|
-
const N = `css/${F}`, D =
|
|
185
|
+
const N = `css/${F}`, D = u(n, N);
|
|
186
186
|
x(D, l.css);
|
|
187
187
|
});
|
|
188
188
|
const d = C.map((c) => `@import url('./${c}');`).join(`
|
|
189
|
-
`), S =
|
|
190
|
-
x(
|
|
189
|
+
`), S = M(p, 6), y = u(n, `css/${S}.css`);
|
|
190
|
+
x(y, d);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
await a(t, n);
|
|
@@ -209,15 +209,15 @@ ${f}`;
|
|
|
209
209
|
}
|
|
210
210
|
}, nt = async (t, s) => {
|
|
211
211
|
try {
|
|
212
|
-
const e = [], n =
|
|
213
|
-
if (
|
|
212
|
+
const e = [], n = u(t, "./saltygen"), r = u(n, "index.css");
|
|
213
|
+
if (E(s)) {
|
|
214
214
|
const $ = await _(t), a = await R(s, n);
|
|
215
215
|
Object.entries(a).forEach(([h, b]) => {
|
|
216
216
|
if (!b.generator) return;
|
|
217
217
|
const j = b.generator._withBuildContext({
|
|
218
218
|
name: h,
|
|
219
219
|
config: $
|
|
220
|
-
}), w = `${j.hash}-${j.priority}.css`, C = `css/${w}`, d =
|
|
220
|
+
}), w = `${j.hash}-${j.priority}.css`, C = `css/${w}`, d = u(n, C);
|
|
221
221
|
e.push(w), x(d, j.css);
|
|
222
222
|
});
|
|
223
223
|
const f = B(r, "utf8").split(`
|
|
@@ -230,14 +230,14 @@ ${f}`;
|
|
|
230
230
|
}
|
|
231
231
|
}, rt = async (t, s) => {
|
|
232
232
|
try {
|
|
233
|
-
const e =
|
|
234
|
-
if (
|
|
233
|
+
const e = u(t, "./saltygen");
|
|
234
|
+
if (E(s)) {
|
|
235
235
|
let r = B(s, "utf8");
|
|
236
236
|
r.replace(/^(?!export\s)const\s.*/gm, (i) => `export ${i}`) !== r && await X(s, r);
|
|
237
237
|
const $ = await _(t), a = await R(s, e);
|
|
238
238
|
let f = r;
|
|
239
239
|
Object.entries(a).forEach(([i, p]) => {
|
|
240
|
-
var
|
|
240
|
+
var y;
|
|
241
241
|
if (p.isKeyframes) {
|
|
242
242
|
console.log("value", p);
|
|
243
243
|
return;
|
|
@@ -249,12 +249,12 @@ ${f}`;
|
|
|
249
249
|
}), b = new RegExp(`${i}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(r);
|
|
250
250
|
if (!b)
|
|
251
251
|
return console.error("Could not find the original declaration");
|
|
252
|
-
const j = (
|
|
252
|
+
const j = (y = b.at(1)) == null ? void 0 : y.trim(), { element: w, variantKeys: C } = h.props, d = `${i} = styled(${j}, "${h.classNames}", "${h._callerName}", ${JSON.stringify(w)}, ${JSON.stringify(
|
|
253
253
|
C
|
|
254
254
|
)});`, S = new RegExp(`${i}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`, "g");
|
|
255
255
|
f = f.replace(S, d);
|
|
256
256
|
});
|
|
257
|
-
const o =
|
|
257
|
+
const o = M(s, 6);
|
|
258
258
|
return $.importStrategy === "component" && (f = `import '../../saltygen/css/${o}.css';
|
|
259
259
|
${f}`), f = f.replace("{ styled }", "{ styledClient as styled }"), f = f.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), f;
|
|
260
260
|
}
|
|
@@ -265,12 +265,12 @@ ${f}`), f = f.replace("{ styled }", "{ styledClient as styled }"), f = f.replace
|
|
|
265
265
|
name: "stylegen",
|
|
266
266
|
buildStart: () => et(t),
|
|
267
267
|
load: async (s) => {
|
|
268
|
-
if (s
|
|
268
|
+
if (E(s))
|
|
269
269
|
return await rt(t, s);
|
|
270
270
|
},
|
|
271
271
|
watchChange: {
|
|
272
272
|
handler: async (s) => {
|
|
273
|
-
s
|
|
273
|
+
E(s) && await nt(t, s), s.includes("salty-config") && await K(t);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
});
|