@salty-css/webpack 0.0.1-alpha.176 → 0.0.1-alpha.178

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.
@@ -5,7 +5,7 @@
5
5
  }`;return n.push(x),u}const h=d.includes("&")?c.replace("&",t):c.startsWith(":")?`${t}${c}`:`${t} ${c}`,D=V(r,h);return n.push(D),u}const y=c.startsWith("-")?c:M(c),p=(h,D=";")=>u=`${u}${h}${D}`,k=h=>p(`${y}:${h}`);if(typeof r=="number")return k(r);if(typeof r!="string")if("toString"in r)r=r.toString();else return u;const{modifiers:N}={},T=function*(){yield te(r),yield be(r,N)}();for(const{result:h,additionalCss:D=[]}of T)r=h,D.forEach(j=>{const x=V(j,"");p(x,"")});return k(r)},"");return o?t?[`${t} { ${o} }`,...n].join(`
6
6
  `):o:n.join(`
7
7
  `)},se=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([o,i])=>{if(typeof i=="object"){if(!i)return;const u=o.trim(),d=se(i,[...t,u]);s.push(d)}else n[o]=i}),Object.keys(n).length){const o=t.map(M).join("-"),i=V(n,`.${o}`);s.push(i)}return s.join(`
8
- `)},Se=e=>Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=ne(n).map(o=>`"${o}"`).join(" | ")),t),{}),ne=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const i=t?`${t}.${n}`:n;return typeof o=="object"?ne(o,i,s):s.add(t)}),[...s]):[],re=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=a.join(e,"package.json");return f.existsSync(t)?t:re(a.join(e,".."))},$e=async e=>{const t=re(e);return await K.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},je=async e=>{const t=await $e(e);if(t)return t.type};let J;const oe=async e=>{if(J)return J;const t=await je(e);return t==="module"?J="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:G&&G.tagName.toUpperCase()==="SCRIPT"&&G.src||new URL("index-a4KtTJRO.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},B=I.createLogger({level:"debug",format:I.format.combine(I.format.colorize(),I.format.cli()),transports:[new I.transports.Console({})]});function ie(e){return e?typeof e!="string"?ie(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const we={"*, *::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"}},q=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),O={externalModules:[],rcFile:void 0,destDir:void 0},ce=e=>{if(O.externalModules.length>0)return O.externalModules;const s=f.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return O.externalModules=n,n},W=async e=>{if(O.destDir)return O.destDir;const t=await U(e),s=a.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},ae=["salty","css","styles","styled"],le=(e=[])=>new RegExp(`\\.(${[...ae,...e].join("|")})\\.`),H=(e,t=[])=>le(t).test(e),fe=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=a.join(e,".saltyrc.json"),s=await K.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):fe(a.join(e,".."))},U=async e=>{var n,o;const t=await fe(e),s=(n=t.projects)==null?void 0:n.find(i=>e.endsWith(i.dir||""));return s||((o=t.projects)==null?void 0:o.find(i=>i.dir===t.defaultProject))},Fe=async e=>{const t=await U(e),s=await W(e),n=a.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=a.join(s,"salty.config.js"),i=await oe(e),u=ce(n);await ee.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:i,external:u});const d=Date.now(),{config:r}=await import(`${o}?t=${d}`);return r},Ce=async(e,t)=>{const s=await Fe(e),n=new Set,o=($,C=[])=>$?Object.entries($).flatMap(([E,_])=>{if(!_)return;if(typeof _=="object")return o(_,[...C,E]);const z=ie(E),R=M(E),A=[...C,z].join(".");n.add(`"${A}"`);const L=[...C.map(M),R].join("-"),{result:pe}=te(_);return`--${L}: ${pe};`}):[],i=$=>$?Object.entries($).flatMap(([C,E])=>{const _=o(E);return C==="base"?_.join(""):`${C} { ${_.join("")} }`}):[],u=$=>$?Object.entries($).flatMap(([C,E])=>Object.entries(E).flatMap(([_,z])=>{const R=o(z,[C]),A=`.${C}-${_}, [data-${C}="${_}"]`,L=R.join("");return`${A} { ${L} }`})):[],d=$=>t.variables.map(C=>C._current[$]),r=o(q(s.variables,d("variables"))),c=i(q(s.responsiveVariables,d("responsiveVariables"))),y=u(q(s.conditionalVariables,d("conditionalVariables"))),p=await W(e),k=a.join(p,"css/_variables.css"),N=`:root { ${r.join("")} ${c.join("")} } ${y.join("")}`;f.writeFileSync(k,N);const P=a.join(p,"css/_global.css"),T=q(s.global,t.globalStyles),h=V(T,"");f.writeFileSync(P,`@layer global { ${h} }`);const D=a.join(p,"css/_reset.css"),x=s.reset==="none"?{}:typeof s.reset=="object"?s.reset:we,l=V(x,"");f.writeFileSync(D,`@layer reset { ${l} }`);const m=a.join(p,"css/_templates.css"),w=se(s.templates),b=Se(s.templates);f.writeFileSync(m,w);const g=a.join(p,"types/css-tokens.d.ts"),S=`
8
+ `)},Se=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=ne(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},ne=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const i=t?`${t}.${n}`:n;return typeof o=="object"?ne(o,i,s):s.add(t)}),[...s]):[],re=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=a.join(e,"package.json");return f.existsSync(t)?t:re(a.join(e,".."))},$e=async e=>{const t=re(e);return await K.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},je=async e=>{const t=await $e(e);if(t)return t.type};let J;const oe=async e=>{if(J)return J;const t=await je(e);return t==="module"?J="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:G&&G.tagName.toUpperCase()==="SCRIPT"&&G.src||new URL("index-DCw0G0hA.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},B=I.createLogger({level:"debug",format:I.format.combine(I.format.colorize(),I.format.cli()),transports:[new I.transports.Console({})]});function ie(e){return e?typeof e!="string"?ie(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const we={"*, *::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"}},q=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),O={externalModules:[],rcFile:void 0,destDir:void 0},ce=e=>{if(O.externalModules.length>0)return O.externalModules;const s=f.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return O.externalModules=n,n},W=async e=>{if(O.destDir)return O.destDir;const t=await U(e),s=a.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},ae=["salty","css","styles","styled"],le=(e=[])=>new RegExp(`\\.(${[...ae,...e].join("|")})\\.`),H=(e,t=[])=>le(t).test(e),fe=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=a.join(e,".saltyrc.json"),s=await K.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):fe(a.join(e,".."))},U=async e=>{var n,o;const t=await fe(e),s=(n=t.projects)==null?void 0:n.find(i=>e.endsWith(i.dir||""));return s||((o=t.projects)==null?void 0:o.find(i=>i.dir===t.defaultProject))},Fe=async e=>{const t=await U(e),s=await W(e),n=a.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=a.join(s,"salty.config.js"),i=await oe(e),u=ce(n);await ee.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:i,external:u});const d=Date.now(),{config:r}=await import(`${o}?t=${d}`);return r},Ce=async(e,t)=>{const s=await Fe(e),n=new Set,o=($,C=[])=>$?Object.entries($).flatMap(([E,_])=>{if(!_)return;if(typeof _=="object")return o(_,[...C,E]);const z=ie(E),R=M(E),A=[...C,z].join(".");n.add(`"${A}"`);const L=[...C.map(M),R].join("-"),{result:pe}=te(_);return`--${L}: ${pe};`}):[],i=$=>$?Object.entries($).flatMap(([C,E])=>{const _=o(E);return C==="base"?_.join(""):`${C} { ${_.join("")} }`}):[],u=$=>$?Object.entries($).flatMap(([C,E])=>Object.entries(E).flatMap(([_,z])=>{const R=o(z,[C]),A=`.${C}-${_}, [data-${C}="${_}"]`,L=R.join("");return`${A} { ${L} }`})):[],d=$=>t.variables.map(C=>C._current[$]),r=o(q(s.variables,d("variables"))),c=i(q(s.responsiveVariables,d("responsiveVariables"))),y=u(q(s.conditionalVariables,d("conditionalVariables"))),p=await W(e),k=a.join(p,"css/_variables.css"),N=`:root { ${r.join("")} ${c.join("")} } ${y.join("")}`;f.writeFileSync(k,N);const P=a.join(p,"css/_global.css"),T=q(s.global,t.globalStyles),h=V(T,"");f.writeFileSync(P,`@layer global { ${h} }`);const D=a.join(p,"css/_reset.css"),x=s.reset==="none"?{}:typeof s.reset=="object"?s.reset:we,l=V(x,"");f.writeFileSync(D,`@layer reset { ${l} }`);const m=a.join(p,"css/_templates.css"),w=se(s.templates),b=Se(s.templates);f.writeFileSync(m,w);const g=a.join(p,"types/css-tokens.d.ts"),S=`
9
9
  // Variable types
10
10
  type VariableTokens = ${[...n].join("|")};
11
11
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -26,14 +26,14 @@ const Ct = (t, e) => {
26
26
  return Object.values(e).forEach((n) => {
27
27
  const { pattern: r, transform: i } = n;
28
28
  t = t.replace(r, (f) => {
29
- const { value: u, css: o } = i(f);
30
- return o && s.push(o), u;
29
+ const { value: p, css: o } = i(f);
30
+ return o && s.push(o), p;
31
31
  });
32
32
  }), { result: t, additionalCss: s };
33
33
  }, ot = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${R(n[1].replaceAll(".", "-"))})`) } : { result: t }, O = (t, e, s) => {
34
34
  if (!t) return "";
35
- const n = [], r = Object.entries(t).reduce((f, [u, o]) => {
36
- const c = u.trim();
35
+ const n = [], r = Object.entries(t).reduce((f, [p, o]) => {
36
+ const c = p.trim();
37
37
  if (typeof o == "function" && (o = o()), typeof o == "object") {
38
38
  if (!o) return f;
39
39
  if (c === "variants")
@@ -59,10 +59,10 @@ const Ct = (t, e) => {
59
59
  }`;
60
60
  return n.push(F), f;
61
61
  }
62
- const y = u.includes("&") ? c.replace("&", e) : c.startsWith(":") ? `${e}${c}` : `${e} ${c}`, k = O(o, y);
62
+ const y = p.includes("&") ? c.replace("&", e) : c.startsWith(":") ? `${e}${c}` : `${e} ${c}`, k = O(o, y);
63
63
  return n.push(k), f;
64
64
  }
65
- const d = c.startsWith("-") ? c : R(c), p = (y, k = ";") => f = `${f}${y}${k}`, x = (y) => p(`${d}:${y}`);
65
+ const d = c.startsWith("-") ? c : R(c), u = (y, k = ";") => f = `${f}${y}${k}`, x = (y) => u(`${d}:${y}`);
66
66
  if (typeof o == "number") return x(o);
67
67
  if (typeof o != "string")
68
68
  if ("toString" in o) o = o.toString();
@@ -73,7 +73,7 @@ const Ct = (t, e) => {
73
73
  for (const { result: y, additionalCss: k = [] } of T)
74
74
  o = y, k.forEach((S) => {
75
75
  const F = O(S, "");
76
- p(F, "");
76
+ u(F, "");
77
77
  });
78
78
  return x(o);
79
79
  }, "");
@@ -86,8 +86,8 @@ const Ct = (t, e) => {
86
86
  if (Object.entries(t).forEach(([r, i]) => {
87
87
  if (typeof i == "object") {
88
88
  if (!i) return;
89
- const f = r.trim(), u = rt(i, [...e, f]);
90
- s.push(u);
89
+ const f = r.trim(), p = rt(i, [...e, f]);
90
+ s.push(p);
91
91
  } else
92
92
  n[r] = i;
93
93
  }), Object.keys(n).length) {
@@ -96,7 +96,7 @@ const Ct = (t, e) => {
96
96
  }
97
97
  return s.join(`
98
98
  `);
99
- }, Ft = (t) => Object.entries(t).reduce((e, [s, n]) => (typeof n == "object" && (e[s] = it(n).map((r) => `"${r}"`).join(" | ")), e), {}), it = (t, e = "", s = /* @__PURE__ */ new Set()) => t ? (Object.entries(t).forEach(([n, r]) => {
99
+ }, Ft = (t) => t ? Object.entries(t).reduce((e, [s, n]) => (typeof n == "object" && (e[s] = it(n).map((r) => `"${r}"`).join(" | ")), e), {}) : {}, it = (t, e = "", s = /* @__PURE__ */ new Set()) => t ? (Object.entries(t).forEach(([n, r]) => {
100
100
  const i = e ? `${e}.${n}` : n;
101
101
  return typeof r == "object" ? it(r, i, s) : s.add(e);
102
102
  }), [...s]) : [], ct = (t) => {
@@ -185,15 +185,15 @@ const Dt = {
185
185
  if (_.destDir) return _.destDir;
186
186
  const e = await X(t), s = l(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
187
187
  return _.destDir = s, s;
188
- }, pt = ["salty", "css", "styles", "styled"], Nt = (t = []) => new RegExp(`\\.(${[...pt, ...t].join("|")})\\.`), U = (t, e = []) => Nt(e).test(t), ut = async (t) => {
188
+ }, ut = ["salty", "css", "styles", "styled"], Nt = (t = []) => new RegExp(`\\.(${[...ut, ...t].join("|")})\\.`), U = (t, e = []) => Nt(e).test(t), pt = async (t) => {
189
189
  if (_.rcFile) return _.rcFile;
190
190
  if (t === "/") throw new Error("Could not find .saltyrc.json file");
191
191
  const e = l(t, ".saltyrc.json"), s = await nt(e, "utf-8").then(JSON.parse).catch(() => {
192
192
  });
193
- return s ? (_.rcFile = s, s) : ut(l(t, ".."));
193
+ return s ? (_.rcFile = s, s) : pt(l(t, ".."));
194
194
  }, X = async (t) => {
195
195
  var n, r;
196
- const e = await ut(t), s = (n = e.projects) == null ? void 0 : n.find((i) => t.endsWith(i.dir || ""));
196
+ const e = await pt(t), s = (n = e.projects) == null ? void 0 : n.find((i) => t.endsWith(i.dir || ""));
197
197
  return s || ((r = e.projects) == null ? void 0 : r.find((i) => i.dir === e.defaultProject));
198
198
  }, Pt = async (t) => {
199
199
  const e = await X(t), s = await z(t), n = l(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), r = l(s, "salty.config.js"), i = await at(t), f = ft(n);
@@ -206,7 +206,7 @@ const Dt = {
206
206
  format: i,
207
207
  external: f
208
208
  });
209
- const u = Date.now(), { config: o } = await import(`${r}?t=${u}`);
209
+ const p = Date.now(), { config: o } = await import(`${r}?t=${p}`);
210
210
  return o;
211
211
  }, Et = async (t, e) => {
212
212
  const s = await Pt(t), n = /* @__PURE__ */ new Set(), r = (b, C = []) => b ? Object.entries(b).flatMap(([V, P]) => {
@@ -222,15 +222,15 @@ const Dt = {
222
222
  }) : [], f = (b) => b ? Object.entries(b).flatMap(([C, V]) => Object.entries(V).flatMap(([P, Z]) => {
223
223
  const A = r(Z, [C]), J = `.${C}-${P}, [data-${C}="${P}"]`, L = A.join("");
224
224
  return `${J} { ${L} }`;
225
- })) : [], u = (b) => e.variables.map((C) => C._current[b]), o = r(I(s.variables, u("variables"))), c = i(I(s.responsiveVariables, u("responsiveVariables"))), d = f(I(s.conditionalVariables, u("conditionalVariables"))), p = await z(t), x = l(p, "css/_variables.css"), D = `:root { ${o.join("")} ${c.join("")} } ${d.join("")}`;
225
+ })) : [], p = (b) => e.variables.map((C) => C._current[b]), o = r(I(s.variables, p("variables"))), c = i(I(s.responsiveVariables, p("responsiveVariables"))), d = f(I(s.conditionalVariables, p("conditionalVariables"))), u = await z(t), x = l(u, "css/_variables.css"), D = `:root { ${o.join("")} ${c.join("")} } ${d.join("")}`;
226
226
  E(x, D);
227
- const N = l(p, "css/_global.css"), T = I(s.global, e.globalStyles), y = O(T, "");
227
+ const N = l(u, "css/_global.css"), T = I(s.global, e.globalStyles), y = O(T, "");
228
228
  E(N, `@layer global { ${y} }`);
229
- const k = l(p, "css/_reset.css"), F = s.reset === "none" ? {} : typeof s.reset == "object" ? s.reset : Dt, a = O(F, "");
229
+ const k = l(u, "css/_reset.css"), F = s.reset === "none" ? {} : typeof s.reset == "object" ? s.reset : Dt, a = O(F, "");
230
230
  E(k, `@layer reset { ${a} }`);
231
- const m = l(p, "css/_templates.css"), w = rt(s.templates), h = Ft(s.templates);
231
+ const m = l(u, "css/_templates.css"), w = rt(s.templates), h = Ft(s.templates);
232
232
  E(m, w);
233
- const g = l(p, "types/css-tokens.d.ts"), $ = `
233
+ const g = l(u, "types/css-tokens.d.ts"), $ = `
234
234
  // Variable types
235
235
  type VariableTokens = ${[...n].join("|")};
236
236
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -248,8 +248,8 @@ const Dt = {
248
248
  if (!r.test(t)) return e;
249
249
  const f = r.exec(t);
250
250
  if (f) {
251
- const u = f.at(1);
252
- if (pt.some((c) => u == null ? void 0 : u.includes(c))) return e;
251
+ const p = f.at(1);
252
+ if (ut.some((c) => p == null ? void 0 : p.includes(c))) return e;
253
253
  }
254
254
  return "styled('div',";
255
255
  }), Y = async (t, e, s) => {
@@ -258,7 +258,7 @@ const Dt = {
258
258
  const i = q(e);
259
259
  let f = M(e, "utf8");
260
260
  f = et(f);
261
- const u = l(s, "js", n + ".js"), o = await X(t), c = l(t, (o == null ? void 0 : o.configDir) || "", "salty.config.ts"), d = ft(c), p = await at(t);
261
+ const p = l(s, "js", n + ".js"), o = await X(t), c = l(t, (o == null ? void 0 : o.configDir) || "", "salty.config.ts"), d = ft(c), u = await at(t);
262
262
  await st.build({
263
263
  stdin: {
264
264
  contents: f,
@@ -269,8 +269,8 @@ const Dt = {
269
269
  minify: !1,
270
270
  treeShaking: !0,
271
271
  bundle: !0,
272
- outfile: u,
273
- format: p,
272
+ outfile: p,
273
+ format: u,
274
274
  target: ["node20"],
275
275
  keepNames: !0,
276
276
  external: d,
@@ -288,7 +288,7 @@ const Dt = {
288
288
  ]
289
289
  });
290
290
  const x = Date.now();
291
- return await import(`${u}?t=${x}`);
291
+ return await import(`${p}?t=${x}`);
292
292
  }, v = async (t) => {
293
293
  const e = await z(t), s = l(e, "salty.config.js"), n = Date.now(), { config: r } = await import(`${s}?t=${n}`);
294
294
  return r;
@@ -340,18 +340,18 @@ const Dt = {
340
340
  const { value: m } = a, w = `a_${m.animationName}.css`, h = `css/${w}`, g = l(i, h);
341
341
  n.push(w), E(g, m.css);
342
342
  }
343
- const p = {};
343
+ const u = {};
344
344
  for (const a of o.components) {
345
345
  const { value: m, name: w, src: h } = a, g = m._withBuildContext({
346
346
  name: w,
347
347
  config: d,
348
348
  prod: e
349
349
  });
350
- r[g.priority] || (r[g.priority] = []), r[g.priority].push(g.cssFileName), d.importStrategy === "component" && (p[h] ? p[h].push(g.cssFileName) : p[h] = [g.cssFileName]);
350
+ r[g.priority] || (r[g.priority] = []), r[g.priority].push(g.cssFileName), d.importStrategy === "component" && (u[h] ? u[h].push(g.cssFileName) : u[h] = [g.cssFileName]);
351
351
  const j = `css/${g.cssFileName}`, $ = l(i, j);
352
352
  E($, g.css);
353
353
  }
354
- d.importStrategy === "component" && Object.entries(p).forEach(([a, m]) => {
354
+ d.importStrategy === "component" && Object.entries(u).forEach(([a, m]) => {
355
355
  const w = m.map((b) => `@import url('./${b}');`).join(`
356
356
  `), h = H(a, 6), g = q(a), j = R(g.name), $ = l(i, `css/f_${j}-${h}.css`);
357
357
  E($, w);
@@ -397,7 +397,7 @@ ${Z}
397
397
  const s = await z(t);
398
398
  if (U(e)) {
399
399
  const r = [], i = await v(t), f = await Y(t, e, s);
400
- Object.entries(f).forEach(([u, o]) => {
400
+ Object.entries(f).forEach(([p, o]) => {
401
401
  if (o.isKeyframes && o.css) {
402
402
  const D = `css/${`a_${o.animationName}.css`}`, N = l(s, D);
403
403
  E(N, o.css);
@@ -405,26 +405,26 @@ ${Z}
405
405
  }
406
406
  if (!o.generator) return;
407
407
  const c = o.generator._withBuildContext({
408
- name: u,
408
+ name: p,
409
409
  config: i
410
- }), d = `css/${c.cssFileName}`, p = l(s, d);
411
- E(p, c.css), r[c.priority] || (r[c.priority] = []), r[c.priority].push(c.cssFileName);
412
- }), i.importStrategy !== "component" && r.forEach((u, o) => {
410
+ }), d = `css/${c.cssFileName}`, u = l(s, d);
411
+ E(u, c.css), r[c.priority] || (r[c.priority] = []), r[c.priority].push(c.cssFileName);
412
+ }), i.importStrategy !== "component" && r.forEach((p, o) => {
413
413
  const c = `l_${o}.css`, d = l(s, "css", c);
414
- let p = M(d, "utf8");
415
- u.forEach((x) => {
414
+ let u = M(d, "utf8");
415
+ p.forEach((x) => {
416
416
  var y;
417
417
  const D = l(s, "css", x), N = ((y = /.*-([^-]+)-\d+.css/.exec(x)) == null ? void 0 : y.at(1)) || H(D, 6);
418
- if (!p.includes(N)) {
418
+ if (!u.includes(N)) {
419
419
  const k = M(D, "utf8"), S = `/*start:${N}*/
420
420
  ${k}
421
421
  /*end:${N}*/
422
422
  `;
423
- p = `${p.replace(/\}$/, "")}
423
+ u = `${u.replace(/\}$/, "")}
424
424
  ${S}
425
425
  }`;
426
426
  }
427
- }), E(d, p);
427
+ }), E(d, u);
428
428
  });
429
429
  }
430
430
  } catch (s) {
@@ -436,14 +436,14 @@ ${S}
436
436
  if (U(e)) {
437
437
  const i = M(e, "utf8");
438
438
  i.replace(/^(?!export\s)const\s.*/gm, (d) => `export ${d}`) !== i && await $t(e, i);
439
- const u = await v(t), o = await Y(t, e, n);
439
+ const p = await v(t), o = await Y(t, e, n);
440
440
  let c = i;
441
- if (Object.entries(o).forEach(([d, p]) => {
441
+ if (Object.entries(o).forEach(([d, u]) => {
442
442
  var $;
443
- if (p.isKeyframes || !p.generator) return;
444
- const x = p.generator._withBuildContext({
443
+ if (u.isKeyframes || !u.generator) return;
444
+ const x = u.generator._withBuildContext({
445
445
  name: d,
446
- config: u,
446
+ config: p,
447
447
  prod: s
448
448
  }), D = new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(i);
449
449
  if (!D) return console.error("Could not find the original declaration");
@@ -461,9 +461,9 @@ ${S}
461
461
  else throw new Error("Failed to find the end of the styled call and timed out");
462
462
  const w = y + F, h = c.slice(y, w), g = c, j = ` ${d} = styled(${N}, "${x.classNames}", ${JSON.stringify(x.props)});`;
463
463
  c = c.replace(h, j), g === c && console.error("Minimize file failed to change content", { name: d, tagName: N });
464
- }), u.importStrategy === "component") {
465
- const d = H(e, 6), p = q(e);
466
- c = `import '../../saltygen/css/${`f_${R(p.name)}-${d}.css`}';
464
+ }), p.importStrategy === "component") {
465
+ const d = H(e, 6), u = q(e);
466
+ c = `import '../../saltygen/css/${`f_${R(u.name)}-${d}.css`}';
467
467
  ${c}`;
468
468
  }
469
469
  return c = c.replace("{ styled }", "{ styledClient as styled }"), c = c.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), c;
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("path"),t=require("./index-a4KtTJRO.cjs"),y=require("fs/promises"),g=require("fs"),p=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!t.isSaltyFile(e))return!1;const a=await y.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(a)},c=(e,s,l=!1,a=!1)=>{var n,u,i;(u=(n=e.module)==null?void 0:n.rules)==null||u.push({test:t.saltyFileRegExp(),use:[{loader:d.resolve(__dirname,a?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),l||(i=e.plugins)==null||i.push({apply:f=>{let o=!1;f.hooks.watchRun.tapPromise({name:"generateCss"},async h=>{o||(o=!0,await t.generateCss(s),g.watch(s,{recursive:!0},async(w,r)=>{await p(r)?await t.generateCss(s):t.isSaltyFile(r)&&await t.generateFile(s,r)}))})}})};exports.default=c;exports.saltyPlugin=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("path"),r=require("./index-DCw0G0hA.cjs"),y=require("fs/promises"),g=require("fs"),p=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!r.isSaltyFile(e))return!1;const t=await y.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(t)},o=(e,s,a=!1,t=!1)=>{var u,n,l;(n=(u=e.module)==null?void 0:u.rules)==null||n.push({test:r.saltyFileRegExp(),use:[{loader:d.resolve(__dirname,t?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),a||(l=e.plugins)==null||l.push({apply:c=>{let i=!1;c.hooks.watchRun.tapPromise({name:"generateCss"},async()=>{i||(i=!0,await r.generateCss(s),g.watch(s,{recursive:!0},async(h,f)=>{await p(f)}))})}})};exports.default=o;exports.saltyPlugin=o;
package/index.js CHANGED
@@ -1,35 +1,35 @@
1
- import { resolve as d } from "path";
2
- import { i as c, s as p, g as u, a as y } from "./index-jvM0uSOz.js";
3
- import { readFile as g } from "fs/promises";
4
- import { watch as m } from "fs";
5
- const w = async (s) => {
1
+ import { resolve as f } from "path";
2
+ import { i as c, s as d, g as p } from "./index-PlqtKMPx.js";
3
+ import { readFile as y } from "fs/promises";
4
+ import { watch as g } from "fs";
5
+ const m = async (s) => {
6
6
  if (!s || s.includes("node_modules") || s.includes("saltygen")) return !1;
7
7
  if (s.includes("salty.config")) return !0;
8
8
  if (!c(s)) return !1;
9
- const t = await g(s, "utf-8");
9
+ const t = await y(s, "utf-8");
10
10
  return !!/.+define[A-Z]\w+/.test(t);
11
- }, k = (s, e, r = !1, t = !1) => {
12
- var l, o, n;
13
- (o = (l = s.module) == null ? void 0 : l.rules) == null || o.push({
14
- test: p(),
11
+ }, F = (s, e, r = !1, t = !1) => {
12
+ var a, n, o;
13
+ (n = (a = s.module) == null ? void 0 : a.rules) == null || n.push({
14
+ test: d(),
15
15
  use: [
16
16
  {
17
- loader: d(__dirname, t ? "./loader.cjs" : "./loader.js"),
17
+ loader: f(__dirname, t ? "./loader.cjs" : "./loader.js"),
18
18
  options: { dir: e }
19
19
  }
20
20
  ]
21
- }), r || (n = s.plugins) == null || n.push({
22
- apply: (f) => {
21
+ }), r || (o = s.plugins) == null || o.push({
22
+ apply: (l) => {
23
23
  let i = !1;
24
- f.hooks.watchRun.tapPromise({ name: "generateCss" }, async (h) => {
25
- i || (i = !0, await u(e), m(e, { recursive: !0 }, async (F, a) => {
26
- await w(a) ? await u(e) : c(a) && await y(e, a);
24
+ l.hooks.watchRun.tapPromise({ name: "generateCss" }, async () => {
25
+ i || (i = !0, await p(e), g(e, { recursive: !0 }, async (h, u) => {
26
+ await m(u);
27
27
  }));
28
28
  });
29
29
  }
30
30
  });
31
31
  };
32
32
  export {
33
- k as default,
34
- k as saltyPlugin
33
+ F as default,
34
+ F as saltyPlugin
35
35
  };
package/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const i=require("./index-a4KtTJRO.cjs");async function n(){const{dir:e}=this.getOptions(),{resourcePath:t}=this;return await i.generateFile(e,t),await i.minimizeFile(e,t)}module.exports=n;
1
+ "use strict";const i=require("./index-DCw0G0hA.cjs");async function n(){const{dir:e}=this.getOptions(),{resourcePath:t}=this;return await i.generateFile(e,t),await i.minimizeFile(e,t)}module.exports=n;
package/loader.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, m as i } from "./index-jvM0uSOz.js";
1
+ import { a as e, m as i } from "./index-PlqtKMPx.js";
2
2
  async function s() {
3
3
  const { dir: t } = this.getOptions(), { resourcePath: a } = this;
4
4
  return await e(t, a), await i(t, a);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/webpack",
3
- "version": "0.0.1-alpha.176",
3
+ "version": "0.0.1-alpha.178",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@salty-css/core": "^0.0.1-alpha.176",
37
+ "@salty-css/core": "^0.0.1-alpha.178",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }