@salty-css/core 0.0.1-alpha.287 → 0.0.1-alpha.288

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,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-Dg98Xd3x.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-2eX-l4VO.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,v)=>{se.exec(y,x=>{if(x)return v(x);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),v=oe(`Installing packages: ${C}`).start(),x=y.join(" ");await X(`npm install ${x}`),v.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"))},v=async(i,a)=>{const{default:g}=await C[i],d=ne.render(g,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,g=process.cwd();return n.join(g,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:g=i,cssFile:d,skipInstall:p}=this.opts();if(!g)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(g),q=await Promise.all([v("salty.config.ts"),v("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"),f=await s.readFile(h,"utf-8").catch(()=>{});if(f===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(f),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!==f&&(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+`
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-DA5ISFwd.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-CD2iMVSg.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,v)=>{se.exec(y,x=>{if(x)return v(x);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),v=oe(`Installing packages: ${C}`).start(),x=y.join(" ");await X(`npm install ${x}`),v.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"))},v=async(i,a)=>{const{default:g}=await C[i],d=ne.render(g,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,g=process.cwd();return n.join(g,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:g=i,cssFile:d,skipInstall:p}=this.opts();if(!g)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(g),q=await Promise.all([v("salty.config.ts"),v("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"),f=await s.readFile(h,"utf-8").catch(()=>{});if(f===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(f),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!==f&&(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 rt } 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 ct, format as et } from "path";
5
5
  import { render as lt } from "ejs";
6
- import { l as e, a as h, g as K, i as dt, b as ft } from "../index-6JCRY_wd.js";
6
+ import { l as e, a as h, g as K, i as dt, b as ft } from "../index-NweiKqJ2.js";
7
7
  import { p as pt } from "../pascal-case-BQpR5PdN.js";
8
8
  import { exec as gt } from "child_process";
9
9
  import ut from "ora";
10
- import { c as yt } from "../should-restart-YBRJU0GU.js";
10
+ import { c as yt } from "../should-restart-hZeXtL5Y.js";
11
11
  const st = (u) => new Promise((v, k) => {
12
12
  gt(u, ($) => {
13
13
  if ($) return k($);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("fs/promises"),r=require("path"),t=require("../helpers-DVANmpVz.cjs"),i=async()=>{const o=t.getCorePackageRoot(),c=r.join(o,"cache/config-cache.json"),e=await n.readFile(c,"utf8");if(!e)throw new Error("Could not find config cache file");return JSON.parse(e)};exports.resolveDynamicConfigCache=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("fs/promises"),r=require("path"),t=require("../helpers-DER54FsO.cjs"),i=async()=>{const o=t.getCorePackageRoot(),c=r.join(o,"cache/config-cache.json"),e=await n.readFile(c,"utf8");if(!e)throw new Error("Could not find config cache file");return JSON.parse(e)};exports.resolveDynamicConfigCache=i;
@@ -1,6 +1,6 @@
1
1
  import { readFile as r } from "fs/promises";
2
2
  import { join as t } from "path";
3
- import { g as n } from "../helpers-C1RIrlCB.js";
3
+ import { g as n } from "../helpers-f73tgqcY.js";
4
4
  const s = async () => {
5
5
  const e = n(), c = t(e, "cache/config-cache.json"), o = await r(c, "utf8");
6
6
  if (!o) throw new Error("Could not find config cache file");
@@ -1 +1,2 @@
1
1
  export declare const getCorePackageRoot: () => string;
2
+ export declare const resolveValue: <T>(value: unknown, maxLevel?: number, _level?: number) => Promise<T>;
@@ -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-DZYIEhB4.cjs");require("../parsers/index.cjs");const e=require("../index-Dg98Xd3x.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.cjs");require("../helpers-DVANmpVz.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;
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-DZYIEhB4.cjs");require("../parsers/index.cjs");const e=require("../index-DA5ISFwd.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.cjs");require("../helpers-DER54FsO.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,10 +6,10 @@ import "fs";
6
6
  import "fs/promises";
7
7
  import "../parse-styles-DLPgVsVQ.js";
8
8
  import "../parsers/index.js";
9
- import { e as y, d as x, g as S, b as c, i as f, m as C, s as E, c as b } from "../index-6JCRY_wd.js";
9
+ import { e as y, d as x, g as S, b as c, i as f, m as C, s as E, c as b } from "../index-NweiKqJ2.js";
10
10
  import "../css/merge.js";
11
11
  import "../define-templates-4A2yHcMF.js";
12
- import "../helpers-C1RIrlCB.js";
12
+ import "../helpers-f73tgqcY.js";
13
13
  export {
14
14
  y as compileSaltyFile,
15
15
  x as generateConfigStyles,
package/css/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-DZYIEhB4.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const n=l||w.toHash(t),r=async(s={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:i="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...s},a=`${n} ${e} ${o} ${i} ${S} ${p} ${g} ${b}`;if(!y)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await m.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:f,keyframes:t}),r};exports.keyframes=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-DZYIEhB4.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=({animationName:y,params:u,appendInitialStyles:l,...t})=>async(f={})=>{const n=y||w.toHash(t),r=async()=>{const{duration:e="500ms",easing:s="ease-in-out",delay:o="0s",iterationCount:i="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...f},a=`${n} ${e} ${s} ${o} ${i} ${p} ${g} ${b}`;if(!l)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([e,s])=>{if(!s)return"";const o=await m.parseAndJoinStyles(s,"");return`${typeof e=="number"?`${e}%`:e}{${o}}`}),d=(await Promise.all($)).join(""),S=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:S,keyframes:t}),r};exports.keyframes=C;
@@ -18,5 +18,5 @@ interface KeyframesParams {
18
18
  playState?: StyleValue<'animationPlayState'>;
19
19
  }
20
20
  type KeyframesProps = Keyframes & KeyframesConfig;
21
- export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => Promise<(params?: KeyframesParams) => Promise<string>>;
21
+ export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => Promise<() => Promise<string>>;
22
22
  export {};
package/css/keyframes.js CHANGED
@@ -1,33 +1,33 @@
1
- import { p as m } from "../parse-styles-DLPgVsVQ.js";
1
+ import { p as c } from "../parse-styles-DLPgVsVQ.js";
2
2
  import { t as j } from "../dash-case-DBThphLm.js";
3
- const v = async ({ animationName: $, params: f, appendInitialStyles: l, ...t }) => {
4
- const r = $ || j(t), o = async (n = {}) => {
3
+ const v = ({ animationName: f, params: $, appendInitialStyles: y, ...t }) => async (u = {}) => {
4
+ const r = f || j(t), e = async () => {
5
5
  const {
6
- duration: s = "500ms",
7
- easing: e = "ease-in-out",
8
- delay: i = "0s",
9
- iterationCount: d = "1",
6
+ duration: n = "500ms",
7
+ easing: s = "ease-in-out",
8
+ delay: o = "0s",
9
+ iterationCount: i = "1",
10
10
  direction: S = "normal",
11
11
  fillMode: g = "forwards",
12
12
  playState: w = "running"
13
- } = { ...f, ...n }, a = `${r} ${s} ${e} ${i} ${d} ${S} ${g} ${w}`;
14
- if (!l) return a;
15
- const c = t.from || t["0%"];
16
- if (!c) return a;
17
- const b = await m(c, "");
13
+ } = { ...$, ...u }, a = `${r} ${n} ${s} ${o} ${i} ${S} ${g} ${w}`;
14
+ if (!y) return a;
15
+ const m = t.from || t["0%"];
16
+ if (!m) return a;
17
+ const b = await c(m, "");
18
18
  return `${a};${b}`;
19
- }, u = Object.entries(t).map(async ([n, s]) => {
19
+ }, l = Object.entries(t).map(async ([n, s]) => {
20
20
  if (!s) return "";
21
- const e = await m(s, "");
22
- return `${typeof n == "number" ? `${n}%` : n}{${e}}`;
23
- }), p = (await Promise.all(u)).join(""), y = `@keyframes ${r} {${p}}`;
24
- return Object.assign(o, {
25
- toString: o,
21
+ const o = await c(s, "");
22
+ return `${typeof n == "number" ? `${n}%` : n}{${o}}`;
23
+ }), d = (await Promise.all(l)).join(""), p = `@keyframes ${r} {${d}}`;
24
+ return Object.assign(e, {
25
+ toString: e,
26
26
  isKeyframes: !0,
27
27
  animationName: r,
28
- css: y,
28
+ css: p,
29
29
  keyframes: t
30
- }), o;
30
+ }), e;
31
31
  };
32
32
  export {
33
33
  v as keyframes
@@ -0,0 +1 @@
1
+ "use strict";const c=require("path");var n=typeof document<"u"?document.currentScript:null;const i=()=>{let{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:n&&n.tagName.toUpperCase()==="SCRIPT"&&n.src||new URL("helpers-DER54FsO.cjs",document.baseURI).href);for(;/core\/?(src\/)?$/.test(e)===!1;)e=c.join(e,"../");return e},o=async(e,t=10,r=0)=>r>=t?e:e instanceof Promise?await o(await e,r+1,t):typeof e=="function"?await o(await e(),r+1,t):e;exports.getCorePackageRoot=i;exports.resolveValue=o;
@@ -0,0 +1,11 @@
1
+ import { join as i } from "path";
2
+ const s = () => {
3
+ let { pathname: t } = new URL(import.meta.url);
4
+ for (; /core\/?(src\/)?$/.test(t) === !1; )
5
+ t = i(t, "../");
6
+ return t;
7
+ }, n = async (t, r = 10, o = 0) => o >= r ? t : t instanceof Promise ? await n(await t, o + 1, r) : typeof t == "function" ? await n(await t(), o + 1, r) : t;
8
+ export {
9
+ s as g,
10
+ n as r
11
+ };
@@ -1,41 +1,41 @@
1
- "use strict";const ve=require("esbuild"),Oe=require("child_process"),_=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),we=require("fs/promises"),ae=require("./parse-styles-DZYIEhB4.cjs"),he=require("./parsers/index.cjs"),Q=require("winston"),J=require("./css/merge.cjs"),Ee=require("./define-templates-Cunsb_Tr.cjs"),ce=require("typescript"),Ve=require("./helpers-DVANmpVz.cjs");var re=typeof document<"u"?document.currentScript:null;function Re(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=Re(ve),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,".."))},Me=async e=>{const t=be(e);return await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Je=async e=>{const t=await Me(e);if(t)return t.type};let H;const Fe=async e=>{if(H)return H;const t=await Je(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("index-Dg98Xd3x.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({})]}),qe=e=>{B.error(e)};function $e(e){return e?typeof e!="string"?$e(String(e)):e.replace(/[^\d\w]/g,"."):""}const ze={"*, *::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"}},He=(e,t)=>new Promise((s,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},100),l=ce.createSourceFile("temp.ts",e,ce.ScriptTarget.Latest,!0);function o(y){if(ce.isVariableDeclaration(y)&&y.name.getText()===t){const w=y.getStart(),m=y.getEnd();clearTimeout(r),s([w,m])}y.forEachChild(o)}o(l)}),O={externalModules:[],rcFile:void 0,destDir:void 0},Ce=e=>{if(O.externalModules.length>0)return O.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 O.externalModules=n,n},q=async e=>{if(O.destDir)return O.destDir;const t=await fe(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},le=["salty","css","styles","styled"],Pe=(e=[])=>new RegExp(`\\.(${[...le,...e].join("|")})\\.`),Z=(e,t=[])=>Pe(t).test(e),Ne=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=i.join(e,".saltyrc.json"),s=await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.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))},We=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 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:w}=await import(`${r}?t=${y}`);return{config:w,path:r}},xe=async(e,t)=>{var de,ye;const s=await q(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async S=>{const{contents:F,outputFilePath:K}=await U(e,S,s);Object.entries(F).forEach(([D,P])=>{P.isMedia?n.mediaQueries.push([D,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${D};;${K}`))})}));const{config:r,path:l}=await We(e),o={...r},{mediaQueries:y}=n;o.mediaQueries=Object.fromEntries(y.map(([S,F])=>[`@${S}`,F]));const w=y.map(([S])=>`'@${S}'`).join(" | "),m=new Set,a=async(S,F=[])=>{if(!S)return[];const K=Object.entries(S).map(async([P,M])=>{const L=async T=>{if(!T)return;if(T instanceof Promise)return await L(await T);if(typeof T=="function")return await L(await T());if(typeof T=="object")return await a(T,[...F,P]);const ne=$e(P),oe=_.dashCase(P),ie=[...F,ne].join(".");m.add(`"${ie}"`);const Y=[...F.map(_.dashCase),oe].join("-"),ge=ae.parseVariableTokens(T);return ge?`--${Y}: ${ge.transformed};`:`--${Y}: ${T};`};return await L(M)});return(await Promise.all(K)).flat()},g=async S=>{if(!S)return[];const F=Object.entries(S).map(async([D,P])=>{const M=await a(P);return D==="base"?M.join(""):o.mediaQueries[D]?`${o.mediaQueries[D]} { ${M.join("")} }`:`${D} { ${M.join("")} }`});return(await Promise.all(F)).flat()},d=async S=>{if(!S)return[];const F=Object.entries(S).map(async([D,P])=>{const M=Object.entries(P).map(async([T,ne])=>{const oe=await a(ne,[D]),ie=`.${D}-${T}, [data-${D}="${T}"]`,Y=oe.join("");return`${ie} { ${Y} }`});return(await Promise.all(M)).flat()});return(await Promise.all(F)).flat()},h=S=>({...S,responsive:void 0,conditional:void 0}),p=S=>n.variables.map(F=>S==="static"?h(F._current):F._current[S]),$=J.mergeObjects(h(r.variables),p("static")),x=await a($),k=J.mergeObjects((de=r.variables)==null?void 0:de.responsive,p("responsive")),E=await g(k),z=J.mergeObjects((ye=r.variables)==null?void 0:ye.conditional,p("conditional")),A=await d(z),me=i.join(s,"css/_variables.css"),V=`:root { ${x.join("")} ${E.join("")} } ${A.join("")}`;c.writeFileSync(me,V),o.staticVariables=$;const ee=i.join(s,"css/_global.css"),u=J.mergeObjects(r.global,n.globalStyles),j=await ae.parseAndJoinStyles(u,"");c.writeFileSync(ee,`@layer global { ${j} }`);const b=i.join(s,"css/_reset.css"),C=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:ze,N=await ae.parseAndJoinStyles(C,"");c.writeFileSync(b,`@layer reset { ${N} }`);const v=i.join(s,"css/_templates.css"),R=J.mergeObjects(r.templates,n.templates),W=await he.parseTemplates(R),I=he.getTemplateTypes(R);c.writeFileSync(v,`@layer templates { ${W} }`),o.templates=R;const X=r.templates?[Ee.defineTemplates(r.templates)._setPath(`config;;${l}`)]:[],te=J.mergeFactories(n.templates,X);o.templatePaths=Object.fromEntries(Object.entries(te).map(([S,F])=>[S,F._path]));const G=i.join(s,"types/css-tokens.d.ts"),ke=`
1
+ "use strict";const Oe=require("esbuild"),Ve=require("child_process"),T=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),we=require("fs/promises"),ae=require("./parse-styles-DZYIEhB4.cjs"),he=require("./parsers/index.cjs"),Q=require("winston"),J=require("./css/merge.cjs"),Ee=require("./define-templates-Cunsb_Tr.cjs"),ce=require("typescript"),je=require("./helpers-DER54FsO.cjs");var re=typeof document<"u"?document.currentScript:null;function Re(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 be=Re(Oe),Fe=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:Fe(i.join(e,".."))},Me=async e=>{const t=Fe(e);return await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Je=async e=>{const t=await Me(e);if(t)return t.type};let H;const $e=async e=>{if(H)return H;const t=await Je(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("index-DA5ISFwd.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({})]}),qe=e=>{B.error(e)};function Ce(e){return e?typeof e!="string"?Ce(String(e)):e.replace(/[^\d\w]/g,"."):""}const ze={"*, *::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"}},He=(e,t)=>new Promise((s,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},100),l=ce.createSourceFile("temp.ts",e,ce.ScriptTarget.Latest,!0);function o(y){if(ce.isVariableDeclaration(y)&&y.name.getText()===t){const w=y.getStart(),m=y.getEnd();clearTimeout(r),s([w,m])}y.forEachChild(o)}o(l)}),O={externalModules:[],rcFile:void 0,destDir:void 0},Pe=e=>{if(O.externalModules.length>0)return O.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 O.externalModules=n,n},q=async e=>{if(O.destDir)return O.destDir;const t=await fe(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},le=["salty","css","styles","styled"],Ne=(e=[])=>new RegExp(`\\.(${[...le,...e].join("|")})\\.`),Z=(e,t=[])=>Ne(t).test(e),xe=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=i.join(e,".saltyrc.json"),s=await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):xe(i.join(e,".."))},fe=async e=>{var n,r;const t=await xe(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))},We=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 $e(e),o=Pe(n);await be.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:r,format:l,external:o});const y=Date.now(),{config:w}=await import(`${r}?t=${y}`);return{config:w,path:r}},ke=async(e,t)=>{var de,ye;const s=await q(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async S=>{const{contents:$,outputFilePath:K}=await U(e,S,s);Object.entries($).forEach(([D,P])=>{P.isMedia?n.mediaQueries.push([D,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${D};;${K}`))})}));const{config:r,path:l}=await We(e),o={...r},{mediaQueries:y}=n;o.mediaQueries=Object.fromEntries(y.map(([S,$])=>[`@${S}`,$]));const w=y.map(([S])=>`'@${S}'`).join(" | "),m=new Set,a=async(S,$=[])=>{if(!S)return[];const K=Object.entries(S).map(async([P,M])=>{const L=async v=>{if(!v)return;if(v instanceof Promise)return await L(await v);if(typeof v=="function")return await L(await v());if(typeof v=="object")return await a(v,[...$,P]);const ne=Ce(P),oe=T.dashCase(P),ie=[...$,ne].join(".");m.add(`"${ie}"`);const Y=[...$.map(T.dashCase),oe].join("-"),ge=ae.parseVariableTokens(v);return ge?`--${Y}: ${ge.transformed};`:`--${Y}: ${v};`};return await L(M)});return(await Promise.all(K)).flat()},g=async S=>{if(!S)return[];const $=Object.entries(S).map(async([D,P])=>{const M=await a(P);return D==="base"?M.join(""):o.mediaQueries[D]?`${o.mediaQueries[D]} { ${M.join("")} }`:`${D} { ${M.join("")} }`});return(await Promise.all($)).flat()},d=async S=>{if(!S)return[];const $=Object.entries(S).map(async([D,P])=>{const M=Object.entries(P).map(async([v,ne])=>{const oe=await a(ne,[D]),ie=`.${D}-${v}, [data-${D}="${v}"]`,Y=oe.join("");return`${ie} { ${Y} }`});return(await Promise.all(M)).flat()});return(await Promise.all($)).flat()},h=S=>({...S,responsive:void 0,conditional:void 0}),p=S=>n.variables.map($=>S==="static"?h($._current):$._current[S]),C=J.mergeObjects(h(r.variables),p("static")),x=await a(C),k=J.mergeObjects((de=r.variables)==null?void 0:de.responsive,p("responsive")),V=await g(k),z=J.mergeObjects((ye=r.variables)==null?void 0:ye.conditional,p("conditional")),A=await d(z),me=i.join(s,"css/_variables.css"),E=`:root { ${x.join("")} ${V.join("")} } ${A.join("")}`;c.writeFileSync(me,E),o.staticVariables=C;const ee=i.join(s,"css/_global.css"),f=J.mergeObjects(r.global,n.globalStyles),j=await ae.parseAndJoinStyles(f,"");c.writeFileSync(ee,`@layer global { ${j} }`);const F=i.join(s,"css/_reset.css"),b=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:ze,N=await ae.parseAndJoinStyles(b,"");c.writeFileSync(F,`@layer reset { ${N} }`);const _=i.join(s,"css/_templates.css"),R=J.mergeObjects(r.templates,n.templates),W=await he.parseTemplates(R),I=he.getTemplateTypes(R);c.writeFileSync(_,`@layer templates { ${W} }`),o.templates=R;const X=r.templates?[Ee.defineTemplates(r.templates)._setPath(`config;;${l}`)]:[],te=J.mergeFactories(n.templates,X);o.templatePaths=Object.fromEntries(Object.entries(te).map(([S,$])=>[S,$._path]));const G=i.join(s,"types/css-tokens.d.ts"),De=`
2
2
  // Variable types
3
3
  type VariableTokens = ${[...m].join("|")};
4
4
  type PropertyValueToken = \`{\${VariableTokens}}\`;
5
5
 
6
6
  // Template types
7
7
  type TemplateTokens = {
8
- ${Object.entries(I).map(([S,F])=>`${S}?: ${F}`).join(`
8
+ ${Object.entries(I).map(([S,$])=>`${S}?: ${$}`).join(`
9
9
  `)}
10
10
  }
11
11
 
12
12
  // Media query types
13
13
  type MediaQueryKeys = ${w||"''"};
14
- `;c.writeFileSync(G,ke);const De=i.join(s,"cache/config-cache.json");c.writeFileSync(De,JSON.stringify(o,null,2));const Te=Ve.getCorePackageRoot(),_e=i.join(Te,"cache/config-cache.json");c.writeFileSync(_e,JSON.stringify(o,null,2))},Se=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(m=>y==null?void 0:y.includes(m)))return t}return"styled('div',"}),Ie=(e,t)=>{try{const s=c.readFileSync(i.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
14
+ `;c.writeFileSync(G,De);const ve=i.join(s,"cache/config-cache.json");c.writeFileSync(ve,JSON.stringify(o,null,2));const Te=je.getCorePackageRoot(),_e=i.join(Te,"cache/config-cache.json");c.writeFileSync(_e,JSON.stringify(o,null,2))},Se=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(m=>y==null?void 0:y.includes(m)))return t}return"styled('div',"}),Ie=(e,t)=>{try{const s=c.readFileSync(i.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
15
15
 
16
16
  ${e}`:`globalThis.saltyConfig = {};
17
17
 
18
- ${e}`}catch{return e}},U=async(e,t,s)=>{const n=_.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=Se(o),o=Ie(o,e);const y=i.join(s,"js",n+".js"),w=await fe(e),m=i.join(e,(w==null?void 0:w.configDir)||"","salty.config.ts"),a=Ce(m),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:p=>{p.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},$=>{const x=c.readFileSync($.path,"utf8");return{contents:Se(x),loader:"ts"}})}}]});const d=Date.now();return{contents:await import(`${y}?t=${d}`),outputFilePath:y}},Ge=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 Ge(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)},pe=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Ke=async(e,t=pe(),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)&&Oe.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 m=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()&&Z(u)){m.add(u);const C=c.readFileSync(u,"utf8");/define[\w\d]+\(/.test(C)&&a.add(u)}}await g(e),await xe(e,a);const d={keyframes:[],components:[],classNames:[]};await Promise.all([...m].map(async u=>{const{contents:j}=await U(e,u,o);for(let[b,f]of Object.entries(j))f instanceof Promise&&(f=await f),f.isKeyframes?d.keyframes.push({value:f,src:u,name:b}):f.isClassName?d.classNames.push({...f,src:u,name:b}):f.generator&&d.components.push({...f,src:u,name:b})}));const h=await ue(e);for(const u of d.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 p={};for(const u of d.components){const{src:j,name:b}=u;p[j]||(p[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}`,v=i.join(o,N);c.writeFileSync(v,C),h.importStrategy==="component"&&p[j].push(f.cssFileName)}for(const u of d.classNames){const{src:j,name:b}=u;p[j]||(p[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}`,v=i.join(o,N);c.writeFileSync(v,C),h.importStrategy==="component"&&p[j].push(f.cssFileName)}h.importStrategy==="component"&&Object.entries(p).forEach(([u,j])=>{const b=j.map(R=>`@import url('./${R}');`).join(`
19
- `),f=_.toHash(u,6),C=i.parse(u),N=_.dashCase(C.name),v=i.join(o,`css/f_${N}-${f}.css`);c.writeFileSync(v,b||"/* Empty file */")});const $=r.map(u=>`@import url('./css/${u}');`).join(`
18
+ ${e}`}catch{return e}},U=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=Se(o),o=Ie(o,e);const y=i.join(s,"js",n+".js"),w=await fe(e),m=i.join(e,(w==null?void 0:w.configDir)||"","salty.config.ts"),a=Pe(m),g=await $e(e);await be.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:p=>{p.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},C=>{const x=c.readFileSync(C.path,"utf8");return{contents:Se(x),loader:"ts"}})}}]});const d=Date.now();return{contents:await import(`${y}?t=${d}`),outputFilePath:y}},Ge=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 Ge(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)},pe=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Ke=async(e,t=pe(),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 m=new Set,a=new Set;async function g(f){const j=["node_modules","saltygen"],F=c.statSync(f);if(F.isDirectory()){const u=c.readdirSync(f);if(j.some(N=>f.includes(N)))return;await Promise.all(u.map(N=>g(i.join(f,N))))}else if(F.isFile()&&Z(f)){m.add(f);const b=c.readFileSync(f,"utf8");/define[\w\d]+\(/.test(b)&&a.add(f)}}await g(e),await ke(e,a);const d={keyframes:[],components:[],classNames:[]};await Promise.all([...m].map(async f=>{const{contents:j}=await U(e,f,o);for(let[F,u]of Object.entries(j)){const b=await je.resolveValue(u,1);b.isKeyframes?d.keyframes.push({value:b,src:f,name:F}):b.isClassName?d.classNames.push({...u,src:f,name:F}):b.generator&&d.components.push({...u,src:f,name:F})}}));const h=await ue(e);for(const f of d.keyframes){const{value:j}=f,F=`a_${j.animationName}.css`,u=`css/${F}`,b=i.join(o,u);r.push(F),c.writeFileSync(b,j.css)}const p={};for(const f of d.components){const{src:j,name:F}=f;p[j]||(p[j]=[]);const u=f.generator._withBuildContext({callerName:F,isProduction:t,config:h});l[u.priority]||(l[u.priority]=[]);const b=await u.css;if(!b)continue;l[u.priority].push(u.cssFileName);const N=`css/${u.cssFileName}`,_=i.join(o,N);c.writeFileSync(_,b),h.importStrategy==="component"&&p[j].push(u.cssFileName)}for(const f of d.classNames){const{src:j,name:F}=f;p[j]||(p[j]=[]);const u=f.generator._withBuildContext({callerName:F,isProduction:t,config:h}),b=await u.css;if(!b)continue;l[u.priority]||(l[u.priority]=[]),l[u.priority].push(u.cssFileName);const N=`css/${u.cssFileName}`,_=i.join(o,N);c.writeFileSync(_,b),h.importStrategy==="component"&&p[j].push(u.cssFileName)}h.importStrategy==="component"&&Object.entries(p).forEach(([f,j])=>{const F=j.map(R=>`@import url('./${R}');`).join(`
19
+ `),u=T.toHash(f,6),b=i.parse(f),N=T.dashCase(b.name),_=i.join(o,`css/f_${N}-${u}.css`);c.writeFileSync(_,F||"/* Empty file */")});const C=r.map(f=>`@import url('./css/${f}');`).join(`
20
20
  `);let A=`/*!
21
21
  * Generated with Salty CSS (https://salty-css.dev)
22
22
  * Do not edit this file directly
23
23
  */
24
24
  @layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
25
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(`
26
+ ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(f=>{try{return c.readFileSync(i.join(o,"css",f),"utf8").length>0}catch{return!1}}).map(f=>`@import url('./css/${f}');`).join(`
27
27
  `)}
28
- ${$}`;if(h.importStrategy!=="component"){const u=l.reduce((j,b,f)=>{const C=b.reduce((W,I)=>{var se;const X=i.join(o,"css",I),te=c.readFileSync(X,"utf8"),G=((se=/.*-([^-]+)-\d+.css/.exec(I))==null?void 0:se.at(1))||_.toHash(X,6);return W.includes(G)?W:`${W}
28
+ ${C}`;if(h.importStrategy!=="component"){const f=l.reduce((j,F,u)=>{const b=F.reduce((W,I)=>{var se;const X=i.join(o,"css",I),te=c.readFileSync(X,"utf8"),G=((se=/.*-([^-]+)-\d+.css/.exec(I))==null?void 0:se.at(1))||T.toHash(X,6);return W.includes(G)?W:`${W}
29
29
  /*start:${G}-${I}*/
30
30
  ${te}
31
31
  /*end:${G}*/
32
- `},""),N=`l_${f}.css`,v=i.join(o,"css",N),R=`@layer l${f} { ${C}
33
- }`;return c.writeFileSync(v,R),`${j}
34
- @import url('./css/${N}');`},"");A+=u}c.writeFileSync(y,A);const V=Date.now()-n,ee=V<200?"🔥":V<500?"🚀":V<1e3?"🎉":V<2e3?"🚗":V<5e3?"🤔":"🥴";B.info(`Generated CSS in ${V}ms! ${ee}`)}catch(n){console.error(n)}},Le=async(e,t,s=pe())=>{try{const n=await q(e);if(Z(t)){const l=[],o=await ue(e),{contents:y}=await U(e,t,n);for(const[w,m]of Object.entries(y)){if(m.isKeyframes&&m.css){const $=`css/${`a_${m.animationName}.css`}`,x=i.join(n,$);c.writeFileSync(x,await m.css);continue}if(m.isClassName){const p=m.generator._withBuildContext({callerName:w,isProduction:s,config:o}),$=await p.css;if(!$)continue;l[p.priority]||(l[p.priority]=[]),l[p.priority].push(p.cssFileName);const x=`css/${p.cssFileName}`,k=i.join(n,x);c.writeFileSync(k,$);continue}if(!m.generator)continue;const a=m.generator._withBuildContext({callerName:w,isProduction:s,config:o}),g=await a.css;if(!g)continue;const d=`css/${a.cssFileName}`,h=i.join(n,d);c.writeFileSync(h,g),l[a.priority]||(l[a.priority]=[]),l[a.priority].push(a.cssFileName)}if(o.importStrategy!=="component")l.forEach((w,m)=>{const a=`l_${m}.css`,g=i.join(n,"css",a);let d=c.readFileSync(g,"utf8");w.forEach(h=>{var k;const p=i.join(n,"css",h),$=((k=/.*-([^-]+)-\d+.css/.exec(h))==null?void 0:k.at(1))||_.toHash(p,6);if(!d.includes($)){const E=c.readFileSync(p,"utf8"),z=`/*start:${$}-${h}*/
35
- ${E}
36
- /*end:${$}*/
32
+ `},""),N=`l_${u}.css`,_=i.join(o,"css",N),R=`@layer l${u} { ${b}
33
+ }`;return c.writeFileSync(_,R),`${j}
34
+ @import url('./css/${N}');`},"");A+=f}c.writeFileSync(y,A);const E=Date.now()-n,ee=E<200?"🔥":E<500?"🚀":E<1e3?"🎉":E<2e3?"🚗":E<5e3?"🤔":"🥴";B.info(`Generated CSS in ${E}ms! ${ee}`)}catch(n){console.error(n)}},Le=async(e,t,s=pe())=>{try{const n=await q(e);if(Z(t)){const l=[],o=await ue(e),{contents:y}=await U(e,t,n);for(const[w,m]of Object.entries(y)){if(m.isKeyframes&&m.css){const C=`css/${`a_${m.animationName}.css`}`,x=i.join(n,C);c.writeFileSync(x,await m.css);continue}if(m.isClassName){const p=m.generator._withBuildContext({callerName:w,isProduction:s,config:o}),C=await p.css;if(!C)continue;l[p.priority]||(l[p.priority]=[]),l[p.priority].push(p.cssFileName);const x=`css/${p.cssFileName}`,k=i.join(n,x);c.writeFileSync(k,C);continue}if(!m.generator)continue;const a=m.generator._withBuildContext({callerName:w,isProduction:s,config:o}),g=await a.css;if(!g)continue;const d=`css/${a.cssFileName}`,h=i.join(n,d);c.writeFileSync(h,g),l[a.priority]||(l[a.priority]=[]),l[a.priority].push(a.cssFileName)}if(o.importStrategy!=="component")l.forEach((w,m)=>{const a=`l_${m}.css`,g=i.join(n,"css",a);let d=c.readFileSync(g,"utf8");w.forEach(h=>{var k;const p=i.join(n,"css",h),C=((k=/.*-([^-]+)-\d+.css/.exec(h))==null?void 0:k.at(1))||T.toHash(p,6);if(!d.includes(C)){const V=c.readFileSync(p,"utf8"),z=`/*start:${C}-${h}*/
35
+ ${V}
36
+ /*end:${C}*/
37
37
  `;d=`${d.replace(/\}$/,"")}
38
38
  ${z}
39
39
  }`}}),c.writeFileSync(g,d)});else{const w=l.flat().map(h=>`@import url('./${h}');`).join(`
40
- `),m=_.toHash(t,6),a=i.parse(t),g=_.dashCase(a.name),d=i.join(n,`css/f_${g}-${m}.css`);c.writeFileSync(d,w||"/* Empty file */")}}}catch(n){console.error(n)}},Qe=async(e,t,s=pe())=>{var n,r;try{const l=await q(e);if(Z(t)){const y=c.readFileSync(t,"utf8"),w=await ue(e),{contents:m}=await U(e,t,l);let a=y;for(const[g,d]of Object.entries(m)){if(d.isKeyframes||!d.generator)continue;const h=d.generator._withBuildContext({callerName:g,isProduction:s,config:w}),[p,$]=await He(a,g),x=a.slice(p,$);if(d.isClassName){const k=a,E=` ${g} = className("${h.classNames}")`;a=a.replace(x,E),k===a&&console.error("Minimize file failed to change content",{name:g})}if(x.includes("styled")){const k=(r=(n=/styled\(([^,]+),/.exec(x))==null?void 0:n.at(1))==null?void 0:r.trim(),E=a,z=` ${g} = styled(${k}, "${h.classNames}", ${JSON.stringify(h.clientProps)})`;a=a.replace(x,z),E===a&&console.error("Minimize file failed to change content",{name:g,tagName:k})}}if(w.importStrategy==="component"){const g=_.toHash(t,6),d=i.parse(t);a=`import '../../saltygen/css/${`f_${_.dashCase(d.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=U;exports.generateConfigStyles=xe;exports.generateCss=Ke;exports.generateFile=Le;exports.isSaltyFile=Z;exports.logError=qe;exports.logger=B;exports.minimizeFile=Qe;exports.saltyFileExtensions=le;exports.saltyFileRegExp=Pe;
40
+ `),m=T.toHash(t,6),a=i.parse(t),g=T.dashCase(a.name),d=i.join(n,`css/f_${g}-${m}.css`);c.writeFileSync(d,w||"/* Empty file */")}}}catch(n){console.error(n)}},Qe=async(e,t,s=pe())=>{var n,r;try{const l=await q(e);if(Z(t)){const y=c.readFileSync(t,"utf8"),w=await ue(e),{contents:m}=await U(e,t,l);let a=y;for(const[g,d]of Object.entries(m)){if(d.isKeyframes||!d.generator)continue;const h=d.generator._withBuildContext({callerName:g,isProduction:s,config:w}),[p,C]=await He(a,g),x=a.slice(p,C);if(d.isClassName){const k=a,V=` ${g} = className("${h.classNames}")`;a=a.replace(x,V),k===a&&console.error("Minimize file failed to change content",{name:g})}if(x.includes("styled")){const k=(r=(n=/styled\(([^,]+),/.exec(x))==null?void 0:n.at(1))==null?void 0:r.trim(),V=a,z=` ${g} = styled(${k}, "${h.classNames}", ${JSON.stringify(h.clientProps)})`;a=a.replace(x,z),V===a&&console.error("Minimize file failed to change content",{name:g,tagName:k})}}if(w.importStrategy==="component"){const g=T.toHash(t,6),d=i.parse(t);a=`import '../../saltygen/css/${`f_${T.dashCase(d.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=U;exports.generateConfigStyles=ke;exports.generateCss=Ke;exports.generateFile=Le;exports.isSaltyFile=Z;exports.logError=qe;exports.logger=B;exports.minimizeFile=Qe;exports.saltyFileExtensions=le;exports.saltyFileRegExp=Ne;
@@ -2,7 +2,7 @@ import * as St from "esbuild";
2
2
  import { execSync as Vt } from "child_process";
3
3
  import { t as I, d as A } from "./dash-case-DBThphLm.js";
4
4
  import { join as i, parse as tt } from "path";
5
- import { existsSync as ft, mkdirSync as G, statSync as Et, readdirSync as Ot, readFileSync as T, writeFileSync as C } from "fs";
5
+ import { existsSync as ft, mkdirSync as G, statSync as Et, readdirSync as Ot, readFileSync as T, writeFileSync as F } from "fs";
6
6
  import { readFile as Ct } from "fs/promises";
7
7
  import { p as $t, a as Mt } from "./parse-styles-DLPgVsVQ.js";
8
8
  import { parseTemplates as Rt, getTemplateTypes as Jt } from "./parsers/index.js";
@@ -10,36 +10,36 @@ import { createLogger as zt, transports as Wt, format as rt } 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
- import { g as It } from "./helpers-C1RIrlCB.js";
13
+ import { r as It, g as Kt } from "./helpers-f73tgqcY.js";
14
14
  const Ft = (t) => {
15
15
  if (!t || t === "/") throw new Error("Could not find package.json file");
16
16
  const e = i(t, "package.json");
17
17
  return ft(e) ? e : Ft(i(t, ".."));
18
- }, Kt = async (t) => {
18
+ }, Qt = async (t) => {
19
19
  const e = Ft(t);
20
20
  return await Ct(e, "utf-8").then(JSON.parse).catch(() => {
21
21
  });
22
- }, Qt = async (t) => {
23
- const e = await Kt(t);
22
+ }, Bt = async (t) => {
23
+ const e = await Qt(t);
24
24
  if (e)
25
25
  return e.type;
26
26
  };
27
27
  let W;
28
28
  const Pt = async (t) => {
29
29
  if (W) return W;
30
- const e = await Qt(t);
30
+ const e = await Bt(t);
31
31
  return e === "module" ? W = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (W = "cjs"), W || "esm";
32
32
  }, Z = zt({
33
33
  level: "debug",
34
34
  format: rt.combine(rt.colorize(), rt.cli()),
35
35
  transports: [new Wt.Console({})]
36
- }), me = (t) => {
36
+ }), pe = (t) => {
37
37
  Z.error(t);
38
38
  };
39
39
  function jt(t) {
40
40
  return t ? typeof t != "string" ? jt(String(t)) : t.replace(/[^\d\w]/g, ".") : "";
41
41
  }
42
- const Bt = {
42
+ const Lt = {
43
43
  /** Set box model to border-box */
44
44
  "*, *::before, *::after": {
45
45
  boxSizing: "border-box"
@@ -85,7 +85,7 @@ const Bt = {
85
85
  fontSize: "100%",
86
86
  lineHeight: "1.15em"
87
87
  }
88
- }, Lt = (t, e) => new Promise((s, n) => {
88
+ }, qt = (t, e) => new Promise((s, n) => {
89
89
  const c = setTimeout(() => {
90
90
  n(new Error("Timeout"));
91
91
  }, 100), r = lt.createSourceFile("temp.ts", t, lt.ScriptTarget.Latest, !0);
@@ -111,7 +111,7 @@ const Bt = {
111
111
  if (V.destDir) return V.destDir;
112
112
  const e = await pt(t), s = i(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
113
113
  return V.destDir = s, s;
114
- }, xt = ["salty", "css", "styles", "styled"], qt = (t = []) => new RegExp(`\\.(${[...xt, ...t].join("|")})\\.`), mt = (t, e = []) => qt(e).test(t), Dt = async (t) => {
114
+ }, xt = ["salty", "css", "styles", "styled"], At = (t = []) => new RegExp(`\\.(${[...xt, ...t].join("|")})\\.`), mt = (t, e = []) => At(e).test(t), Dt = async (t) => {
115
115
  if (V.rcFile) return V.rcFile;
116
116
  if (t === "/") throw new Error("Could not find .saltyrc.json file");
117
117
  const e = i(t, ".saltyrc.json"), s = await Ct(e, "utf-8").then(JSON.parse).catch(() => {
@@ -121,7 +121,7 @@ const Bt = {
121
121
  var n, c;
122
122
  const e = await Dt(t), s = (n = e.projects) == null ? void 0 : n.find((r) => t.endsWith(r.dir || ""));
123
123
  return s || ((c = e.projects) == null ? void 0 : c.find((r) => r.dir === e.defaultProject));
124
- }, At = async (t) => {
124
+ }, Ut = async (t) => {
125
125
  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 Pt(t), o = Nt(n);
126
126
  await St.build({
127
127
  entryPoints: [n],
@@ -134,7 +134,7 @@ const Bt = {
134
134
  });
135
135
  const d = Date.now(), { config: w } = await import(`${c}?t=${d}`);
136
136
  return { config: w, path: c };
137
- }, Ut = async (t, e) => {
137
+ }, Xt = async (t, e) => {
138
138
  var yt, ht;
139
139
  const s = await J(t), n = {
140
140
  mediaQueries: [],
@@ -144,25 +144,25 @@ const Bt = {
144
144
  };
145
145
  await Promise.all(
146
146
  [...e].map(async (h) => {
147
- const { contents: S, outputFilePath: L } = await et(t, h, s);
148
- Object.entries(S).forEach(([k, j]) => {
147
+ const { contents: C, outputFilePath: L } = await et(t, h, s);
148
+ Object.entries(C).forEach(([k, j]) => {
149
149
  j.isMedia ? n.mediaQueries.push([k, j]) : j.isGlobalDefine ? n.globalStyles.push(j) : j.isDefineVariables ? n.variables.push(j) : j.isDefineTemplates && n.templates.push(j._setPath(`${k};;${L}`));
150
150
  });
151
151
  })
152
152
  );
153
- const { config: c, path: r } = await At(t), o = { ...c }, { mediaQueries: d } = n;
154
- o.mediaQueries = Object.fromEntries(d.map(([h, S]) => [`@${h}`, S]));
155
- const w = d.map(([h]) => `'@${h}'`).join(" | "), p = /* @__PURE__ */ new Set(), a = async (h, S = []) => {
153
+ const { config: c, path: r } = await Ut(t), o = { ...c }, { mediaQueries: d } = n;
154
+ o.mediaQueries = Object.fromEntries(d.map(([h, C]) => [`@${h}`, C]));
155
+ const w = d.map(([h]) => `'@${h}'`).join(" | "), p = /* @__PURE__ */ new Set(), a = async (h, C = []) => {
156
156
  if (!h) return [];
157
157
  const L = Object.entries(h).map(async ([j, R]) => {
158
158
  const q = async (v) => {
159
159
  if (!v) return;
160
160
  if (v instanceof Promise) return await q(await v);
161
161
  if (typeof v == "function") return await q(await v());
162
- if (typeof v == "object") return await a(v, [...S, j]);
163
- const at = jt(j), it = A(j), ct = [...S, at].join(".");
162
+ if (typeof v == "object") return await a(v, [...C, j]);
163
+ const at = jt(j), it = A(j), ct = [...C, at].join(".");
164
164
  p.add(`"${ct}"`);
165
- const Y = [...S.map(A), it].join("-"), wt = Mt(v);
165
+ const Y = [...C.map(A), it].join("-"), wt = Mt(v);
166
166
  return wt ? `--${Y}: ${wt.transformed};` : `--${Y}: ${v};`;
167
167
  };
168
168
  return await q(R);
@@ -170,31 +170,31 @@ const Bt = {
170
170
  return (await Promise.all(L)).flat();
171
171
  }, g = async (h) => {
172
172
  if (!h) return [];
173
- const S = Object.entries(h).map(async ([k, j]) => {
173
+ const C = Object.entries(h).map(async ([k, j]) => {
174
174
  const R = await a(j);
175
175
  return k === "base" ? R.join("") : o.mediaQueries[k] ? `${o.mediaQueries[k]} { ${R.join("")} }` : `${k} { ${R.join("")} }`;
176
176
  });
177
- return (await Promise.all(S)).flat();
177
+ return (await Promise.all(C)).flat();
178
178
  }, u = async (h) => {
179
179
  if (!h) return [];
180
- const S = Object.entries(h).map(async ([k, j]) => {
180
+ const C = Object.entries(h).map(async ([k, j]) => {
181
181
  const R = Object.entries(j).map(async ([v, at]) => {
182
182
  const it = await a(at, [k]), ct = `.${k}-${v}, [data-${k}="${v}"]`, Y = it.join("");
183
183
  return `${ct} { ${Y} }`;
184
184
  });
185
185
  return (await Promise.all(R)).flat();
186
186
  });
187
- return (await Promise.all(S)).flat();
188
- }, 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((yt = c.variables) == null ? void 0 : yt.responsive, m("responsive")), E = await g(D), z = H((ht = c.variables) == null ? void 0 : ht.conditional, m("conditional")), U = await u(z), gt = i(s, "css/_variables.css"), O = `:root { ${x.join("")} ${E.join("")} } ${U.join("")}`;
189
- C(gt, O), o.staticVariables = F;
190
- const st = i(s, "css/_global.css"), f = H(c.global, n.globalStyles), $ = await $t(f, "");
191
- C(st, `@layer global { ${$} }`);
192
- const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : Bt, N = await $t(P, "");
193
- C(b, `@layer reset { ${N} }`);
187
+ return (await Promise.all(C)).flat();
188
+ }, y = (h) => ({ ...h, responsive: void 0, conditional: void 0 }), m = (h) => n.variables.map((C) => h === "static" ? y(C._current) : C._current[h]), P = H(y(c.variables), m("static")), x = await a(P), D = H((yt = c.variables) == null ? void 0 : yt.responsive, m("responsive")), E = await g(D), z = H((ht = c.variables) == null ? void 0 : ht.conditional, m("conditional")), U = await u(z), gt = i(s, "css/_variables.css"), O = `:root { ${x.join("")} ${E.join("")} } ${U.join("")}`;
189
+ F(gt, O), o.staticVariables = P;
190
+ const st = i(s, "css/_global.css"), l = H(c.global, n.globalStyles), $ = await $t(l, "");
191
+ F(st, `@layer global { ${$} }`);
192
+ const S = i(s, "css/_reset.css"), b = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : Lt, N = await $t(b, "");
193
+ F(S, `@layer reset { ${N} }`);
194
194
  const _ = i(s, "css/_templates.css"), M = H(c.templates, n.templates), K = await Rt(M), Q = Jt(M);
195
- C(_, `@layer templates { ${K} }`), o.templates = M;
195
+ F(_, `@layer templates { ${K} }`), o.templates = M;
196
196
  const X = c.templates ? [Ht(c.templates)._setPath(`config;;${r}`)] : [], nt = Gt(n.templates, X);
197
- o.templatePaths = Object.fromEntries(Object.entries(nt).map(([h, S]) => [h, S._path]));
197
+ o.templatePaths = Object.fromEntries(Object.entries(nt).map(([h, C]) => [h, C._path]));
198
198
  const B = i(s, "types/css-tokens.d.ts"), kt = `
199
199
  // Variable types
200
200
  type VariableTokens = ${[...p].join("|")};
@@ -202,18 +202,18 @@ const Bt = {
202
202
 
203
203
  // Template types
204
204
  type TemplateTokens = {
205
- ${Object.entries(Q).map(([h, S]) => `${h}?: ${S}`).join(`
205
+ ${Object.entries(Q).map(([h, C]) => `${h}?: ${C}`).join(`
206
206
  `)}
207
207
  }
208
208
 
209
209
  // Media query types
210
210
  type MediaQueryKeys = ${w || "''"};
211
211
  `;
212
- C(B, kt);
212
+ F(B, kt);
213
213
  const vt = i(s, "cache/config-cache.json");
214
- C(vt, JSON.stringify(o, null, 2));
215
- const Tt = It(), _t = i(Tt, "cache/config-cache.json");
216
- C(_t, JSON.stringify(o, null, 2));
214
+ F(vt, JSON.stringify(o, null, 2));
215
+ const Tt = Kt(), _t = i(Tt, "cache/config-cache.json");
216
+ F(_t, JSON.stringify(o, null, 2));
217
217
  }, bt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
218
218
  if (/^['"`]/.test(s)) return e;
219
219
  const c = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
@@ -224,7 +224,7 @@ const Bt = {
224
224
  if (xt.some((p) => d == null ? void 0 : d.includes(p))) return e;
225
225
  }
226
226
  return "styled('div',";
227
- }), Xt = (t, e) => {
227
+ }), Yt = (t, e) => {
228
228
  try {
229
229
  const s = T(i(e, "saltygen/cache/config-cache.json"), "utf8");
230
230
  return s ? `globalThis.saltyConfig = ${s};
@@ -240,7 +240,7 @@ ${t}`;
240
240
  ft(c) || G(c);
241
241
  const r = tt(e);
242
242
  let o = T(e, "utf8");
243
- o = bt(o), o = Xt(o, t);
243
+ o = bt(o), o = Yt(o, t);
244
244
  const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a = Nt(p), g = await Pt(t);
245
245
  await St.build({
246
246
  stdin: {
@@ -262,8 +262,8 @@ ${t}`;
262
262
  {
263
263
  name: "test",
264
264
  setup: (m) => {
265
- m.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (F) => {
266
- const x = T(F.path, "utf8");
265
+ m.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (P) => {
266
+ const x = T(P.path, "utf8");
267
267
  return { contents: bt(x), loader: "ts" };
268
268
  });
269
269
  }
@@ -272,12 +272,12 @@ ${t}`;
272
272
  });
273
273
  const u = Date.now();
274
274
  return { contents: await import(`${d}?t=${u}`), outputFilePath: d };
275
- }, Yt = async (t) => {
275
+ }, Zt = async (t) => {
276
276
  const e = await J(t), s = i(e, "cache/config-cache.json"), n = T(s, "utf8");
277
277
  if (!n) throw new Error("Could not find config cache file");
278
278
  return JSON.parse(n);
279
279
  }, ut = async (t) => {
280
- const e = await Yt(t), s = await J(t), n = i(s, "salty.config.js"), c = Date.now(), { config: r } = await import(`${n}?t=${c}`);
280
+ const e = await Zt(t), s = await J(t), n = i(s, "salty.config.js"), c = Date.now(), { config: r } = await import(`${n}?t=${c}`);
281
281
  return H(r, e);
282
282
  }, dt = () => {
283
283
  try {
@@ -285,7 +285,7 @@ ${t}`;
285
285
  } catch {
286
286
  return !1;
287
287
  }
288
- }, pe = async (t, e = dt(), s = !0) => {
288
+ }, ue = async (t, e = dt(), s = !0) => {
289
289
  try {
290
290
  const n = Date.now();
291
291
  e ? Z.info("Generating CSS in production mode! 🔥") : Z.info("Generating CSS in development mode! 🚀");
@@ -294,83 +294,85 @@ ${t}`;
294
294
  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"));
295
295
  })();
296
296
  const p = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
297
- async function g(f) {
298
- const $ = ["node_modules", "saltygen"], b = Et(f);
299
- if (b.isDirectory()) {
300
- const l = Ot(f);
301
- if ($.some((N) => f.includes(N))) return;
302
- await Promise.all(l.map((N) => g(i(f, N))));
303
- } else if (b.isFile() && mt(f)) {
304
- p.add(f);
305
- const P = T(f, "utf8");
306
- /define[\w\d]+\(/.test(P) && a.add(f);
297
+ async function g(l) {
298
+ const $ = ["node_modules", "saltygen"], S = Et(l);
299
+ if (S.isDirectory()) {
300
+ const f = Ot(l);
301
+ if ($.some((N) => l.includes(N))) return;
302
+ await Promise.all(f.map((N) => g(i(l, N))));
303
+ } else if (S.isFile() && mt(l)) {
304
+ p.add(l);
305
+ const b = T(l, "utf8");
306
+ /define[\w\d]+\(/.test(b) && a.add(l);
307
307
  }
308
308
  }
309
- await g(t), await Ut(t, a);
309
+ await g(t), await Xt(t, a);
310
310
  const u = {
311
311
  keyframes: [],
312
312
  components: [],
313
313
  classNames: []
314
314
  };
315
315
  await Promise.all(
316
- [...p].map(async (f) => {
317
- const { contents: $ } = await et(t, f, o);
318
- for (let [b, l] of Object.entries($))
319
- l instanceof Promise && (l = await l), l.isKeyframes ? u.keyframes.push({
320
- value: l,
321
- src: f,
322
- name: b
323
- }) : l.isClassName ? u.classNames.push({
324
- ...l,
325
- src: f,
326
- name: b
327
- }) : l.generator && u.components.push({
328
- ...l,
329
- src: f,
330
- name: b
316
+ [...p].map(async (l) => {
317
+ const { contents: $ } = await et(t, l, o);
318
+ for (let [S, f] of Object.entries($)) {
319
+ const b = await It(f, 1);
320
+ b.isKeyframes ? u.keyframes.push({
321
+ value: b,
322
+ src: l,
323
+ name: S
324
+ }) : b.isClassName ? u.classNames.push({
325
+ ...f,
326
+ src: l,
327
+ name: S
328
+ }) : b.generator && u.components.push({
329
+ ...f,
330
+ src: l,
331
+ name: S
331
332
  });
333
+ }
332
334
  })
333
335
  );
334
336
  const y = await ut(t);
335
- for (const f of u.keyframes) {
336
- const { value: $ } = f, b = `a_${$.animationName}.css`, l = `css/${b}`, P = i(o, l);
337
- c.push(b), C(P, $.css);
337
+ for (const l of u.keyframes) {
338
+ const { value: $ } = l, S = `a_${$.animationName}.css`, f = `css/${S}`, b = i(o, f);
339
+ c.push(S), F(b, $.css);
338
340
  }
339
341
  const m = {};
340
- for (const f of u.components) {
341
- const { src: $, name: b } = f;
342
+ for (const l of u.components) {
343
+ const { src: $, name: S } = l;
342
344
  m[$] || (m[$] = []);
343
- const l = f.generator._withBuildContext({
344
- callerName: b,
345
+ const f = l.generator._withBuildContext({
346
+ callerName: S,
345
347
  isProduction: e,
346
348
  config: y
347
349
  });
348
- r[l.priority] || (r[l.priority] = []);
349
- const P = await l.css;
350
- if (!P) continue;
351
- r[l.priority].push(l.cssFileName);
352
- const N = `css/${l.cssFileName}`, _ = i(o, N);
353
- C(_, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
350
+ r[f.priority] || (r[f.priority] = []);
351
+ const b = await f.css;
352
+ if (!b) continue;
353
+ r[f.priority].push(f.cssFileName);
354
+ const N = `css/${f.cssFileName}`, _ = i(o, N);
355
+ F(_, b), y.importStrategy === "component" && m[$].push(f.cssFileName);
354
356
  }
355
- for (const f of u.classNames) {
356
- const { src: $, name: b } = f;
357
+ for (const l of u.classNames) {
358
+ const { src: $, name: S } = l;
357
359
  m[$] || (m[$] = []);
358
- const l = f.generator._withBuildContext({
359
- callerName: b,
360
+ const f = l.generator._withBuildContext({
361
+ callerName: S,
360
362
  isProduction: e,
361
363
  config: y
362
- }), P = await l.css;
363
- if (!P) continue;
364
- r[l.priority] || (r[l.priority] = []), r[l.priority].push(l.cssFileName);
365
- const N = `css/${l.cssFileName}`, _ = i(o, N);
366
- C(_, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
364
+ }), b = await f.css;
365
+ if (!b) continue;
366
+ r[f.priority] || (r[f.priority] = []), r[f.priority].push(f.cssFileName);
367
+ const N = `css/${f.cssFileName}`, _ = i(o, N);
368
+ F(_, b), y.importStrategy === "component" && m[$].push(f.cssFileName);
367
369
  }
368
- y.importStrategy === "component" && Object.entries(m).forEach(([f, $]) => {
369
- const b = $.map((M) => `@import url('./${M}');`).join(`
370
- `), l = I(f, 6), P = tt(f), N = A(P.name), _ = i(o, `css/f_${N}-${l}.css`);
371
- C(_, b || "/* Empty file */");
370
+ y.importStrategy === "component" && Object.entries(m).forEach(([l, $]) => {
371
+ const S = $.map((M) => `@import url('./${M}');`).join(`
372
+ `), f = I(l, 6), b = tt(l), N = A(b.name), _ = i(o, `css/f_${N}-${f}.css`);
373
+ F(_, S || "/* Empty file */");
372
374
  });
373
- const F = c.map((f) => `@import url('./css/${f}');`).join(`
375
+ const P = c.map((l) => `@import url('./css/${l}');`).join(`
374
376
  `);
375
377
  let U = `/*!
376
378
  * Generated with Salty CSS (https://salty-css.dev)
@@ -378,20 +380,20 @@ ${t}`;
378
380
  */
379
381
  @layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
380
382
 
381
- ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((f) => {
383
+ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((l) => {
382
384
  try {
383
- return T(i(o, "css", f), "utf8").length > 0;
385
+ return T(i(o, "css", l), "utf8").length > 0;
384
386
  } catch {
385
387
  return !1;
386
388
  }
387
- }).map((f) => `@import url('./css/${f}');`).join(
389
+ }).map((l) => `@import url('./css/${l}');`).join(
388
390
  `
389
391
  `
390
392
  )}
391
- ${F}`;
393
+ ${P}`;
392
394
  if (y.importStrategy !== "component") {
393
- const f = r.reduce(($, b, l) => {
394
- const P = b.reduce((K, Q) => {
395
+ const l = r.reduce(($, S, f) => {
396
+ const b = S.reduce((K, Q) => {
395
397
  var ot;
396
398
  const X = i(o, "css", Q), nt = T(X, "utf8"), B = ((ot = /.*-([^-]+)-\d+.css/.exec(Q)) == null ? void 0 : ot.at(1)) || I(X, 6);
397
399
  return K.includes(B) ? K : `${K}
@@ -399,28 +401,28 @@ ${F}`;
399
401
  ${nt}
400
402
  /*end:${B}*/
401
403
  `;
402
- }, ""), N = `l_${l}.css`, _ = i(o, "css", N), M = `@layer l${l} { ${P}
404
+ }, ""), N = `l_${f}.css`, _ = i(o, "css", N), M = `@layer l${f} { ${b}
403
405
  }`;
404
- return C(_, M), `${$}
406
+ return F(_, M), `${$}
405
407
  @import url('./css/${N}');`;
406
408
  }, "");
407
- U += f;
409
+ U += l;
408
410
  }
409
- C(d, U);
411
+ F(d, U);
410
412
  const O = Date.now() - n, st = O < 200 ? "🔥" : O < 500 ? "🚀" : O < 1e3 ? "🎉" : O < 2e3 ? "🚗" : O < 5e3 ? "🤔" : "🥴";
411
413
  Z.info(`Generated CSS in ${O}ms! ${st}`);
412
414
  } catch (n) {
413
415
  console.error(n);
414
416
  }
415
- }, ue = async (t, e, s = dt()) => {
417
+ }, de = async (t, e, s = dt()) => {
416
418
  try {
417
419
  const n = await J(t);
418
420
  if (mt(e)) {
419
421
  const r = [], o = await ut(t), { contents: d } = await et(t, e, n);
420
422
  for (const [w, p] of Object.entries(d)) {
421
423
  if (p.isKeyframes && p.css) {
422
- const F = `css/${`a_${p.animationName}.css`}`, x = i(n, F);
423
- C(x, await p.css);
424
+ const P = `css/${`a_${p.animationName}.css`}`, x = i(n, P);
425
+ F(x, await p.css);
424
426
  continue;
425
427
  }
426
428
  if (p.isClassName) {
@@ -428,11 +430,11 @@ ${nt}
428
430
  callerName: w,
429
431
  isProduction: s,
430
432
  config: o
431
- }), F = await m.css;
432
- if (!F) continue;
433
+ }), P = await m.css;
434
+ if (!P) continue;
433
435
  r[m.priority] || (r[m.priority] = []), r[m.priority].push(m.cssFileName);
434
436
  const x = `css/${m.cssFileName}`, D = i(n, x);
435
- C(D, F);
437
+ F(D, P);
436
438
  continue;
437
439
  }
438
440
  if (!p.generator) continue;
@@ -443,7 +445,7 @@ ${nt}
443
445
  }), g = await a.css;
444
446
  if (!g) continue;
445
447
  const u = `css/${a.cssFileName}`, y = i(n, u);
446
- C(y, g), r[a.priority] || (r[a.priority] = []), r[a.priority].push(a.cssFileName);
448
+ F(y, g), r[a.priority] || (r[a.priority] = []), r[a.priority].push(a.cssFileName);
447
449
  }
448
450
  if (o.importStrategy !== "component")
449
451
  r.forEach((w, p) => {
@@ -451,28 +453,28 @@ ${nt}
451
453
  let u = T(g, "utf8");
452
454
  w.forEach((y) => {
453
455
  var D;
454
- const m = i(n, "css", y), F = ((D = /.*-([^-]+)-\d+.css/.exec(y)) == null ? void 0 : D.at(1)) || I(m, 6);
455
- if (!u.includes(F)) {
456
- const E = T(m, "utf8"), z = `/*start:${F}-${y}*/
456
+ const m = i(n, "css", y), P = ((D = /.*-([^-]+)-\d+.css/.exec(y)) == null ? void 0 : D.at(1)) || I(m, 6);
457
+ if (!u.includes(P)) {
458
+ const E = T(m, "utf8"), z = `/*start:${P}-${y}*/
457
459
  ${E}
458
- /*end:${F}*/
460
+ /*end:${P}*/
459
461
  `;
460
462
  u = `${u.replace(/\}$/, "")}
461
463
  ${z}
462
464
  }`;
463
465
  }
464
- }), C(g, u);
466
+ }), F(g, u);
465
467
  });
466
468
  else {
467
469
  const w = r.flat().map((y) => `@import url('./${y}');`).join(`
468
470
  `), p = I(e, 6), a = tt(e), g = A(a.name), u = i(n, `css/f_${g}-${p}.css`);
469
- C(u, w || "/* Empty file */");
471
+ F(u, w || "/* Empty file */");
470
472
  }
471
473
  }
472
474
  } catch (n) {
473
475
  console.error(n);
474
476
  }
475
- }, de = async (t, e, s = dt()) => {
477
+ }, ge = async (t, e, s = dt()) => {
476
478
  var n, c;
477
479
  try {
478
480
  const r = await J(t);
@@ -485,7 +487,7 @@ ${z}
485
487
  callerName: g,
486
488
  isProduction: s,
487
489
  config: w
488
- }), [m, F] = await Lt(a, g), x = a.slice(m, F);
490
+ }), [m, P] = await qt(a, g), x = a.slice(m, P);
489
491
  if (u.isClassName) {
490
492
  const D = a, E = ` ${g} = className("${y.classNames}")`;
491
493
  a = a.replace(x, E), D === a && console.error("Minimize file failed to change content", { name: g });
@@ -507,14 +509,14 @@ ${a}`;
507
509
  }
508
510
  };
509
511
  export {
510
- me as a,
511
- ue as b,
512
- qt as c,
513
- Ut as d,
512
+ pe as a,
513
+ de as b,
514
+ At as c,
515
+ Xt as d,
514
516
  et as e,
515
- pe as g,
517
+ ue as g,
516
518
  mt as i,
517
519
  Z as l,
518
- de as m,
520
+ ge as m,
519
521
  xt as s
520
522
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.287",
3
+ "version": "0.0.1-alpha.288",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-2eX-l4VO.cjs");exports.checkShouldRestart=e.checkShouldRestart;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-CD2iMVSg.cjs");exports.checkShouldRestart=e.checkShouldRestart;
package/server/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as o } from "../should-restart-YBRJU0GU.js";
1
+ import { c as o } from "../should-restart-hZeXtL5Y.js";
2
2
  export {
3
3
  o as checkShouldRestart
4
4
  };
@@ -1 +1 @@
1
- "use strict";const s=require("fs/promises"),r=require("./index-Dg98Xd3x.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;
1
+ "use strict";const s=require("fs/promises"),r=require("./index-DA5ISFwd.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;
@@ -1,5 +1,5 @@
1
1
  import { readFile as r } from "fs/promises";
2
- import { i as e } from "./index-6JCRY_wd.js";
2
+ import { i as e } from "./index-NweiKqJ2.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,10 +0,0 @@
1
- import { join as t } from "path";
2
- const r = () => {
3
- let { pathname: e } = new URL(import.meta.url);
4
- for (; /core\/?(src\/)?$/.test(e) === !1; )
5
- e = t(e, "../");
6
- return e;
7
- };
8
- export {
9
- r as g
10
- };
@@ -1 +0,0 @@
1
- "use strict";const r=require("path");var t=typeof document<"u"?document.currentScript:null;const n=()=>{let{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:t&&t.tagName.toUpperCase()==="SCRIPT"&&t.src||new URL("helpers-DVANmpVz.cjs",document.baseURI).href);for(;/core\/?(src\/)?$/.test(e)===!1;)e=r.join(e,"../");return e};exports.getCorePackageRoot=n;