@salty-css/core 0.0.1-alpha.281 → 0.0.1-alpha.282
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/compiler/index.cjs +1 -1
- package/compiler/index.js +1 -1
- package/{index-D3EUFKhD.js → index-8a_5lZS1.js} +77 -72
- package/index-DOl289-D.cjs +41 -0
- package/package.json +1 -1
- package/server/index.cjs +1 -1
- package/server/index.js +1 -1
- package/{should-restart-mZFoFAt4.js → should-restart-Cjw8WqZq.js} +1 -1
- package/{should-restart-CFLKMt9i.cjs → should-restart-Z7Vfizh9.cjs} +1 -1
- package/index-CidX_d4J.cjs +0 -41
package/bin/main.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),A=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),e=require("../index-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),A=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),e=require("../index-DOl289-D.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-Z7Vfizh9.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,x=>{if(x)return P(x);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),x=y.join(" ");await X(`npm install ${x}`),P.succeed(`Installed packages: ${C}`)},re=()=>A.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!re())return;await X(`./node_modules/.bin/prettier --write "${y}"`),e.logger.info(`Formatted ${y} with Prettier`)}catch(C){e.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function ce(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:f}=await C[i],d=ne.render(f,a);return{fileName:i,content:d}},x=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:G&&G.tagName.toUpperCase()==="SCRIPT"&&G.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await x()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},H=i=>{const a=i==="."?"":i,f=process.cwd();return n.join(f,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return e.logError("Salty CSS project must be initialized in a directory with a package.json file.");e.logger.info("Initializing a new Salty-CSS project!");const{dir:f=i,cssFile:d,skipInstall:p}=this.opts();if(!f)return e.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const c=process.cwd(),r=H(f),q=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=q.map(async({fileName:t,content:u})=>{const l=n.join(r,t);if(await s.readFile(l,"utf-8").catch(()=>{})!==void 0){e.logger.debug("File already exists: "+l);return}const k=t.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),e.logger.info("Creating file: "+l),await s.writeFile(l,u),await S(l)});await Promise.all(m);const w=n.relative(c,r)||".",h=n.join(c,".saltyrc.json"),g=await s.readFile(h,"utf-8").catch(()=>{});if(g===void 0){e.logger.info("Creating file: "+h);const u=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,u),await S(h)}else{const t=JSON.parse(g),u=(t==null?void 0:t.projects)||[];if(u.findIndex(o=>o.dir===w)===-1){u.push({dir:w,framework:"react"}),t.projects=[...u];const o=JSON.stringify(t,null,2);o!==g&&(e.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(c,".gitignore"),T=await s.readFile(j,"utf-8").catch(()=>{});T!==void 0&&(T.includes("saltygen")||(e.logger.info("Edit file: "+j),await s.writeFile(j,T+`
|
2
2
|
|
3
3
|
# Salty-CSS
|
4
4
|
saltygen
|
package/bin/main.js
CHANGED
@@ -3,11 +3,11 @@ import { existsSync as Q, watch as re } from "fs";
|
|
3
3
|
import { mkdir as q, readFile as S, writeFile as C } from "fs/promises";
|
4
4
|
import { join as a, relative as z, parse as ce, format as te } from "path";
|
5
5
|
import { render as le } from "ejs";
|
6
|
-
import { l as t, a as h, g as K, i as de, b as fe } from "../index-
|
6
|
+
import { l as t, a as h, g as K, i as de, b as fe } from "../index-8a_5lZS1.js";
|
7
7
|
import { p as pe } from "../pascal-case-BQpR5PdN.js";
|
8
8
|
import { exec as ue } from "child_process";
|
9
9
|
import ge from "ora";
|
10
|
-
import { c as ye } from "../should-restart-
|
10
|
+
import { c as ye } from "../should-restart-Cjw8WqZq.js";
|
11
11
|
const ne = (g) => new Promise((P, x) => {
|
12
12
|
ue(g, ($) => {
|
13
13
|
if ($) return x($);
|
package/compiler/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-Bdgw_4ME.cjs");require("../parsers/index.cjs");const e=require("../index-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-Bdgw_4ME.cjs");require("../parsers/index.cjs");const e=require("../index-DOl289-D.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
|
package/compiler/index.js
CHANGED
@@ -6,7 +6,7 @@ import "fs";
|
|
6
6
|
import "fs/promises";
|
7
7
|
import "../parse-styles-C1E6ETeH.js";
|
8
8
|
import "../parsers/index.js";
|
9
|
-
import { e as F, d as y, g as x, b as S, i as c, m as f, s as C, c as E } from "../index-
|
9
|
+
import { e as F, d as y, g as x, b as S, i as c, m as f, s as C, c as E } from "../index-8a_5lZS1.js";
|
10
10
|
import "../css/merge.js";
|
11
11
|
import "../define-templates-4A2yHcMF.js";
|
12
12
|
export {
|
@@ -1,22 +1,22 @@
|
|
1
|
-
import * as
|
1
|
+
import * as Ft from "esbuild";
|
2
2
|
import { execSync as vt } from "child_process";
|
3
3
|
import { t as I, d as U } from "./dash-case-DBThphLm.js";
|
4
4
|
import { join as i, parse as tt } from "path";
|
5
5
|
import { existsSync as ft, writeFileSync as C, mkdirSync as G, readFileSync as _, statSync as Et, readdirSync as Ot } from "fs";
|
6
|
-
import { readFile as
|
7
|
-
import { p as
|
6
|
+
import { readFile as Pt } from "fs/promises";
|
7
|
+
import { p as St, a as Mt } from "./parse-styles-C1E6ETeH.js";
|
8
8
|
import { parseTemplates as Rt, getTemplateTypes as Jt } from "./parsers/index.js";
|
9
9
|
import { createLogger as zt, format as rt, transports as Wt } from "winston";
|
10
10
|
import { mergeObjects as H, mergeFactories as Gt } from "./css/merge.js";
|
11
11
|
import { d as Ht } from "./define-templates-4A2yHcMF.js";
|
12
12
|
import lt from "typescript";
|
13
|
-
const
|
13
|
+
const jt = (t) => {
|
14
14
|
if (!t || t === "/") throw new Error("Could not find package.json file");
|
15
15
|
const e = i(t, "package.json");
|
16
|
-
return ft(e) ? e :
|
16
|
+
return ft(e) ? e : jt(i(t, ".."));
|
17
17
|
}, It = async (t) => {
|
18
|
-
const e =
|
19
|
-
return await
|
18
|
+
const e = jt(t);
|
19
|
+
return await Pt(e, "utf-8").then(JSON.parse).catch(() => {
|
20
20
|
});
|
21
21
|
}, Kt = async (t) => {
|
22
22
|
const e = await It(t);
|
@@ -24,7 +24,7 @@ const Ft = (t) => {
|
|
24
24
|
return e.type;
|
25
25
|
};
|
26
26
|
let W;
|
27
|
-
const
|
27
|
+
const Nt = async (t) => {
|
28
28
|
if (W) return W;
|
29
29
|
const e = await Kt(t);
|
30
30
|
return e === "module" ? W = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (W = "cjs"), W || "esm";
|
@@ -35,8 +35,8 @@ const Pt = async (t) => {
|
|
35
35
|
}), fe = (t) => {
|
36
36
|
Z.error(t);
|
37
37
|
};
|
38
|
-
function
|
39
|
-
return t ? typeof t != "string" ?
|
38
|
+
function xt(t) {
|
39
|
+
return t ? typeof t != "string" ? xt(String(t)) : t.replace(/[^\d\w]/g, ".") : "";
|
40
40
|
}
|
41
41
|
const Qt = {
|
42
42
|
/** Set box model to border-box */
|
@@ -96,11 +96,14 @@ const Qt = {
|
|
96
96
|
d.forEachChild(o);
|
97
97
|
}
|
98
98
|
o(r);
|
99
|
-
}), Bt = () =>
|
99
|
+
}), Bt = () => {
|
100
|
+
const { pathname: t } = new URL(import.meta.url);
|
101
|
+
return i(t, "../");
|
102
|
+
}, v = {
|
100
103
|
externalModules: [],
|
101
104
|
rcFile: void 0,
|
102
105
|
destDir: void 0
|
103
|
-
},
|
106
|
+
}, Dt = (t) => {
|
104
107
|
if (v.externalModules.length > 0) return v.externalModules;
|
105
108
|
const s = _(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
|
106
109
|
if (!s) return [];
|
@@ -110,19 +113,19 @@ const Qt = {
|
|
110
113
|
if (v.destDir) return v.destDir;
|
111
114
|
const e = await pt(t), s = i(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
|
112
115
|
return v.destDir = s, s;
|
113
|
-
},
|
116
|
+
}, kt = ["salty", "css", "styles", "styled"], qt = (t = []) => new RegExp(`\\.(${[...kt, ...t].join("|")})\\.`), mt = (t, e = []) => qt(e).test(t), Tt = async (t) => {
|
114
117
|
if (v.rcFile) return v.rcFile;
|
115
118
|
if (t === "/") throw new Error("Could not find .saltyrc.json file");
|
116
|
-
const e = i(t, ".saltyrc.json"), s = await
|
119
|
+
const e = i(t, ".saltyrc.json"), s = await Pt(e, "utf-8").then(JSON.parse).catch(() => {
|
117
120
|
});
|
118
|
-
return s ? (v.rcFile = s, s) :
|
121
|
+
return s ? (v.rcFile = s, s) : Tt(i(t, ".."));
|
119
122
|
}, pt = async (t) => {
|
120
123
|
var n, c;
|
121
|
-
const e = await
|
124
|
+
const e = await Tt(t), s = (n = e.projects) == null ? void 0 : n.find((r) => t.endsWith(r.dir || ""));
|
122
125
|
return s || ((c = e.projects) == null ? void 0 : c.find((r) => r.dir === e.defaultProject));
|
123
126
|
}, Ut = 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
|
125
|
-
await
|
127
|
+
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 Nt(t), o = Dt(n);
|
128
|
+
await Ft.build({
|
126
129
|
entryPoints: [n],
|
127
130
|
minify: !0,
|
128
131
|
treeShaking: !0,
|
@@ -134,7 +137,7 @@ const Qt = {
|
|
134
137
|
const d = Date.now(), { config: w } = await import(`${c}?t=${d}`);
|
135
138
|
return { config: w, path: c };
|
136
139
|
}, At = async (t, e) => {
|
137
|
-
var
|
140
|
+
var wt, $t;
|
138
141
|
const s = await J(t), n = {
|
139
142
|
mediaQueries: [],
|
140
143
|
globalStyles: [],
|
@@ -159,15 +162,15 @@ const Qt = {
|
|
159
162
|
if (T instanceof Promise) return await q(await T);
|
160
163
|
if (typeof T == "function") return await q(await T());
|
161
164
|
if (typeof T == "object") return await a(T, [...S, j]);
|
162
|
-
const at =
|
165
|
+
const at = xt(j), it = U(j), ct = [...S, at].join(".");
|
163
166
|
p.add(`"${ct}"`);
|
164
|
-
const Y = [...S.map(U), it].join("-"),
|
165
|
-
return
|
167
|
+
const Y = [...S.map(U), it].join("-"), bt = Mt(T);
|
168
|
+
return bt ? `--${Y}: ${bt.transformed};` : `--${Y}: ${T};`;
|
166
169
|
};
|
167
170
|
return await q(R);
|
168
171
|
});
|
169
172
|
return (await Promise.all(B)).flat();
|
170
|
-
},
|
173
|
+
}, g = async (h) => {
|
171
174
|
if (!h) return [];
|
172
175
|
const S = Object.entries(h).map(async ([k, j]) => {
|
173
176
|
const R = await a(j);
|
@@ -184,17 +187,17 @@ const Qt = {
|
|
184
187
|
return (await Promise.all(R)).flat();
|
185
188
|
});
|
186
189
|
return (await Promise.all(S)).flat();
|
187
|
-
},
|
188
|
-
C(
|
189
|
-
const st = i(s, "css/_global.css"), f = H(c.global, n.globalStyles), $ = await
|
190
|
+
}, y = (h) => ({ ...h, responsive: void 0, conditional: void 0 }), m = (h) => n.variables.map((S) => h === "static" ? y(S._current) : S._current[h]), F = H(y(c.variables), m("static")), x = await a(F), D = H((wt = c.variables) == null ? void 0 : wt.responsive, m("responsive")), E = await g(D), z = H(($t = c.variables) == null ? void 0 : $t.conditional, m("conditional")), A = await u(z), gt = i(s, "css/_variables.css"), O = `:root { ${x.join("")} ${E.join("")} } ${A.join("")}`;
|
191
|
+
C(gt, O), o.staticVariables = F;
|
192
|
+
const st = i(s, "css/_global.css"), f = H(c.global, n.globalStyles), $ = await St(f, "");
|
190
193
|
C(st, `@layer global { ${$} }`);
|
191
|
-
const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : Qt, N = await
|
194
|
+
const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : Qt, N = await St(P, "");
|
192
195
|
C(b, `@layer reset { ${N} }`);
|
193
196
|
const V = i(s, "css/_templates.css"), M = H(c.templates, n.templates), K = await Rt(M), Q = Jt(M);
|
194
197
|
C(V, `@layer templates { ${K} }`), o.templates = M;
|
195
198
|
const X = c.templates ? [Ht(c.templates)._setPath(`config;;${r}`)] : [], nt = Gt(n.templates, X);
|
196
199
|
o.templatePaths = Object.fromEntries(Object.entries(nt).map(([h, S]) => [h, S._path]));
|
197
|
-
const L = i(s, "types/css-tokens.d.ts"),
|
200
|
+
const L = i(s, "types/css-tokens.d.ts"), _t = `
|
198
201
|
// Variable types
|
199
202
|
type VariableTokens = ${[...p].join("|")};
|
200
203
|
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
@@ -208,19 +211,21 @@ const Qt = {
|
|
208
211
|
// Media query types
|
209
212
|
type MediaQueryKeys = ${w || "''"};
|
210
213
|
`;
|
211
|
-
C(L,
|
212
|
-
const
|
213
|
-
C(Tt, JSON.stringify(o, null, 2));
|
214
|
-
const _t = Bt(), Vt = i(_t, "../cache/config-cache.json");
|
214
|
+
C(L, _t);
|
215
|
+
const Vt = i(s, "cache/config-cache.json");
|
215
216
|
C(Vt, JSON.stringify(o, null, 2));
|
216
|
-
|
217
|
+
const yt = Bt();
|
218
|
+
console.log("Config _dirname", yt);
|
219
|
+
const ht = i(yt, "../cache/config-cache.json");
|
220
|
+
console.log("Config cache secondary path", ht), C(ht, JSON.stringify(o, null, 2));
|
221
|
+
}, Ct = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
|
217
222
|
if (/^['"`]/.test(s)) return e;
|
218
223
|
const c = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
|
219
224
|
if (!c.test(t)) return e;
|
220
225
|
const o = c.exec(t);
|
221
226
|
if (o) {
|
222
227
|
const d = o.at(1);
|
223
|
-
if (
|
228
|
+
if (kt.some((p) => d == null ? void 0 : d.includes(p))) return e;
|
224
229
|
}
|
225
230
|
return "styled('div',";
|
226
231
|
}), Xt = (t, e) => {
|
@@ -239,9 +244,9 @@ ${t}`;
|
|
239
244
|
ft(c) || G(c);
|
240
245
|
const r = tt(e);
|
241
246
|
let o = _(e, "utf8");
|
242
|
-
o =
|
243
|
-
const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a =
|
244
|
-
await
|
247
|
+
o = Ct(o), o = Xt(o, t);
|
248
|
+
const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a = Dt(p), g = await Nt(t);
|
249
|
+
await Ft.build({
|
245
250
|
stdin: {
|
246
251
|
contents: o,
|
247
252
|
sourcefile: r.base,
|
@@ -252,7 +257,7 @@ ${t}`;
|
|
252
257
|
treeShaking: !0,
|
253
258
|
bundle: !0,
|
254
259
|
outfile: d,
|
255
|
-
format:
|
260
|
+
format: g,
|
256
261
|
target: ["node20"],
|
257
262
|
keepNames: !0,
|
258
263
|
external: a,
|
@@ -263,7 +268,7 @@ ${t}`;
|
|
263
268
|
setup: (m) => {
|
264
269
|
m.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (F) => {
|
265
270
|
const x = _(F.path, "utf8");
|
266
|
-
return { contents:
|
271
|
+
return { contents: Ct(x), loader: "ts" };
|
267
272
|
});
|
268
273
|
}
|
269
274
|
}
|
@@ -293,19 +298,19 @@ ${t}`;
|
|
293
298
|
ft(o) && vt("rm -rf " + o), G(o, { recursive: !0 }), G(i(o, "css")), G(i(o, "types")), G(i(o, "js")), G(i(o, "cache"));
|
294
299
|
})();
|
295
300
|
const p = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
296
|
-
async function
|
301
|
+
async function g(f) {
|
297
302
|
const $ = ["node_modules", "saltygen"], b = Et(f);
|
298
303
|
if (b.isDirectory()) {
|
299
304
|
const l = Ot(f);
|
300
305
|
if ($.some((N) => f.includes(N))) return;
|
301
|
-
await Promise.all(l.map((N) =>
|
306
|
+
await Promise.all(l.map((N) => g(i(f, N))));
|
302
307
|
} else if (b.isFile() && mt(f)) {
|
303
308
|
p.add(f);
|
304
309
|
const P = _(f, "utf8");
|
305
310
|
/define[\w\d]+\(/.test(P) && a.add(f);
|
306
311
|
}
|
307
312
|
}
|
308
|
-
await
|
313
|
+
await g(t), await At(t, a);
|
309
314
|
const u = {
|
310
315
|
keyframes: [],
|
311
316
|
components: [],
|
@@ -330,7 +335,7 @@ ${t}`;
|
|
330
335
|
});
|
331
336
|
})
|
332
337
|
);
|
333
|
-
const
|
338
|
+
const y = await ut(t);
|
334
339
|
for (const f of u.keyframes) {
|
335
340
|
const { value: $ } = f, b = `a_${$.animationName}.css`, l = `css/${b}`, P = i(o, l);
|
336
341
|
c.push(b), C(P, $.css);
|
@@ -342,14 +347,14 @@ ${t}`;
|
|
342
347
|
const l = f.generator._withBuildContext({
|
343
348
|
callerName: b,
|
344
349
|
isProduction: e,
|
345
|
-
config:
|
350
|
+
config: y
|
346
351
|
});
|
347
352
|
r[l.priority] || (r[l.priority] = []);
|
348
353
|
const P = await l.css;
|
349
354
|
if (!P) continue;
|
350
355
|
r[l.priority].push(l.cssFileName);
|
351
356
|
const N = `css/${l.cssFileName}`, V = i(o, N);
|
352
|
-
C(V, P),
|
357
|
+
C(V, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
|
353
358
|
}
|
354
359
|
for (const f of u.classNames) {
|
355
360
|
const { src: $, name: b } = f;
|
@@ -357,14 +362,14 @@ ${t}`;
|
|
357
362
|
const l = f.generator._withBuildContext({
|
358
363
|
callerName: b,
|
359
364
|
isProduction: e,
|
360
|
-
config:
|
365
|
+
config: y
|
361
366
|
}), P = await l.css;
|
362
367
|
if (!P) continue;
|
363
368
|
r[l.priority] || (r[l.priority] = []), r[l.priority].push(l.cssFileName);
|
364
369
|
const N = `css/${l.cssFileName}`, V = i(o, N);
|
365
|
-
C(V, P),
|
370
|
+
C(V, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
|
366
371
|
}
|
367
|
-
|
372
|
+
y.importStrategy === "component" && Object.entries(m).forEach(([f, $]) => {
|
368
373
|
const b = $.map((M) => `@import url('./${M}');`).join(`
|
369
374
|
`), l = I(f, 6), P = tt(f), N = U(P.name), V = i(o, `css/f_${N}-${l}.css`);
|
370
375
|
C(V, b || "/* Empty file */");
|
@@ -388,7 +393,7 @@ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((f) =
|
|
388
393
|
`
|
389
394
|
)}
|
390
395
|
${F}`;
|
391
|
-
if (
|
396
|
+
if (y.importStrategy !== "component") {
|
392
397
|
const f = r.reduce(($, b, l) => {
|
393
398
|
const P = b.reduce((K, Q) => {
|
394
399
|
var ot;
|
@@ -439,20 +444,20 @@ ${nt}
|
|
439
444
|
callerName: w,
|
440
445
|
isProduction: s,
|
441
446
|
config: o
|
442
|
-
}),
|
443
|
-
if (!
|
444
|
-
const u = `css/${a.cssFileName}`,
|
445
|
-
C(
|
447
|
+
}), g = await a.css;
|
448
|
+
if (!g) continue;
|
449
|
+
const u = `css/${a.cssFileName}`, y = i(n, u);
|
450
|
+
C(y, g), r[a.priority] || (r[a.priority] = []), r[a.priority].push(a.cssFileName);
|
446
451
|
}
|
447
452
|
if (o.importStrategy !== "component")
|
448
453
|
r.forEach((w, p) => {
|
449
|
-
const a = `l_${p}.css`,
|
450
|
-
let u = _(
|
451
|
-
w.forEach((
|
454
|
+
const a = `l_${p}.css`, g = i(n, "css", a);
|
455
|
+
let u = _(g, "utf8");
|
456
|
+
w.forEach((y) => {
|
452
457
|
var D;
|
453
|
-
const m = i(n, "css",
|
458
|
+
const m = i(n, "css", y), F = ((D = /.*-([^-]+)-\d+.css/.exec(y)) == null ? void 0 : D.at(1)) || I(m, 6);
|
454
459
|
if (!u.includes(F)) {
|
455
|
-
const E = _(m, "utf8"), z = `/*start:${F}-${
|
460
|
+
const E = _(m, "utf8"), z = `/*start:${F}-${y}*/
|
456
461
|
${E}
|
457
462
|
/*end:${F}*/
|
458
463
|
`;
|
@@ -460,11 +465,11 @@ ${E}
|
|
460
465
|
${z}
|
461
466
|
}`;
|
462
467
|
}
|
463
|
-
}), C(
|
468
|
+
}), C(g, u);
|
464
469
|
});
|
465
470
|
else {
|
466
|
-
const w = r.flat().map((
|
467
|
-
`), p = I(e, 6), a = tt(e),
|
471
|
+
const w = r.flat().map((y) => `@import url('./${y}');`).join(`
|
472
|
+
`), p = I(e, 6), a = tt(e), g = U(a.name), u = i(n, `css/f_${g}-${p}.css`);
|
468
473
|
C(u, w || "/* Empty file */");
|
469
474
|
}
|
470
475
|
}
|
@@ -478,25 +483,25 @@ ${z}
|
|
478
483
|
if (mt(e)) {
|
479
484
|
const d = _(e, "utf8"), w = await ut(t), { contents: p } = await et(t, e, r);
|
480
485
|
let a = d;
|
481
|
-
for (const [
|
486
|
+
for (const [g, u] of Object.entries(p)) {
|
482
487
|
if (u.isKeyframes || !u.generator) continue;
|
483
|
-
const
|
484
|
-
callerName:
|
488
|
+
const y = u.generator._withBuildContext({
|
489
|
+
callerName: g,
|
485
490
|
isProduction: s,
|
486
491
|
config: w
|
487
|
-
}), [m, F] = await Lt(a,
|
492
|
+
}), [m, F] = await Lt(a, g), x = a.slice(m, F);
|
488
493
|
if (u.isClassName) {
|
489
|
-
const D = a, E = ` ${
|
490
|
-
a = a.replace(x, E), D === a && console.error("Minimize file failed to change content", { name:
|
494
|
+
const D = a, E = ` ${g} = className("${y.classNames}")`;
|
495
|
+
a = a.replace(x, E), D === a && console.error("Minimize file failed to change content", { name: g });
|
491
496
|
}
|
492
497
|
if (x.includes("styled")) {
|
493
|
-
const D = (c = (n = /styled\(([^,]+),/.exec(x)) == null ? void 0 : n.at(1)) == null ? void 0 : c.trim(), E = a, z = ` ${
|
494
|
-
a = a.replace(x, z), E === a && console.error("Minimize file failed to change content", { name:
|
498
|
+
const D = (c = (n = /styled\(([^,]+),/.exec(x)) == null ? void 0 : n.at(1)) == null ? void 0 : c.trim(), E = a, z = ` ${g} = styled(${D}, "${y.classNames}", ${JSON.stringify(y.clientProps)})`;
|
499
|
+
a = a.replace(x, z), E === a && console.error("Minimize file failed to change content", { name: g, tagName: D });
|
495
500
|
}
|
496
501
|
}
|
497
502
|
if (w.importStrategy === "component") {
|
498
|
-
const
|
499
|
-
a = `import '../../saltygen/css/${`f_${U(u.name)}-${
|
503
|
+
const g = I(e, 6), u = tt(e);
|
504
|
+
a = `import '../../saltygen/css/${`f_${U(u.name)}-${g}.css`}';
|
500
505
|
${a}`;
|
501
506
|
}
|
502
507
|
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;
|
@@ -515,5 +520,5 @@ export {
|
|
515
520
|
mt as i,
|
516
521
|
Z as l,
|
517
522
|
ue as m,
|
518
|
-
|
523
|
+
kt as s
|
519
524
|
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";const Oe=require("esbuild"),ve=require("child_process"),T=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),be=require("fs/promises"),ce=require("./parse-styles-Bdgw_4ME.cjs"),Se=require("./parsers/index.cjs"),Q=require("winston"),J=require("./css/merge.cjs"),Ee=require("./define-templates-Cunsb_Tr.cjs"),re=require("typescript");var I=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 Fe=Ve(Oe),$e=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:$e(i.join(e,".."))},Re=async e=>{const t=$e(e);return await be.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Me=async e=>{const t=await Re(e);if(t)return t.type};let H;const Ce=async e=>{if(H)return H;const t=await Me(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:I&&I.tagName.toUpperCase()==="SCRIPT"&&I.src||new URL("index-DOl289-D.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({})]}),Je=e=>{B.error(e)};function Pe(e){return e?typeof e!="string"?Pe(String(e)):e.replace(/[^\d\w]/g,"."):""}const qe={"*, *::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"}},ze=(e,t)=>new Promise((s,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},100),l=re.createSourceFile("temp.ts",e,re.ScriptTarget.Latest,!0);function o(y){if(re.isVariableDeclaration(y)&&y.name.getText()===t){const S=y.getStart(),p=y.getEnd();clearTimeout(r),s([S,p])}y.forEachChild(o)}o(l)}),He=()=>{const{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:I&&I.tagName.toUpperCase()==="SCRIPT"&&I.src||new URL("index-DOl289-D.cjs",document.baseURI).href);return i.join(e,"../")},v={externalModules:[],rcFile:void 0,destDir:void 0},Ne=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"],xe=(e=[])=>new RegExp(`\\.(${[...le,...e].join("|")})\\.`),ee=(e,t=[])=>xe(t).test(e),_e=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 be.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(v.rcFile=s,s):_e(i.join(e,".."))},fe=async e=>{var n,r;const t=await _e(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))},Ie=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 Ce(e),o=Ne(n);await Fe.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}},ke=async(e,t)=>{var ge,he;const s=await q(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async w=>{const{contents:F,outputFilePath:G}=await A(e,w,s);Object.entries(F).forEach(([k,P])=>{P.isMedia?n.mediaQueries.push([k,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${k};;${G}`))})}));const{config:r,path:l}=await Ie(e),o={...r},{mediaQueries:y}=n;o.mediaQueries=Object.fromEntries(y.map(([w,F])=>[`@${w}`,F]));const S=y.map(([w])=>`'@${w}'`).join(" | "),p=new Set,a=async(w,F=[])=>{if(!w)return[];const G=Object.entries(w).map(async([P,M])=>{const K=async D=>{if(!D)return;if(D instanceof Promise)return await K(await D);if(typeof D=="function")return await K(await D());if(typeof D=="object")return await a(D,[...F,P]);const oe=Pe(P),ie=T.dashCase(P),ae=[...F,oe].join(".");p.add(`"${ae}"`);const Z=[...F.map(T.dashCase),ie].join("-"),we=ce.parseVariableTokens(D);return we?`--${Z}: ${we.transformed};`:`--${Z}: ${D};`};return await K(M)});return(await Promise.all(G)).flat()},g=async w=>{if(!w)return[];const F=Object.entries(w).map(async([k,P])=>{const M=await a(P);return k==="base"?M.join(""):o.mediaQueries[k]?`${o.mediaQueries[k]} { ${M.join("")} }`:`${k} { ${M.join("")} }`});return(await Promise.all(F)).flat()},m=async w=>{if(!w)return[];const F=Object.entries(w).map(async([k,P])=>{const M=Object.entries(P).map(async([D,oe])=>{const ie=await a(oe,[k]),ae=`.${k}-${D}, [data-${k}="${D}"]`,Z=ie.join("");return`${ae} { ${Z} }`});return(await Promise.all(M)).flat()});return(await Promise.all(F)).flat()},h=w=>({...w,responsive:void 0,conditional:void 0}),d=w=>n.variables.map(F=>w==="static"?h(F._current):F._current[w]),$=J.mergeObjects(h(r.variables),d("static")),x=await a($),_=J.mergeObjects((ge=r.variables)==null?void 0:ge.responsive,d("responsive")),E=await g(_),z=J.mergeObjects((he=r.variables)==null?void 0:he.conditional,d("conditional")),X=await m(z),pe=i.join(s,"css/_variables.css"),V=`:root { ${x.join("")} ${E.join("")} } ${X.join("")}`;c.writeFileSync(pe,V),o.staticVariables=$;const te=i.join(s,"css/_global.css"),u=J.mergeObjects(r.global,n.globalStyles),j=await ce.parseAndJoinStyles(u,"");c.writeFileSync(te,`@layer global { ${j} }`);const b=i.join(s,"css/_reset.css"),C=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:qe,N=await ce.parseAndJoinStyles(C,"");c.writeFileSync(b,`@layer reset { ${N} }`);const O=i.join(s,"css/_templates.css"),R=J.mergeObjects(r.templates,n.templates),L=await Se.parseTemplates(R),W=Se.getTemplateTypes(R);c.writeFileSync(O,`@layer templates { ${L} }`),o.templates=R;const Y=r.templates?[Ee.defineTemplates(r.templates)._setPath(`config;;${l}`)]:[],se=J.mergeFactories(n.templates,Y);o.templatePaths=Object.fromEntries(Object.entries(se).map(([w,F])=>[w,F._path]));const U=i.join(s,"types/css-tokens.d.ts"),De=`
|
2
|
+
// Variable types
|
3
|
+
type VariableTokens = ${[...p].join("|")};
|
4
|
+
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
5
|
+
|
6
|
+
// Template types
|
7
|
+
type TemplateTokens = {
|
8
|
+
${Object.entries(W).map(([w,F])=>`${w}?: ${F}`).join(`
|
9
|
+
`)}
|
10
|
+
}
|
11
|
+
|
12
|
+
// Media query types
|
13
|
+
type MediaQueryKeys = ${S||"''"};
|
14
|
+
`;c.writeFileSync(U,De);const Te=i.join(s,"cache/config-cache.json");c.writeFileSync(Te,JSON.stringify(o,null,2));const me=He();console.log("Config _dirname",me);const ye=i.join(me,"../cache/config-cache.json");console.log("Config cache secondary path",ye),c.writeFileSync(ye,JSON.stringify(o,null,2))},je=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(p=>y==null?void 0:y.includes(p)))return t}return"styled('div',"}),Le=(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}},A=async(e,t,s)=>{const n=T.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=je(o),o=Le(o,e);const y=i.join(s,"js",n+".js"),S=await fe(e),p=i.join(e,(S==null?void 0:S.configDir)||"","salty.config.ts"),a=Ne(p),g=await Ce(e);await Fe.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:d=>{d.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},$=>{const x=c.readFileSync($.path,"utf8");return{contents:je(x),loader:"ts"}})}}]});const m=Date.now();return{contents:await import(`${y}?t=${m}`),outputFilePath:y}},We=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 We(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)},de=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Ue=async(e,t=de(),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)&&ve.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 p=new Set,a=new Set;async function g(u){const j=["node_modules","saltygen"],b=c.statSync(u);if(b.isDirectory()){const f=c.readdirSync(u);if(j.some(N=>u.includes(N)))return;await Promise.all(f.map(N=>g(i.join(u,N))))}else if(b.isFile()&&ee(u)){p.add(u);const C=c.readFileSync(u,"utf8");/define[\w\d]+\(/.test(C)&&a.add(u)}}await g(e),await ke(e,a);const m={keyframes:[],components:[],classNames:[]};await Promise.all([...p].map(async u=>{const{contents:j}=await A(e,u,o);for(let[b,f]of Object.entries(j))f instanceof Promise&&(f=await f),f.isKeyframes?m.keyframes.push({value:f,src:u,name:b}):f.isClassName?m.classNames.push({...f,src:u,name:b}):f.generator&&m.components.push({...f,src:u,name:b})}));const h=await ue(e);for(const u of m.keyframes){const{value:j}=u,b=`a_${j.animationName}.css`,f=`css/${b}`,C=i.join(o,f);r.push(b),c.writeFileSync(C,j.css)}const d={};for(const u of m.components){const{src:j,name:b}=u;d[j]||(d[j]=[]);const f=u.generator._withBuildContext({callerName:b,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"&&d[j].push(f.cssFileName)}for(const u of m.classNames){const{src:j,name:b}=u;d[j]||(d[j]=[]);const f=u.generator._withBuildContext({callerName:b,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"&&d[j].push(f.cssFileName)}h.importStrategy==="component"&&Object.entries(d).forEach(([u,j])=>{const b=j.map(R=>`@import url('./${R}');`).join(`
|
19
|
+
`),f=T.toHash(u,6),C=i.parse(u),N=T.dashCase(C.name),O=i.join(o,`css/f_${N}-${f}.css`);c.writeFileSync(O,b||"/* Empty file */")});const $=r.map(u=>`@import url('./css/${u}');`).join(`
|
20
|
+
`);let X=`/*!
|
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((j,b,f)=>{const C=b.reduce((L,W)=>{var ne;const Y=i.join(o,"css",W),se=c.readFileSync(Y,"utf8"),U=((ne=/.*-([^-]+)-\d+.css/.exec(W))==null?void 0:ne.at(1))||T.toHash(Y,6);return L.includes(U)?L:`${L}
|
29
|
+
/*start:${U}-${W}*/
|
30
|
+
${se}
|
31
|
+
/*end:${U}*/
|
32
|
+
`},""),N=`l_${f}.css`,O=i.join(o,"css",N),R=`@layer l${f} { ${C}
|
33
|
+
}`;return c.writeFileSync(O,R),`${j}
|
34
|
+
@import url('./css/${N}');`},"");X+=u}c.writeFileSync(y,X);const V=Date.now()-n,te=V<200?"🔥":V<500?"🚀":V<1e3?"🎉":V<2e3?"🚗":V<5e3?"🤔":"🥴";B.info(`Generated CSS in ${V}ms! ${te}`)}catch(n){console.error(n)}},Ge=async(e,t,s=de())=>{try{const n=await q(e);if(ee(t)){const l=[],o=await ue(e),{contents:y}=await A(e,t,n);for(const[S,p]of Object.entries(y)){if(p.isKeyframes&&p.css){const $=`css/${`a_${p.animationName}.css`}`,x=i.join(n,$);c.writeFileSync(x,await p.css);continue}if(p.isClassName){const d=p.generator._withBuildContext({callerName:S,isProduction:s,config:o}),$=await d.css;if(!$)continue;l[d.priority]||(l[d.priority]=[]),l[d.priority].push(d.cssFileName);const x=`css/${d.cssFileName}`,_=i.join(n,x);c.writeFileSync(_,$);continue}if(!p.generator)continue;const a=p.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,p)=>{const a=`l_${p}.css`,g=i.join(n,"css",a);let m=c.readFileSync(g,"utf8");S.forEach(h=>{var _;const d=i.join(n,"css",h),$=((_=/.*-([^-]+)-\d+.css/.exec(h))==null?void 0:_.at(1))||T.toHash(d,6);if(!m.includes($)){const E=c.readFileSync(d,"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
|
+
`),p=T.toHash(t,6),a=i.parse(t),g=T.dashCase(a.name),m=i.join(n,`css/f_${g}-${p}.css`);c.writeFileSync(m,S||"/* Empty file */")}}}catch(n){console.error(n)}},Ke=async(e,t,s=de())=>{var n,r;try{const l=await q(e);if(ee(t)){const y=c.readFileSync(t,"utf8"),S=await ue(e),{contents:p}=await A(e,t,l);let a=y;for(const[g,m]of Object.entries(p)){if(m.isKeyframes||!m.generator)continue;const h=m.generator._withBuildContext({callerName:g,isProduction:s,config:S}),[d,$]=await ze(a,g),x=a.slice(d,$);if(m.isClassName){const _=a,E=` ${g} = className("${h.classNames}")`;a=a.replace(x,E),_===a&&console.error("Minimize file failed to change content",{name:g})}if(x.includes("styled")){const _=(r=(n=/styled\(([^,]+),/.exec(x))==null?void 0:n.at(1))==null?void 0:r.trim(),E=a,z=` ${g} = styled(${_}, "${h.classNames}", ${JSON.stringify(h.clientProps)})`;a=a.replace(x,z),E===a&&console.error("Minimize file failed to change content",{name:g,tagName:_})}}if(S.importStrategy==="component"){const g=T.toHash(t,6),m=i.parse(t);a=`import '../../saltygen/css/${`f_${T.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=A;exports.generateConfigStyles=ke;exports.generateCss=Ue;exports.generateFile=Ge;exports.isSaltyFile=ee;exports.logError=Je;exports.logger=B;exports.minimizeFile=Ke;exports.saltyFileExtensions=le;exports.saltyFileRegExp=xe;
|
package/package.json
CHANGED
package/server/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-Z7Vfizh9.cjs");exports.checkShouldRestart=e.checkShouldRestart;
|
package/server/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { readFile as r } from "fs/promises";
|
2
|
-
import { i as e } from "./index-
|
2
|
+
import { i as e } from "./index-8a_5lZS1.js";
|
3
3
|
const f = async (t) => {
|
4
4
|
if (!t || t.includes("node_modules") || t.includes("saltygen")) return !1;
|
5
5
|
if (t.includes("salty.config")) return !0;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";const s=require("fs/promises"),r=require("./index-
|
1
|
+
"use strict";const s=require("fs/promises"),r=require("./index-DOl289-D.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!(/.+define[A-Z]\w+/.test(e)||/.+keyframes\(.+/.test(e))};exports.checkShouldRestart=i;
|
package/index-CidX_d4J.cjs
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
"use strict";const Oe=require("esbuild"),Re=require("child_process"),D=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),Se=require("fs/promises"),ce=require("./parse-styles-Bdgw_4ME.cjs"),he=require("./parsers/index.cjs"),Q=require("winston"),q=require("./css/merge.cjs"),ve=require("./define-templates-Cunsb_Tr.cjs"),re=require("typescript");var R=typeof document<"u"?document.currentScript:null;function Ee(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 je=Ee(Oe),be=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:be(i.join(e,".."))},Ve=async e=>{const t=be(e);return await Se.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Me=async e=>{const t=await Ve(e);if(t)return t.type};let U;const Fe=async e=>{if(U)return U;const t=await Me(e);return t==="module"?U="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:R&&R.tagName.toUpperCase()==="SCRIPT"&&R.src||new URL("index-CidX_d4J.cjs",document.baseURI).href).endsWith(".cjs"))&&(U="cjs"),U||"esm"},B=Q.createLogger({level:"debug",format:Q.format.combine(Q.format.colorize(),Q.format.cli()),transports:[new Q.transports.Console({})]}),Je=e=>{B.error(e)};function $e(e){return e?typeof e!="string"?$e(String(e)):e.replace(/[^\d\w]/g,"."):""}const qe={"*, *::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"}},ze=(e,t)=>new Promise((s,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},100),l=re.createSourceFile("temp.ts",e,re.ScriptTarget.Latest,!0);function o(y){if(re.isVariableDeclaration(y)&&y.name.getText()===t){const S=y.getStart(),p=y.getEnd();clearTimeout(r),s([S,p])}y.forEachChild(o)}o(l)}),Ie=()=>(console.log("dirname",typeof document>"u"?require("url").pathToFileURL(__filename).href:R&&R.tagName.toUpperCase()==="SCRIPT"&&R.src||new URL("index-CidX_d4J.cjs",document.baseURI).href),new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:R&&R.tagName.toUpperCase()==="SCRIPT"&&R.src||new URL("index-CidX_d4J.cjs",document.baseURI).href).pathname),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},z=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("|")})\\.`),ee=(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))},Ue=async e=>{const t=await fe(e),s=await z(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 je.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 z(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async w=>{const{contents:F,outputFilePath:G}=await A(e,w,s);Object.entries(F).forEach(([T,P])=>{P.isMedia?n.mediaQueries.push([T,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${T};;${G}`))})}));const{config:r,path:l}=await Ue(e),o={...r},{mediaQueries:y}=n;o.mediaQueries=Object.fromEntries(y.map(([w,F])=>[`@${w}`,F]));const S=y.map(([w])=>`'@${w}'`).join(" | "),p=new Set,a=async(w,F=[])=>{if(!w)return[];const G=Object.entries(w).map(async([P,J])=>{const K=async k=>{if(!k)return;if(k instanceof Promise)return await K(await k);if(typeof k=="function")return await K(await k());if(typeof k=="object")return await a(k,[...F,P]);const oe=$e(P),ie=D.dashCase(P),ae=[...F,oe].join(".");p.add(`"${ae}"`);const Z=[...F.map(D.dashCase),ie].join("-"),ge=ce.parseVariableTokens(k);return ge?`--${Z}: ${ge.transformed};`:`--${Z}: ${k};`};return await K(J)});return(await Promise.all(G)).flat()},g=async w=>{if(!w)return[];const F=Object.entries(w).map(async([T,P])=>{const J=await a(P);return T==="base"?J.join(""):o.mediaQueries[T]?`${o.mediaQueries[T]} { ${J.join("")} }`:`${T} { ${J.join("")} }`});return(await Promise.all(F)).flat()},m=async w=>{if(!w)return[];const F=Object.entries(w).map(async([T,P])=>{const J=Object.entries(P).map(async([k,oe])=>{const ie=await a(oe,[T]),ae=`.${T}-${k}, [data-${T}="${k}"]`,Z=ie.join("");return`${ae} { ${Z} }`});return(await Promise.all(J)).flat()});return(await Promise.all(F)).flat()},h=w=>({...w,responsive:void 0,conditional:void 0}),d=w=>n.variables.map(F=>w==="static"?h(F._current):F._current[w]),$=q.mergeObjects(h(r.variables),d("static")),x=await a($),_=q.mergeObjects((me=r.variables)==null?void 0:me.responsive,d("responsive")),E=await g(_),I=q.mergeObjects((ye=r.variables)==null?void 0:ye.conditional,d("conditional")),X=await m(I),pe=i.join(s,"css/_variables.css"),V=`:root { ${x.join("")} ${E.join("")} } ${X.join("")}`;c.writeFileSync(pe,V),o.staticVariables=$;const te=i.join(s,"css/_global.css"),u=q.mergeObjects(r.global,n.globalStyles),j=await ce.parseAndJoinStyles(u,"");c.writeFileSync(te,`@layer global { ${j} }`);const b=i.join(s,"css/_reset.css"),C=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:qe,N=await ce.parseAndJoinStyles(C,"");c.writeFileSync(b,`@layer reset { ${N} }`);const O=i.join(s,"css/_templates.css"),M=q.mergeObjects(r.templates,n.templates),H=await he.parseTemplates(M),L=he.getTemplateTypes(M);c.writeFileSync(O,`@layer templates { ${H} }`),o.templates=M;const Y=r.templates?[ve.defineTemplates(r.templates)._setPath(`config;;${l}`)]:[],se=q.mergeFactories(n.templates,Y);o.templatePaths=Object.fromEntries(Object.entries(se).map(([w,F])=>[w,F._path]));const W=i.join(s,"types/css-tokens.d.ts"),_e=`
|
2
|
-
// Variable types
|
3
|
-
type VariableTokens = ${[...p].join("|")};
|
4
|
-
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
5
|
-
|
6
|
-
// Template types
|
7
|
-
type TemplateTokens = {
|
8
|
-
${Object.entries(L).map(([w,F])=>`${w}?: ${F}`).join(`
|
9
|
-
`)}
|
10
|
-
}
|
11
|
-
|
12
|
-
// Media query types
|
13
|
-
type MediaQueryKeys = ${S||"''"};
|
14
|
-
`;c.writeFileSync(W,_e);const Te=i.join(s,"cache/config-cache.json");c.writeFileSync(Te,JSON.stringify(o,null,2));const ke=Ie(),De=i.join(ke,"../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(p=>y==null?void 0:y.includes(p)))return t}return"styled('div',"}),He=(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}},A=async(e,t,s)=>{const n=D.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=He(o,e);const y=i.join(s,"js",n+".js"),S=await fe(e),p=i.join(e,(S==null?void 0:S.configDir)||"","salty.config.ts"),a=Ce(p),g=await Fe(e);await je.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:d=>{d.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}},Le=async e=>{const t=await z(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 Le(e),s=await z(e),n=i.join(s,"salty.config.js"),r=Date.now(),{config:l}=await import(`${n}?t=${r}`);return q.mergeObjects(l,t)},de=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},We=async(e,t=de(),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 z(e),y=i.join(o,"index.css");s&&(()=>{c.existsSync(o)&&Re.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 p=new Set,a=new Set;async function g(u){const j=["node_modules","saltygen"],b=c.statSync(u);if(b.isDirectory()){const f=c.readdirSync(u);if(j.some(N=>u.includes(N)))return;await Promise.all(f.map(N=>g(i.join(u,N))))}else if(b.isFile()&&ee(u)){p.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([...p].map(async u=>{const{contents:j}=await A(e,u,o);for(let[b,f]of Object.entries(j))f instanceof Promise&&(f=await f),f.isKeyframes?m.keyframes.push({value:f,src:u,name:b}):f.isClassName?m.classNames.push({...f,src:u,name:b}):f.generator&&m.components.push({...f,src:u,name:b})}));const h=await ue(e);for(const u of m.keyframes){const{value:j}=u,b=`a_${j.animationName}.css`,f=`css/${b}`,C=i.join(o,f);r.push(b),c.writeFileSync(C,j.css)}const d={};for(const u of m.components){const{src:j,name:b}=u;d[j]||(d[j]=[]);const f=u.generator._withBuildContext({callerName:b,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"&&d[j].push(f.cssFileName)}for(const u of m.classNames){const{src:j,name:b}=u;d[j]||(d[j]=[]);const f=u.generator._withBuildContext({callerName:b,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"&&d[j].push(f.cssFileName)}h.importStrategy==="component"&&Object.entries(d).forEach(([u,j])=>{const b=j.map(M=>`@import url('./${M}');`).join(`
|
19
|
-
`),f=D.toHash(u,6),C=i.parse(u),N=D.dashCase(C.name),O=i.join(o,`css/f_${N}-${f}.css`);c.writeFileSync(O,b||"/* Empty file */")});const $=r.map(u=>`@import url('./css/${u}');`).join(`
|
20
|
-
`);let X=`/*!
|
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((j,b,f)=>{const C=b.reduce((H,L)=>{var ne;const Y=i.join(o,"css",L),se=c.readFileSync(Y,"utf8"),W=((ne=/.*-([^-]+)-\d+.css/.exec(L))==null?void 0:ne.at(1))||D.toHash(Y,6);return H.includes(W)?H:`${H}
|
29
|
-
/*start:${W}-${L}*/
|
30
|
-
${se}
|
31
|
-
/*end:${W}*/
|
32
|
-
`},""),N=`l_${f}.css`,O=i.join(o,"css",N),M=`@layer l${f} { ${C}
|
33
|
-
}`;return c.writeFileSync(O,M),`${j}
|
34
|
-
@import url('./css/${N}');`},"");X+=u}c.writeFileSync(y,X);const V=Date.now()-n,te=V<200?"🔥":V<500?"🚀":V<1e3?"🎉":V<2e3?"🚗":V<5e3?"🤔":"🥴";B.info(`Generated CSS in ${V}ms! ${te}`)}catch(n){console.error(n)}},Ge=async(e,t,s=de())=>{try{const n=await z(e);if(ee(t)){const l=[],o=await ue(e),{contents:y}=await A(e,t,n);for(const[S,p]of Object.entries(y)){if(p.isKeyframes&&p.css){const $=`css/${`a_${p.animationName}.css`}`,x=i.join(n,$);c.writeFileSync(x,await p.css);continue}if(p.isClassName){const d=p.generator._withBuildContext({callerName:S,isProduction:s,config:o}),$=await d.css;if(!$)continue;l[d.priority]||(l[d.priority]=[]),l[d.priority].push(d.cssFileName);const x=`css/${d.cssFileName}`,_=i.join(n,x);c.writeFileSync(_,$);continue}if(!p.generator)continue;const a=p.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,p)=>{const a=`l_${p}.css`,g=i.join(n,"css",a);let m=c.readFileSync(g,"utf8");S.forEach(h=>{var _;const d=i.join(n,"css",h),$=((_=/.*-([^-]+)-\d+.css/.exec(h))==null?void 0:_.at(1))||D.toHash(d,6);if(!m.includes($)){const E=c.readFileSync(d,"utf8"),I=`/*start:${$}-${h}*/
|
35
|
-
${E}
|
36
|
-
/*end:${$}*/
|
37
|
-
`;m=`${m.replace(/\}$/,"")}
|
38
|
-
${I}
|
39
|
-
}`}}),c.writeFileSync(g,m)});else{const S=l.flat().map(h=>`@import url('./${h}');`).join(`
|
40
|
-
`),p=D.toHash(t,6),a=i.parse(t),g=D.dashCase(a.name),m=i.join(n,`css/f_${g}-${p}.css`);c.writeFileSync(m,S||"/* Empty file */")}}}catch(n){console.error(n)}},Ke=async(e,t,s=de())=>{var n,r;try{const l=await z(e);if(ee(t)){const y=c.readFileSync(t,"utf8"),S=await ue(e),{contents:p}=await A(e,t,l);let a=y;for(const[g,m]of Object.entries(p)){if(m.isKeyframes||!m.generator)continue;const h=m.generator._withBuildContext({callerName:g,isProduction:s,config:S}),[d,$]=await ze(a,g),x=a.slice(d,$);if(m.isClassName){const _=a,E=` ${g} = className("${h.classNames}")`;a=a.replace(x,E),_===a&&console.error("Minimize file failed to change content",{name:g})}if(x.includes("styled")){const _=(r=(n=/styled\(([^,]+),/.exec(x))==null?void 0:n.at(1))==null?void 0:r.trim(),E=a,I=` ${g} = styled(${_}, "${h.classNames}", ${JSON.stringify(h.clientProps)})`;a=a.replace(x,I),E===a&&console.error("Minimize file failed to change content",{name:g,tagName:_})}}if(S.importStrategy==="component"){const g=D.toHash(t,6),m=i.parse(t);a=`import '../../saltygen/css/${`f_${D.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=A;exports.generateConfigStyles=xe;exports.generateCss=We;exports.generateFile=Ge;exports.isSaltyFile=ee;exports.logError=Je;exports.logger=B;exports.minimizeFile=Ke;exports.saltyFileExtensions=le;exports.saltyFileRegExp=Pe;
|