@salty-css/webpack 0.0.1-alpha.119 → 0.0.1-alpha.120

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.
@@ -1,11 +1,11 @@
1
- "use strict";const rt=require("esbuild"),it=require("child_process"),a=require("path"),f=require("fs"),U=require("fs/promises"),_=require("winston");var Z=typeof document<"u"?document.currentScript:null;function ct(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const G=ct(rt),L=t=>String.fromCharCode(t+(t>25?39:97)),at=(t,e)=>{let s="",n;for(n=Math.abs(t);n>52;n=n/52|0)s=L(n%52)+s;return s=L(n%52)+s,s.length<e?s=s.padStart(e,"a"):s.length>e&&(s=s.slice(-e)),s},lt=(t,e)=>{let s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return t},q=(t,e=3)=>{const s=lt(5381,JSON.stringify(t))>>>0;return at(s,e)};function V(t){return t?typeof t!="string"?V(String(t)):t.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(e,s)=>(s>0?"-":"")+e.toLowerCase()):""}const ft=(t,e)=>{if(typeof t!="string")return{result:t};if(!e)return{result:t};const s=[];return Object.values(e).forEach(n=>{const{pattern:r,transform:i}=n;t=t.replace(r,y=>{const{value:c,css:j}=i(y);return j&&s.push(j),c})}),{result:t,additionalCss:s}},X=t=>typeof t!="string"?{result:t}:/\{[^{}]+\}/g.test(t)?{result:t.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V(n[1].replaceAll(".","-"))})`)}:{result:t},E=(t,e,s,n)=>{if(!t)return"";const r=[],i=Object.entries(t).reduce((c,[j,o])=>{const d=j.trim();if(typeof o=="function"&&(o=o()),typeof o=="object"){if(!o)return c;if(d==="variants")return Object.entries(o).forEach(([w,u])=>{u&&Object.entries(u).forEach(([P,C])=>{if(!C)return;const O=`${e}.${w}-${P}`,g=E(C,O);r.push(g)})}),c;if(d==="defaultVariants")return c;if(d==="compoundVariants")return o.forEach(w=>{const{css:u,...P}=w,C=Object.entries(P).reduce((g,[p,m])=>`${g}.${p}-${m}`,e),O=E(u,C);r.push(O)}),c;if(d.startsWith("@")){const w=E(o,e),u=`${d} {
1
+ "use strict";const rt=require("esbuild"),it=require("child_process"),a=require("path"),f=require("fs"),U=require("fs/promises"),_=require("winston");var Z=typeof document<"u"?document.currentScript:null;function ct(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const G=ct(rt),L=t=>String.fromCharCode(t+(t>25?39:97)),at=(t,e)=>{let s="",n;for(n=Math.abs(t);n>52;n=n/52|0)s=L(n%52)+s;return s=L(n%52)+s,s.length<e?s=s.padStart(e,"a"):s.length>e&&(s=s.slice(-e)),s},lt=(t,e)=>{let s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return t},q=(t,e=5)=>{const s=lt(5381,JSON.stringify(t))>>>0;return at(s,e)};function V(t){return t?typeof t!="string"?V(String(t)):t.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(e,s)=>(s>0?"-":"")+e.toLowerCase()):""}const ft=(t,e)=>{if(typeof t!="string")return{result:t};if(!e)return{result:t};const s=[];return Object.values(e).forEach(n=>{const{pattern:r,transform:i}=n;t=t.replace(r,y=>{const{value:c,css:j}=i(y);return j&&s.push(j),c})}),{result:t,additionalCss:s}},X=t=>typeof t!="string"?{result:t}:/\{[^{}]+\}/g.test(t)?{result:t.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V(n[1].replaceAll(".","-"))})`)}:{result:t},E=(t,e,s,n)=>{if(!t)return"";const r=[],i=Object.entries(t).reduce((c,[j,o])=>{const d=j.trim();if(typeof o=="function"&&(o=o()),typeof o=="object"){if(!o)return c;if(d==="variants")return Object.entries(o).forEach(([w,u])=>{u&&Object.entries(u).forEach(([P,C])=>{if(!C)return;const O=`${e}.${w}-${P}`,g=E(C,O);r.push(g)})}),c;if(d==="defaultVariants")return c;if(d==="compoundVariants")return o.forEach(w=>{const{css:u,...P}=w,C=Object.entries(P).reduce((g,[p,m])=>`${g}.${p}-${m}`,e),O=E(u,C);r.push(O)}),c;if(d.startsWith("@")){const w=E(o,e),u=`${d} {
2
2
  ${w.replace(`
3
3
  `,`
4
4
  `)}
5
5
  }`;return r.push(u),c}const h=j.includes("&")?d.replace("&",e):d.startsWith(":")?`${e}${d}`:`${e} ${d}`,$=E(o,h);return r.push($),c}const S=d.startsWith("-")?d:V(d),F=(h,$=";")=>c=`${c}${h}${$}`,x=h=>F(`${S}:${h}`);if(typeof o=="number")return x(o);if(typeof o!="string")if("toString"in o)o=o.toString();else return c;const{modifiers:l}={},T=function*(){yield X(o),yield ft(o,l)}();for(const{result:h,additionalCss:$=[]}of T)o=h,$.forEach(w=>{const u=E(w,"");F(u,"")});return x(o)},"");if(!i)return r.join(`
6
6
  `);if(!e)return i;let y="";return y=`${e} { ${i} }`,[y,...r].join(`
7
7
  `)},Y=(t,e=[])=>{if(!t)return"";const s=[],n={};if(Object.entries(t).forEach(([r,i])=>{if(typeof i=="object"){if(!i)return;const y=r.trim(),c=Y(i,[...e,y]);s.push(c)}else n[r]=i}),Object.keys(n).length){const r=e.map(V).join("-"),i=E(n,`.${r}`);s.push(i)}return s.join(`
8
- `)},ut=t=>Object.entries(t).reduce((e,[s,n])=>(typeof n=="object"&&(e[s]=Q(n).map(r=>`"${r}"`).join(" | ")),e),{}),Q=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,r])=>{const i=e?`${e}.${n}`:n;return typeof r=="object"?Q(r,i,s):s.add(e)}),[...s]):[],v=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=a.join(t,"package.json");return f.existsSync(e)?e:v(a.join(t,".."))},pt=async t=>{const e=v(t);return await U.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},dt=async t=>{const e=await pt(t);if(e)return e.type};let N;const tt=async t=>{if(N)return N;const e=await dt(t);return e==="module"?N="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:Z&&Z.tagName.toUpperCase()==="SCRIPT"&&Z.src||new URL("index-BysiENYs.cjs",document.baseURI).href).endsWith(".cjs"))&&(N="cjs"),N||"esm"},K=_.createLogger({level:"debug",format:_.format.combine(_.format.colorize(),_.format.cli()),transports:[new _.transports.Console({})]});function et(t){return t?typeof t!="string"?et(String(t)):t.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(e,s)=>(s>0?".":"")+e.toLowerCase()):""}const gt={"*, *::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"},button:{lineHeight:"1em"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},z={externalModules:[]},st=t=>{if(z.externalModules.length>0)return z.externalModules;const e=a.join(t,"salty.config.ts"),n=f.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const r=n[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return z.externalModules=r,r},J=t=>a.join(t,"./saltygen"),yt=["salty","css","styles","styled"],nt=(t=[])=>new RegExp(`\\.(${[...yt,...t].join("|")})\\.`),I=(t,e=[])=>nt(e).test(t),ht=async t=>{const e=J(t),s=a.join(t,"salty.config.ts"),n=a.join(e,"salty.config.js"),r=await tt(t),i=st(t);await G.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:r,external:i});const y=Date.now(),{config:c}=await import(`${n}?t=${y}`);return c},mt=async t=>{const e=await ht(t),s=new Set,n=(g,p=[])=>g?Object.entries(g).flatMap(([m,b])=>{if(!b)return;if(typeof b=="object")return n(b,[...p,m]);const D=et(m),A=V(m),M=[...p,D].join(".");s.add(`"${M}"`);const R=[...p.map(V),A].join("-"),{result:W}=X(b);return`--${R}: ${W};`}):[],r=g=>g?Object.entries(g).flatMap(([p,m])=>{const b=n(m);return p==="base"?b.join(""):`${p} { ${b.join("")} }`}):[],i=g=>g?Object.entries(g).flatMap(([p,m])=>Object.entries(m).flatMap(([b,D])=>{const A=n(D,[p]),M=`.${p}-${b}, [data-${p}="${b}"]`,R=A.join("");return`${M} { ${R} }`})):[],y=n(e.variables),c=r(e.responsiveVariables),j=i(e.conditionalVariables),o=J(t),d=a.join(o,"css/variables.css"),S=`:root { ${y.join("")} ${c.join("")} } ${j.join("")}`;f.writeFileSync(d,S);const F=a.join(o,"css/global.css"),x=E(e.global,"");f.writeFileSync(F,`@layer global { ${x} }`);const l=a.join(o,"css/reset.css"),T=e.reset==="none"?{}:typeof e.reset=="object"?e.reset:gt,h=E(T,"");f.writeFileSync(l,`@layer reset { ${h} }`);const $=a.join(o,"css/templates.css"),w=Y(e.templates),u=ut(e.templates);f.writeFileSync($,w);const P=a.join(o,"types/css-tokens.d.ts"),O=`
8
+ `)},ut=t=>Object.entries(t).reduce((e,[s,n])=>(typeof n=="object"&&(e[s]=Q(n).map(r=>`"${r}"`).join(" | ")),e),{}),Q=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,r])=>{const i=e?`${e}.${n}`:n;return typeof r=="object"?Q(r,i,s):s.add(e)}),[...s]):[],v=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=a.join(t,"package.json");return f.existsSync(e)?e:v(a.join(t,".."))},pt=async t=>{const e=v(t);return await U.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},dt=async t=>{const e=await pt(t);if(e)return e.type};let N;const tt=async t=>{if(N)return N;const e=await dt(t);return e==="module"?N="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:Z&&Z.tagName.toUpperCase()==="SCRIPT"&&Z.src||new URL("index-C85_DMmG.cjs",document.baseURI).href).endsWith(".cjs"))&&(N="cjs"),N||"esm"},K=_.createLogger({level:"debug",format:_.format.combine(_.format.colorize(),_.format.cli()),transports:[new _.transports.Console({})]});function et(t){return t?typeof t!="string"?et(String(t)):t.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(e,s)=>(s>0?".":"")+e.toLowerCase()):""}const gt={"*, *::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"},button:{lineHeight:"1em"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},z={externalModules:[]},st=t=>{if(z.externalModules.length>0)return z.externalModules;const e=a.join(t,"salty.config.ts"),n=f.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const r=n[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return z.externalModules=r,r},J=t=>a.join(t,"./saltygen"),yt=["salty","css","styles","styled"],nt=(t=[])=>new RegExp(`\\.(${[...yt,...t].join("|")})\\.`),I=(t,e=[])=>nt(e).test(t),ht=async t=>{const e=J(t),s=a.join(t,"salty.config.ts"),n=a.join(e,"salty.config.js"),r=await tt(t),i=st(t);await G.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:r,external:i});const y=Date.now(),{config:c}=await import(`${n}?t=${y}`);return c},mt=async t=>{const e=await ht(t),s=new Set,n=(g,p=[])=>g?Object.entries(g).flatMap(([m,b])=>{if(!b)return;if(typeof b=="object")return n(b,[...p,m]);const D=et(m),A=V(m),M=[...p,D].join(".");s.add(`"${M}"`);const R=[...p.map(V),A].join("-"),{result:W}=X(b);return`--${R}: ${W};`}):[],r=g=>g?Object.entries(g).flatMap(([p,m])=>{const b=n(m);return p==="base"?b.join(""):`${p} { ${b.join("")} }`}):[],i=g=>g?Object.entries(g).flatMap(([p,m])=>Object.entries(m).flatMap(([b,D])=>{const A=n(D,[p]),M=`.${p}-${b}, [data-${p}="${b}"]`,R=A.join("");return`${M} { ${R} }`})):[],y=n(e.variables),c=r(e.responsiveVariables),j=i(e.conditionalVariables),o=J(t),d=a.join(o,"css/variables.css"),S=`:root { ${y.join("")} ${c.join("")} } ${j.join("")}`;f.writeFileSync(d,S);const F=a.join(o,"css/global.css"),x=E(e.global,"");f.writeFileSync(F,`@layer global { ${x} }`);const l=a.join(o,"css/reset.css"),T=e.reset==="none"?{}:typeof e.reset=="object"?e.reset:gt,h=E(T,"");f.writeFileSync(l,`@layer reset { ${h} }`);const $=a.join(o,"css/templates.css"),w=Y(e.templates),u=ut(e.templates);f.writeFileSync($,w);const P=a.join(o,"types/css-tokens.d.ts"),O=`
9
9
  // Variable types
10
10
  type VariableTokens = ${[...s].join("|")};
11
11
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -12,7 +12,7 @@ const q = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), gt = (t, e) => {
12
12
  let s = e.length;
13
13
  for (; s; ) t = t * 33 ^ e.charCodeAt(--s);
14
14
  return t;
15
- }, I = (t, e = 3) => {
15
+ }, I = (t, e = 5) => {
16
16
  const s = dt(5381, JSON.stringify(t)) >>> 0;
17
17
  return gt(s, e);
18
18
  };
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-BysiENYs.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-C85_DMmG.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-7hxQ_ONX.js";
2
+ import { s as u, g as i } from "./index-DAmJ383d.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-BysiENYs.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-C85_DMmG.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-7hxQ_ONX.js";
1
+ import { a as e, m as i } from "./index-DAmJ383d.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.119",
3
+ "version": "0.0.1-alpha.120",
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.119",
37
+ "@salty-css/core": "^0.0.1-alpha.120",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }