@salty-css/core 0.0.1-alpha.50 → 0.0.1-alpha.52
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 +13 -2
- package/compiler/index.cjs +9 -9
- package/compiler/index.js +135 -129
- package/package.json +1 -1
package/README.md
CHANGED
@@ -22,7 +22,7 @@ In the world of frontend dev is there anything saltier than CSS? Salty CSS is bu
|
|
22
22
|
|
23
23
|
#### Initialize Salty CSS for a project
|
24
24
|
|
25
|
-
In your existing repository run `npx salty-css init [directory]` which installs required salty-css packages to the current directory and creates project files to the provided directory. Directory can be left blank if you want files to be created to the current directory. Init will also create `.saltyrc` which contains some metadata for future CLI commands.
|
25
|
+
In your existing repository run `npx salty-css init [directory]` which installs required salty-css packages to the current directory, detects framework in use (current support for vite and next.js) and creates project files to the provided directory. Directory can be left blank if you want files to be created to the current directory. Init will also create `.saltyrc` which contains some metadata for future CLI commands.
|
26
26
|
|
27
27
|
#### Create components
|
28
28
|
|
@@ -43,11 +43,22 @@ To ease the pain of package updates all Salty CSS packages can be updated with `
|
|
43
43
|
1. Install related dependencies: `npm i @salty-css/core @salty-css/react`
|
44
44
|
2. Create `salty.config.ts` to your app directory
|
45
45
|
|
46
|
+
#### Next.js
|
47
|
+
|
48
|
+
1. First check the instructions for React
|
49
|
+
2. For Next.js support install `npm i -D @salty-css/next`
|
50
|
+
3. Add Salty CSS plugin to next.js config
|
51
|
+
|
52
|
+
- **Next.js 15:** In `next.config.ts` add import for salty plugin `import { withSaltyCss } from '@salty-css/next';` and then add `withSaltyCss` to wrap your nextConfig export like so `export default withSaltyCss(nextConfig);`
|
53
|
+
- **Next.js 14 and older:** In `next.config.js` add import for salty plugin `const { withSaltyCss } = require('@salty-css/next');` and then add `withSaltyCss` to wrap your nextConfig export like so `module.exports = withSaltyCss(nextConfig);`
|
54
|
+
|
55
|
+
4. Make sure that `salty.config.ts` and `next.config.ts` are in the same folder!
|
56
|
+
|
46
57
|
#### Vite
|
47
58
|
|
48
59
|
1. First check the instructions for React
|
49
60
|
2. For Vite support install `npm i -D @salty-css/vite`
|
50
|
-
3. In `vite.config
|
61
|
+
3. In `vite.config` add import for salty plugin `import { saltyPlugin } from '@salty-css/vite';` and then add `saltyPlugin(__dirname)` to your vite configuration plugins
|
51
62
|
4. Make sure that `salty.config.ts` and `vite.config.ts` are in the same folder!
|
52
63
|
|
53
64
|
### Create components
|
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 K=require("esbuild"),W=require("child_process"),N=require("../dash-case-DKzpenwY.cjs"),o=require("path"),c=require("fs"),G=require("fs/promises"),V=require("../parse-templates-W0YfTmOT.cjs");function J(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 q=J(K),O=t=>o.join(t,"./saltygen"),M=["salty","css","styles","styled"],z=(t=[])=>new RegExp(`\\.(${[...M,...t].join("|")})\\.`),E=(t,s=[])=>z(s).test(t),A=async t=>{const s=O(t),n=o.join(t,"salty.config.ts"),e=o.join(s,"salty.config.js");await q.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:e,format:"esm",external:["react"]});const a=Date.now(),{config:D}=await import(`${e}?t=${a}`);return D},B=async t=>{const s=await A(t),n=new Set,e=(y,f=[])=>y?Object.entries(y).flatMap(([g,l])=>{if(!l)return;if(typeof l=="object")return e(l,[...f,g]);const m=[...f,g].join(".");n.add(`"${m}"`);const h=[...f.map(N.dashCase),N.dashCase(g)].join("-"),{result:w}=V.parseValueTokens(l);return`--${h}: ${w};`}):[],a=y=>y?Object.entries(y).flatMap(([f,g])=>{const l=e(g);return f==="base"?l.join(""):`${f} { ${l.join("")} }`}):[],D=y=>y?Object.entries(y).flatMap(([f,g])=>Object.entries(g).flatMap(([l,m])=>{const h=e(m,[f]),w=`.${f}-${l}, [data-${f}="${l}"]`,k=h.join("");return`${w} { ${k} }`})):[],S=e(s.variables),C=a(s.responsiveVariables),i=D(s.conditionalVariables),$=O(t),j=o.join($,"css/variables.css"),x=`:root { ${S.join("")} ${C.join("")} } ${i.join("")}`;c.writeFileSync(j,x);const d=o.join($,"types/css-tokens.d.ts"),p=`type VariableTokens = ${[...n].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;c.writeFileSync(d,p);const b=o.join($,"css/global.css"),F=V.parseStyles(s.global,"");c.writeFileSync(b,F);const u=o.join($,"css/templates.css"),P=V.parseTemplates(s.templates);c.writeFileSync(u,P)},v=async(t,s)=>{const n=N.toHash(t),e=o.join(s,"js",n+".js");await q.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:e,format:"esm",target:["es2022"],keepNames:!0,external:["react"]});const a=Date.now();return await import(`${e}?t=${a}`)},R=async t=>{const s=O(t),n=o.join(s,"salty.config.js"),{config:e}=await import(n);return e},L=async t=>{try{const s=[],n=[],e=O(t),a=o.join(e,"index.css");(()=>{c.existsSync(e)&&W.execSync("rm -rf "+e),c.mkdirSync(e),c.mkdirSync(o.join(e,"css")),c.mkdirSync(o.join(e,"types"))})(),await B(t);const S=await R(t);async function C(r,p){const b=c.statSync(r);if(b.isDirectory()){const F=c.readdirSync(r);await Promise.all(F.map(u=>C(o.join(r,u),o.join(p,u))))}else if(b.isFile()&&E(r)){const u=await v(r,e),P=[];Object.entries(u).forEach(([l,m])=>{if(m.isKeyframes&&m.css){const _=`${m.animationName}.css`,I=`css/${_}`,H=o.join(e,I);s.push(_),c.writeFileSync(H,m.css);return}if(!m.generator)return;const h=m.generator._withBuildContext({name:l,config:S}),w=`${h.hash}-${h.priority}.css`;n[h.priority]||(n[h.priority]=[]),n[h.priority].push(w),P.push(w);const k=`css/${w}`,T=o.join(e,k);c.writeFileSync(T,h.css)});const y=P.map(l=>`@import url('./${l}');`).join(`
|
2
|
+
`),f=N.toHash(r,6),g=o.join(e,`css/${f}.css`);c.writeFileSync(g,y)}}await C(t,e);const i=s.map(r=>`@import url('./css/${r}');`).join(`
|
3
|
+
`);let d=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
4
4
|
|
5
|
-
${["
|
5
|
+
${["variables.css","global.css","templates.css"].filter(r=>{try{return c.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(S.importStrategy!=="component"){const r=n.flat().map(p=>`@import url('./css/${p}');`).join(`
|
8
|
+
`);d+=r}c.writeFileSync(a,d)}catch(s){console.error(s)}},U=async(t,s)=>{try{const n=[],e=o.join(t,"./saltygen"),a=o.join(e,"index.css");if(E(s)){const S=await R(t),C=await v(s,e);Object.entries(C).forEach(([d,r])=>{if(!r.generator)return;const p=r.generator._withBuildContext({name:d,config:S}),b=`${p.hash}-${p.priority}.css`,F=`css/${b}`,u=o.join(e,F);n.push(b),c.writeFileSync(u,p.css)});const i=c.readFileSync(a,"utf8").split(`
|
9
|
+
`),$=n.map(d=>`@import url('../saltygen/css/${d}');`),x=[...new Set([...i,...$])].join(`
|
10
|
+
`);c.writeFileSync(a,x)}}catch(n){console.error(n)}},X=async(t,s)=>{try{const n=o.join(t,"./saltygen");if(E(s)){const a=c.readFileSync(s,"utf8");a.replace(/^(?!export\s)const\s.*/gm,j=>`export ${j}`)!==a&&await G.writeFile(s,a);const S=await R(t),C=await v(s,n);let i=a;Object.entries(C).forEach(([j,x])=>{var k;if(x.isKeyframes||!x.generator)return;const d=x.generator._withBuildContext({name:j,config:S}),r=new RegExp(`\\s${j}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!r)return console.error("Could not find the original declaration");const p=(k=r.at(1))==null?void 0:k.trim(),b=new RegExp(`\\s${j}[=\\s]+styled\\(`,"g").exec(i);if(!b)return console.error("Could not find the original declaration");const{index:F}=b;let u=!1;const P=setTimeout(()=>u=!0,5e3);let y=0,f=!1,g=0;for(;!f&&!u;){const T=i[F+y];T==="("&&g++,T===")"&&g--,g===0&&T===")"&&(f=!0),y>i.length&&(u=!0),y++}if(!u)clearTimeout(P);else throw new Error("Failed to find the end of the styled call and timed out");const l=F+y,m=i.slice(F,l),h=i,w=` ${j} = styled(${p}, "${d.classNames}", "${d._callerName}", ${JSON.stringify(d.props)});`;i=i.replace(m,w),h===i&&console.error("Minimize file failed to change content",{name:j,tagName:p})});const $=N.toHash(s,6);return S.importStrategy==="component"&&(i=`import '../../saltygen/css/${$}.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=v;exports.generateConfigStyles=B;exports.generateCss=L;exports.generateFile=U;exports.isSaltyFile=E;exports.minimizeFile=X;exports.saltyFileExtensions=M;exports.saltyFileRegExp=z;
|
package/compiler/index.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import * as
|
2
|
-
import { execSync as
|
3
|
-
import { t as E, d as
|
4
|
-
import { join as
|
5
|
-
import { writeFileSync as
|
6
|
-
import { writeFile as
|
7
|
-
import { p as
|
8
|
-
const T = (s) =>
|
9
|
-
const e = T(s), n =
|
10
|
-
await
|
1
|
+
import * as _ from "esbuild";
|
2
|
+
import { execSync as K } from "child_process";
|
3
|
+
import { t as E, d as M } from "../dash-case-DMQMcCO6.js";
|
4
|
+
import { join as o } from "path";
|
5
|
+
import { writeFileSync as w, existsSync as W, mkdirSync as V, statSync as G, readdirSync as J, readFileSync as v } from "fs";
|
6
|
+
import { writeFile as q } from "fs/promises";
|
7
|
+
import { p as A, a as L, b as U } from "../parse-templates-D4p3pgQR.js";
|
8
|
+
const T = (s) => o(s, "./saltygen"), X = ["salty", "css", "styles", "styled"], Y = (s = []) => new RegExp(`\\.(${[...X, ...s].join("|")})\\.`), O = (s, e = []) => Y(e).test(s), Z = async (s) => {
|
9
|
+
const e = T(s), n = o(s, "salty.config.ts"), t = o(e, "salty.config.js");
|
10
|
+
await _.build({
|
11
11
|
entryPoints: [n],
|
12
12
|
minify: !0,
|
13
13
|
treeShaking: !0,
|
@@ -16,33 +16,33 @@ const T = (s) => i(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W
|
|
16
16
|
format: "esm",
|
17
17
|
external: ["react"]
|
18
18
|
});
|
19
|
-
const
|
20
|
-
return
|
21
|
-
},
|
22
|
-
const e = await
|
23
|
-
if (!
|
24
|
-
if (typeof
|
25
|
-
const
|
26
|
-
n.add(`"${
|
27
|
-
const
|
28
|
-
return `--${
|
29
|
-
}) : [],
|
30
|
-
const
|
31
|
-
return
|
32
|
-
}) : [],
|
33
|
-
const
|
34
|
-
return `${
|
35
|
-
})) : [],
|
36
|
-
|
37
|
-
const
|
38
|
-
|
39
|
-
const
|
40
|
-
|
41
|
-
const
|
42
|
-
|
43
|
-
},
|
44
|
-
const n = E(s), t =
|
45
|
-
await
|
19
|
+
const c = Date.now(), { config: D } = await import(`${t}?t=${c}`);
|
20
|
+
return D;
|
21
|
+
}, Q = async (s) => {
|
22
|
+
const e = await Z(s), n = /* @__PURE__ */ new Set(), t = (l, f = []) => l ? Object.entries(l).flatMap(([y, a]) => {
|
23
|
+
if (!a) return;
|
24
|
+
if (typeof a == "object") return t(a, [...f, y]);
|
25
|
+
const u = [...f, y].join(".");
|
26
|
+
n.add(`"${u}"`);
|
27
|
+
const d = [...f.map(M), M(y)].join("-"), { result: j } = U(a);
|
28
|
+
return `--${d}: ${j};`;
|
29
|
+
}) : [], c = (l) => l ? Object.entries(l).flatMap(([f, y]) => {
|
30
|
+
const a = t(y);
|
31
|
+
return f === "base" ? a.join("") : `${f} { ${a.join("")} }`;
|
32
|
+
}) : [], D = (l) => l ? Object.entries(l).flatMap(([f, y]) => Object.entries(y).flatMap(([a, u]) => {
|
33
|
+
const d = t(u, [f]), j = `.${f}-${a}, [data-${f}="${a}"]`, k = d.join("");
|
34
|
+
return `${j} { ${k} }`;
|
35
|
+
})) : [], F = t(e.variables), C = c(e.responsiveVariables), i = D(e.conditionalVariables), S = T(s), h = o(S, "css/variables.css"), x = `:root { ${F.join("")} ${C.join("")} } ${i.join("")}`;
|
36
|
+
w(h, x);
|
37
|
+
const g = o(S, "types/css-tokens.d.ts"), p = `type VariableTokens = ${[...n].join("|") || '""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;
|
38
|
+
w(g, p);
|
39
|
+
const $ = o(S, "css/global.css"), b = A(e.global, "");
|
40
|
+
w($, b);
|
41
|
+
const m = o(S, "css/templates.css"), P = L(e.templates);
|
42
|
+
w(m, P);
|
43
|
+
}, R = async (s, e) => {
|
44
|
+
const n = E(s), t = o(e, "js", n + ".js");
|
45
|
+
await _.build({
|
46
46
|
entryPoints: [s],
|
47
47
|
minify: !0,
|
48
48
|
treeShaking: !0,
|
@@ -53,129 +53,135 @@ const T = (s) => i(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W
|
|
53
53
|
keepNames: !0,
|
54
54
|
external: ["react"]
|
55
55
|
});
|
56
|
-
const
|
57
|
-
return await import(`${t}?t=${
|
58
|
-
},
|
59
|
-
const e = T(s), n =
|
56
|
+
const c = Date.now();
|
57
|
+
return await import(`${t}?t=${c}`);
|
58
|
+
}, B = async (s) => {
|
59
|
+
const e = T(s), n = o(e, "salty.config.js"), { config: t } = await import(n);
|
60
60
|
return t;
|
61
|
-
},
|
61
|
+
}, rt = async (s) => {
|
62
62
|
try {
|
63
|
-
const e = [], n = [], t = T(s),
|
63
|
+
const e = [], n = [], t = T(s), c = o(t, "index.css");
|
64
64
|
(() => {
|
65
|
-
|
66
|
-
})(), await
|
67
|
-
const
|
68
|
-
async function
|
69
|
-
const
|
70
|
-
if (
|
71
|
-
const
|
72
|
-
await Promise.all(
|
73
|
-
} else if (
|
74
|
-
const
|
75
|
-
Object.entries(
|
76
|
-
if (
|
77
|
-
const
|
78
|
-
e.push(
|
65
|
+
W(t) && K("rm -rf " + t), V(t), V(o(t, "css")), V(o(t, "types"));
|
66
|
+
})(), await Q(s);
|
67
|
+
const F = await B(s);
|
68
|
+
async function C(r, p) {
|
69
|
+
const $ = G(r);
|
70
|
+
if ($.isDirectory()) {
|
71
|
+
const b = J(r);
|
72
|
+
await Promise.all(b.map((m) => C(o(r, m), o(p, m))));
|
73
|
+
} else if ($.isFile() && O(r)) {
|
74
|
+
const m = await R(r, t), P = [];
|
75
|
+
Object.entries(m).forEach(([a, u]) => {
|
76
|
+
if (u.isKeyframes && u.css) {
|
77
|
+
const I = `${u.animationName}.css`, z = `css/${I}`, H = o(t, z);
|
78
|
+
e.push(I), w(H, u.css);
|
79
79
|
return;
|
80
80
|
}
|
81
|
-
if (!
|
82
|
-
const
|
83
|
-
name:
|
84
|
-
config:
|
85
|
-
}),
|
86
|
-
n[
|
87
|
-
const
|
88
|
-
|
81
|
+
if (!u.generator) return;
|
82
|
+
const d = u.generator._withBuildContext({
|
83
|
+
name: a,
|
84
|
+
config: F
|
85
|
+
}), j = `${d.hash}-${d.priority}.css`;
|
86
|
+
n[d.priority] || (n[d.priority] = []), n[d.priority].push(j), P.push(j);
|
87
|
+
const k = `css/${j}`, N = o(t, k);
|
88
|
+
w(N, d.css);
|
89
89
|
});
|
90
|
-
const
|
91
|
-
`),
|
92
|
-
|
90
|
+
const l = P.map((a) => `@import url('./${a}');`).join(`
|
91
|
+
`), f = E(r, 6), y = o(t, `css/${f}.css`);
|
92
|
+
w(y, l);
|
93
93
|
}
|
94
94
|
}
|
95
|
-
await
|
96
|
-
const
|
95
|
+
await C(s, t);
|
96
|
+
const i = e.map((r) => `@import url('./css/${r}');`).join(`
|
97
97
|
`);
|
98
|
-
let
|
98
|
+
let g = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
99
99
|
|
100
|
-
${["
|
100
|
+
${["variables.css", "global.css", "templates.css"].filter((r) => {
|
101
|
+
try {
|
102
|
+
return v(o(t, "css", r), "utf8").length > 0;
|
103
|
+
} catch {
|
104
|
+
return !1;
|
105
|
+
}
|
106
|
+
}).map((r) => `@import url('./css/${r}');`).join(`
|
101
107
|
`)}
|
102
|
-
${
|
103
|
-
if (
|
104
|
-
const
|
108
|
+
${i}`;
|
109
|
+
if (F.importStrategy !== "component") {
|
110
|
+
const r = n.flat().map((p) => `@import url('./css/${p}');`).join(`
|
105
111
|
`);
|
106
|
-
|
112
|
+
g += r;
|
107
113
|
}
|
108
|
-
|
114
|
+
w(c, g);
|
109
115
|
} catch (e) {
|
110
116
|
console.error(e);
|
111
117
|
}
|
112
|
-
},
|
118
|
+
}, ct = async (s, e) => {
|
113
119
|
try {
|
114
|
-
const n = [], t =
|
115
|
-
if (
|
116
|
-
const
|
117
|
-
Object.entries(
|
118
|
-
if (!
|
119
|
-
const
|
120
|
-
name:
|
121
|
-
config:
|
122
|
-
}),
|
123
|
-
n.push(
|
120
|
+
const n = [], t = o(s, "./saltygen"), c = o(t, "index.css");
|
121
|
+
if (O(e)) {
|
122
|
+
const F = await B(s), C = await R(e, t);
|
123
|
+
Object.entries(C).forEach(([g, r]) => {
|
124
|
+
if (!r.generator) return;
|
125
|
+
const p = r.generator._withBuildContext({
|
126
|
+
name: g,
|
127
|
+
config: F
|
128
|
+
}), $ = `${p.hash}-${p.priority}.css`, b = `css/${$}`, m = o(t, b);
|
129
|
+
n.push($), w(m, p.css);
|
124
130
|
});
|
125
|
-
const
|
126
|
-
`),
|
131
|
+
const i = v(c, "utf8").split(`
|
132
|
+
`), S = n.map((g) => `@import url('../saltygen/css/${g}');`), x = [.../* @__PURE__ */ new Set([...i, ...S])].join(`
|
127
133
|
`);
|
128
|
-
|
134
|
+
w(c, x);
|
129
135
|
}
|
130
136
|
} catch (n) {
|
131
137
|
console.error(n);
|
132
138
|
}
|
133
|
-
},
|
139
|
+
}, at = async (s, e) => {
|
134
140
|
try {
|
135
|
-
const n =
|
136
|
-
if (
|
137
|
-
const
|
138
|
-
|
139
|
-
const
|
140
|
-
let
|
141
|
-
Object.entries(
|
142
|
-
var
|
143
|
-
if (
|
144
|
-
const
|
145
|
-
name:
|
146
|
-
config:
|
147
|
-
}),
|
148
|
-
if (!
|
149
|
-
const
|
150
|
-
if (
|
151
|
-
const { index:
|
152
|
-
let
|
153
|
-
const
|
154
|
-
let
|
155
|
-
for (; !
|
156
|
-
const N =
|
157
|
-
N === "(" &&
|
141
|
+
const n = o(s, "./saltygen");
|
142
|
+
if (O(e)) {
|
143
|
+
const c = v(e, "utf8");
|
144
|
+
c.replace(/^(?!export\s)const\s.*/gm, (h) => `export ${h}`) !== c && await q(e, c);
|
145
|
+
const F = await B(s), C = await R(e, n);
|
146
|
+
let i = c;
|
147
|
+
Object.entries(C).forEach(([h, x]) => {
|
148
|
+
var k;
|
149
|
+
if (x.isKeyframes || !x.generator) return;
|
150
|
+
const g = x.generator._withBuildContext({
|
151
|
+
name: h,
|
152
|
+
config: F
|
153
|
+
}), r = new RegExp(`\\s${h}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(c);
|
154
|
+
if (!r) return console.error("Could not find the original declaration");
|
155
|
+
const p = (k = r.at(1)) == null ? void 0 : k.trim(), $ = new RegExp(`\\s${h}[=\\s]+styled\\(`, "g").exec(i);
|
156
|
+
if (!$) return console.error("Could not find the original declaration");
|
157
|
+
const { index: b } = $;
|
158
|
+
let m = !1;
|
159
|
+
const P = setTimeout(() => m = !0, 5e3);
|
160
|
+
let l = 0, f = !1, y = 0;
|
161
|
+
for (; !f && !m; ) {
|
162
|
+
const N = i[b + l];
|
163
|
+
N === "(" && y++, N === ")" && y--, y === 0 && N === ")" && (f = !0), l > i.length && (m = !0), l++;
|
158
164
|
}
|
159
|
-
if (!
|
165
|
+
if (!m) clearTimeout(P);
|
160
166
|
else throw new Error("Failed to find the end of the styled call and timed out");
|
161
|
-
const
|
162
|
-
|
167
|
+
const a = b + l, u = i.slice(b, a), d = i, j = ` ${h} = styled(${p}, "${g.classNames}", "${g._callerName}", ${JSON.stringify(g.props)});`;
|
168
|
+
i = i.replace(u, j), d === i && console.error("Minimize file failed to change content", { name: h, tagName: p });
|
163
169
|
});
|
164
|
-
const
|
165
|
-
return
|
166
|
-
${
|
170
|
+
const S = E(e, 6);
|
171
|
+
return F.importStrategy === "component" && (i = `import '../../saltygen/css/${S}.css';
|
172
|
+
${i}`), i = i.replace("{ styled }", "{ styledClient as styled }"), i = i.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), i;
|
167
173
|
}
|
168
174
|
} catch (n) {
|
169
175
|
console.error("Error in minimizeFile:", n);
|
170
176
|
}
|
171
177
|
};
|
172
178
|
export {
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
179
|
+
R as compileSaltyFile,
|
180
|
+
Q as generateConfigStyles,
|
181
|
+
rt as generateCss,
|
182
|
+
ct as generateFile,
|
183
|
+
O as isSaltyFile,
|
184
|
+
at as minimizeFile,
|
185
|
+
X as saltyFileExtensions,
|
186
|
+
Y as saltyFileRegExp
|
181
187
|
};
|