@salty-css/webpack 0.0.1-alpha.243 → 0.0.1-alpha.244
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/{index-C97eBBve.cjs → index-C46X2dm-.cjs} +3 -3
- package/{index-CHPE5cnj.js → index-C_rzJhGh.js} +5 -4
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/loader.cjs +1 -1
- package/loader.js +1 -1
- package/package.json +2 -2
@@ -1,9 +1,9 @@
|
|
1
|
-
"use strict";var Vt=Object.defineProperty;var Mt=(t,e,s)=>e in t?Vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var et=(t,e,s)=>Mt(t,typeof e!="symbol"?e+"":e,s);const vt=require("esbuild"),Rt=require("child_process"),c=require("path"),d=require("fs"),bt=require("fs/promises"),B=require("winston"),lt=require("typescript");var ft=typeof document<"u"?document.currentScript:null;function zt(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 St=zt(vt),wt=t=>String.fromCharCode(t+(t>25?39:97)),Jt=(t,e)=>{let s="",n;for(n=Math.abs(t);n>52;n=n/52|0)s=wt(n%52)+s;return s=wt(n%52)+s,s.length<e?s=s.padStart(e,"a"):s.length>e&&(s=s.slice(-e)),s},Wt=(t,e)=>{let s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return t},q=(t,e=5)=>{const s=Wt(5381,JSON.stringify(t))>>>0;return Jt(s,e)};function R(t){return t?typeof t!="string"?R(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 At=t=>e=>{if(typeof e!="string"||!t)return;let s=e;const n=[];return Object.values(t).forEach(i=>{const{pattern:r,transform:o}=i;s=s.replace(r,y=>{const{value:b,css:m}=o(y);return m&&n.push(m),b})}),{transformed:s,additionalCss:n}},jt=t=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...i)=>`var(--${R(i[1].replaceAll(".","-"))})`)},qt=jt(),It=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Ht=(t,e,s)=>It.some(i=>typeof i=="string"?i===t:i.test(t))?`${e}px`:`${e}`,Lt=["Webkit","Moz","ms","O"],Qt=t=>t.startsWith("-")?t:Lt.some(e=>t.startsWith(e))?`-${R(t)}`:R(t),st=async(t,e="",s,n=!1)=>{if(!t)throw new Error("No styles provided to parseStyles function!");const i=new Set,r=Object.entries(t),o=async([p,u])=>{const $=p.trim(),P=Qt($),x=(v,k=";")=>`${P}:${v}${k}`,E={scope:e,config:s};if(typeof u=="function")return o([p,u(E)]);if(u instanceof Promise)return o([p,await u]);if(typeof u=="object"){if(!u)return;if(u.isColor)return x(u.toString());if($==="defaultVariants")return;if($==="variants"){const D=Object.entries(u);for(const[a,g]of D){if(!g)
|
1
|
+
"use strict";var Vt=Object.defineProperty;var Mt=(t,e,s)=>e in t?Vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var et=(t,e,s)=>Mt(t,typeof e!="symbol"?e+"":e,s);const vt=require("esbuild"),Rt=require("child_process"),c=require("path"),d=require("fs"),bt=require("fs/promises"),B=require("winston"),lt=require("typescript");var ft=typeof document<"u"?document.currentScript:null;function zt(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 St=zt(vt),wt=t=>String.fromCharCode(t+(t>25?39:97)),Jt=(t,e)=>{let s="",n;for(n=Math.abs(t);n>52;n=n/52|0)s=wt(n%52)+s;return s=wt(n%52)+s,s.length<e?s=s.padStart(e,"a"):s.length>e&&(s=s.slice(-e)),s},Wt=(t,e)=>{let s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return t},q=(t,e=5)=>{const s=Wt(5381,JSON.stringify(t))>>>0;return Jt(s,e)};function R(t){return t?typeof t!="string"?R(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 At=t=>e=>{if(typeof e!="string"||!t)return;let s=e;const n=[];return Object.values(t).forEach(i=>{const{pattern:r,transform:o}=i;s=s.replace(r,y=>{const{value:b,css:m}=o(y);return m&&n.push(m),b})}),{transformed:s,additionalCss:n}},jt=t=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...i)=>`var(--${R(i[1].replaceAll(".","-"))})`)},qt=jt(),It=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Ht=(t,e,s)=>It.some(i=>typeof i=="string"?i===t:i.test(t))?`${e}px`:`${e}`,Lt=["Webkit","Moz","ms","O"],Qt=t=>t.startsWith("-")?t:Lt.some(e=>t.startsWith(e))?`-${R(t)}`:R(t),st=async(t,e="",s,n=!1)=>{if(!t)throw new Error("No styles provided to parseStyles function!");const i=new Set,r=Object.entries(t),o=async([p,u])=>{const $=p.trim(),P=Qt($),x=(v,k=";")=>`${P}:${v}${k}`,E={scope:e,config:s};if(typeof u=="function")return o([p,u(E)]);if(u instanceof Promise)return o([p,await u]);if(typeof u=="object"){if(!u)return;if(u.isColor)return x(u.toString());if($==="defaultVariants")return;if($==="variants"){const D=Object.entries(u);for(const[a,g]of D){if(!g)continue;const j=Object.entries(g);for(const[f,C]of j){if(!C)continue;const N=`${e}.${a}-${f}`;(await st(C,N,s)).forEach(J=>i.add(J))}}return}if($==="compoundVariants"){for(const D of u){const{css:a,...g}=D,j=Object.entries(g).reduce((C,[N,O])=>`${C}.${N}-${O}`,e);(await st(a,j,s)).forEach(C=>i.add(C))}return}if($.startsWith("@")){const D=$,a=await Z(u,e,s),g=`${D} { ${a} }`;i.add(g);return}const v=p.includes("&")?$.replace("&",e):$.startsWith(":")?`${e}${$}`:`${e} ${$}`;(await st(u,v,s)).forEach(D=>i.add(D));return}if(typeof u=="number"){const v=Ht(P,u);return x(v)}if(typeof u!="string")if("toString"in u)u=u.toString();else throw new Error(`Invalid value type for property ${P}`);return x(u)},y=r.map(o),{modifiers:b}={},m=[jt(),At(b)],w=(await Promise.all(y).then(p=>Promise.all(p.map(u=>m.reduce(async($,P)=>{const x=await $;if(!x)return x;const E=await P(x);if(!E)return x;const{transformed:v,additionalCss:k}=E;let D="";if(k)for(const a of k)D+=await Z(a,"");return`${D}${v}`},Promise.resolve(u)))))).filter(p=>p!==void 0).join(`
|
2
2
|
`);if(!w.trim())return Array.from(i);const h=e?`${e} {
|
3
3
|
${w}
|
4
4
|
}`:w;return i.has(h)?Array.from(i):[h,...i]},Z=async(t,e,s,n=!1)=>(await st(t,e,s,n)).join(`
|
5
5
|
`),Ft=async(t,e=[])=>{if(!t)return"";const s=[],n={};for(const[i,r]of Object.entries(t))if(typeof r!="function")if(r&&typeof r=="object"){const o=i.trim(),y=await Ft(r,[...e,o]);s.push(y)}else n[i]=r;if(Object.keys(n).length){const i=e.map(R).join("-"),r="t_"+q(i,4),o=await Z(n,`.${i}, .${r}`);s.push(o)}return s.join(`
|
6
|
-
`)},Gt=t=>t?Object.entries(t).reduce((e,[s,n])=>(typeof n=="function"?e[s]="any":typeof n=="object"&&(e[s]=Ct(n).map(i=>`"${i}"`).join(" | ")),e),{}):{},Ct=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,i])=>{const r=e?`${e}.${n}`:n;return typeof i=="object"?Ct(i,r,s):s.add(e)}),[...s]):[],Pt=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=c.join(t,"package.json");return d.existsSync(e)?e:Pt(c.join(t,".."))},Kt=async t=>{const e=Pt(t);return await bt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},Ut=async t=>{const e=await Kt(t);if(e)return e.type};let H;const Nt=async t=>{if(H)return H;const e=await Ut(t);return e==="module"?H="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ft&&ft.tagName.toUpperCase()==="SCRIPT"&&ft.src||new URL("index-
|
6
|
+
`)},Gt=t=>t?Object.entries(t).reduce((e,[s,n])=>(typeof n=="function"?e[s]="any":typeof n=="object"&&(e[s]=Ct(n).map(i=>`"${i}"`).join(" | ")),e),{}):{},Ct=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,i])=>{const r=e?`${e}.${n}`:n;return typeof i=="object"?Ct(i,r,s):s.add(e)}),[...s]):[],Pt=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=c.join(t,"package.json");return d.existsSync(e)?e:Pt(c.join(t,".."))},Kt=async t=>{const e=Pt(t);return await bt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},Ut=async t=>{const e=await Kt(t);if(e)return e.type};let H;const Nt=async t=>{if(H)return H;const e=await Ut(t);return e==="module"?H="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ft&&ft.tagName.toUpperCase()==="SCRIPT"&&ft.src||new URL("index-C46X2dm-.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},ut=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]});function _t(t){return t?typeof t!="string"?_t(String(t)):t.replace(/[^\d\w]/g,"."):""}const Bt={"*, *::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"}},L=(...t)=>t.flat().reduce((e,s)=>s!=null&&s._current?{...e,...s._current}:{...e,...s},{}),Zt=(...t)=>t.flat().reduce((e,s)=>({...e,...s._children}),{});class Xt{constructor(e){et(this,"_path");this.params=e}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(e){return this._path=e,this}}class Yt{constructor(e){et(this,"_path");et(this,"templates",[]);this.params=e,Object.entries(e).forEach(([s,n])=>{this.templates.push(new Xt({name:s,template:n}))})}get _current(){return this.params}get _children(){return Object.fromEntries(this.templates.map(e=>[e.params.name,e]))}get isDefineTemplates(){return!0}_setPath(e){return this._path=e,this.templates.forEach(s=>s._setPath(e)),this}}const te=t=>new Yt(t),ee=(t,e)=>new Promise((s,n)=>{const i=setTimeout(()=>{n(new Error("Timeout"))},100),r=lt.createSourceFile("temp.ts",t,lt.ScriptTarget.Latest,!0);function o(y){if(lt.isVariableDeclaration(y)&&y.name.getText()===e){const b=y.getStart(),m=y.getEnd();clearTimeout(i),s([b,m])}y.forEachChild(o)}o(r)}),z={externalModules:[],rcFile:void 0,destDir:void 0},xt=t=>{if(z.externalModules.length>0)return z.externalModules;const s=d.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return z.externalModules=n,n},I=async t=>{if(z.destDir)return z.destDir;const e=await dt(t),s=c.join(t,(e==null?void 0:e.saltygenDir)||"saltygen");return z.destDir=s,s},Tt=["salty","css","styles","styled"],kt=(t=[])=>new RegExp(`\\.(${[...Tt,...t].join("|")})\\.`),nt=(t,e=[])=>kt(e).test(t),Dt=async t=>{if(z.rcFile)return z.rcFile;if(t==="/")throw new Error("Could not find .saltyrc.json file");const e=c.join(t,".saltyrc.json"),s=await bt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{});return s?(z.rcFile=s,s):Dt(c.join(t,".."))},dt=async t=>{var n,i;const e=await Dt(t),s=(n=e.projects)==null?void 0:n.find(r=>t.endsWith(r.dir||""));return s||((i=e.projects)==null?void 0:i.find(r=>r.dir===e.defaultProject))},se=async t=>{const e=await dt(t),s=await I(t),n=c.join(t,(e==null?void 0:e.configDir)||"","salty.config.ts"),i=c.join(s,"salty.config.js"),r=await Nt(t),o=xt(n);await St.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:i,format:r,external:o});const y=Date.now(),{config:b}=await import(`${i}?t=${y}`);return{config:b,path:i}},ne=async(t,e)=>{var yt,ht;const s=await I(t),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...e].map(async F=>{const{contents:_,outputFilePath:K}=await it(t,F,s);Object.entries(_).forEach(([V,T])=>{T.isMedia?n.mediaQueries.push([V,T]):T.isGlobalDefine?n.globalStyles.push(T):T.isDefineVariables?n.variables.push(T):T.isDefineTemplates&&n.templates.push(T._setPath(`${V};;${K}`))})}));const{config:i,path:r}=await se(t),o={...i},{mediaQueries:y}=n;o.mediaQueries=Object.fromEntries(y.map(([F,_])=>[`@${F}`,_]));const b=y.map(([F])=>`'@${F}'`).join(" | "),m=new Set,l=async(F,_=[])=>{if(!F)return[];const K=Object.entries(F).map(async([T,A])=>{const U=async M=>{if(!M)return;if(M instanceof Promise)return await U(await M);if(typeof M=="function")return await U(await M());if(typeof M=="object")return await l(M,[..._,T]);const rt=_t(T),at=R(T),ct=[..._,rt].join(".");m.add(`"${ct}"`);const tt=[..._.map(R),at].join("-"),gt=qt(M);return gt?`--${tt}: ${gt.transformed};`:`--${tt}: ${M};`};return await U(A)});return(await Promise.all(K)).flat()},w=async F=>{if(!F)return[];const _=Object.entries(F).map(async([V,T])=>{const A=await l(T);return V==="base"?A.join(""):o.mediaQueries[V]?`${o.mediaQueries[V]} { ${A.join("")} }`:`${V} { ${A.join("")} }`});return(await Promise.all(_)).flat()},h=async F=>{if(!F)return[];const _=Object.entries(F).map(async([V,T])=>{const A=Object.entries(T).map(async([M,rt])=>{const at=await l(rt,[V]),ct=`.${V}-${M}, [data-${V}="${M}"]`,tt=at.join("");return`${ct} { ${tt} }`});return(await Promise.all(A)).flat()});return(await Promise.all(_)).flat()},S=F=>({...F,responsive:void 0,conditional:void 0}),p=F=>n.variables.map(_=>F==="static"?S(_._current):_._current[F]),u=L(S(i.variables),p("static")),$=await l(u),P=L((yt=i.variables)==null?void 0:yt.responsive,p("responsive")),x=await w(P),E=L((ht=i.variables)==null?void 0:ht.conditional,p("conditional")),v=await h(E),k=c.join(s,"css/_variables.css"),D=`:root { ${$.join("")} ${x.join("")} } ${v.join("")}`;d.writeFileSync(k,D),o.staticVariables=u;const a=c.join(s,"css/_global.css"),g=L(i.global,n.globalStyles),j=await Z(g,"");d.writeFileSync(a,`@layer global { ${j} }`);const f=c.join(s,"css/_reset.css"),N=i.reset==="none"?{}:typeof i.reset=="object"?i.reset:Bt,O=await Z(N,"");d.writeFileSync(f,`@layer reset { ${O} }`);const J=c.join(s,"css/_templates.css"),W=L(i.templates,n.templates),Q=await Ft(W),X=Gt(W);d.writeFileSync(J,`@layer templates { ${Q} }`),o.templates=W;const ot=i.templates?[te(i.templates)._setPath(`config;;${r}`)]:[],G=Zt(n.templates,ot);o.templatePaths=Object.fromEntries(Object.entries(G).map(([F,_])=>[F,_._path]));const Y=c.join(s,"types/css-tokens.d.ts"),Et=`
|
7
7
|
// Variable types
|
8
8
|
type VariableTokens = ${[...m].join("|")};
|
9
9
|
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
@@ -32,7 +32,7 @@ ${ot}
|
|
32
32
|
/*end:${G}*/
|
33
33
|
`},""),N=`l_${f}.css`,O=c.join(o,"css",N),J=`@layer l${f} { ${C}
|
34
34
|
}`;return d.writeFileSync(O,J),`${g}
|
35
|
-
@import url('./css/${N}');`},"");E+=a}d.writeFileSync(y,E);const k=Date.now()-n,D=k<200?"🔥":k<500?"🚀":k<1e3?"🎉":k<2e3?"🚗":k<5e3?"🤔":"🥴";ut.info(`Generated CSS in ${k}ms! ${D}`)}catch(n){console.error(n)}},ae=async(t,e,s=mt())=>{try{const n=await I(t);if(nt(e)){const r=[],o=await pt(t),{contents:y}=await it(t,e,n);for(const[b,m]of Object.entries(y)){if(m.isKeyframes&&m.css){const u=`css/${`a_${m.animationName}.css`}`,$=c.join(n,u);d.writeFileSync($,await m.css);
|
35
|
+
@import url('./css/${N}');`},"");E+=a}d.writeFileSync(y,E);const k=Date.now()-n,D=k<200?"🔥":k<500?"🚀":k<1e3?"🎉":k<2e3?"🚗":k<5e3?"🤔":"🥴";ut.info(`Generated CSS in ${k}ms! ${D}`)}catch(n){console.error(n)}},ae=async(t,e,s=mt())=>{try{const n=await I(t);if(nt(e)){const r=[],o=await pt(t),{contents:y}=await it(t,e,n);for(const[b,m]of Object.entries(y)){if(m.isKeyframes&&m.css){const u=`css/${`a_${m.animationName}.css`}`,$=c.join(n,u);d.writeFileSync($,await m.css);continue}if(m.isClassName){const p=m.generator._withBuildContext({callerName:b,isProduction:s,config:o}),u=await p.css;if(!u)continue;r[p.priority]||(r[p.priority]=[]),r[p.priority].push(p.cssFileName);const $=`css/${p.cssFileName}`,P=c.join(n,$);d.writeFileSync(P,u);continue}if(!m.generator)continue;const l=m.generator._withBuildContext({callerName:b,isProduction:s,config:o}),w=await l.css;if(!w)continue;const h=`css/${l.cssFileName}`,S=c.join(n,h);d.writeFileSync(S,w),r[l.priority]||(r[l.priority]=[]),r[l.priority].push(l.cssFileName)}if(o.importStrategy!=="component")r.forEach((b,m)=>{const l=`l_${m}.css`,w=c.join(n,"css",l);let h=d.readFileSync(w,"utf8");b.forEach(S=>{var P;const p=c.join(n,"css",S),u=((P=/.*-([^-]+)-\d+.css/.exec(S))==null?void 0:P.at(1))||q(p,6);if(!h.includes(u)){const x=d.readFileSync(p,"utf8"),E=`/*start:${u}-${S}*/
|
36
36
|
${x}
|
37
37
|
/*end:${u}*/
|
38
38
|
`;h=`${h.replace(/\}$/,"")}
|
@@ -68,10 +68,10 @@ const Gt = (e) => (t) => {
|
|
68
68
|
if ($ === "variants") {
|
69
69
|
const k = Object.entries(f);
|
70
70
|
for (const [a, y] of k) {
|
71
|
-
if (!y)
|
71
|
+
if (!y) continue;
|
72
72
|
const C = Object.entries(y);
|
73
73
|
for (const [l, j] of C) {
|
74
|
-
if (!j)
|
74
|
+
if (!j) continue;
|
75
75
|
const F = `${t}.${a}-${l}`;
|
76
76
|
(await nt(j, F, s)).forEach((W) => o.add(W));
|
77
77
|
}
|
@@ -585,7 +585,7 @@ ${it}
|
|
585
585
|
if (m.isKeyframes && m.css) {
|
586
586
|
const f = `css/${`a_${m.animationName}.css`}`, $ = u(n, f);
|
587
587
|
x($, await m.css);
|
588
|
-
|
588
|
+
continue;
|
589
589
|
}
|
590
590
|
if (m.isClassName) {
|
591
591
|
const p = m.generator._withBuildContext({
|
@@ -597,8 +597,9 @@ ${it}
|
|
597
597
|
i[p.priority] || (i[p.priority] = []), i[p.priority].push(p.cssFileName);
|
598
598
|
const $ = `css/${p.cssFileName}`, P = u(n, $);
|
599
599
|
x(P, f);
|
600
|
+
continue;
|
600
601
|
}
|
601
|
-
if (!m.generator)
|
602
|
+
if (!m.generator) continue;
|
602
603
|
const c = m.generator._withBuildContext({
|
603
604
|
callerName: w,
|
604
605
|
isProduction: s,
|
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-
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("path"),t=require("./index-C46X2dm-.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 i,n,u;(n=(i=e.module)==null?void 0:i.rules)==null||n.push({test:t.saltyFileRegExp(),use:[{loader:d.resolve(__dirname,a?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),l||(u=e.plugins)==null||u.push({apply:f=>{let o=!1;f.hooks.beforeCompile.tapPromise({name:"generateCss"},async()=>{o||(o=!0,await t.generateCss(s),g.watch(s,{recursive:!0},async(h,r)=>{await p(r)?await t.generateCss(s,!1,!1):t.isSaltyFile(r)&&await t.generateFile(s,r)}))})}})};exports.default=c;exports.saltyPlugin=c;
|
package/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { resolve as p } from "path";
|
2
|
-
import { i as f, s as d, g as u, a as y } from "./index-
|
2
|
+
import { i as f, s as d, g as u, a as y } from "./index-C_rzJhGh.js";
|
3
3
|
import { readFile as g } from "fs/promises";
|
4
4
|
import { watch as m } from "fs";
|
5
5
|
const w = async (s) => {
|
package/loader.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";const i=require("./index-
|
1
|
+
"use strict";const i=require("./index-C46X2dm-.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
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salty-css/webpack",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.244",
|
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.
|
37
|
+
"@salty-css/core": "^0.0.1-alpha.244",
|
38
38
|
"webpack": ">=5.x"
|
39
39
|
}
|
40
40
|
}
|