@salty-css/core 0.0.1-alpha.60 → 0.0.1-alpha.61
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/compiler/index.cjs +9 -9
- package/compiler/index.d.ts +1 -1
- package/compiler/index.js +142 -134
- package/package.json +1 -1
package/compiler/index.cjs
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
2
|
-
`),
|
3
|
-
`);let
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("esbuild"),A=require("child_process"),M=require("../dash-case-DKzpenwY.cjs"),o=require("path"),l=require("fs"),X=require("fs/promises"),v=require("../parse-templates-DVK3iZIl.cjs");var R=typeof document<"u"?document.currentScript:null;function Y(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const e=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,e.get?e:{enumerable:!0,get:()=>t[n]})}}return s.default=t,Object.freeze(s)}const I=Y(J),z=()=>(typeof document>"u"?require("url").pathToFileURL(__filename).href:R&&R.tagName.toUpperCase()==="SCRIPT"&&R.src||new URL("compiler/index.cjs",document.baseURI).href).endsWith(".cjs")?"cjs":"esm",V={externalModules:[]},B=t=>{if(V.externalModules.length>0)return V.externalModules;const s=o.join(t,"salty.config.ts"),e=l.readFileSync(s,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!e)return[];const a=e[1].split(",").map(F=>F.replace(/['"`]/g,"").trim());return V.externalModules=a,a},N=t=>o.join(t,"./saltygen"),H=["salty","css","styles","styled"],U=(t=[])=>new RegExp(`\\.(${[...H,...t].join("|")})\\.`),E=(t,s=[])=>U(s).test(t),Z=async t=>{const s=N(t),n=o.join(t,"salty.config.ts"),e=o.join(s,"salty.config.js"),a=z(),F=B(t);await I.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:e,format:a,external:F});const f=Date.now(),{config:g}=await import(`${e}?t=${f}`);return g},W=async t=>{const s=await Z(t),n=new Set,e=(c,u=[])=>c?Object.entries(c).flatMap(([d,p])=>{if(!p)return;if(typeof p=="object")return e(p,[...u,d]);const C=[...u,d].join(".");n.add(`"${C}"`);const h=[...u.map(M.dashCase),M.dashCase(d)].join("-"),{result:j}=v.parseValueTokens(p);return`--${h}: ${j};`}):[],a=c=>c?Object.entries(c).flatMap(([u,d])=>{const p=e(d);return u==="base"?p.join(""):`${u} { ${p.join("")} }`}):[],F=c=>c?Object.entries(c).flatMap(([u,d])=>Object.entries(d).flatMap(([p,C])=>{const h=e(C,[u]),j=`.${u}-${p}, [data-${u}="${p}"]`,D=h.join("");return`${j} { ${D} }`})):[],f=e(s.variables),g=a(s.responsiveVariables),i=F(s.conditionalVariables),w=N(t),S=o.join(w,"css/variables.css"),T=`:root { ${f.join("")} ${g.join("")} } ${i.join("")}`;l.writeFileSync(S,T);const m=o.join(w,"types/css-tokens.d.ts"),y=`type VariableTokens = ${[...n].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;l.writeFileSync(m,y);const x=o.join(w,"css/global.css"),$=v.parseStyles(s.global,"");l.writeFileSync(x,$);const b=o.join(w,"css/templates.css"),k=v.parseTemplates(s.templates);l.writeFileSync(b,k)},O=async(t,s,n)=>{const e=M.toHash(s),a=o.join(n,"js",e+".js"),F=z(),f=B(t);await I.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:a,format:F,target:["es2022"],keepNames:!0,external:f});const g=Date.now();return await import(`${a}?t=${g}`)},_=async t=>{const s=N(t),n=o.join(s,"salty.config.js"),{config:e}=await import(n);return e},Q=async t=>{try{const s=[],n=[],e=N(t),a=o.join(e,"index.css");(()=>{l.existsSync(e)&&A.execSync("rm -rf "+e),l.mkdirSync(e),l.mkdirSync(o.join(e,"css")),l.mkdirSync(o.join(e,"types"))})(),await W(t);const f=await _(t);async function g(r,y){const x=["node_modules","saltygen"],$=l.statSync(r);if($.isDirectory()){const b=l.readdirSync(r);if(x.some(c=>r.includes(c)))return;await Promise.all(b.map(c=>g(o.join(r,c),o.join(y,c))))}else if($.isFile()&&E(r)){const k=await O(t,r,e),c=[];Object.entries(k).forEach(([C,h])=>{if(h.isKeyframes&&h.css){const q=`${h.animationName}.css`,L=`css/${q}`,G=o.join(e,L);s.push(q),l.writeFileSync(G,h.css);return}if(!h.generator)return;const j=h.generator._withBuildContext({name:C,config:f}),D=`${j.hash}-${j.priority}.css`;n[j.priority]||(n[j.priority]=[]),n[j.priority].push(D),c.push(D);const P=`css/${D}`,K=o.join(e,P);l.writeFileSync(K,j.css)});const u=c.map(C=>`@import url('./${C}');`).join(`
|
2
|
+
`),d=M.toHash(r,6),p=o.join(e,`css/${d}.css`);l.writeFileSync(p,u)}}await g(t,e);const i=s.map(r=>`@import url('./css/${r}');`).join(`
|
3
|
+
`);let m=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
4
4
|
|
5
|
-
${["variables.css","global.css","templates.css"].filter(
|
5
|
+
${["variables.css","global.css","templates.css"].filter(r=>{try{return l.readFileSync(o.join(e,"css",r),"utf8").length>0}catch{return!1}}).map(r=>`@import url('./css/${r}');`).join(`
|
6
6
|
`)}
|
7
|
-
${
|
8
|
-
`);
|
9
|
-
`),
|
10
|
-
`);
|
11
|
-
${
|
7
|
+
${i}`;if(f.importStrategy!=="component"){const r=n.flat().map(y=>`@import url('./css/${y}');`).join(`
|
8
|
+
`);m+=r}l.writeFileSync(a,m)}catch(s){console.error(s)}},tt=async(t,s)=>{try{const n=[],e=o.join(t,"./saltygen"),a=o.join(e,"index.css");if(E(s)){const f=await _(t),g=await O(t,s,e);Object.entries(g).forEach(([m,r])=>{if(!r.generator)return;const y=r.generator._withBuildContext({name:m,config:f}),x=`${y.hash}-${y.priority}.css`,$=`css/${x}`,b=o.join(e,$);n.push(x),l.writeFileSync(b,y.css)});const i=l.readFileSync(a,"utf8").split(`
|
9
|
+
`),w=n.map(m=>`@import url('../saltygen/css/${m}');`),T=[...new Set([...i,...w])].join(`
|
10
|
+
`);l.writeFileSync(a,T)}}catch(n){console.error(n)}},et=async(t,s)=>{try{const n=o.join(t,"./saltygen");if(E(s)){const a=l.readFileSync(s,"utf8");a.replace(/^(?!export\s)const\s.*/gm,S=>`export ${S}`)!==a&&await X.writeFile(s,a);const f=await _(t),g=await O(t,s,n);let i=a;Object.entries(g).forEach(([S,T])=>{var D;if(T.isKeyframes||!T.generator)return;const m=T.generator._withBuildContext({name:S,config:f}),r=new RegExp(`\\s${S}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!r)return console.error("Could not find the original declaration");const y=(D=r.at(1))==null?void 0:D.trim(),x=new RegExp(`\\s${S}[=\\s]+styled\\(`,"g").exec(i);if(!x)return console.error("Could not find the original declaration");const{index:$}=x;let b=!1;const k=setTimeout(()=>b=!0,5e3);let c=0,u=!1,d=0;for(;!u&&!b;){const P=i[$+c];P==="("&&d++,P===")"&&d--,d===0&&P===")"&&(u=!0),c>i.length&&(b=!0),c++}if(!b)clearTimeout(k);else throw new Error("Failed to find the end of the styled call and timed out");const p=$+c,C=i.slice($,p),h=i,j=` ${S} = styled(${y}, "${m.classNames}", "${m._callerName}", ${JSON.stringify(m.props)});`;i=i.replace(C,j),h===i&&console.error("Minimize file failed to change content",{name:S,tagName:y})});const w=M.toHash(s,6);return f.importStrategy==="component"&&(i=`import '../../saltygen/css/${w}.css';
|
11
|
+
${i}`),i=i.replace("{ styled }","{ styledClient as styled }"),i=i.replace("@salty-css/react/styled","@salty-css/react/styled-client"),i}}catch(n){console.error("Error in minimizeFile:",n)}};exports.compileSaltyFile=O;exports.generateConfigStyles=W;exports.generateCss=Q;exports.generateFile=tt;exports.isSaltyFile=E;exports.minimizeFile=et;exports.saltyFileExtensions=H;exports.saltyFileRegExp=U;
|
package/compiler/index.d.ts
CHANGED
@@ -3,7 +3,7 @@ export declare const saltyFileExtensions: string[];
|
|
3
3
|
export declare const saltyFileRegExp: (additional?: string[]) => RegExp;
|
4
4
|
export declare const isSaltyFile: (file: string, additional?: string[]) => boolean;
|
5
5
|
export declare const generateConfigStyles: (dirname: string) => Promise<void>;
|
6
|
-
export declare const compileSaltyFile: (sourceFilePath: string, outputDirectory: string) => Promise<{
|
6
|
+
export declare const compileSaltyFile: (dirname: string, sourceFilePath: string, outputDirectory: string) => Promise<{
|
7
7
|
[key: string]: {
|
8
8
|
generator: StyleComponentGenerator;
|
9
9
|
isKeyframes?: boolean;
|
package/compiler/index.js
CHANGED
@@ -1,188 +1,196 @@
|
|
1
|
-
import * as
|
2
|
-
import { execSync as
|
3
|
-
import { t as
|
4
|
-
import { join as
|
5
|
-
import { writeFileSync as
|
6
|
-
import { writeFile as
|
7
|
-
import { p as
|
8
|
-
const
|
9
|
-
|
10
|
-
|
1
|
+
import * as z from "esbuild";
|
2
|
+
import { execSync as q } from "child_process";
|
3
|
+
import { t as v, d as _ } from "../dash-case-DMQMcCO6.js";
|
4
|
+
import { join as o } from "path";
|
5
|
+
import { writeFileSync as F, existsSync as A, mkdirSync as E, statSync as L, readdirSync as U, readFileSync as M } from "fs";
|
6
|
+
import { writeFile as X } from "fs/promises";
|
7
|
+
import { p as Y, a as Z, b as Q } from "../parse-templates-DUUSaubj.js";
|
8
|
+
const W = () => import.meta.url.endsWith(".cjs") ? "cjs" : "esm", V = {
|
9
|
+
externalModules: []
|
10
|
+
}, H = (t) => {
|
11
|
+
if (V.externalModules.length > 0) return V.externalModules;
|
12
|
+
const e = o(t, "salty.config.ts"), s = M(e, "utf8").match(/externalModules:\s?\[(.*)\]/);
|
13
|
+
if (!s) return [];
|
14
|
+
const a = s[1].split(",").map((w) => w.replace(/['"`]/g, "").trim());
|
15
|
+
return V.externalModules = a, a;
|
16
|
+
}, N = (t) => o(t, "./saltygen"), tt = ["salty", "css", "styles", "styled"], st = (t = []) => new RegExp(`\\.(${[...tt, ...t].join("|")})\\.`), O = (t, e = []) => st(e).test(t), et = async (t) => {
|
17
|
+
const e = N(t), n = o(t, "salty.config.ts"), s = o(e, "salty.config.js"), a = W(), w = H(t);
|
18
|
+
await z.build({
|
11
19
|
entryPoints: [n],
|
12
20
|
minify: !0,
|
13
21
|
treeShaking: !0,
|
14
22
|
bundle: !0,
|
15
|
-
outfile:
|
23
|
+
outfile: s,
|
16
24
|
format: a,
|
17
|
-
external:
|
25
|
+
external: w
|
18
26
|
});
|
19
|
-
const
|
27
|
+
const f = Date.now(), { config: y } = await import(`${s}?t=${f}`);
|
20
28
|
return y;
|
21
|
-
},
|
22
|
-
const e = await
|
29
|
+
}, nt = async (t) => {
|
30
|
+
const e = await et(t), n = /* @__PURE__ */ new Set(), s = (i, l = []) => i ? Object.entries(i).flatMap(([m, p]) => {
|
23
31
|
if (!p) return;
|
24
|
-
if (typeof p == "object") return
|
25
|
-
const
|
26
|
-
n.add(`"${
|
27
|
-
const
|
28
|
-
return `--${
|
29
|
-
}) : [], a = (
|
30
|
-
const p =
|
32
|
+
if (typeof p == "object") return s(p, [...l, m]);
|
33
|
+
const C = [...l, m].join(".");
|
34
|
+
n.add(`"${C}"`);
|
35
|
+
const d = [...l.map(_), _(m)].join("-"), { result: h } = Q(p);
|
36
|
+
return `--${d}: ${h};`;
|
37
|
+
}) : [], a = (i) => i ? Object.entries(i).flatMap(([l, m]) => {
|
38
|
+
const p = s(m);
|
31
39
|
return l === "base" ? p.join("") : `${l} { ${p.join("")} }`;
|
32
|
-
}) : [],
|
33
|
-
const
|
34
|
-
return `${
|
35
|
-
})) : [],
|
36
|
-
|
37
|
-
const
|
38
|
-
|
39
|
-
const
|
40
|
-
|
41
|
-
const
|
42
|
-
|
43
|
-
},
|
44
|
-
const
|
45
|
-
|
46
|
-
entryPoints: [
|
40
|
+
}) : [], w = (i) => i ? Object.entries(i).flatMap(([l, m]) => Object.entries(m).flatMap(([p, C]) => {
|
41
|
+
const d = s(C, [l]), h = `.${l}-${p}, [data-${l}="${p}"]`, k = d.join("");
|
42
|
+
return `${h} { ${k} }`;
|
43
|
+
})) : [], f = s(e.variables), y = a(e.responsiveVariables), r = w(e.conditionalVariables), S = N(t), $ = o(S, "css/variables.css"), D = `:root { ${f.join("")} ${y.join("")} } ${r.join("")}`;
|
44
|
+
F($, D);
|
45
|
+
const g = o(S, "types/css-tokens.d.ts"), u = `type VariableTokens = ${[...n].join("|") || '""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;
|
46
|
+
F(g, u);
|
47
|
+
const j = o(S, "css/global.css"), x = Y(e.global, "");
|
48
|
+
F(j, x);
|
49
|
+
const b = o(S, "css/templates.css"), T = Z(e.templates);
|
50
|
+
F(b, T);
|
51
|
+
}, R = async (t, e, n) => {
|
52
|
+
const s = v(e), a = o(n, "js", s + ".js"), w = W(), f = H(t);
|
53
|
+
await z.build({
|
54
|
+
entryPoints: [e],
|
47
55
|
minify: !0,
|
48
56
|
treeShaking: !0,
|
49
57
|
bundle: !0,
|
50
|
-
outfile:
|
51
|
-
format:
|
58
|
+
outfile: a,
|
59
|
+
format: w,
|
52
60
|
target: ["es2022"],
|
53
61
|
keepNames: !0,
|
54
|
-
external:
|
62
|
+
external: f
|
55
63
|
});
|
56
|
-
const
|
57
|
-
return await import(`${
|
58
|
-
},
|
59
|
-
const e = N(
|
60
|
-
return
|
61
|
-
},
|
64
|
+
const y = Date.now();
|
65
|
+
return await import(`${a}?t=${y}`);
|
66
|
+
}, B = async (t) => {
|
67
|
+
const e = N(t), n = o(e, "salty.config.js"), { config: s } = await import(n);
|
68
|
+
return s;
|
69
|
+
}, pt = async (t) => {
|
62
70
|
try {
|
63
|
-
const e = [], n = [],
|
71
|
+
const e = [], n = [], s = N(t), a = o(s, "index.css");
|
64
72
|
(() => {
|
65
|
-
|
66
|
-
})(), await
|
67
|
-
const
|
68
|
-
async function
|
69
|
-
const
|
70
|
-
if (
|
71
|
-
const
|
72
|
-
if (
|
73
|
-
await Promise.all(
|
74
|
-
} else if (
|
75
|
-
const T = await
|
76
|
-
Object.entries(T).forEach(([
|
77
|
-
if (
|
78
|
-
const
|
79
|
-
e.push(
|
73
|
+
A(s) && q("rm -rf " + s), E(s), E(o(s, "css")), E(o(s, "types"));
|
74
|
+
})(), await nt(t);
|
75
|
+
const f = await B(t);
|
76
|
+
async function y(c, u) {
|
77
|
+
const j = ["node_modules", "saltygen"], x = L(c);
|
78
|
+
if (x.isDirectory()) {
|
79
|
+
const b = U(c);
|
80
|
+
if (j.some((i) => c.includes(i))) return;
|
81
|
+
await Promise.all(b.map((i) => y(o(c, i), o(u, i))));
|
82
|
+
} else if (x.isFile() && O(c)) {
|
83
|
+
const T = await R(t, c, s), i = [];
|
84
|
+
Object.entries(T).forEach(([C, d]) => {
|
85
|
+
if (d.isKeyframes && d.css) {
|
86
|
+
const I = `${d.animationName}.css`, G = `css/${I}`, J = o(s, G);
|
87
|
+
e.push(I), F(J, d.css);
|
80
88
|
return;
|
81
89
|
}
|
82
|
-
if (!
|
83
|
-
const
|
84
|
-
name:
|
85
|
-
config:
|
86
|
-
}), k = `${
|
87
|
-
n[
|
88
|
-
const P = `css/${k}`,
|
89
|
-
|
90
|
+
if (!d.generator) return;
|
91
|
+
const h = d.generator._withBuildContext({
|
92
|
+
name: C,
|
93
|
+
config: f
|
94
|
+
}), k = `${h.hash}-${h.priority}.css`;
|
95
|
+
n[h.priority] || (n[h.priority] = []), n[h.priority].push(k), i.push(k);
|
96
|
+
const P = `css/${k}`, K = o(s, P);
|
97
|
+
F(K, h.css);
|
90
98
|
});
|
91
|
-
const l =
|
92
|
-
`), m =
|
93
|
-
|
99
|
+
const l = i.map((C) => `@import url('./${C}');`).join(`
|
100
|
+
`), m = v(c, 6), p = o(s, `css/${m}.css`);
|
101
|
+
F(p, l);
|
94
102
|
}
|
95
103
|
}
|
96
|
-
await
|
97
|
-
const
|
104
|
+
await y(t, s);
|
105
|
+
const r = e.map((c) => `@import url('./css/${c}');`).join(`
|
98
106
|
`);
|
99
|
-
let
|
107
|
+
let g = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
100
108
|
|
101
|
-
${["variables.css", "global.css", "templates.css"].filter((
|
109
|
+
${["variables.css", "global.css", "templates.css"].filter((c) => {
|
102
110
|
try {
|
103
|
-
return
|
111
|
+
return M(o(s, "css", c), "utf8").length > 0;
|
104
112
|
} catch {
|
105
113
|
return !1;
|
106
114
|
}
|
107
|
-
}).map((
|
115
|
+
}).map((c) => `@import url('./css/${c}');`).join(`
|
108
116
|
`)}
|
109
|
-
${
|
110
|
-
if (
|
111
|
-
const
|
117
|
+
${r}`;
|
118
|
+
if (f.importStrategy !== "component") {
|
119
|
+
const c = n.flat().map((u) => `@import url('./css/${u}');`).join(`
|
112
120
|
`);
|
113
|
-
|
121
|
+
g += c;
|
114
122
|
}
|
115
|
-
|
123
|
+
F(a, g);
|
116
124
|
} catch (e) {
|
117
125
|
console.error(e);
|
118
126
|
}
|
119
|
-
},
|
127
|
+
}, ft = async (t, e) => {
|
120
128
|
try {
|
121
|
-
const n = [],
|
122
|
-
if (
|
123
|
-
const
|
124
|
-
Object.entries(
|
125
|
-
if (!
|
126
|
-
const
|
127
|
-
name:
|
128
|
-
config:
|
129
|
-
}),
|
130
|
-
n.push(
|
129
|
+
const n = [], s = o(t, "./saltygen"), a = o(s, "index.css");
|
130
|
+
if (O(e)) {
|
131
|
+
const f = await B(t), y = await R(t, e, s);
|
132
|
+
Object.entries(y).forEach(([g, c]) => {
|
133
|
+
if (!c.generator) return;
|
134
|
+
const u = c.generator._withBuildContext({
|
135
|
+
name: g,
|
136
|
+
config: f
|
137
|
+
}), j = `${u.hash}-${u.priority}.css`, x = `css/${j}`, b = o(s, x);
|
138
|
+
n.push(j), F(b, u.css);
|
131
139
|
});
|
132
|
-
const
|
133
|
-
`),
|
140
|
+
const r = M(a, "utf8").split(`
|
141
|
+
`), S = n.map((g) => `@import url('../saltygen/css/${g}');`), D = [.../* @__PURE__ */ new Set([...r, ...S])].join(`
|
134
142
|
`);
|
135
|
-
|
143
|
+
F(a, D);
|
136
144
|
}
|
137
145
|
} catch (n) {
|
138
146
|
console.error(n);
|
139
147
|
}
|
140
|
-
},
|
148
|
+
}, ut = async (t, e) => {
|
141
149
|
try {
|
142
|
-
const n =
|
143
|
-
if (
|
144
|
-
const a =
|
145
|
-
a.replace(/^(?!export\s)const\s.*/gm, (
|
146
|
-
const
|
147
|
-
let
|
148
|
-
Object.entries(
|
150
|
+
const n = o(t, "./saltygen");
|
151
|
+
if (O(e)) {
|
152
|
+
const a = M(e, "utf8");
|
153
|
+
a.replace(/^(?!export\s)const\s.*/gm, ($) => `export ${$}`) !== a && await X(e, a);
|
154
|
+
const f = await B(t), y = await R(t, e, n);
|
155
|
+
let r = a;
|
156
|
+
Object.entries(y).forEach(([$, D]) => {
|
149
157
|
var k;
|
150
158
|
if (D.isKeyframes || !D.generator) return;
|
151
|
-
const
|
152
|
-
name:
|
153
|
-
config:
|
154
|
-
}),
|
155
|
-
if (!
|
156
|
-
const
|
157
|
-
if (!
|
158
|
-
const { index:
|
159
|
-
let
|
160
|
-
const T = setTimeout(() =>
|
161
|
-
let
|
162
|
-
for (; !l &&
|
163
|
-
const P =
|
164
|
-
P === "(" && m++, P === ")" && m--, m === 0 && P === ")" && (l = !0),
|
159
|
+
const g = D.generator._withBuildContext({
|
160
|
+
name: $,
|
161
|
+
config: f
|
162
|
+
}), c = new RegExp(`\\s${$}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(a);
|
163
|
+
if (!c) return console.error("Could not find the original declaration");
|
164
|
+
const u = (k = c.at(1)) == null ? void 0 : k.trim(), j = new RegExp(`\\s${$}[=\\s]+styled\\(`, "g").exec(r);
|
165
|
+
if (!j) return console.error("Could not find the original declaration");
|
166
|
+
const { index: x } = j;
|
167
|
+
let b = !1;
|
168
|
+
const T = setTimeout(() => b = !0, 5e3);
|
169
|
+
let i = 0, l = !1, m = 0;
|
170
|
+
for (; !l && !b; ) {
|
171
|
+
const P = r[x + i];
|
172
|
+
P === "(" && m++, P === ")" && m--, m === 0 && P === ")" && (l = !0), i > r.length && (b = !0), i++;
|
165
173
|
}
|
166
|
-
if (
|
174
|
+
if (!b) clearTimeout(T);
|
167
175
|
else throw new Error("Failed to find the end of the styled call and timed out");
|
168
|
-
const p =
|
169
|
-
|
176
|
+
const p = x + i, C = r.slice(x, p), d = r, h = ` ${$} = styled(${u}, "${g.classNames}", "${g._callerName}", ${JSON.stringify(g.props)});`;
|
177
|
+
r = r.replace(C, h), d === r && console.error("Minimize file failed to change content", { name: $, tagName: u });
|
170
178
|
});
|
171
|
-
const
|
172
|
-
return
|
173
|
-
${
|
179
|
+
const S = v(e, 6);
|
180
|
+
return f.importStrategy === "component" && (r = `import '../../saltygen/css/${S}.css';
|
181
|
+
${r}`), r = r.replace("{ styled }", "{ styledClient as styled }"), r = r.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), r;
|
174
182
|
}
|
175
183
|
} catch (n) {
|
176
184
|
console.error("Error in minimizeFile:", n);
|
177
185
|
}
|
178
186
|
};
|
179
187
|
export {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
+
R as compileSaltyFile,
|
189
|
+
nt as generateConfigStyles,
|
190
|
+
pt as generateCss,
|
191
|
+
ft as generateFile,
|
192
|
+
O as isSaltyFile,
|
193
|
+
ut as minimizeFile,
|
194
|
+
tt as saltyFileExtensions,
|
195
|
+
st as saltyFileRegExp
|
188
196
|
};
|