@salty-css/webpack 0.0.1-alpha.49 → 0.0.1-alpha.50
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-CQ2Ph8Zy.js → index-BsM68yLp.js} +3 -3
- package/{index-bKg2rNBB.cjs → index-DCb5MAYH.cjs} +1 -1
- 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
@@ -237,9 +237,9 @@ ${i}`;
|
|
237
237
|
const $ = m.generator._withBuildContext({
|
238
238
|
name: c,
|
239
239
|
config: h
|
240
|
-
}), S = new RegExp(
|
240
|
+
}), S = new RegExp(`\\s${c}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(r);
|
241
241
|
if (!S) return console.error("Could not find the original declaration");
|
242
|
-
const b = (D = S.at(1)) == null ? void 0 : D.trim(), j = new RegExp(
|
242
|
+
const b = (D = S.at(1)) == null ? void 0 : D.trim(), j = new RegExp(`\\s${c}[=\\s]+styled\\(`, "g").exec(i);
|
243
243
|
if (!j) return console.error("Could not find the original declaration");
|
244
244
|
const { index: F } = j;
|
245
245
|
let d = !1;
|
@@ -251,7 +251,7 @@ ${i}`;
|
|
251
251
|
}
|
252
252
|
if (!d) clearTimeout(x);
|
253
253
|
else throw new Error("Failed to find the end of the styled call and timed out");
|
254
|
-
const l = F + f, w = i.slice(F, l), C = i, k =
|
254
|
+
const l = F + f, w = i.slice(F, l), C = i, k = ` ${c} = styled(${b}, "${$.classNames}", "${$._callerName}", ${JSON.stringify($.props)});`;
|
255
255
|
i = i.replace(w, k), C === i && console.error("Minimize file failed to change content", { name: c, tagName: b });
|
256
256
|
});
|
257
257
|
const o = A(s, 6);
|
@@ -14,5 +14,5 @@ ${["@import url('./css/variables.css');","@import url('./css/global.css');","@im
|
|
14
14
|
${i}`;if($.importStrategy!=="component"){const d=s.flat().map(j=>`@import url('./css/${j}');`).join(`
|
15
15
|
`);c+=d}h.writeFileSync(r,c)}catch(e){console.error(e)}},tt=async(t,e)=>{try{const s=[],n=y.join(t,"./saltygen"),r=y.join(n,"index.css");if(_(e)){const $=await M(t),p=await A(e,n);Object.entries(p).forEach(([j,F])=>{if(!F.generator)return;const b=F.generator._withBuildContext({name:j,config:$}),S=`${b.hash}-${b.priority}.css`,C=`css/${S}`,m=y.join(n,C);s.push(S),h.writeFileSync(m,b.css)});const i=h.readFileSync(r,"utf8").split(`
|
16
16
|
`),o=s.map(j=>`@import url('../saltygen/css/${j}');`),d=[...new Set([...i,...o])].join(`
|
17
|
-
`);h.writeFileSync(r,d)}}catch(s){console.error(s)}},et=async(t,e)=>{try{const s=y.join(t,"./saltygen");if(_(e)){const r=h.readFileSync(e,"utf8");r.replace(/^(?!export\s)const\s.*/gm,c=>`export ${c}`)!==r&&await J.writeFile(e,r);const $=await M(t),p=await A(e,s);let i=r;Object.entries(p).forEach(([c,d])=>{var P;if(d.isKeyframes||!d.generator)return;const j=d.generator._withBuildContext({name:c,config:$}),F=new RegExp(
|
17
|
+
`);h.writeFileSync(r,d)}}catch(s){console.error(s)}},et=async(t,e)=>{try{const s=y.join(t,"./saltygen");if(_(e)){const r=h.readFileSync(e,"utf8");r.replace(/^(?!export\s)const\s.*/gm,c=>`export ${c}`)!==r&&await J.writeFile(e,r);const $=await M(t),p=await A(e,s);let i=r;Object.entries(p).forEach(([c,d])=>{var P;if(d.isKeyframes||!d.generator)return;const j=d.generator._withBuildContext({name:c,config:$}),F=new RegExp(`\\s${c}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!F)return console.error("Could not find the original declaration");const b=(P=F.at(1))==null?void 0:P.trim(),S=new RegExp(`\\s${c}[=\\s]+styled\\(`,"g").exec(i);if(!S)return console.error("Could not find the original declaration");const{index:C}=S;let m=!1;const x=setTimeout(()=>m=!0,5e3);let f=0,a=!1,u=0;for(;!a&&!m;){const N=i[C+f];N==="("&&u++,N===")"&&u--,u===0&&N===")"&&(a=!0),f>i.length&&(m=!0),f++}if(!m)clearTimeout(x);else throw new Error("Failed to find the end of the styled call and timed out");const l=C+f,w=i.slice(C,l),O=i,k=` ${c} = styled(${b}, "${j.classNames}", "${j._callerName}", ${JSON.stringify(j.props)});`;i=i.replace(w,k),O===i&&console.error("Minimize file failed to change content",{name:c,tagName:b})});const o=V(e,6);return $.importStrategy==="component"&&(i=`import '../../saltygen/css/${o}.css';
|
18
18
|
${i}`),i=i.replace("{ styled }","{ styledClient as styled }"),i=i.replace("@salty-css/react/styled","@salty-css/react/styled-client"),i}}catch(s){console.error("Error in minimizeFile:",s)}};exports.generateCss=v;exports.generateFile=tt;exports.minimizeFile=et;exports.saltyFileRegExp=I;
|
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-DCb5MAYH.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-BsM68yLp.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-DCb5MAYH.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.50",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -29,7 +29,7 @@
|
|
29
29
|
}
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@salty-css/core": "^0.0.1-alpha.
|
32
|
+
"@salty-css/core": "^0.0.1-alpha.50",
|
33
33
|
"webpack": ">=5.x"
|
34
34
|
}
|
35
35
|
}
|