@salty-css/webpack 0.0.1-alpha.132 → 0.0.1-alpha.133
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-CYMRnTcU.cjs → index-B__mWF2q.cjs} +8 -8
- package/{index-DArCrM27.js → index-DbupcYa1.js} +30 -25
- 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,11 +1,11 @@
|
|
1
|
-
"use strict";const fe=require("esbuild"),ue=require("child_process"),c=require("path"),u=require("fs"),U=require("fs/promises"),z=require("winston");var W=typeof document<"u"?document.currentScript:null;function pe(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 X=pe(fe),G=e=>String.fromCharCode(e+(e>25?39:97)),de=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=G(n%52)+s;return s=G(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},ge=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},I=(e,t=5)=>{const s=ge(5381,JSON.stringify(e))>>>0;return de(s,t)};function _(e){return e?typeof e!="string"?_(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 ye=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:r}=n;e=e.replace(i,g=>{const{value:f,css:h}=r(g);return h&&s.push(h),f})}),{result:e,additionalCss:s}},Y=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${_(n[1].replaceAll(".","-"))})`)}:{result:e},O=(e,t,s,n)=>{if(!e)return"";const i=[],r=Object.entries(e).reduce((f,[h,o])=>{const a=h.trim();if(typeof o=="function"&&(o=o()),typeof o=="object"){if(!o)return f;if(a==="variants")return Object.entries(o).forEach(([d,$])=>{$&&Object.entries($).forEach(([
|
1
|
+
"use strict";const fe=require("esbuild"),ue=require("child_process"),c=require("path"),u=require("fs"),U=require("fs/promises"),z=require("winston");var W=typeof document<"u"?document.currentScript:null;function pe(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 X=pe(fe),G=e=>String.fromCharCode(e+(e>25?39:97)),de=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=G(n%52)+s;return s=G(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},ge=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},I=(e,t=5)=>{const s=ge(5381,JSON.stringify(e))>>>0;return de(s,t)};function _(e){return e?typeof e!="string"?_(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 ye=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:r}=n;e=e.replace(i,g=>{const{value:f,css:h}=r(g);return h&&s.push(h),f})}),{result:e,additionalCss:s}},Y=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${_(n[1].replaceAll(".","-"))})`)}:{result:e},O=(e,t,s,n)=>{if(!e)return"";const i=[],r=Object.entries(e).reduce((f,[h,o])=>{const a=h.trim();if(typeof o=="function"&&(o=o()),typeof o=="object"){if(!o)return f;if(a==="variants")return Object.entries(o).forEach(([d,$])=>{$&&Object.entries($).forEach(([k,P])=>{if(!P)return;const N=`${t}.${d}-${k}`,p=O(P,N);i.push(p)})}),f;if(a==="defaultVariants")return f;if(a==="compoundVariants")return o.forEach(d=>{const{css:$,...k}=d,P=Object.entries(k).reduce((p,[y,w])=>`${p}.${y}-${w}`,t),N=O($,P);i.push(N)}),f;if(a.startsWith("@")){const d=O(o,t),$=`${a} {
|
2
2
|
${d.replace(`
|
3
3
|
`,`
|
4
4
|
`)}
|
5
|
-
}`;return i.push($),f}const m=h.includes("&")?a.replace("&",t):a.startsWith(":")?`${t}${a}`:`${t} ${a}`,l=O(o,m);return i.push(l),f}const F=a.startsWith("-")?a:_(a),x=(m,l=";")=>f=`${f}${m}${l}`,b=m=>x(`${F}:${m}`);if(typeof o=="number")return b(o);if(typeof o!="string")if("toString"in o)o=o.toString();else return f;const{modifiers:
|
5
|
+
}`;return i.push($),f}const m=h.includes("&")?a.replace("&",t):a.startsWith(":")?`${t}${a}`:`${t} ${a}`,l=O(o,m);return i.push(l),f}const F=a.startsWith("-")?a:_(a),x=(m,l=";")=>f=`${f}${m}${l}`,b=m=>x(`${F}:${m}`);if(typeof o=="number")return b(o);if(typeof o!="string")if("toString"in o)o=o.toString();else return f;const{modifiers:C}={},j=function*(){yield Y(o),yield ye(o,C)}();for(const{result:m,additionalCss:l=[]}of j)o=m,l.forEach(d=>{const $=O(d,"");x($,"")});return b(o)},"");if(!r)return i.join(`
|
6
6
|
`);if(!t)return r;let g="";return g=`${t} { ${r} }`,[g,...i].join(`
|
7
7
|
`)},Q=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([i,r])=>{if(typeof r=="object"){if(!r)return;const g=i.trim(),f=Q(r,[...t,g]);s.push(f)}else n[i]=r}),Object.keys(n).length){const i=t.map(_).join("-"),r=O(n,`.${i}`);s.push(r)}return s.join(`
|
8
|
-
`)},me=e=>Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=v(n).map(i=>`"${i}"`).join(" | ")),t),{}),v=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const r=t?`${t}.${n}`:n;return typeof i=="object"?v(i,r,s):s.add(t)}),[...s]):[],ee=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return u.existsSync(t)?t:ee(c.join(e,".."))},he=async e=>{const t=ee(e);return await U.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},be=async e=>{const t=await he(e);if(t)return t.type};let V;const te=async e=>{if(V)return V;const t=await be(e);return t==="module"?V="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:W&&W.tagName.toUpperCase()==="SCRIPT"&&W.src||new URL("index-
|
8
|
+
`)},me=e=>Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=v(n).map(i=>`"${i}"`).join(" | ")),t),{}),v=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const r=t?`${t}.${n}`:n;return typeof i=="object"?v(i,r,s):s.add(t)}),[...s]):[],ee=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return u.existsSync(t)?t:ee(c.join(e,".."))},he=async e=>{const t=ee(e);return await U.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},be=async e=>{const t=await he(e);if(t)return t.type};let V;const te=async e=>{if(V)return V;const t=await be(e);return t==="module"?V="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:W&&W.tagName.toUpperCase()==="SCRIPT"&&W.src||new URL("index-B__mWF2q.cjs",document.baseURI).href).endsWith(".cjs"))&&(V="cjs"),V||"esm"},Z=z.createLogger({level:"debug",format:z.format.combine(z.format.colorize(),z.format.cli()),transports:[new z.transports.Console({})]});function se(e){return e?typeof e!="string"?se(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 je={"*, *::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={externalModules:[]},ne=e=>{if(q.externalModules.length>0)return q.externalModules;const t=c.join(e,"salty.config.ts"),n=u.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const i=n[1].split(",").map(r=>r.replace(/['"`]/g,"").trim());return q.externalModules=i,i},J=e=>c.join(e,"./saltygen"),Se=["salty","css","styles","styled"],oe=(e=[])=>new RegExp(`\\.(${[...Se,...e].join("|")})\\.`),H=(e,t=[])=>oe(t).test(e),$e=async e=>{const t=J(e),s=c.join(e,"salty.config.ts"),n=c.join(t,"salty.config.js"),i=await te(e),r=ne(e);await X.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:i,external:r});const g=Date.now(),{config:f}=await import(`${n}?t=${g}`);return f},we=async e=>{const t=await $e(e),s=new Set,n=(p,y=[])=>p?Object.entries(p).flatMap(([w,S])=>{if(!S)return;if(typeof S=="object")return n(S,[...y,w]);const A=se(w),R=_(w),M=[...y,A].join(".");s.add(`"${M}"`);const T=[...y.map(_),R].join("-"),{result:D}=Y(S);return`--${T}: ${D};`}):[],i=p=>p?Object.entries(p).flatMap(([y,w])=>{const S=n(w);return y==="base"?S.join(""):`${y} { ${S.join("")} }`}):[],r=p=>p?Object.entries(p).flatMap(([y,w])=>Object.entries(w).flatMap(([S,A])=>{const R=n(A,[y]),M=`.${y}-${S}, [data-${y}="${S}"]`,T=R.join("");return`${M} { ${T} }`})):[],g=n(t.variables),f=i(t.responsiveVariables),h=r(t.conditionalVariables),o=J(e),a=c.join(o,"css/_variables.css"),F=`:root { ${g.join("")} ${f.join("")} } ${h.join("")}`;u.writeFileSync(a,F);const x=c.join(o,"css/_global.css"),b=O(t.global,"");u.writeFileSync(x,`@layer global { ${b} }`);const C=c.join(o,"css/_reset.css"),j=t.reset==="none"?{}:typeof t.reset=="object"?t.reset:je,m=O(j,"");u.writeFileSync(C,`@layer reset { ${m} }`);const l=c.join(o,"css/_templates.css"),d=Q(t.templates),$=me(t.templates);u.writeFileSync(l,d);const k=c.join(o,"types/css-tokens.d.ts"),N=`
|
9
9
|
// Variable types
|
10
10
|
type VariableTokens = ${[...s].join("|")};
|
11
11
|
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
@@ -15,14 +15,14 @@
|
|
15
15
|
${Object.entries($).map(([p,y])=>`${p}?: ${y}`).join(`
|
16
16
|
`)}
|
17
17
|
}
|
18
|
-
`;u.writeFileSync(
|
18
|
+
`;u.writeFileSync(k,N)},B=async(e,t,s)=>{const n=I(t),i=c.join(s,"./temp");u.existsSync(i)||u.mkdirSync(i);const r=c.parse(t);let g=u.readFileSync(t,"utf8");g=g.replace(/styled\([^"'`{,]+,/g,"styled('div',");const f=c.join(s,"js",n+".js"),h=ne(e),o=await te(e);await X.build({stdin:{contents:g,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:f,format:o,target:["node20"],keepNames:!0,external:h,packages:"external"});const a=Date.now();return await import(`${f}?t=${a}`)},K=async e=>{const t=J(e),s=c.join(t,"salty.config.js"),n=Date.now(),{config:i}=await import(`${s}?t=${n}`);return i},re=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Fe=async(e,t=re())=>{try{const s=Date.now();t?Z.info("Generating CSS in production mode! 🔥"):Z.info("Generating CSS in development mode! 🚀");const n=[],i=[],r=J(e),g=c.join(r,"index.css");(()=>{u.existsSync(r)&&ue.execSync("rm -rf "+r),u.mkdirSync(r),u.mkdirSync(c.join(r,"css")),u.mkdirSync(c.join(r,"types"))})(),await we(e);const h=await K(e);async function o(l,d){const $=["node_modules","saltygen"],k=u.statSync(l);if(k.isDirectory()){const P=u.readdirSync(l);if($.some(p=>l.includes(p)))return;await Promise.all(P.map(p=>o(c.join(l,p),c.join(d,p))))}else if(k.isFile()&&H(l)){const N=await B(e,l,r),p=[];Object.entries(N).forEach(([M,T])=>{if(T.isKeyframes&&T.css){const L=`a_${T.animationName}.css`,ae=`css/${L}`,le=c.join(r,ae);n.push(L),u.writeFileSync(le,T.css);return}if(!T.generator)return;const D=T.generator._withBuildContext({name:M,config:h,prod:t});i[D.priority]||(i[D.priority]=[]),i[D.priority].push(D.cssFileName),p.push(D.cssFileName);const ie=`css/${D.cssFileName}`,ce=c.join(r,ie);u.writeFileSync(ce,D.css)});const y=p.map(M=>`@import url('./${M}');`).join(`
|
19
19
|
`),w=I(l,6),S=c.parse(l),A=_(S.name),R=c.join(r,`css/f_${A}-${w}.css`);u.writeFileSync(R,y)}}await o(e,r);const a=n.map(l=>`@import url('./css/${l}');`).join(`
|
20
|
-
`);let
|
20
|
+
`);let C=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
21
21
|
|
22
22
|
${["_variables.css","_reset.css","_global.css","_templates.css"].filter(l=>{try{return u.readFileSync(c.join(r,"css",l),"utf8").length>0}catch{return!1}}).map(l=>`@import url('./css/${l}');`).join(`
|
23
23
|
`)}
|
24
24
|
${a}`;if(h.importStrategy!=="component"){const l=i.flat().map(d=>`@import url('./css/${d}');`).join(`
|
25
|
-
`);
|
25
|
+
`);C+=l}u.writeFileSync(g,C);const j=Date.now()-s,m=j<200?"🔥":j<500?"🚀":j<1e3?"🎉":j<2e3?"🚗":j<5e3?"🤔":"🥴";Z.info(`Generated CSS in ${j}ms! ${m}`)}catch(s){console.error(s)}},xe=async(e,t)=>{try{const s=[],n=c.join(e,"./saltygen"),i=c.join(n,"index.css");if(H(t)){const g=await K(e),f=await B(e,t,n);Object.entries(f).forEach(([x,b])=>{if(b.isKeyframes&&b.css){const l=`css/${`a_${b.animationName}.css`}`,d=c.join(n,l);u.writeFileSync(d,b.css);return}if(!b.generator)return;const C=b.generator._withBuildContext({name:x,config:g}),E=`css/${C.cssFileName}`,j=c.join(n,E);s.push(C.cssFileName),u.writeFileSync(j,C.css)});const h=u.readFileSync(i,"utf8").split(`
|
26
26
|
`),o=s.map(x=>`@import url('../saltygen/css/${x}');`),F=[...new Set([...h,...o])].join(`
|
27
|
-
`);u.writeFileSync(i,F)}}catch(s){console.error(s)}},
|
28
|
-
${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Fe;exports.generateFile=xe;exports.minimizeFile=
|
27
|
+
`);u.writeFileSync(i,F)}}catch(s){console.error(s)}},Ce=async(e,t,s=re())=>{try{const n=c.join(e,"./saltygen");if(H(t)){const r=u.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,a=>`export ${a}`)!==r&&await U.writeFile(t,r);const f=await K(e),h=await B(e,t,n);let o=r;if(Object.entries(h).forEach(([a,F])=>{var w;if(F.isKeyframes||!F.generator)return;const x=F.generator._withBuildContext({name:a,config:f,prod:s}),b=new RegExp(`\\s${a}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!b)return console.error("Could not find the original declaration");const C=(w=b.at(1))==null?void 0:w.trim(),E=new RegExp(`\\s${a}[=\\s]+styled\\(`,"g").exec(o);if(!E)return console.error("Could not find the original declaration");const{index:j}=E;let m=!1;const l=setTimeout(()=>m=!0,5e3);let d=0,$=!1,k=0;for(;!$&&!m;){const S=o[j+d];S==="("&&k++,S===")"&&k--,k===0&&S===")"&&($=!0),d>o.length&&(m=!0),d++}if(!m)clearTimeout(l);else throw new Error("Failed to find the end of the styled call and timed out");const P=j+d,N=o.slice(j,P),p=o,y=` ${a} = styled(${C}, "${x.classNames}", ${JSON.stringify(x.props)});`;o=o.replace(N,y),p===o&&console.error("Minimize file failed to change content",{name:a,tagName:C})}),f.importStrategy==="component"){const a=I(t,6),F=c.parse(t);o=`import '../../saltygen/css/${`f_${_(F.name)}-${a}.css`}';
|
28
|
+
${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Fe;exports.generateFile=xe;exports.minimizeFile=Ce;exports.saltyFileRegExp=oe;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as Q from "esbuild";
|
2
2
|
import { execSync as pt } from "child_process";
|
3
3
|
import { join as l, parse as I } from "path";
|
4
|
-
import { existsSync as K, writeFileSync as
|
4
|
+
import { existsSync as K, writeFileSync as k, readFileSync as W, mkdirSync as z, statSync as ut, readdirSync as dt } from "fs";
|
5
5
|
import { readFile as gt, writeFile as mt } from "fs/promises";
|
6
6
|
import { createLogger as yt, format as Z, transports as ht } from "winston";
|
7
7
|
const Y = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), $t = (t, e) => {
|
@@ -38,9 +38,9 @@ const St = (t, e) => {
|
|
38
38
|
if (!o) return f;
|
39
39
|
if (c === "variants")
|
40
40
|
return Object.entries(o).forEach(([u, S]) => {
|
41
|
-
S && Object.entries(S).forEach(([
|
41
|
+
S && Object.entries(S).forEach(([C, P]) => {
|
42
42
|
if (!P) return;
|
43
|
-
const N = `${e}.${u}-${
|
43
|
+
const N = `${e}.${u}-${C}`, p = E(P, N);
|
44
44
|
i.push(p);
|
45
45
|
});
|
46
46
|
}), f;
|
@@ -48,7 +48,7 @@ const St = (t, e) => {
|
|
48
48
|
return f;
|
49
49
|
if (c === "compoundVariants")
|
50
50
|
return o.forEach((u) => {
|
51
|
-
const { css: S, ...
|
51
|
+
const { css: S, ...C } = u, P = Object.entries(C).reduce((p, [g, j]) => `${p}.${g}-${j}`, e), N = E(S, P);
|
52
52
|
i.push(N);
|
53
53
|
}), f;
|
54
54
|
if (c.startsWith("@")) {
|
@@ -159,9 +159,14 @@ const xt = {
|
|
159
159
|
"h1, h2, h3, h4, h5, h6": {
|
160
160
|
textWrap: "balance"
|
161
161
|
},
|
162
|
+
/** Improve link color */
|
163
|
+
a: {
|
164
|
+
color: "currentColor"
|
165
|
+
},
|
162
166
|
/** Improve button line height */
|
163
167
|
button: {
|
164
|
-
lineHeight: "1em"
|
168
|
+
lineHeight: "1em",
|
169
|
+
color: "currentColor"
|
165
170
|
},
|
166
171
|
/** Improve form elements */
|
167
172
|
"input, optgroup, select, textarea": {
|
@@ -177,7 +182,7 @@ const xt = {
|
|
177
182
|
if (!n) return [];
|
178
183
|
const i = n[1].split(",").map((r) => r.replace(/['"`]/g, "").trim());
|
179
184
|
return B.externalModules = i, i;
|
180
|
-
}, R = (t) => l(t, "./saltygen"),
|
185
|
+
}, R = (t) => l(t, "./saltygen"), Ct = ["salty", "css", "styles", "styled"], kt = (t = []) => new RegExp(`\\.(${[...Ct, ...t].join("|")})\\.`), L = (t, e = []) => kt(e).test(t), Pt = async (t) => {
|
181
186
|
const e = R(t), s = l(t, "salty.config.ts"), n = l(e, "salty.config.js"), i = await nt(t), r = rt(t);
|
182
187
|
await Q.build({
|
183
188
|
entryPoints: [s],
|
@@ -205,14 +210,14 @@ const xt = {
|
|
205
210
|
const J = n(A, [g]), M = `.${g}-${b}, [data-${g}="${b}"]`, T = J.join("");
|
206
211
|
return `${M} { ${T} }`;
|
207
212
|
})) : [], d = n(e.variables), f = i(e.responsiveVariables), y = r(e.conditionalVariables), o = R(t), c = l(o, "css/_variables.css"), w = `:root { ${d.join("")} ${f.join("")} } ${y.join("")}`;
|
208
|
-
|
213
|
+
k(c, w);
|
209
214
|
const F = l(o, "css/_global.css"), h = E(e.global, "");
|
210
|
-
|
215
|
+
k(F, `@layer global { ${h} }`);
|
211
216
|
const x = l(o, "css/_reset.css"), $ = e.reset === "none" ? {} : typeof e.reset == "object" ? e.reset : xt, m = E($, "");
|
212
|
-
|
217
|
+
k(x, `@layer reset { ${m} }`);
|
213
218
|
const a = l(o, "css/_templates.css"), u = tt(e.templates), S = jt(e.templates);
|
214
|
-
|
215
|
-
const
|
219
|
+
k(a, u);
|
220
|
+
const C = l(o, "types/css-tokens.d.ts"), N = `
|
216
221
|
// Variable types
|
217
222
|
type VariableTokens = ${[...s].join("|")};
|
218
223
|
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
@@ -223,7 +228,7 @@ const xt = {
|
|
223
228
|
`)}
|
224
229
|
}
|
225
230
|
`;
|
226
|
-
C
|
231
|
+
k(C, N);
|
227
232
|
}, q = async (t, e, s) => {
|
228
233
|
const n = G(e), i = l(s, "./temp");
|
229
234
|
K(i) || z(i);
|
@@ -269,17 +274,17 @@ const xt = {
|
|
269
274
|
})(), await Nt(t);
|
270
275
|
const y = await U(t);
|
271
276
|
async function o(a, u) {
|
272
|
-
const S = ["node_modules", "saltygen"],
|
273
|
-
if (
|
277
|
+
const S = ["node_modules", "saltygen"], C = ut(a);
|
278
|
+
if (C.isDirectory()) {
|
274
279
|
const P = dt(a);
|
275
280
|
if (S.some((p) => a.includes(p))) return;
|
276
281
|
await Promise.all(P.map((p) => o(l(a, p), l(u, p))));
|
277
|
-
} else if (
|
282
|
+
} else if (C.isFile() && L(a)) {
|
278
283
|
const N = await q(t, a, r), p = [];
|
279
284
|
Object.entries(N).forEach(([M, T]) => {
|
280
285
|
if (T.isKeyframes && T.css) {
|
281
286
|
const X = `a_${T.animationName}.css`, lt = `css/${X}`, ft = l(r, lt);
|
282
|
-
n.push(X),
|
287
|
+
n.push(X), k(ft, T.css);
|
283
288
|
return;
|
284
289
|
}
|
285
290
|
if (!T.generator) return;
|
@@ -290,11 +295,11 @@ const xt = {
|
|
290
295
|
});
|
291
296
|
i[D.priority] || (i[D.priority] = []), i[D.priority].push(D.cssFileName), p.push(D.cssFileName);
|
292
297
|
const ct = `css/${D.cssFileName}`, at = l(r, ct);
|
293
|
-
|
298
|
+
k(at, D.css);
|
294
299
|
});
|
295
300
|
const g = p.map((M) => `@import url('./${M}');`).join(`
|
296
301
|
`), j = G(a, 6), b = I(a), A = O(b.name), J = l(r, `css/f_${A}-${j}.css`);
|
297
|
-
|
302
|
+
k(J, g);
|
298
303
|
}
|
299
304
|
}
|
300
305
|
await o(t, r);
|
@@ -316,7 +321,7 @@ ${c}`;
|
|
316
321
|
`);
|
317
322
|
x += a;
|
318
323
|
}
|
319
|
-
|
324
|
+
k(d, x);
|
320
325
|
const $ = Date.now() - s, m = $ < 200 ? "🔥" : $ < 500 ? "🚀" : $ < 1e3 ? "🎉" : $ < 2e3 ? "🚗" : $ < 5e3 ? "🤔" : "🥴";
|
321
326
|
H.info(`Generated CSS in ${$}ms! ${m}`);
|
322
327
|
} catch (s) {
|
@@ -330,7 +335,7 @@ ${c}`;
|
|
330
335
|
Object.entries(f).forEach(([F, h]) => {
|
331
336
|
if (h.isKeyframes && h.css) {
|
332
337
|
const a = `css/${`a_${h.animationName}.css`}`, u = l(n, a);
|
333
|
-
|
338
|
+
k(u, h.css);
|
334
339
|
return;
|
335
340
|
}
|
336
341
|
if (!h.generator) return;
|
@@ -338,12 +343,12 @@ ${c}`;
|
|
338
343
|
name: F,
|
339
344
|
config: d
|
340
345
|
}), V = `css/${x.cssFileName}`, $ = l(n, V);
|
341
|
-
s.push(x.cssFileName),
|
346
|
+
s.push(x.cssFileName), k($, x.css);
|
342
347
|
});
|
343
348
|
const y = W(i, "utf8").split(`
|
344
349
|
`), o = s.map((F) => `@import url('../saltygen/css/${F}');`), w = [.../* @__PURE__ */ new Set([...y, ...o])].join(`
|
345
350
|
`);
|
346
|
-
|
351
|
+
k(i, w);
|
347
352
|
}
|
348
353
|
} catch (s) {
|
349
354
|
console.error(s);
|
@@ -370,10 +375,10 @@ ${c}`;
|
|
370
375
|
const { index: $ } = V;
|
371
376
|
let m = !1;
|
372
377
|
const a = setTimeout(() => m = !0, 5e3);
|
373
|
-
let u = 0, S = !1,
|
378
|
+
let u = 0, S = !1, C = 0;
|
374
379
|
for (; !S && !m; ) {
|
375
380
|
const b = o[$ + u];
|
376
|
-
b === "(" &&
|
381
|
+
b === "(" && C++, b === ")" && C--, C === 0 && b === ")" && (S = !0), u > o.length && (m = !0), u++;
|
377
382
|
}
|
378
383
|
if (!m) clearTimeout(a);
|
379
384
|
else throw new Error("Failed to find the end of the styled call and timed out");
|
@@ -394,5 +399,5 @@ export {
|
|
394
399
|
_t as a,
|
395
400
|
Mt as g,
|
396
401
|
At as m,
|
397
|
-
|
402
|
+
kt as s
|
398
403
|
};
|
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-
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("path"),u=require("./index-B__mWF2q.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-
|
2
|
+
import { s as u, g as i } from "./index-DbupcYa1.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-
|
1
|
+
"use strict";const i=require("./index-B__mWF2q.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.133",
|
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.133",
|
38
38
|
"webpack": ">=5.x"
|
39
39
|
}
|
40
40
|
}
|