@salty-css/vite 0.0.1-alpha.211 → 0.0.1-alpha.213

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.
Files changed (3) hide show
  1. package/index.cjs +1 -1
  2. package/index.js +1 -1
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -39,4 +39,4 @@ ${R}
39
39
  ${N}
40
40
  }`}}),d.writeFileSync(b,g)});else{const $=r.flat().map(y=>`@import url('./${y}');`).join(`
41
41
  `),f=v(t,6),p=l.parse(t),b=V(p.name),g=l.join(n,`css/f_${b}-${f}.css`);d.writeFileSync(g,$||"/* Empty file */")}}}catch(n){console.error(n)}},oe=async(e,t,s=ft())=>{try{const n=await z(e);if(Z(t)){const r=d.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,p=>`export ${p}`)!==r&&await st.writeFile(t,r);const w=await lt(e),{contents:$}=await nt(e,t,n);let f=r;if(Object.entries($).forEach(([p,b])=>{var u;if(b.isKeyframes||!b.generator)return;const g=b.generator._withBuildContext({callerName:p,isProduction:s,config:w}),y=new RegExp(`\\s${p}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!y)return console.error("Could not find the original declaration");const a=(u=y.at(1))==null?void 0:u.trim(),m=new RegExp(`\\s${p}[=\\s]+styled\\(`,"g").exec(f);if(!m)return console.error("Could not find the original declaration");const{index:x}=m;let P=!1;const R=setTimeout(()=>P=!0,5e3);let N=0,M=!1,j=0;for(;!M&&!P;){const S=f[x+N];S==="("&&j++,S===")"&&j--,j===0&&S===")"&&(M=!0),N>f.length&&(P=!0),N++}if(!P)clearTimeout(R);else throw new Error("Failed to find the end of the styled call and timed out");const D=x+N,c=f.slice(x,D),h=f,F=` ${p} = styled(${a}, "${g.classNames}", ${JSON.stringify(g.clientProps)});`;f=f.replace(c,F),h===f&&console.error("Minimize file failed to change content",{name:p,tagName:a})}),w.importStrategy==="component"){const p=v(t,6),b=l.parse(t);f=`import '../../saltygen/css/${`f_${V(b.name)}-${p}.css`}';
42
- ${f}`}return f=f.replace("{ styled }","{ styledClient as styled }"),f=f.replace("@salty-css/react/styled","@salty-css/react/styled-client"),f}}catch(n){console.error("Error in minimizeFile:",n)}},ht=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!Z(e))return!1;const n=await st.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(n)},xt=e=>({name:"stylegen",buildStart:()=>se(e),load:async t=>{if(Z(t))return await oe(e,t)},handleHotUpdate:async({file:t,server:s})=>{await ht(t)&&await s.restart()},watchChange:{handler:async t=>{Z(t)&&(await ht(t)||await ne(e,t))}}});exports.default=xt;exports.saltyPlugin=xt;
42
+ ${f}`}return f=f.replace("{ styled }","{ styledClient as styled }"),f=f.replace("@salty-css/react/styled","@salty-css/react/styled-client"),f}}catch(n){console.error("Error in minimizeFile:",n)}},ht=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!Z(e))return!1;const n=await st.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(n)},xt=e=>({name:"stylegen",buildStart:()=>se(e),load:async t=>{if(Z(t))return await oe(e,t)},handleHotUpdate:async({file:t,server:s})=>{await ht(t)&&s.restart()},watchChange:{handler:async t=>{Z(t)&&(await ht(t)||await ne(e,t))}}});exports.default=xt;exports.saltyPlugin=xt;
package/index.js CHANGED
@@ -656,7 +656,7 @@ ${l}`;
656
656
  return await le(e, t);
657
657
  },
658
658
  handleHotUpdate: async ({ file: t, server: s }) => {
659
- await wt(t) && await s.restart();
659
+ await wt(t) && s.restart();
660
660
  },
661
661
  watchChange: {
662
662
  handler: async (t) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/vite",
3
- "version": "0.0.1-alpha.211",
3
+ "version": "0.0.1-alpha.213",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -34,6 +34,6 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@salty-css/core": "^0.0.1-alpha.211"
37
+ "@salty-css/core": "^0.0.1-alpha.213"
38
38
  }
39
39
  }