@salty-css/core 0.0.1-alpha.35 → 0.0.1-alpha.37

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 CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("commander"),i=require("fs/promises"),t=require("path"),z=require("ejs"),W=require("../compiler/index.cjs"),H=require("../pascal-case-iWoaJWwT.cjs"),x=require("winston"),M=require("fs"),B=require("child_process"),G=require("ora");var O=typeof document<"u"?document.currentScript:null;const n=x.createLogger({level:"debug",format:x.format.combine(x.format.colorize(),x.format.cli()),transports:[new x.transports.Console({})]}),S=a=>{n.error(a)},A=a=>new Promise((g,h)=>{B.exec(a,P=>{if(P)return h(P);g()})}),I=async(...a)=>{const g=a.map(C=>C.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),h=G(`Installing packages: ${g}`).start(),P=a.join(" ");await A(`npm install ${P}`),h.succeed(`Installed packages: ${g}`)},V=()=>M.existsSync(t.join(process.cwd(),"node_modules",".bin","prettier"));async function J(a){try{if(!V())return;await A(`./node_modules/.bin/prettier --write "${a}"`),n.info(`Formatted ${a} with Prettier`)}catch(g){n.error(`Error formatting ${a} with Prettier:`,g)}}async function K(){const a=new R.Command;a.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const g={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-BupieCfE.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"))},h=async(e,s)=>{const{default:c}=await g[e],u=z.render(c,s);return{fileName:e,content:u}},P=async()=>{const e=t.join(process.cwd(),".saltyrc");return await i.readFile(e,"utf-8").then(JSON.parse).catch(()=>({}))},C=async(e=t.join(process.cwd(),"package.json"))=>{const s=await i.readFile(e,"utf-8").then(JSON.parse).catch(()=>{});if(!s)throw"Could not read package.json file!";return s},T=async()=>{const e=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:O&&O.tagName.toUpperCase()==="SCRIPT"&&O.src||new URL("bin/main.cjs",document.baseURI).href);return C(e)},N=await(async()=>(await P()).defaultProject)(),k=await T(),$={core:`@salty-css/core@${k.version}`,react:`@salty-css/react@${k.version}`,eslintPluginCore:`@salty-css/eslint-plugin-core@${k.version}`,vite:`@salty-css/vite@${k.version}`},_=e=>{const s=e==="."?"":e,c=process.cwd();return t.join(c,s)};a.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(e="."){if(!await C().catch(()=>{}))return S("Salty CSS project must be initialized in a directory with a package.json file.");n.info("Initializing a new Salty-CSS project!");const{dir:c=e,cssFile:u,skipInstall:y}=this.opts();if(!c)return S("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");y||(await I($.core,$.react),await I(`-D ${$.eslintPluginCore}`));const w=process.cwd(),l=_(c),j=await Promise.all([h("salty.config.ts"),h("saltygen/index.css")]);await i.mkdir(l,{recursive:!0});const f=j.map(async({fileName:o,content:p})=>{const m=t.join(l,o);if(await i.readFile(m,"utf-8").catch(()=>{})!==void 0){n.debug("File already exists: "+m);return}const E=o.split("/").slice(0,-1).join("/");E&&await i.mkdir(t.join(l,E),{recursive:!0}),n.info("Writing file: "+m),await i.writeFile(m,p),await J(m)});await Promise.all(f);const r=t.relative(w,l)||".",d=t.join(w,".saltyrc"),F=await i.readFile(d,"utf-8").catch(()=>{});if(F===void 0){n.info("Creating file: "+d);const p=JSON.stringify({defaultProject:r,projects:[r]},null,2);await i.writeFile(d,p)}else{n.info("Edit file: "+d);const o=JSON.parse(F),p=new Set((o==null?void 0:o.projects)||[]);p.add(r),o.projects=[...p];const m=JSON.stringify(o,null,2);await i.writeFile(d,m)}const D=t.join(w,".gitignore"),b=await i.readFile(D,"utf-8").catch(()=>{});if(b!==void 0&&(b.includes("saltygen")||(n.info("Edit file: "+D),await i.writeFile(D,b+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("commander"),i=require("fs/promises"),t=require("path"),z=require("ejs"),W=require("../compiler/index.cjs"),H=require("../pascal-case-iWoaJWwT.cjs"),x=require("winston"),M=require("fs"),B=require("child_process"),G=require("ora");var O=typeof document<"u"?document.currentScript:null;const n=x.createLogger({level:"debug",format:x.format.combine(x.format.colorize(),x.format.cli()),transports:[new x.transports.Console({})]}),S=a=>{n.error(a)},A=a=>new Promise((f,h)=>{B.exec(a,P=>{if(P)return h(P);f()})}),I=async(...a)=>{const f=a.map(C=>C.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),h=G(`Installing packages: ${f}`).start(),P=a.join(" ");await A(`npm install ${P}`),h.succeed(`Installed packages: ${f}`)},V=()=>M.existsSync(t.join(process.cwd(),"node_modules",".bin","prettier"));async function J(a){try{if(!V())return;await A(`./node_modules/.bin/prettier --write "${a}"`),n.info(`Formatted ${a} with Prettier`)}catch(f){n.error(`Error formatting ${a} with Prettier:`,f)}}async function K(){const a=new R.Command;a.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const f={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-BupieCfE.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"))},h=async(e,r)=>{const{default:c}=await f[e],p=z.render(c,r);return{fileName:e,content:p}},P=async()=>{const e=t.join(process.cwd(),".saltyrc");return await i.readFile(e,"utf-8").then(JSON.parse).catch(()=>({}))},C=async(e=t.join(process.cwd(),"package.json"))=>{const r=await i.readFile(e,"utf-8").then(JSON.parse).catch(()=>{});if(!r)throw"Could not read package.json file!";return r},T=async()=>{const e=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:O&&O.tagName.toUpperCase()==="SCRIPT"&&O.src||new URL("bin/main.cjs",document.baseURI).href);return C(e)},N=await(async()=>(await P()).defaultProject)(),k=await T(),$={core:`@salty-css/core@${k.version}`,react:`@salty-css/react@${k.version}`,eslintPluginCore:`@salty-css/eslint-plugin-core@${k.version}`,vite:`@salty-css/vite@${k.version}`},_=e=>{const r=e==="."?"":e,c=process.cwd();return t.join(c,r)};a.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(e="."){if(!await C().catch(()=>{}))return S("Salty CSS project must be initialized in a directory with a package.json file.");n.info("Initializing a new Salty-CSS project!");const{dir:c=e,cssFile:p,skipInstall:m}=this.opts();if(!c)return S("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");m||(await I($.core,$.react),await I(`-D ${$.eslintPluginCore}`));const w=process.cwd(),l=_(c),j=await Promise.all([h("salty.config.ts"),h("saltygen/index.css")]);await i.mkdir(l,{recursive:!0});const u=j.map(async({fileName:o,content:d})=>{const g=t.join(l,o);if(await i.readFile(g,"utf-8").catch(()=>{})!==void 0){n.debug("File already exists: "+g);return}const E=o.split("/").slice(0,-1).join("/");E&&await i.mkdir(t.join(l,E),{recursive:!0}),n.info("Writing file: "+g),await i.writeFile(g,d),await J(g)});await Promise.all(u);const F=t.relative(w,l)||".",s=t.join(w,".saltyrc"),y=await i.readFile(s,"utf-8").catch(()=>{});if(y===void 0){n.info("Creating file: "+s);const d=JSON.stringify({defaultProject:F,projects:[F]},null,2);await i.writeFile(s,d)}else{n.info("Edit file: "+s);const o=JSON.parse(y),d=new Set((o==null?void 0:o.projects)||[]);d.add(F),o.projects=[...d];const g=JSON.stringify(o,null,2);await i.writeFile(s,g)}const D=t.join(w,".gitignore"),b=await i.readFile(D,"utf-8").catch(()=>{});if(b!==void 0&&(b.includes("saltygen")||(n.info("Edit file: "+D),await i.writeFile(D,b+`
2
2
 
3
3
  # Salty-CSS
4
4
  saltygen
5
- `))),u){const o=t.join(l,u),p=await i.readFile(o,"utf-8").catch(()=>{});if(p!==void 0&&!p.includes("saltygen")){const q=t.join(o,".."),L=`@import '${t.relative(q,t.join(l,"saltygen/index.css"))}';`;n.info("Edit file: "+o),await i.writeFile(o,L+`
6
- `+p),await J(o)}}const v=t.join(l,"vite.config.ts"),U=await i.readFile(v,"utf-8").catch(()=>{});if(U!==void 0&&!U.includes("saltyPlugin")){n.info("Edit file: "+v);const p=`import { saltyPlugin } from '@salty-css/vite';
5
+ `))),p){const o=t.join(l,p),d=await i.readFile(o,"utf-8").catch(()=>{});if(d!==void 0&&!d.includes("saltygen")){const q=t.join(o,".."),L=`@import '${t.relative(q,t.join(l,"saltygen/index.css"))}';`;n.info("Edit file: "+o),await i.writeFile(o,L+`
6
+ `+d),await J(o)}}const v=t.join(l,"vite.config.ts"),U=await i.readFile(v,"utf-8").catch(()=>{});if(U!==void 0&&!U.includes("saltyPlugin")){n.info("Edit file: "+v);const d=`import { saltyPlugin } from '@salty-css/vite';
7
7
  `,q=U.replace(/(plugins: \[)/,`$1
8
- saltyPlugin(__dirname),`);n.info("Installing @salty-css/vite"),y||await I(`-D ${$.vite}`),n.info("Adding Salty-CSS plugin to Vite config..."),await i.writeFile(v,p+q),await J(v)}}),a.command("build [directory]").alias("b").description("Build the Salty-CSS project.").option("-d, --dir <dir>","Project directory to build the project in.").action(async function(e=N){n.info("Building the Salty-CSS project...");const{dir:s=e}=this.opts();if(!s)return S("Project directory must be provided. Add it as the first argument after build command or use the --dir option.");const c=_(s);await W.generateCss(c)}),a.command("generate [file] [directory]").alias("g").description("Generate a new component file.").option("-f, --file <file>","File to generate.").option("-d, --dir <dir>","Project directory to generate the file in.").option("-t, --tag <tag>","HTML tag of the component.","div").option("-n, --name <name>","Name of the component.").option("-c, --className <className>","CSS class of the component.").action(async function(e,s=N){const{file:c=e,dir:u=s,tag:y,name:w,className:l}=this.opts();if(!c)return S("File to generate must be provided. Add it as the first argument after generate command or use the --file option.");if(!u)return S("Project directory must be provided. Add it as the second argument after generate command or use the --dir option.");const j=_(u),f=t.join(j,c),r=t.parse(f);r.ext||(r.ext=".ts"),r.name.endsWith(".css")||(r.name=r.name+".css"),r.base=r.name+r.ext;const d=t.format(r),F=d.split("/").slice(0,-1).join("/");if(F&&await i.mkdir(t.join(j,F),{recursive:!0}),await i.readFile(d,"utf-8").catch(()=>{})!==void 0){n.error("File already exists:",d);return}n.info("Generating a new file: "+d);const b=H.pascalCase(w||r.base.replace(/\.css\.\w+$/,"")),{content:v}=await h("react/react-styled-file.ts",{tag:y,name:b,className:l});await i.writeFile(d,v),await J(d)}),a.command("update").alias("up").description("Update Salty-CSS packages to the latest version.").option("--legacy-peer-deps <legacyPeerDeps>","Use legacy peer dependencies (not recommended).",!1).action(async function(e,s=N){const{legacyPeerDeps:c}=this.opts(),u=t.join(process.cwd(),"package.json"),y=await C(u).catch(f=>S(f));if(!y)return;const w={...y.dependencies,...y.devDependencies},l=Object.keys(w).filter(f=>f==="salty-css"||f.startsWith("@salty-css/"));if(!l.length)return S("No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: "+u);const j=l.map(f=>`${f}@${k.version}`);c?(n.warn("Using legacy peer dependencies to update packages."),await I(...j,"--legacy-peer-deps")):await I(...j),n.info("Salty-CSS packages updated successfully!")}),a.parseAsync(process.argv)}exports.main=K;
8
+ saltyPlugin(__dirname),`);n.info("Installing @salty-css/vite"),m||await I(`-D ${$.vite}`),n.info("Adding Salty-CSS plugin to Vite config..."),await i.writeFile(v,d+q),await J(v)}}),a.command("build [directory]").alias("b").description("Build the Salty-CSS project.").option("-d, --dir <dir>","Project directory to build the project in.").action(async function(e=N){n.info("Building the Salty-CSS project...");const{dir:r=e}=this.opts();if(!r)return S("Project directory must be provided. Add it as the first argument after build command or use the --dir option.");const c=_(r);await W.generateCss(c)}),a.command("generate [file] [directory]").alias("g").description("Generate a new component file.").option("-f, --file <file>","File to generate.").option("-d, --dir <dir>","Project directory to generate the file in.").option("-t, --tag <tag>","HTML tag of the component.","div").option("-n, --name <name>","Name of the component.").option("-c, --className <className>","CSS class of the component.").action(async function(e,r=N){const{file:c=e,dir:p=r,tag:m,name:w,className:l}=this.opts();if(!c)return S("File to generate must be provided. Add it as the first argument after generate command or use the --file option.");if(!p)return S("Project directory must be provided. Add it as the second argument after generate command or use the --dir option.");const j=_(p),u=c.split("/").slice(0,-1).join("/");u&&await i.mkdir(t.join(j,u),{recursive:!0});const F=t.join(j,c),s=t.parse(F);s.ext||(s.ext=".ts"),s.name.endsWith(".css")||(s.name=s.name+".css"),s.base=s.name+s.ext;const y=t.format(s);if(await i.readFile(y,"utf-8").catch(()=>{})!==void 0){n.error("File already exists:",y);return}n.info("Generating a new file: "+y);const b=H.pascalCase(w||s.base.replace(/\.css\.\w+$/,"")),{content:v}=await h("react/react-styled-file.ts",{tag:m,name:b,className:l});await i.writeFile(y,v),await J(y)}),a.command("update").alias("up").description("Update Salty-CSS packages to the latest version.").option("--legacy-peer-deps <legacyPeerDeps>","Use legacy peer dependencies (not recommended).",!1).action(async function(e,r=N){const{legacyPeerDeps:c}=this.opts(),p=t.join(process.cwd(),"package.json"),m=await C(p).catch(u=>S(u));if(!m)return;const w={...m.dependencies,...m.devDependencies},l=Object.keys(w).filter(u=>u==="salty-css"||u.startsWith("@salty-css/"));if(!l.length)return S("No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: "+p);const j=l.map(u=>`${u}@${k.version}`);c?(n.warn("Using legacy peer dependencies to update packages."),await I(...j,"--legacy-peer-deps")):await I(...j),n.info("Salty-CSS packages updated successfully!")}),a.parseAsync(process.argv)}exports.main=K;
package/bin/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Command as B } from "commander";
2
2
  import { mkdir as U, readFile as y, writeFile as P } from "fs/promises";
3
- import { join as a, relative as L, parse as G, format as M } from "path";
3
+ import { join as o, relative as L, parse as G, format as M } from "path";
4
4
  import { render as R } from "ejs";
5
5
  import { generateCss as V } from "../compiler/index.js";
6
6
  import { p as q } from "../pascal-case-BQpR5PdN.js";
@@ -14,43 +14,43 @@ const e = K({
14
14
  transports: [new Q.Console({})]
15
15
  }), v = (i) => {
16
16
  e.error(i);
17
- }, T = (i) => new Promise((g, h) => {
17
+ }, T = (i) => new Promise((f, h) => {
18
18
  Y(i, (j) => {
19
19
  if (j) return h(j);
20
- g();
20
+ f();
21
21
  });
22
22
  }), x = async (...i) => {
23
- const g = i.map((k) => k.replace("-D", "").split("@").slice(0, -1).join("@").trim()).join(", "), h = Z(`Installing packages: ${g}`).start(), j = i.join(" ");
24
- await T(`npm install ${j}`), h.succeed(`Installed packages: ${g}`);
25
- }, tt = () => X(a(process.cwd(), "node_modules", ".bin", "prettier"));
23
+ const f = i.map((k) => k.replace("-D", "").split("@").slice(0, -1).join("@").trim()).join(", "), h = Z(`Installing packages: ${f}`).start(), j = i.join(" ");
24
+ await T(`npm install ${j}`), h.succeed(`Installed packages: ${f}`);
25
+ }, tt = () => X(o(process.cwd(), "node_modules", ".bin", "prettier"));
26
26
  async function N(i) {
27
27
  try {
28
28
  if (!tt()) return;
29
29
  await T(`./node_modules/.bin/prettier --write "${i}"`), e.info(`Formatted ${i} with Prettier`);
30
- } catch (g) {
31
- e.error(`Error formatting ${i} with Prettier:`, g);
30
+ } catch (f) {
31
+ e.error(`Error formatting ${i} with Prettier:`, f);
32
32
  }
33
33
  }
34
34
  async function ft() {
35
35
  const i = new B();
36
36
  i.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");
37
- const g = {
37
+ const f = {
38
38
  // Core files
39
39
  "salty.config.ts": import("../salty.config-D9ANEDiH.js"),
40
40
  "saltygen/index.css": import("../index-D_732b92.js"),
41
41
  // React
42
42
  "react/react-styled-file.ts": import("../react-styled-file-CGVf5n1B.js")
43
- }, h = async (t, o) => {
44
- const { default: r } = await g[t], p = R(r, o);
45
- return { fileName: t, content: p };
43
+ }, h = async (t, s) => {
44
+ const { default: r } = await f[t], d = R(r, s);
45
+ return { fileName: t, content: d };
46
46
  }, j = async () => {
47
- const t = a(process.cwd(), ".saltyrc");
47
+ const t = o(process.cwd(), ".saltyrc");
48
48
  return await y(t, "utf-8").then(JSON.parse).catch(() => ({}));
49
- }, k = async (t = a(process.cwd(), "package.json")) => {
50
- const o = await y(t, "utf-8").then(JSON.parse).catch(() => {
49
+ }, k = async (t = o(process.cwd(), "package.json")) => {
50
+ const s = await y(t, "utf-8").then(JSON.parse).catch(() => {
51
51
  });
52
- if (!o) throw "Could not read package.json file!";
53
- return o;
52
+ if (!s) throw "Could not read package.json file!";
53
+ return s;
54
54
  }, W = async () => {
55
55
  const t = new URL("../package.json", import.meta.url);
56
56
  return k(t);
@@ -60,99 +60,101 @@ async function ft() {
60
60
  eslintPluginCore: `@salty-css/eslint-plugin-core@${F.version}`,
61
61
  vite: `@salty-css/vite@${F.version}`
62
62
  }, A = (t) => {
63
- const o = t === "." ? "" : t, r = process.cwd();
64
- return a(r, o);
63
+ const s = t === "." ? "" : t, r = process.cwd();
64
+ return o(r, s);
65
65
  };
66
66
  i.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(t = ".") {
67
67
  if (!await k().catch(() => {
68
68
  })) return v("Salty CSS project must be initialized in a directory with a package.json file.");
69
69
  e.info("Initializing a new Salty-CSS project!");
70
- const { dir: r = t, cssFile: p, skipInstall: u } = this.opts();
70
+ const { dir: r = t, cssFile: d, skipInstall: m } = this.opts();
71
71
  if (!r) return v("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");
72
- u || (await x(D.core, D.react), await x(`-D ${D.eslintPluginCore}`));
72
+ m || (await x(D.core, D.react), await x(`-D ${D.eslintPluginCore}`));
73
73
  const w = process.cwd(), c = A(r), S = await Promise.all([h("salty.config.ts"), h("saltygen/index.css")]);
74
74
  await U(c, { recursive: !0 });
75
- const f = S.map(async ({ fileName: n, content: d }) => {
76
- const m = a(c, n);
77
- if (await y(m, "utf-8").catch(() => {
75
+ const p = S.map(async ({ fileName: n, content: l }) => {
76
+ const g = o(c, n);
77
+ if (await y(g, "utf-8").catch(() => {
78
78
  }) !== void 0) {
79
- e.debug("File already exists: " + m);
79
+ e.debug("File already exists: " + g);
80
80
  return;
81
81
  }
82
82
  const _ = n.split("/").slice(0, -1).join("/");
83
- _ && await U(a(c, _), { recursive: !0 }), e.info("Writing file: " + m), await P(m, d), await N(m);
83
+ _ && await U(o(c, _), { recursive: !0 }), e.info("Writing file: " + g), await P(g, l), await N(g);
84
84
  });
85
- await Promise.all(f);
86
- const s = L(w, c) || ".", l = a(w, ".saltyrc"), $ = await y(l, "utf-8").catch(() => {
85
+ await Promise.all(p);
86
+ const $ = L(w, c) || ".", a = o(w, ".saltyrc"), u = await y(a, "utf-8").catch(() => {
87
87
  });
88
- if ($ === void 0) {
89
- e.info("Creating file: " + l);
90
- const d = JSON.stringify({
91
- defaultProject: s,
92
- projects: [s]
88
+ if (u === void 0) {
89
+ e.info("Creating file: " + a);
90
+ const l = JSON.stringify({
91
+ defaultProject: $,
92
+ projects: [$]
93
93
  }, null, 2);
94
- await P(l, d);
94
+ await P(a, l);
95
95
  } else {
96
- e.info("Edit file: " + l);
97
- const n = JSON.parse($), d = new Set((n == null ? void 0 : n.projects) || []);
98
- d.add(s), n.projects = [...d];
99
- const m = JSON.stringify(n, null, 2);
100
- await P(l, m);
96
+ e.info("Edit file: " + a);
97
+ const n = JSON.parse(u), l = new Set((n == null ? void 0 : n.projects) || []);
98
+ l.add($), n.projects = [...l];
99
+ const g = JSON.stringify(n, null, 2);
100
+ await P(a, g);
101
101
  }
102
- const I = a(w, ".gitignore"), b = await y(I, "utf-8").catch(() => {
102
+ const I = o(w, ".gitignore"), b = await y(I, "utf-8").catch(() => {
103
103
  });
104
104
  if (b !== void 0 && (b.includes("saltygen") || (e.info("Edit file: " + I), await P(I, b + `
105
105
 
106
106
  # Salty-CSS
107
107
  saltygen
108
- `))), p) {
109
- const n = a(c, p), d = await y(n, "utf-8").catch(() => {
108
+ `))), d) {
109
+ const n = o(c, d), l = await y(n, "utf-8").catch(() => {
110
110
  });
111
- if (d !== void 0 && !d.includes("saltygen")) {
112
- const J = a(n, ".."), H = `@import '${L(J, a(c, "saltygen/index.css"))}';`;
111
+ if (l !== void 0 && !l.includes("saltygen")) {
112
+ const J = o(n, ".."), H = `@import '${L(J, o(c, "saltygen/index.css"))}';`;
113
113
  e.info("Edit file: " + n), await P(n, H + `
114
- ` + d), await N(n);
114
+ ` + l), await N(n);
115
115
  }
116
116
  }
117
- const C = a(c, "vite.config.ts"), O = await y(C, "utf-8").catch(() => {
117
+ const C = o(c, "vite.config.ts"), O = await y(C, "utf-8").catch(() => {
118
118
  });
119
119
  if (O !== void 0 && !O.includes("saltyPlugin")) {
120
120
  e.info("Edit file: " + C);
121
- const d = `import { saltyPlugin } from '@salty-css/vite';
121
+ const l = `import { saltyPlugin } from '@salty-css/vite';
122
122
  `, J = O.replace(/(plugins: \[)/, `$1
123
123
  saltyPlugin(__dirname),`);
124
- e.info("Installing @salty-css/vite"), u || await x(`-D ${D.vite}`), e.info("Adding Salty-CSS plugin to Vite config..."), await P(C, d + J), await N(C);
124
+ e.info("Installing @salty-css/vite"), m || await x(`-D ${D.vite}`), e.info("Adding Salty-CSS plugin to Vite config..."), await P(C, l + J), await N(C);
125
125
  }
126
126
  }), i.command("build [directory]").alias("b").description("Build the Salty-CSS project.").option("-d, --dir <dir>", "Project directory to build the project in.").action(async function(t = E) {
127
127
  e.info("Building the Salty-CSS project...");
128
- const { dir: o = t } = this.opts();
129
- if (!o) return v("Project directory must be provided. Add it as the first argument after build command or use the --dir option.");
130
- const r = A(o);
128
+ const { dir: s = t } = this.opts();
129
+ if (!s) return v("Project directory must be provided. Add it as the first argument after build command or use the --dir option.");
130
+ const r = A(s);
131
131
  await V(r);
132
- }), i.command("generate [file] [directory]").alias("g").description("Generate a new component file.").option("-f, --file <file>", "File to generate.").option("-d, --dir <dir>", "Project directory to generate the file in.").option("-t, --tag <tag>", "HTML tag of the component.", "div").option("-n, --name <name>", "Name of the component.").option("-c, --className <className>", "CSS class of the component.").action(async function(t, o = E) {
133
- const { file: r = t, dir: p = o, tag: u, name: w, className: c } = this.opts();
132
+ }), i.command("generate [file] [directory]").alias("g").description("Generate a new component file.").option("-f, --file <file>", "File to generate.").option("-d, --dir <dir>", "Project directory to generate the file in.").option("-t, --tag <tag>", "HTML tag of the component.", "div").option("-n, --name <name>", "Name of the component.").option("-c, --className <className>", "CSS class of the component.").action(async function(t, s = E) {
133
+ const { file: r = t, dir: d = s, tag: m, name: w, className: c } = this.opts();
134
134
  if (!r) return v("File to generate must be provided. Add it as the first argument after generate command or use the --file option.");
135
- if (!p) return v("Project directory must be provided. Add it as the second argument after generate command or use the --dir option.");
136
- const S = A(p), f = a(S, r), s = G(f);
137
- s.ext || (s.ext = ".ts"), s.name.endsWith(".css") || (s.name = s.name + ".css"), s.base = s.name + s.ext;
138
- const l = M(s), $ = l.split("/").slice(0, -1).join("/");
139
- if ($ && await U(a(S, $), { recursive: !0 }), await y(l, "utf-8").catch(() => {
135
+ if (!d) return v("Project directory must be provided. Add it as the second argument after generate command or use the --dir option.");
136
+ const S = A(d), p = r.split("/").slice(0, -1).join("/");
137
+ p && await U(o(S, p), { recursive: !0 });
138
+ const $ = o(S, r), a = G($);
139
+ a.ext || (a.ext = ".ts"), a.name.endsWith(".css") || (a.name = a.name + ".css"), a.base = a.name + a.ext;
140
+ const u = M(a);
141
+ if (await y(u, "utf-8").catch(() => {
140
142
  }) !== void 0) {
141
- e.error("File already exists:", l);
143
+ e.error("File already exists:", u);
142
144
  return;
143
145
  }
144
- e.info("Generating a new file: " + l);
145
- const b = q(w || s.base.replace(/\.css\.\w+$/, "")), { content: C } = await h("react/react-styled-file.ts", { tag: u, name: b, className: c });
146
- await P(l, C), await N(l);
147
- }), i.command("update").alias("up").description("Update Salty-CSS packages to the latest version.").option("--legacy-peer-deps <legacyPeerDeps>", "Use legacy peer dependencies (not recommended).", !1).action(async function(t, o = E) {
148
- const { legacyPeerDeps: r } = this.opts(), p = a(process.cwd(), "package.json"), u = await k(p).catch((f) => v(f));
149
- if (!u) return;
150
- const w = { ...u.dependencies, ...u.devDependencies }, c = Object.keys(w).filter((f) => f === "salty-css" || f.startsWith("@salty-css/"));
146
+ e.info("Generating a new file: " + u);
147
+ const b = q(w || a.base.replace(/\.css\.\w+$/, "")), { content: C } = await h("react/react-styled-file.ts", { tag: m, name: b, className: c });
148
+ await P(u, C), await N(u);
149
+ }), i.command("update").alias("up").description("Update Salty-CSS packages to the latest version.").option("--legacy-peer-deps <legacyPeerDeps>", "Use legacy peer dependencies (not recommended).", !1).action(async function(t, s = E) {
150
+ const { legacyPeerDeps: r } = this.opts(), d = o(process.cwd(), "package.json"), m = await k(d).catch((p) => v(p));
151
+ if (!m) return;
152
+ const w = { ...m.dependencies, ...m.devDependencies }, c = Object.keys(w).filter((p) => p === "salty-css" || p.startsWith("@salty-css/"));
151
153
  if (!c.length)
152
154
  return v(
153
- "No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: " + p
155
+ "No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: " + d
154
156
  );
155
- const S = c.map((f) => `${f}@${F.version}`);
157
+ const S = c.map((p) => `${p}@${F.version}`);
156
158
  r ? (e.warn("Using legacy peer dependencies to update packages."), await x(...S, "--legacy-peer-deps")) : await x(...S), e.info("Salty-CSS packages updated successfully!");
157
159
  }), i.parseAsync(process.argv);
158
160
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("esbuild"),B=require("child_process"),P=require("../dash-case-DKzpenwY.cjs"),o=require("path"),r=require("fs"),K=require("fs/promises"),V=require("../parse-templates-W0YfTmOT.cjs");function G(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const R=G(z),N=t=>o.join(t,"./saltygen"),_=["salty","css","styles","styled"],q=(t=[])=>new RegExp(`\\.(${[..._,...t].join("|")})\\.`),O=(t,e=[])=>q(e).test(t),J=async t=>{const e=N(t),n=o.join(t,"salty.config.ts"),s=o.join(e,"salty.config.js");await R.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:"esm",external:["react"]});const a=Date.now(),{config:w}=await import(`${s}?t=${a}`);return w},M=async t=>{const e=await J(t),n=new Set,s=(d,y=[])=>d?Object.entries(d).flatMap(([p,c])=>{if(!c)return;if(typeof c=="object")return s(c,[...y,p]);const C=[...y,p].join(".");n.add(`"${C}"`);const x=[...y.map(P.dashCase),P.dashCase(p)].join("-"),{result:D}=V.parseValueTokens(c);return`--${x}: ${D};`}):[],a=d=>d?Object.entries(d).flatMap(([y,p])=>{const c=s(p);return y==="base"?c.join(""):`${y} { ${c.join("")} }`}):[],w=d=>d?Object.entries(d).flatMap(([y,p])=>Object.entries(p).flatMap(([c,C])=>{const x=s(C,[y]),D=`.${y}-${c}, [data-${y}="${c}"]`,k=x.join("");return`${D} { ${k} }`})):[],j=s(e.variables),S=a(e.responsiveVariables),l=w(e.conditionalVariables),b=N(t),f=o.join(b,"css/variables.css"),i=`:root { ${j.join("")} ${S.join("")} } ${l.join("")}`;r.writeFileSync(f,i);const g=o.join(b,"types/css-tokens.d.ts"),m=`type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;r.writeFileSync(g,m);const u=o.join(b,"css/global.css"),h=V.parseStyles(e.global,"");r.writeFileSync(u,h);const F=o.join(b,"css/templates.css"),v=V.parseTemplates(e.templates);r.writeFileSync(F,v)},T=async(t,e)=>{const n=P.toHash(t),s=o.join(e,"js",n+".js");await R.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:"esm",target:["es2022"],keepNames:!0,external:["react"]});const a=Date.now();return await import(`${s}?t=${a}`)},E=async t=>{const e=N(t),n=o.join(e,"salty.config.js"),{config:s}=await import(n);return s},A=async t=>{try{const e=[],n=[],s=N(t),a=o.join(s,"index.css");(()=>{r.existsSync(s)&&B.execSync("rm -rf "+s),r.mkdirSync(s),r.mkdirSync(o.join(s,"css")),r.mkdirSync(o.join(s,"types"))})(),await M(t);const j=await E(t);async function S(i,g){const $=r.statSync(i);if($.isDirectory()){const m=r.readdirSync(i);await Promise.all(m.map(u=>S(o.join(i,u),o.join(g,u))))}else if($.isFile()&&O(i)){const u=await T(i,s),h=[];Object.entries(u).forEach(([y,p])=>{if(p.isKeyframes&&p.css){const k=`${p.animationName}.css`,H=`css/${k}`,I=o.join(s,H);e.push(k),r.writeFileSync(I,p.css);return}if(!p.generator)return;const c=p.generator._withBuildContext({name:y,config:j}),C=`${c.hash}-${c.priority}.css`;n[c.priority]||(n[c.priority]=[]),n[c.priority].push(C),h.push(C);const x=`css/${C}`,D=o.join(s,x);r.writeFileSync(D,c.css)});const F=h.map(y=>`@import url('./${y}');`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("esbuild"),B=require("child_process"),P=require("../dash-case-DKzpenwY.cjs"),o=require("path"),r=require("fs"),K=require("fs/promises"),V=require("../parse-templates-W0YfTmOT.cjs");function G(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const R=G(I),N=t=>o.join(t,"./saltygen"),_=["salty","css","styles","styled"],q=(t=[])=>new RegExp(`\\.(${[..._,...t].join("|")})\\.`),O=(t,e=[])=>q(e).test(t),J=async t=>{const e=N(t),n=o.join(t,"salty.config.ts"),s=o.join(e,"salty.config.js");await R.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:"esm",external:["react"]});const a=Date.now(),{config:w}=await import(`${s}?t=${a}`);return w},M=async t=>{const e=await J(t),n=new Set,s=(d,y=[])=>d?Object.entries(d).flatMap(([p,c])=>{if(!c)return;if(typeof c=="object")return s(c,[...y,p]);const C=[...y,p].join(".");n.add(`"${C}"`);const x=[...y.map(P.dashCase),P.dashCase(p)].join("-"),{result:D}=V.parseValueTokens(c);return`--${x}: ${D};`}):[],a=d=>d?Object.entries(d).flatMap(([y,p])=>{const c=s(p);return y==="base"?c.join(""):`${y} { ${c.join("")} }`}):[],w=d=>d?Object.entries(d).flatMap(([y,p])=>Object.entries(p).flatMap(([c,C])=>{const x=s(C,[y]),D=`.${y}-${c}, [data-${y}="${c}"]`,k=x.join("");return`${D} { ${k} }`})):[],j=s(e.variables),S=a(e.responsiveVariables),l=w(e.conditionalVariables),b=N(t),f=o.join(b,"css/variables.css"),i=`:root { ${j.join("")} ${S.join("")} } ${l.join("")}`;r.writeFileSync(f,i);const g=o.join(b,"types/css-tokens.d.ts"),m=`type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;r.writeFileSync(g,m);const u=o.join(b,"css/global.css"),h=V.parseStyles(e.global,"");r.writeFileSync(u,h);const F=o.join(b,"css/templates.css"),v=V.parseTemplates(e.templates);r.writeFileSync(F,v)},T=async(t,e)=>{const n=P.toHash(t),s=o.join(e,"js",n+".js");await R.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:"esm",target:["es2022"],keepNames:!0,external:["react"]});const a=Date.now();return await import(`${s}?t=${a}`)},E=async t=>{const e=N(t),n=o.join(e,"salty.config.js"),{config:s}=await import(n);return s},A=async t=>{try{const e=[],n=[],s=N(t),a=o.join(s,"index.css");(()=>{r.existsSync(s)&&B.execSync("rm -rf "+s),r.mkdirSync(s),r.mkdirSync(o.join(s,"css")),r.mkdirSync(o.join(s,"types"))})(),await M(t);const j=await E(t);async function S(i,g){const $=r.statSync(i);if($.isDirectory()){const m=r.readdirSync(i);await Promise.all(m.map(u=>S(o.join(i,u),o.join(g,u))))}else if($.isFile()&&O(i)){const u=await T(i,s),h=[];Object.entries(u).forEach(([y,p])=>{if(p.isKeyframes&&p.css){const k=`${p.animationName}.css`,z=`css/${k}`,H=o.join(s,z);e.push(k),r.writeFileSync(H,p.css);return}if(!p.generator)return;const c=p.generator._withBuildContext({name:y,config:j}),C=`${c.hash}-${c.priority}.css`;n[c.priority]||(n[c.priority]=[]),n[c.priority].push(C),h.push(C);const x=`css/${C}`,D=o.join(s,x);r.writeFileSync(D,c.css)});const F=h.map(y=>`@import url('./${y}');`).join(`
2
2
  `),v=P.toHash(i,6),d=o.join(s,`css/${v}.css`);r.writeFileSync(d,F)}}await S(t,s);const l=e.map(i=>`@import url('./css/${i}');`).join(`
3
3
  `);let f=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
4
4
 
@@ -7,5 +7,5 @@ ${["@import url('./css/variables.css');","@import url('./css/global.css');","@im
7
7
  ${l}`;if(j.importStrategy!=="component"){const i=n.flat().map(g=>`@import url('./css/${g}');`).join(`
8
8
  `);f+=i}r.writeFileSync(a,f)}catch(e){console.error(e)}},L=async(t,e)=>{try{const n=[],s=o.join(t,"./saltygen"),a=o.join(s,"index.css");if(O(e)){const j=await E(t),S=await T(e,s);Object.entries(S).forEach(([g,$])=>{if(!$.generator)return;const m=$.generator._withBuildContext({name:g,config:j}),u=`${m.hash}-${m.priority}.css`,h=`css/${u}`,F=o.join(s,h);n.push(u),r.writeFileSync(F,m.css)});const l=r.readFileSync(a,"utf8").split(`
9
9
  `),b=n.map(g=>`@import url('../saltygen/css/${g}');`),i=[...new Set([...l,...b])].join(`
10
- `);r.writeFileSync(a,i)}}catch(n){console.error(n)}},U=async(t,e)=>{try{const n=o.join(t,"./saltygen");if(O(e)){const a=r.readFileSync(e,"utf8");a.replace(/^(?!export\s)const\s.*/gm,f=>`export ${f}`)!==a&&await K.writeFile(e,a);const j=await E(t),S=await T(e,n);let l=a;Object.entries(S).forEach(([f,i])=>{var F;if(i.isKeyframes){console.log("value",i);return}if(!i.generator)return;const g=i.generator._withBuildContext({name:f,config:j}),$=new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!$)return console.error("Could not find the original declaration");const m=(F=$.at(1))==null?void 0:F.trim(),u=`${f} = styled(${m}, "${g.classNames}", "${g._callerName}", ${JSON.stringify(g.props)});`,h=new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`,"g");l=l.replace(h,u)});const b=P.toHash(e,6);return j.importStrategy==="component"&&(l=`import '../../saltygen/css/${b}.css';
11
- ${l}`),l=l.replace("{ styled }","{ styledClient as styled }"),l=l.replace("@salty-css/react/styled","@salty-css/react/styled-client"),l}}catch(n){console.error(n)}};exports.compileSaltyFile=T;exports.generateConfigStyles=M;exports.generateCss=A;exports.generateFile=L;exports.isSaltyFile=O;exports.minimizeFile=U;exports.saltyFileExtensions=_;exports.saltyFileRegExp=q;
10
+ `);r.writeFileSync(a,i)}}catch(n){console.error(n)}},U=async(t,e)=>{try{const n=o.join(t,"./saltygen");if(O(e)){const a=r.readFileSync(e,"utf8");a.replace(/^(?!export\s)const\s.*/gm,f=>`export ${f}`)!==a&&await K.writeFile(e,a);const j=await E(t),S=await T(e,n);let l=a;Object.entries(S).forEach(([f,i])=>{var F;if(i.isKeyframes||!i.generator)return;const g=i.generator._withBuildContext({name:f,config:j}),$=new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!$)return console.error("Could not find the original declaration");const m=(F=$.at(1))==null?void 0:F.trim(),u=`${f} = styled(${m}, "${g.classNames}", "${g._callerName}", ${JSON.stringify(g.props)});`,h=new RegExp(`${f}[=\\s]+[^()]+styled\\(([^)]|\\n|\\(.*\\){1})+\\)$`,"gm");l=l.replace(h,u)});const b=P.toHash(e,6);return j.importStrategy==="component"&&(l=`import '../../saltygen/css/${b}.css';
11
+ ${l}`),l=l.replace("{ styled }","{ styledClient as styled }"),l=l.replace("@salty-css/react/styled","@salty-css/react/styled-client"),l}}catch(n){console.error("Error in minimizeFile",n)}};exports.compileSaltyFile=T;exports.generateConfigStyles=M;exports.generateCss=A;exports.generateFile=L;exports.isSaltyFile=O;exports.minimizeFile=U;exports.saltyFileExtensions=_;exports.saltyFileRegExp=q;
package/compiler/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as I from "esbuild";
2
- import { execSync as H } from "child_process";
2
+ import { execSync as z } from "child_process";
3
3
  import { t as T, d as R } from "../dash-case-DMQMcCO6.js";
4
4
  import { join as o } from "path";
5
- import { writeFileSync as $, existsSync as K, mkdirSync as V, statSync as z, readdirSync as G, readFileSync as M } from "fs";
5
+ import { writeFileSync as $, existsSync as H, mkdirSync as V, statSync as K, readdirSync as G, readFileSync as M } from "fs";
6
6
  import { writeFile as J } from "fs/promises";
7
7
  import { p as q, a as A, b as L } from "../parse-templates-D4p3pgQR.js";
8
8
  const N = (s) => o(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W = (s = []) => new RegExp(`\\.(${[...U, ...s].join("|")})\\.`), v = (s, e = []) => W(e).test(s), X = async (s) => {
@@ -34,10 +34,10 @@ const N = (s) => o(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W
34
34
  return `${D} { ${P} }`;
35
35
  })) : [], d = t(e.variables), w = c(e.responsiveVariables), a = S(e.conditionalVariables), b = N(s), f = o(b, "css/variables.css"), i = `:root { ${d.join("")} ${w.join("")} } ${a.join("")}`;
36
36
  $(f, i);
37
- const y = o(b, "types/css-tokens.d.ts"), m = `type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;
38
- $(y, m);
39
- const g = o(b, "css/global.css"), F = q(e.global, "");
40
- $(g, F);
37
+ const y = o(b, "types/css-tokens.d.ts"), g = `type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;
38
+ $(y, g);
39
+ const m = o(b, "css/global.css"), F = q(e.global, "");
40
+ $(m, F);
41
41
  const j = o(b, "css/templates.css"), k = A(e.templates);
42
42
  $(j, k);
43
43
  }, E = async (s, e) => {
@@ -62,17 +62,17 @@ const N = (s) => o(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W
62
62
  try {
63
63
  const e = [], n = [], t = N(s), c = o(t, "index.css");
64
64
  (() => {
65
- K(t) && H("rm -rf " + t), V(t), V(o(t, "css")), V(o(t, "types"));
65
+ H(t) && z("rm -rf " + t), V(t), V(o(t, "css")), V(o(t, "types"));
66
66
  })(), await Y(s);
67
67
  const d = await O(s);
68
68
  async function w(i, y) {
69
- const h = z(i);
69
+ const h = K(i);
70
70
  if (h.isDirectory()) {
71
- const m = G(i);
72
- await Promise.all(m.map((g) => w(o(i, g), o(y, g))));
71
+ const g = G(i);
72
+ await Promise.all(g.map((m) => w(o(i, m), o(y, m))));
73
73
  } else if (h.isFile() && v(i)) {
74
- const g = await E(i, t), F = [];
75
- Object.entries(g).forEach(([l, p]) => {
74
+ const m = await E(i, t), F = [];
75
+ Object.entries(m).forEach(([l, p]) => {
76
76
  if (p.isKeyframes && p.css) {
77
77
  const P = `${p.animationName}.css`, _ = `css/${P}`, B = o(t, _);
78
78
  e.push(P), $(B, p.css);
@@ -116,11 +116,11 @@ ${a}`;
116
116
  const d = await O(s), w = await E(e, t);
117
117
  Object.entries(w).forEach(([y, h]) => {
118
118
  if (!h.generator) return;
119
- const m = h.generator._withBuildContext({
119
+ const g = h.generator._withBuildContext({
120
120
  name: y,
121
121
  config: d
122
- }), g = `${m.hash}-${m.priority}.css`, F = `css/${g}`, j = o(t, F);
123
- n.push(g), $(j, m.css);
122
+ }), m = `${g.hash}-${g.priority}.css`, F = `css/${m}`, j = o(t, F);
123
+ n.push(m), $(j, g.css);
124
124
  });
125
125
  const a = M(c, "utf8").split(`
126
126
  `), b = n.map((y) => `@import url('../saltygen/css/${y}');`), i = [.../* @__PURE__ */ new Set([...a, ...b])].join(`
@@ -140,26 +140,22 @@ ${a}`;
140
140
  let a = c;
141
141
  Object.entries(w).forEach(([f, i]) => {
142
142
  var j;
143
- if (i.isKeyframes) {
144
- console.log("value", i);
145
- return;
146
- }
147
- if (!i.generator) return;
143
+ if (i.isKeyframes || !i.generator) return;
148
144
  const y = i.generator._withBuildContext({
149
145
  name: f,
150
146
  config: d
151
147
  }), h = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(c);
152
148
  if (!h)
153
149
  return console.error("Could not find the original declaration");
154
- const m = (j = h.at(1)) == null ? void 0 : j.trim(), g = `${f} = styled(${m}, "${y.classNames}", "${y._callerName}", ${JSON.stringify(y.props)});`, F = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`, "g");
155
- a = a.replace(F, g);
150
+ const g = (j = h.at(1)) == null ? void 0 : j.trim(), m = `${f} = styled(${g}, "${y.classNames}", "${y._callerName}", ${JSON.stringify(y.props)});`, F = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^)]|\\n|\\(.*\\){1})+\\)$`, "gm");
151
+ a = a.replace(F, m);
156
152
  });
157
153
  const b = T(e, 6);
158
154
  return d.importStrategy === "component" && (a = `import '../../saltygen/css/${b}.css';
159
155
  ${a}`), a = a.replace("{ styled }", "{ styledClient as styled }"), a = a.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), a;
160
156
  }
161
157
  } catch (n) {
162
- console.error(n);
158
+ console.error("Error in minimizeFile", n);
163
159
  }
164
160
  };
165
161
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.35",
3
+ "version": "0.0.1-alpha.37",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",