@salty-css/vite 0.0.1-alpha.106 → 0.0.1-alpha.108

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
@@ -5,7 +5,7 @@
5
5
  }`;return o.push(c),a}const g=j.includes("&")?d.replace("&",e):d.startsWith(":")?`${e}${d}`:`${e} ${d}`,$=D(r,g);return o.push($),a}const b=d.startsWith("-")?d:E(d),k=(g,$=";")=>a=`${a}${g}${$}`,C=g=>k(`${b}:${g}`);if(typeof r=="number")return C(r);if(typeof r!="string")if("toString"in r)r=r.toString();else return a;const{modifiers:u}={},O=function*(){yield G(r),yield ut(r,u)}();for(const{result:g,additionalCss:$=[]}of O)r=g,$.forEach(S=>{const c=D(S,"");k(c,"")});return C(r)},"");if(!i)return o.join(`
6
6
  `);if(!e)return i;let y="";return y=`${e} { ${i} }`,[y,...o].join(`
7
7
  `)},H=(t,e=[])=>{if(!t)return"";const s=[],n={};if(Object.entries(t).forEach(([o,i])=>{if(typeof i=="object"){if(!i)return;const y=o.trim(),a=H(i,[...e,y]);s.push(a)}else n[o]=i}),Object.keys(n).length){const o=e.map(E).join("-"),i=D(n,`.${o}`);s.push(i)}return s.join(`
8
- `)},ft=t=>Object.entries(t).reduce((e,[s,n])=>(typeof n=="object"&&(e[s]=K(n).map(o=>`"${o}"`).join(" | ")),e),{}),K=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,o])=>{const i=e?`${e}.${n}`:n;return typeof o=="object"?K(o,i,s):s.add(e)}),[...s]):[],X=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=l.join(t,"package.json");return f.existsSync(e)?e:X(l.join(t,".."))},pt=async t=>{const e=X(t);return await L.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},dt=async t=>{const e=await pt(t);if(e)return e.type};let M;const Y=async t=>{if(M)return M;const e=await dt(t);return e==="module"?M="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:R&&R.tagName.toUpperCase()==="SCRIPT"&&R.src||new URL("index.cjs",document.baseURI).href).endsWith(".cjs"))&&(M="cjs"),M||"esm"},Z=V.createLogger({level:"debug",format:V.format.combine(V.format.colorize(),V.format.cli()),transports:[new V.transports.Console({})]}),A={externalModules:[]},Q=t=>{if(A.externalModules.length>0)return A.externalModules;const e=l.join(t,"salty.config.ts"),n=f.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const o=n[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return A.externalModules=o,o},J=t=>l.join(t,"./saltygen"),yt=["salty","css","styles","styled"],gt=(t=[])=>new RegExp(`\\.(${[...yt,...t].join("|")})\\.`),_=(t,e=[])=>gt(e).test(t),mt=async t=>{const e=J(t),s=l.join(t,"salty.config.ts"),n=l.join(e,"salty.config.js"),o=await Y(t),i=Q(t);await U.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:o,external:i});const y=Date.now(),{config:a}=await import(`${n}?t=${y}`);return a},v=async t=>{const e=await mt(t),s=new Set,n=(c,p=[])=>c?Object.entries(c).flatMap(([m,h])=>{if(!h)return;if(typeof h=="object")return n(h,[...p,m]);const T=[...p,m].join(".");s.add(`"${T}"`);const w=[...p.map(E),E(m)].join("-"),{result:F}=G(h);return`--${w}: ${F};`}):[],o=c=>c?Object.entries(c).flatMap(([p,m])=>{const h=n(m);return p==="base"?h.join(""):`${p} { ${h.join("")} }`}):[],i=c=>c?Object.entries(c).flatMap(([p,m])=>Object.entries(m).flatMap(([h,T])=>{const w=n(T,[p]),F=`.${p}-${h}, [data-${p}="${h}"]`,P=w.join("");return`${F} { ${P} }`})):[],y=n(e.variables),a=o(e.responsiveVariables),j=i(e.conditionalVariables),r=J(t),d=l.join(r,"css/variables.css"),b=`:root { ${y.join("")} ${a.join("")} } ${j.join("")}`;f.writeFileSync(d,b);const k=l.join(r,"css/global.css"),C=D(e.global,"");f.writeFileSync(k,C);const u=l.join(r,"css/templates.css"),x=H(e.templates),O=ft(e.templates);console.log(O),f.writeFileSync(u,x);const g=l.join(r,"types/css-tokens.d.ts"),S=`
8
+ `)},ft=t=>Object.entries(t).reduce((e,[s,n])=>(typeof n=="object"&&(e[s]=K(n).map(o=>`"${o}"`).join(" | ")),e),{}),K=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,o])=>{const i=e?`${e}.${n}`:n;return typeof o=="object"?K(o,i,s):s.add(e)}),[...s]):[],X=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=l.join(t,"package.json");return f.existsSync(e)?e:X(l.join(t,".."))},pt=async t=>{const e=X(t);return await L.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},dt=async t=>{const e=await pt(t);if(e)return e.type};let M;const Y=async t=>{if(M)return M;const e=await dt(t);return e==="module"?M="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:R&&R.tagName.toUpperCase()==="SCRIPT"&&R.src||new URL("index.cjs",document.baseURI).href).endsWith(".cjs"))&&(M="cjs"),M||"esm"},Z=V.createLogger({level:"debug",format:V.format.combine(V.format.colorize(),V.format.cli()),transports:[new V.transports.Console({})]}),A={externalModules:[]},Q=t=>{if(A.externalModules.length>0)return A.externalModules;const e=l.join(t,"salty.config.ts"),n=f.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const o=n[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return A.externalModules=o,o},J=t=>l.join(t,"./saltygen"),yt=["salty","css","styles","styled"],gt=(t=[])=>new RegExp(`\\.(${[...yt,...t].join("|")})\\.`),_=(t,e=[])=>gt(e).test(t),mt=async t=>{const e=J(t),s=l.join(t,"salty.config.ts"),n=l.join(e,"salty.config.js"),o=await Y(t),i=Q(t);await U.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:o,external:i});const y=Date.now(),{config:a}=await import(`${n}?t=${y}`);return a},v=async t=>{const e=await mt(t),s=new Set,n=(c,p=[])=>c?Object.entries(c).flatMap(([m,h])=>{if(!h)return;if(typeof h=="object")return n(h,[...p,m]);const T=[...p,m].join(".");s.add(`"${T}"`);const w=[...p.map(E),E(m)].join("-"),{result:F}=G(h);return`--${w}: ${F};`}):[],o=c=>c?Object.entries(c).flatMap(([p,m])=>{const h=n(m);return p==="base"?h.join(""):`${p} { ${h.join("")} }`}):[],i=c=>c?Object.entries(c).flatMap(([p,m])=>Object.entries(m).flatMap(([h,T])=>{const w=n(T,[p]),F=`.${p}-${h}, [data-${p}="${h}"]`,P=w.join("");return`${F} { ${P} }`})):[],y=n(e.variables),a=o(e.responsiveVariables),j=i(e.conditionalVariables),r=J(t),d=l.join(r,"css/variables.css"),b=`:root { ${y.join("")} ${a.join("")} } ${j.join("")}`;f.writeFileSync(d,b);const k=l.join(r,"css/global.css"),C=D(e.global,"");f.writeFileSync(k,C);const u=l.join(r,"css/templates.css"),x=H(e.templates),O=ft(e.templates);f.writeFileSync(u,x);const g=l.join(r,"types/css-tokens.d.ts"),S=`
9
9
  // Variable types
10
10
  type VariableTokens = ${[...s].join("|")};
11
11
  type PropertyValueToken = \`{\${VariableTokens}}\`;
package/index.js CHANGED
@@ -164,7 +164,7 @@ const Q = async (t) => {
164
164
  const F = f(r, "css/global.css"), C = D(e.global, "");
165
165
  E(F, C);
166
166
  const l = f(r, "css/templates.css"), k = U(e.templates), T = mt(e.templates);
167
- console.log(T), E(l, k);
167
+ E(l, k);
168
168
  const d = f(r, "types/css-tokens.d.ts"), j = `
169
169
  // Variable types
170
170
  type VariableTokens = ${[...s].join("|")};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/vite",
3
- "version": "0.0.1-alpha.106",
3
+ "version": "0.0.1-alpha.108",
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.106"
37
+ "@salty-css/core": "^0.0.1-alpha.108"
38
38
  }
39
39
  }