@salty-css/webpack 0.0.1-alpha.103 → 0.0.1-alpha.105

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 r.push(i),a}const m=h.includes("&")?g.replace("&",e):g.startsWith(":")?`${e}${g}`:`${e} ${g}`,b=O(o,m);return r.push(b),a}const $=g.startsWith("-")?g:M(g),w=(m,b=";")=>a=`${a}${m}${b}`,k=m=>w(`${$}:${m}`);if(typeof o=="number")return k(o);if(typeof o!="string")if("toString"in o)o=o.toString();else return a;const{modifiers:f}={},D=function*(){yield G(o),yield at(o,f)}();for(const{result:m,additionalCss:b=[]}of D)o=m,b.forEach(p=>{const i=O(p,"");w(i,"")});return k(o)},"");if(!c)return r.join(`
6
6
  `);if(!e)return c;let y="";return y=`${e} { ${c} }`,[y,...r].join(`
7
7
  `)},H=(t,e=[])=>{if(!t)return"";const s=[],n={};if(Object.entries(t).forEach(([r,c])=>{if(typeof c=="object"){if(!c)return;const y=r.trim(),a=H(c,[...e,y]);s.push(a)}else n[r]=c}),Object.keys(n).length){const r=e.map(M).join("-"),c=O(n,`.${r}`);s.push(c)}return s.join(`
8
- `)},K=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=l.join(t,"package.json");return u.existsSync(e)?e:K(l.join(t,".."))},lt=async t=>{const e=K(t);return await L.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},ft=async t=>{const e=await lt(t);if(e)return e.type};let E;const X=async t=>{if(E)return E;const e=await ft(t);return e==="module"?E="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:J&&J.tagName.toUpperCase()==="SCRIPT"&&J.src||new URL("index-DgYk1kbe.cjs",document.baseURI).href).endsWith(".cjs"))&&(E="cjs"),E||"esm"},Z=V.createLogger({level:"debug",format:V.format.combine(V.format.colorize(),V.format.cli()),transports:[new V.transports.Console({})]}),R={externalModules:[]},Y=t=>{if(R.externalModules.length>0)return R.externalModules;const e=l.join(t,"salty.config.ts"),n=u.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const r=n[1].split(",").map(c=>c.replace(/['"`]/g,"").trim());return R.externalModules=r,r},_=t=>l.join(t,"./saltygen"),ut=["salty","css","styles","styled"],Q=(t=[])=>new RegExp(`\\.(${[...ut,...t].join("|")})\\.`),q=(t,e=[])=>Q(e).test(t),pt=async t=>{const e=_(t),s=l.join(t,"salty.config.ts"),n=l.join(e,"salty.config.js"),r=await X(t),c=Y(t);await U.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:r,external:c});const y=Date.now(),{config:a}=await import(`${n}?t=${y}`);return a},dt=async t=>{const e=await pt(t),s=new Set,n=(p,i=[])=>p?Object.entries(p).flatMap(([j,d])=>{if(!d)return;if(typeof d=="object")return n(d,[...i,j]);const P=[...i,j].join(".");s.add(`"${P}"`);const C=[...i.map(M),M(j)].join("-"),{result:S}=G(d);return`--${C}: ${S};`}):[],r=p=>p?Object.entries(p).flatMap(([i,j])=>{const d=n(j);return i==="base"?d.join(""):`${i} { ${d.join("")} }`}):[],c=p=>p?Object.entries(p).flatMap(([i,j])=>Object.entries(j).flatMap(([d,P])=>{const C=n(P,[i]),S=`.${i}-${d}, [data-${i}="${d}"]`,x=C.join("");return`${S} { ${x} }`})):[],y=n(e.variables),a=r(e.responsiveVariables),h=c(e.conditionalVariables),o=_(t),g=l.join(o,"css/variables.css"),$=`:root { ${y.join("")} ${a.join("")} } ${h.join("")}`;u.writeFileSync(g,$);const w=l.join(o,"types/css-tokens.d.ts"),f=`type VariableTokens = ${[...s].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;u.writeFileSync(w,f);const F=l.join(o,"css/global.css"),D=O(e.global,"");u.writeFileSync(F,D);const m=l.join(o,"css/templates.css"),b=H(e.templates);u.writeFileSync(m,b)},I=async(t,e,s)=>{const n=A(e),r=l.join(s,"./temp");u.existsSync(r)||u.mkdirSync(r);const c=l.parse(e);let y=u.readFileSync(e,"utf8");y=y.replace(/styled\([^"'`{,]+,/g,"styled('div'");const a=l.join(s,"js",n+".js"),h=Y(t),o=await X(t);await U.build({stdin:{contents:y,sourcefile:c.base,resolveDir:c.dir,loader:"ts"},minify:!1,treeShaking:!0,bundle:!0,outfile:a,format:o,target:["node20"],keepNames:!0,external:h,packages:"external"});const g=Date.now();return await import(`${a}?t=${g}`)},z=async t=>{const e=_(t),s=l.join(e,"salty.config.js"),{config:n}=await import(s);return n},v=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},gt=async(t,e=v())=>{try{e?Z.info("Generating CSS in production mode! 🔥"):Z.info("Generating CSS in development mode! 🚀");const s=[],n=[],r=_(t),c=l.join(r,"index.css");(()=>{u.existsSync(r)&&ot.execSync("rm -rf "+r),u.mkdirSync(r),u.mkdirSync(l.join(r,"css")),u.mkdirSync(l.join(r,"types"))})(),await dt(t);const a=await z(t);async function h(f,F){const D=["node_modules","saltygen"],m=u.statSync(f);if(m.isDirectory()){const b=u.readdirSync(f);if(D.some(i=>f.includes(i)))return;await Promise.all(b.map(i=>h(l.join(f,i),l.join(F,i))))}else if(m.isFile()&&q(f)){const p=await I(t,f,r),i=[];Object.entries(p).forEach(([C,S])=>{if(S.isKeyframes&&S.css){const W=`${S.animationName}.css`,et=`css/${W}`,st=l.join(r,et);s.push(W),u.writeFileSync(st,S.css);return}if(!S.generator)return;const x=S.generator._withBuildContext({name:C,config:a,prod:e}),T=`${x.hash}-${x.priority}.css`;n[x.priority]||(n[x.priority]=[]),n[x.priority].push(T),i.push(T);const N=`css/${T}`,tt=l.join(r,N);u.writeFileSync(tt,x.css)});const j=i.map(C=>`@import url('./${C}');`).join(`
8
+ `)},K=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=l.join(t,"package.json");return u.existsSync(e)?e:K(l.join(t,".."))},lt=async t=>{const e=K(t);return await L.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},ft=async t=>{const e=await lt(t);if(e)return e.type};let E;const X=async t=>{if(E)return E;const e=await ft(t);return e==="module"?E="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:J&&J.tagName.toUpperCase()==="SCRIPT"&&J.src||new URL("index-Bx6QhSAt.cjs",document.baseURI).href).endsWith(".cjs"))&&(E="cjs"),E||"esm"},Z=V.createLogger({level:"debug",format:V.format.combine(V.format.colorize(),V.format.cli()),transports:[new V.transports.Console({})]}),R={externalModules:[]},Y=t=>{if(R.externalModules.length>0)return R.externalModules;const e=l.join(t,"salty.config.ts"),n=u.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const r=n[1].split(",").map(c=>c.replace(/['"`]/g,"").trim());return R.externalModules=r,r},_=t=>l.join(t,"./saltygen"),ut=["salty","css","styles","styled"],Q=(t=[])=>new RegExp(`\\.(${[...ut,...t].join("|")})\\.`),q=(t,e=[])=>Q(e).test(t),pt=async t=>{const e=_(t),s=l.join(t,"salty.config.ts"),n=l.join(e,"salty.config.js"),r=await X(t),c=Y(t);await U.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:r,external:c});const y=Date.now(),{config:a}=await import(`${n}?t=${y}`);return a},dt=async t=>{const e=await pt(t),s=new Set,n=(p,i=[])=>p?Object.entries(p).flatMap(([j,d])=>{if(!d)return;if(typeof d=="object")return n(d,[...i,j]);const P=[...i,j].join(".");s.add(`"${P}"`);const C=[...i.map(M),M(j)].join("-"),{result:S}=G(d);return`--${C}: ${S};`}):[],r=p=>p?Object.entries(p).flatMap(([i,j])=>{const d=n(j);return i==="base"?d.join(""):`${i} { ${d.join("")} }`}):[],c=p=>p?Object.entries(p).flatMap(([i,j])=>Object.entries(j).flatMap(([d,P])=>{const C=n(P,[i]),S=`.${i}-${d}, [data-${i}="${d}"]`,x=C.join("");return`${S} { ${x} }`})):[],y=n(e.variables),a=r(e.responsiveVariables),h=c(e.conditionalVariables),o=_(t),g=l.join(o,"css/variables.css"),$=`:root { ${y.join("")} ${a.join("")} } ${h.join("")}`;u.writeFileSync(g,$);const w=l.join(o,"types/css-tokens.d.ts"),f=`type VariableTokens = ${[...s].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;u.writeFileSync(w,f);const F=l.join(o,"css/global.css"),D=O(e.global,"");u.writeFileSync(F,D);const m=l.join(o,"css/templates.css"),b=H(e.templates);u.writeFileSync(m,b)},I=async(t,e,s)=>{const n=A(e),r=l.join(s,"./temp");u.existsSync(r)||u.mkdirSync(r);const c=l.parse(e);let y=u.readFileSync(e,"utf8");y=y.replace(/styled\([^"'`{,]+,/g,"styled('div',");const a=l.join(s,"js",n+".js"),h=Y(t),o=await X(t);await U.build({stdin:{contents:y,sourcefile:c.base,resolveDir:c.dir,loader:"ts"},minify:!1,treeShaking:!0,bundle:!0,outfile:a,format:o,target:["node20"],keepNames:!0,external:h,packages:"external"});const g=Date.now();return await import(`${a}?t=${g}`)},z=async t=>{const e=_(t),s=l.join(e,"salty.config.js"),{config:n}=await import(s);return n},v=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},gt=async(t,e=v())=>{try{e?Z.info("Generating CSS in production mode! 🔥"):Z.info("Generating CSS in development mode! 🚀");const s=[],n=[],r=_(t),c=l.join(r,"index.css");(()=>{u.existsSync(r)&&ot.execSync("rm -rf "+r),u.mkdirSync(r),u.mkdirSync(l.join(r,"css")),u.mkdirSync(l.join(r,"types"))})(),await dt(t);const a=await z(t);async function h(f,F){const D=["node_modules","saltygen"],m=u.statSync(f);if(m.isDirectory()){const b=u.readdirSync(f);if(D.some(i=>f.includes(i)))return;await Promise.all(b.map(i=>h(l.join(f,i),l.join(F,i))))}else if(m.isFile()&&q(f)){const p=await I(t,f,r),i=[];Object.entries(p).forEach(([C,S])=>{if(S.isKeyframes&&S.css){const W=`${S.animationName}.css`,et=`css/${W}`,st=l.join(r,et);s.push(W),u.writeFileSync(st,S.css);return}if(!S.generator)return;const x=S.generator._withBuildContext({name:C,config:a,prod:e}),T=`${x.hash}-${x.priority}.css`;n[x.priority]||(n[x.priority]=[]),n[x.priority].push(T),i.push(T);const N=`css/${T}`,tt=l.join(r,N);u.writeFileSync(tt,x.css)});const j=i.map(C=>`@import url('./${C}');`).join(`
9
9
  `),d=A(f,6),P=l.join(r,`css/${d}.css`);u.writeFileSync(P,j)}}await h(t,r);const o=s.map(f=>`@import url('./css/${f}');`).join(`
10
10
  `);let k=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
11
11
 
@@ -169,7 +169,7 @@ const Y = async (t) => {
169
169
  W(r) || J(r);
170
170
  const i = ot(e);
171
171
  let d = V(e, "utf8");
172
- d = d.replace(/styled\([^"'`{,]+,/g, "styled('div'");
172
+ d = d.replace(/styled\([^"'`{,]+,/g, "styled('div',");
173
173
  const a = f(s, "js", o + ".js"), m = Q(t), n = await Y(t);
174
174
  await L.build({
175
175
  stdin: {
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("path"),u=require("./index-DgYk1kbe.cjs"),r=(e,s,o=!1,n=!1)=>{var a,l,t;(l=(a=e.module)==null?void 0:a.rules)==null||l.push({test:u.saltyFileRegExp(),use:[{loader:p.resolve(__dirname,n?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),o||(t=e.plugins)==null||t.push({apply:i=>{i.hooks.afterPlugins.tap({name:"generateCss"},async()=>{await u.generateCss(s)})}})};exports.default=r;exports.saltyPlugin=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("path"),u=require("./index-Bx6QhSAt.cjs"),r=(e,s,o=!1,n=!1)=>{var a,l,t;(l=(a=e.module)==null?void 0:a.rules)==null||l.push({test:u.saltyFileRegExp(),use:[{loader:p.resolve(__dirname,n?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),o||(t=e.plugins)==null||t.push({apply:i=>{i.hooks.afterPlugins.tap({name:"generateCss"},async()=>{await u.generateCss(s)})}})};exports.default=r;exports.saltyPlugin=r;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolve as n } from "path";
2
- import { s as u, g as i } from "./index-B9DBlGng.js";
2
+ import { s as u, g as i } from "./index-DkZ0hxRV.js";
3
3
  const g = (s, e, o = !1, r = !1) => {
4
4
  var a, l, t;
5
5
  (l = (a = s.module) == null ? void 0 : a.rules) == null || l.push({
package/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const i=require("./index-DgYk1kbe.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-Bx6QhSAt.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-B9DBlGng.js";
1
+ import { a as e, m as i } from "./index-DkZ0hxRV.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.103",
3
+ "version": "0.0.1-alpha.105",
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.103",
37
+ "@salty-css/core": "^0.0.1-alpha.105",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }