@salty-css/core 0.0.1-alpha.204 → 0.0.1-alpha.205

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/bin/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-DMCrqpTd.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-BEJWepok.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
2
2
 
3
3
  # Salty-CSS
4
4
  saltygen
package/bin/main.js CHANGED
@@ -3,7 +3,7 @@ import { existsSync as K } from "fs";
3
3
  import { mkdir as q, readFile as C, writeFile as w } from "fs/promises";
4
4
  import { join as i, relative as z, parse as re, format as ee } from "path";
5
5
  import { render as ce } from "ejs";
6
- import { l as t, a as h, g as te } from "../index-DOGHBmYn.js";
6
+ import { l as t, a as h, g as te } from "../index-BsRtXRDr.js";
7
7
  import { p as le } from "../pascal-case-BQpR5PdN.js";
8
8
  import { exec as de } from "child_process";
9
9
  import fe from "ora";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-B67L4oyf.cjs");const e=require("../index-DMCrqpTd.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-B67L4oyf.cjs");const e=require("../index-BEJWepok.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
package/compiler/index.js CHANGED
@@ -5,7 +5,7 @@ import "path";
5
5
  import "fs";
6
6
  import "fs/promises";
7
7
  import "../parse-styles-DZbuVYRn.js";
8
- import { d as n, c as g, g as F, e as y, i as x, m as S, s as c, b as f } from "../index-DOGHBmYn.js";
8
+ import { d as n, c as g, g as F, e as y, i as x, m as S, s as c, b as f } from "../index-BsRtXRDr.js";
9
9
  import "../css/merge.js";
10
10
  export {
11
11
  n as compileSaltyFile,
@@ -1,5 +1,5 @@
1
- "use strict";const Ce=require("esbuild"),xe=require("child_process"),P=require("./dash-case-BJEkFEGQ.cjs"),r=require("path"),a=require("fs"),oe=require("fs/promises"),X=require("./parse-styles-B67L4oyf.cjs"),B=require("winston"),V=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function Ne(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 de=Ne(Ce),pe=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,i]of Object.entries(e))if(typeof i=="function")console.log("Function found",o);else if(i&&typeof i=="object"){const f=o.trim(),d=await pe(i,[...t,f]);s.push(d)}else n[o]=i;if(Object.keys(n).length){const o=t.map(P.dashCase).join("-"),i=await X.parseAndJoinStyles(n,`.${o}`);s.push(i)}return s.join(`
2
- `)},ke=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=ye(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},ye=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const i=t?`${t}.${n}`:n;return typeof o=="object"?ye(o,i,s):s.add(t)}),[...s]):[],me=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=r.join(e,"package.json");return a.existsSync(t)?t:me(r.join(e,".."))},Pe=async e=>{const t=me(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},De=async e=>{const t=await Pe(e);if(t)return t.type};let J;const ge=async e=>{if(J)return J;const t=await De(e);return t==="module"?J="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ne&&ne.tagName.toUpperCase()==="SCRIPT"&&ne.src||new URL("index-DMCrqpTd.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},G=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),_e=e=>{G.error(e)};function he(e){return e?typeof e!="string"?he(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 Te={"*, *::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"}},R={externalModules:[],rcFile:void 0,destDir:void 0},Se=e=>{if(R.externalModules.length>0)return R.externalModules;const s=a.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return R.externalModules=n,n},M=async e=>{if(R.destDir)return R.destDir;const t=await re(e),s=r.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return R.destDir=s,s},ie=["salty","css","styles","styled"],we=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),Y=(e,t=[])=>we(t).test(e),je=async e=>{if(R.rcFile)return R.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=r.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(R.rcFile=s,s):je(r.join(e,".."))},re=async e=>{var n,o;const t=await je(e),s=(n=t.projects)==null?void 0:n.find(i=>e.endsWith(i.dir||""));return s||((o=t.projects)==null?void 0:o.find(i=>i.dir===t.defaultProject))},Ee=async e=>{const t=await re(e),s=await M(e),n=r.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=r.join(s,"salty.config.js"),i=await ge(e),f=Se(n);await de.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:i,external:f});const d=Date.now(),{config:y}=await import(`${o}?t=${d}`);return y},be=async(e,t)=>{var ce,le;const s=await M(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async h=>{const{contents:b,outputFilePath:O}=await K(e,h,s);Object.entries(b).forEach(([x,k])=>{k.isMedia?n.mediaQueries.push([x,k]):k.isGlobalDefine?n.globalStyles.push(k):k.isDefineVariables?n.variables.push(k):k.isDefineTemplates&&n.templates.push(k._setPath(O))})}));const o=await Ee(e),i={...o},f=new Set,d=(h,b=[])=>h?Object.entries(h).flatMap(([O,x])=>{if(!x)return;if(typeof x=="object")return d(x,[...b,O]);const k=he(O),te=P.dashCase(O),se=[...b,k].join(".");f.add(`"${se}"`);const U=[...b.map(P.dashCase),te].join("-"),fe=X.parseVariableTokens(x);return fe?`--${U}: ${fe.transformed};`:`--${U}: ${x};`}):[],y=h=>h?Object.entries(h).flatMap(([b,O])=>{const x=d(O);return b==="base"?x.join(""):`${b} { ${x.join("")} }`}):[],u=h=>h?Object.entries(h).flatMap(([b,O])=>Object.entries(O).flatMap(([x,k])=>{const te=d(k,[b]),se=`.${b}-${x}, [data-${b}="${x}"]`,U=te.join("");return`${se} { ${U} }`})):[],m=h=>({...h,responsive:void 0,conditional:void 0}),g=h=>n.variables.map(b=>h==="static"?m(b._current):b._current[h]),p=V.mergeStyles(m(o.variables),g("static")),F=d(p),S=V.mergeStyles((ce=o.variables)==null?void 0:ce.responsive,g("responsive")),T=y(S),D=V.mergeStyles((le=o.variables)==null?void 0:le.conditional,g("conditional")),_=u(D),v=r.join(s,"css/_variables.css"),E=`:root { ${F.join("")} ${T.join("")} } ${_.join("")}`;a.writeFileSync(v,E),i.staticVariables=p;const z=r.join(s,"css/_global.css"),N=V.mergeStyles(o.global,n.globalStyles),H=await X.parseAndJoinStyles(N,"");a.writeFileSync(z,`@layer global { ${H} }`);const c=r.join(s,"css/_reset.css"),j=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Te,l=await X.parseAndJoinStyles(j,"");a.writeFileSync(c,`@layer reset { ${l} }`);const $=r.join(s,"css/_templates.css"),C=V.mergeStyles(o.templates,n.templates),q=await pe(C),I=ke(C);a.writeFileSync($,q),i.templates=C;const W=V.mergeFactories(n.templates);i.templatePaths=Object.fromEntries(Object.entries(W).map(([h,b])=>[h,b._path||"nope"]));const{mediaQueries:A}=n;i.mediaQueries=Object.fromEntries(A.map(([h,b])=>[`@${h}`,b]));const L=A.map(([h])=>`'@${h}'`).join(" | "),ee=r.join(s,"types/css-tokens.d.ts"),Z=`
1
+ "use strict";const Ce=require("esbuild"),xe=require("child_process"),P=require("./dash-case-BJEkFEGQ.cjs"),r=require("path"),a=require("fs"),oe=require("fs/promises"),X=require("./parse-styles-B67L4oyf.cjs"),B=require("winston"),V=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function Ne(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 de=Ne(Ce),pe=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,i]of Object.entries(e))if(typeof i!="function")if(i&&typeof i=="object"){const f=o.trim(),d=await pe(i,[...t,f]);s.push(d)}else n[o]=i;if(Object.keys(n).length){const o=t.map(P.dashCase).join("-"),i=await X.parseAndJoinStyles(n,`.${o}`);s.push(i)}return s.join(`
2
+ `)},ke=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=ye(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},ye=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const i=t?`${t}.${n}`:n;return typeof o=="object"?ye(o,i,s):s.add(t)}),[...s]):[],me=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=r.join(e,"package.json");return a.existsSync(t)?t:me(r.join(e,".."))},Pe=async e=>{const t=me(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},De=async e=>{const t=await Pe(e);if(t)return t.type};let J;const ge=async e=>{if(J)return J;const t=await De(e);return t==="module"?J="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ne&&ne.tagName.toUpperCase()==="SCRIPT"&&ne.src||new URL("index-BEJWepok.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},G=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),_e=e=>{G.error(e)};function he(e){return e?typeof e!="string"?he(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 Te={"*, *::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"}},R={externalModules:[],rcFile:void 0,destDir:void 0},Se=e=>{if(R.externalModules.length>0)return R.externalModules;const s=a.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return R.externalModules=n,n},M=async e=>{if(R.destDir)return R.destDir;const t=await re(e),s=r.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return R.destDir=s,s},ie=["salty","css","styles","styled"],we=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),Y=(e,t=[])=>we(t).test(e),je=async e=>{if(R.rcFile)return R.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=r.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(R.rcFile=s,s):je(r.join(e,".."))},re=async e=>{var n,o;const t=await je(e),s=(n=t.projects)==null?void 0:n.find(i=>e.endsWith(i.dir||""));return s||((o=t.projects)==null?void 0:o.find(i=>i.dir===t.defaultProject))},Ee=async e=>{const t=await re(e),s=await M(e),n=r.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=r.join(s,"salty.config.js"),i=await ge(e),f=Se(n);await de.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:i,external:f});const d=Date.now(),{config:y}=await import(`${o}?t=${d}`);return y},be=async(e,t)=>{var ce,le;const s=await M(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async h=>{const{contents:b,outputFilePath:O}=await K(e,h,s);Object.entries(b).forEach(([x,k])=>{k.isMedia?n.mediaQueries.push([x,k]):k.isGlobalDefine?n.globalStyles.push(k):k.isDefineVariables?n.variables.push(k):k.isDefineTemplates&&n.templates.push(k._setPath(O))})}));const o=await Ee(e),i={...o},f=new Set,d=(h,b=[])=>h?Object.entries(h).flatMap(([O,x])=>{if(!x)return;if(typeof x=="object")return d(x,[...b,O]);const k=he(O),te=P.dashCase(O),se=[...b,k].join(".");f.add(`"${se}"`);const U=[...b.map(P.dashCase),te].join("-"),fe=X.parseVariableTokens(x);return fe?`--${U}: ${fe.transformed};`:`--${U}: ${x};`}):[],y=h=>h?Object.entries(h).flatMap(([b,O])=>{const x=d(O);return b==="base"?x.join(""):`${b} { ${x.join("")} }`}):[],u=h=>h?Object.entries(h).flatMap(([b,O])=>Object.entries(O).flatMap(([x,k])=>{const te=d(k,[b]),se=`.${b}-${x}, [data-${b}="${x}"]`,U=te.join("");return`${se} { ${U} }`})):[],m=h=>({...h,responsive:void 0,conditional:void 0}),g=h=>n.variables.map(b=>h==="static"?m(b._current):b._current[h]),p=V.mergeStyles(m(o.variables),g("static")),F=d(p),S=V.mergeStyles((ce=o.variables)==null?void 0:ce.responsive,g("responsive")),T=y(S),D=V.mergeStyles((le=o.variables)==null?void 0:le.conditional,g("conditional")),_=u(D),v=r.join(s,"css/_variables.css"),E=`:root { ${F.join("")} ${T.join("")} } ${_.join("")}`;a.writeFileSync(v,E),i.staticVariables=p;const z=r.join(s,"css/_global.css"),N=V.mergeStyles(o.global,n.globalStyles),H=await X.parseAndJoinStyles(N,"");a.writeFileSync(z,`@layer global { ${H} }`);const c=r.join(s,"css/_reset.css"),j=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Te,l=await X.parseAndJoinStyles(j,"");a.writeFileSync(c,`@layer reset { ${l} }`);const $=r.join(s,"css/_templates.css"),C=V.mergeStyles(o.templates,n.templates),q=await pe(C),I=ke(C);a.writeFileSync($,q),i.templates=C;const W=V.mergeFactories(n.templates);i.templatePaths=Object.fromEntries(Object.entries(W).map(([h,b])=>[h,b._path||"nope"]));const{mediaQueries:A}=n;i.mediaQueries=Object.fromEntries(A.map(([h,b])=>[`@${h}`,b]));const L=A.map(([h])=>`'@${h}'`).join(" | "),ee=r.join(s,"types/css-tokens.d.ts"),Z=`
3
3
  // Variable types
4
4
  type VariableTokens = ${[...f].join("|")};
5
5
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -9,23 +9,22 @@ import { createLogger as Tt, format as ot, transports as Et } from "winston";
9
9
  import { mergeStyles as z, mergeFactories as Ot } from "./css/merge.js";
10
10
  const yt = async (t, e = []) => {
11
11
  if (!t) return "";
12
- const s = [], o = {};
13
- for (const [n, a] of Object.entries(t))
14
- if (typeof a == "function") console.log("Function found", n);
15
- else if (a && typeof a == "object") {
16
- const l = n.trim(), u = await yt(a, [...e, l]);
12
+ const s = [], n = {};
13
+ for (const [o, a] of Object.entries(t))
14
+ if (typeof a != "function") if (a && typeof a == "object") {
15
+ const l = o.trim(), u = await yt(a, [...e, l]);
17
16
  s.push(u);
18
17
  } else
19
- o[n] = a;
20
- if (Object.keys(o).length) {
21
- const n = e.map(W).join("-"), a = await at(o, `.${n}`);
18
+ n[o] = a;
19
+ if (Object.keys(n).length) {
20
+ const o = e.map(W).join("-"), a = await at(n, `.${o}`);
22
21
  s.push(a);
23
22
  }
24
23
  return s.join(`
25
24
  `);
26
- }, Vt = (t) => t ? Object.entries(t).reduce((e, [s, o]) => (typeof o == "object" && (e[s] = ht(o).map((n) => `"${n}"`).join(" | ")), e), {}) : {}, ht = (t, e = "", s = /* @__PURE__ */ new Set()) => t ? (Object.entries(t).forEach(([o, n]) => {
27
- const a = e ? `${e}.${o}` : o;
28
- return typeof n == "object" ? ht(n, a, s) : s.add(e);
25
+ }, Vt = (t) => t ? Object.entries(t).reduce((e, [s, n]) => (typeof n == "function" ? e[s] = "any" : typeof n == "object" && (e[s] = ht(n).map((o) => `"${o}"`).join(" | ")), e), {}) : {}, ht = (t, e = "", s = /* @__PURE__ */ new Set()) => t ? (Object.entries(t).forEach(([n, o]) => {
26
+ const a = e ? `${e}.${n}` : n;
27
+ return typeof o == "object" ? ht(o, a, s) : s.add(e);
29
28
  }), [...s]) : [], bt = (t) => {
30
29
  if (!t || t === "/") throw new Error("Could not find package.json file");
31
30
  const e = i(t, "package.json");
@@ -108,8 +107,8 @@ const Rt = {
108
107
  if (V.externalModules.length > 0) return V.externalModules;
109
108
  const s = D(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
110
109
  if (!s) return [];
111
- const o = s[1].split(",").map((n) => n.replace(/['"`]/g, "").trim());
112
- return V.externalModules = o, o;
110
+ const n = s[1].split(",").map((o) => o.replace(/['"`]/g, "").trim());
111
+ return V.externalModules = n, n;
113
112
  }, M = async (t) => {
114
113
  if (V.destDir) return V.destDir;
115
114
  const e = await ct(t), s = i(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
@@ -121,25 +120,25 @@ const Rt = {
121
120
  });
122
121
  return s ? (V.rcFile = s, s) : Ft(i(t, ".."));
123
122
  }, ct = async (t) => {
124
- var o, n;
125
- const e = await Ft(t), s = (o = e.projects) == null ? void 0 : o.find((a) => t.endsWith(a.dir || ""));
126
- return s || ((n = e.projects) == null ? void 0 : n.find((a) => a.dir === e.defaultProject));
123
+ var n, o;
124
+ const e = await Ft(t), s = (n = e.projects) == null ? void 0 : n.find((a) => t.endsWith(a.dir || ""));
125
+ return s || ((o = e.projects) == null ? void 0 : o.find((a) => a.dir === e.defaultProject));
127
126
  }, zt = async (t) => {
128
- const e = await ct(t), s = await M(t), o = i(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), n = i(s, "salty.config.js"), a = await $t(t), l = St(o);
127
+ const e = await ct(t), s = await M(t), n = i(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), o = i(s, "salty.config.js"), a = await $t(t), l = St(n);
129
128
  await mt.build({
130
- entryPoints: [o],
129
+ entryPoints: [n],
131
130
  minify: !0,
132
131
  treeShaking: !0,
133
132
  bundle: !0,
134
- outfile: n,
133
+ outfile: o,
135
134
  format: a,
136
135
  external: l
137
136
  });
138
- const u = Date.now(), { config: d } = await import(`${n}?t=${u}`);
137
+ const u = Date.now(), { config: d } = await import(`${o}?t=${u}`);
139
138
  return d;
140
139
  }, Wt = async (t, e) => {
141
140
  var ft, ut;
142
- const s = await M(t), o = {
141
+ const s = await M(t), n = {
143
142
  mediaQueries: [],
144
143
  globalStyles: [],
145
144
  variables: [],
@@ -149,11 +148,11 @@ const Rt = {
149
148
  [...e].map(async (y) => {
150
149
  const { contents: w, outputFilePath: O } = await tt(t, y, s);
151
150
  Object.entries(w).forEach(([x, P]) => {
152
- P.isMedia ? o.mediaQueries.push([x, P]) : P.isGlobalDefine ? o.globalStyles.push(P) : P.isDefineVariables ? o.variables.push(P) : P.isDefineTemplates && o.templates.push(P._setPath(O));
151
+ P.isMedia ? n.mediaQueries.push([x, P]) : P.isGlobalDefine ? n.globalStyles.push(P) : P.isDefineVariables ? n.variables.push(P) : P.isDefineTemplates && n.templates.push(P._setPath(O));
153
152
  });
154
153
  })
155
154
  );
156
- const n = await zt(t), a = { ...n }, l = /* @__PURE__ */ new Set(), u = (y, w = []) => y ? Object.entries(y).flatMap(([O, x]) => {
155
+ const o = await zt(t), a = { ...o }, l = /* @__PURE__ */ new Set(), u = (y, w = []) => y ? Object.entries(y).flatMap(([O, x]) => {
157
156
  if (!x) return;
158
157
  if (typeof x == "object") return u(x, [...w, O]);
159
158
  const P = wt(O), st = W(O), nt = [...w, P].join(".");
@@ -166,19 +165,19 @@ const Rt = {
166
165
  }) : [], f = (y) => y ? Object.entries(y).flatMap(([w, O]) => Object.entries(O).flatMap(([x, P]) => {
167
166
  const st = u(P, [w]), nt = `.${w}-${x}, [data-${w}="${x}"]`, U = st.join("");
168
167
  return `${nt} { ${U} }`;
169
- })) : [], m = (y) => ({ ...y, responsive: void 0, conditional: void 0 }), g = (y) => o.variables.map((w) => y === "static" ? m(w._current) : w._current[y]), p = z(m(n.variables), g("static")), S = u(p), h = z((ft = n.variables) == null ? void 0 : ft.responsive, g("responsive")), T = d(h), k = z((ut = n.variables) == null ? void 0 : ut.conditional, g("conditional")), _ = f(k), v = i(s, "css/_variables.css"), E = `:root { ${S.join("")} ${T.join("")} } ${_.join("")}`;
168
+ })) : [], m = (y) => ({ ...y, responsive: void 0, conditional: void 0 }), g = (y) => n.variables.map((w) => y === "static" ? m(w._current) : w._current[y]), p = z(m(o.variables), g("static")), S = u(p), h = z((ft = o.variables) == null ? void 0 : ft.responsive, g("responsive")), T = d(h), k = z((ut = o.variables) == null ? void 0 : ut.conditional, g("conditional")), _ = f(k), v = i(s, "css/_variables.css"), E = `:root { ${S.join("")} ${T.join("")} } ${_.join("")}`;
170
169
  j(v, E), a.staticVariables = p;
171
- const B = i(s, "css/_global.css"), N = z(n.global, o.globalStyles), G = await at(N, "");
170
+ const B = i(s, "css/_global.css"), N = z(o.global, n.globalStyles), G = await at(N, "");
172
171
  j(B, `@layer global { ${G} }`);
173
- const r = i(s, "css/_reset.css"), $ = n.reset === "none" ? {} : typeof n.reset == "object" ? n.reset : Rt, c = await at($, "");
172
+ const r = i(s, "css/_reset.css"), $ = o.reset === "none" ? {} : typeof o.reset == "object" ? o.reset : Rt, c = await at($, "");
174
173
  j(r, `@layer reset { ${c} }`);
175
- const C = i(s, "css/_templates.css"), F = z(n.templates, o.templates), H = await yt(F), K = Vt(F);
174
+ const C = i(s, "css/_templates.css"), F = z(o.templates, n.templates), H = await yt(F), K = Vt(F);
176
175
  j(C, H), a.templates = F;
177
- const A = Ot(o.templates);
176
+ const A = Ot(n.templates);
178
177
  a.templatePaths = Object.fromEntries(
179
178
  Object.entries(A).map(([y, w]) => [y, w._path || "nope"])
180
179
  );
181
- const { mediaQueries: L } = o;
180
+ const { mediaQueries: L } = n;
182
181
  a.mediaQueries = Object.fromEntries(L.map(([y, w]) => [`@${y}`, w]));
183
182
  const Q = L.map(([y]) => `'@${y}'`).join(" | "), et = i(s, "types/css-tokens.d.ts"), q = `
184
183
  // Variable types
@@ -199,9 +198,9 @@ const Rt = {
199
198
  j(xt, JSON.stringify(a, null, 2));
200
199
  }, dt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
201
200
  if (/^['"`]/.test(s)) return e;
202
- const n = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
203
- if (!n.test(t)) return e;
204
- const l = n.exec(t);
201
+ const o = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
202
+ if (!o.test(t)) return e;
203
+ const l = o.exec(t);
205
204
  if (l) {
206
205
  const u = l.at(1);
207
206
  if (Ct.some((f) => u == null ? void 0 : u.includes(f))) return e;
@@ -219,12 +218,12 @@ ${t}`;
219
218
  return t;
220
219
  }
221
220
  }, tt = async (t, e, s) => {
222
- const o = I(e), n = i(s, "./temp");
223
- it(n) || J(n);
221
+ const n = I(e), o = i(s, "./temp");
222
+ it(o) || J(o);
224
223
  const a = Y(e);
225
224
  let l = D(e, "utf8");
226
225
  l = dt(l), l = It(l, t);
227
- const u = i(s, "js", o + ".js"), d = await ct(t), f = i(t, (d == null ? void 0 : d.configDir) || "", "salty.config.ts"), m = St(f), g = await $t(t);
226
+ const u = i(s, "js", n + ".js"), d = await ct(t), f = i(t, (d == null ? void 0 : d.configDir) || "", "salty.config.ts"), m = St(f), g = await $t(t);
228
227
  await mt.build({
229
228
  stdin: {
230
229
  contents: l,
@@ -256,11 +255,11 @@ ${t}`;
256
255
  const p = Date.now();
257
256
  return { contents: await import(`${u}?t=${p}`), outputFilePath: u };
258
257
  }, Bt = async (t) => {
259
- const e = await M(t), s = i(e, "cache/config-cache.json"), o = D(s, "utf8");
260
- if (!o) throw new Error("Could not find config cache file");
261
- return JSON.parse(o);
258
+ const e = await M(t), s = i(e, "cache/config-cache.json"), n = D(s, "utf8");
259
+ if (!n) throw new Error("Could not find config cache file");
260
+ return JSON.parse(n);
262
261
  }, lt = async (t) => {
263
- const e = await Bt(t), s = await M(t), o = i(s, "salty.config.js"), n = Date.now(), { config: a } = await import(`${o}?t=${n}`);
262
+ const e = await Bt(t), s = await M(t), n = i(s, "salty.config.js"), o = Date.now(), { config: a } = await import(`${n}?t=${o}`);
264
263
  return z(a, e);
265
264
  }, jt = () => {
266
265
  try {
@@ -270,9 +269,9 @@ ${t}`;
270
269
  }
271
270
  }, Xt = async (t, e = jt(), s = !0) => {
272
271
  try {
273
- const o = Date.now();
272
+ const n = Date.now();
274
273
  e ? X.info("Generating CSS in production mode! 🔥") : X.info("Generating CSS in development mode! 🚀");
275
- const n = [], a = [], l = await M(t), u = i(l, "index.css");
274
+ const o = [], a = [], l = await M(t), u = i(l, "index.css");
276
275
  s && (() => {
277
276
  it(l) && Nt("rm -rf " + l), J(l, { recursive: !0 }), J(i(l, "css")), J(i(l, "types")), J(i(l, "js")), J(i(l, "cache"));
278
277
  })();
@@ -318,7 +317,7 @@ ${t}`;
318
317
  const S = await lt(t);
319
318
  for (const r of p.keyframes) {
320
319
  const { value: b } = r, $ = `a_${b.animationName}.css`, c = `css/${$}`, C = i(l, c);
321
- n.push($), j(C, b.css);
320
+ o.push($), j(C, b.css);
322
321
  }
323
322
  const h = {};
324
323
  for (const r of p.components) {
@@ -346,7 +345,7 @@ ${t}`;
346
345
  `), c = I(r, 6), C = Y(r), F = W(C.name), H = i(l, `css/f_${F}-${c}.css`);
347
346
  j(H, $);
348
347
  });
349
- const T = n.map((r) => `@import url('./css/${r}');`).join(`
348
+ const T = o.map((r) => `@import url('./css/${r}');`).join(`
350
349
  `);
351
350
  let E = `@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
352
351
 
@@ -377,16 +376,16 @@ ${et}
377
376
  E += r;
378
377
  }
379
378
  j(u, E);
380
- const N = Date.now() - o, G = N < 200 ? "🔥" : N < 500 ? "🚀" : N < 1e3 ? "🎉" : N < 2e3 ? "🚗" : N < 5e3 ? "🤔" : "🥴";
379
+ const N = Date.now() - n, G = N < 200 ? "🔥" : N < 500 ? "🚀" : N < 1e3 ? "🎉" : N < 2e3 ? "🚗" : N < 5e3 ? "🤔" : "🥴";
381
380
  X.info(`Generated CSS in ${N}ms! ${G}`);
382
- } catch (o) {
383
- console.error(o);
381
+ } catch (n) {
382
+ console.error(n);
384
383
  }
385
384
  }, Yt = async (t, e) => {
386
385
  try {
387
386
  const s = await M(t);
388
387
  if (rt(e)) {
389
- const n = [], a = await lt(t), { contents: l } = await tt(t, e, s);
388
+ const o = [], a = await lt(t), { contents: l } = await tt(t, e, s);
390
389
  for (const [u, d] of Object.entries(l)) {
391
390
  if (d.isKeyframes && d.css) {
392
391
  const S = `css/${`a_${d.animationName}.css`}`, h = i(s, S);
@@ -397,7 +396,7 @@ ${et}
397
396
  const p = d.factory._withBuildContext({
398
397
  name: u
399
398
  });
400
- n[0].push(p.cssFileName);
399
+ o[0].push(p.cssFileName);
401
400
  const S = `css/${p.cssFileName}`, h = i(s, S);
402
401
  j(h, await p.css);
403
402
  }
@@ -406,10 +405,10 @@ ${et}
406
405
  name: u,
407
406
  config: a
408
407
  }), m = `css/${f.cssFileName}`, g = i(s, m);
409
- j(g, await f.css), n[f.priority] || (n[f.priority] = []), n[f.priority].push(f.cssFileName);
408
+ j(g, await f.css), o[f.priority] || (o[f.priority] = []), o[f.priority].push(f.cssFileName);
410
409
  }
411
410
  if (a.importStrategy !== "component")
412
- n.forEach((u, d) => {
411
+ o.forEach((u, d) => {
413
412
  const f = `l_${d}.css`, m = i(s, "css", f);
414
413
  let g = D(m, "utf8");
415
414
  u.forEach((p) => {
@@ -427,7 +426,7 @@ ${v}
427
426
  }), j(m, g);
428
427
  });
429
428
  else {
430
- const u = n.flat().map((p) => `@import url('./${p}');`).join(`
429
+ const u = o.flat().map((p) => `@import url('./${p}');`).join(`
431
430
  `), d = I(e, 6), f = Y(e), m = W(f.name), g = i(s, `css/f_${m}-${d}.css`);
432
431
  j(g, u);
433
432
  }
@@ -437,11 +436,11 @@ ${v}
437
436
  }
438
437
  }, te = async (t, e, s = jt()) => {
439
438
  try {
440
- const o = await M(t);
439
+ const n = await M(t);
441
440
  if (rt(e)) {
442
441
  const a = D(e, "utf8");
443
442
  a.replace(/^(?!export\s)const\s.*/gm, (m) => `export ${m}`) !== a && await Dt(e, a);
444
- const u = await lt(t), { contents: d } = await tt(t, e, o);
443
+ const u = await lt(t), { contents: d } = await tt(t, e, n);
445
444
  let f = a;
446
445
  if (Object.entries(d).forEach(([m, g]) => {
447
446
  var c;
@@ -473,8 +472,8 @@ ${f}`;
473
472
  }
474
473
  return f = f.replace("{ styled }", "{ styledClient as styled }"), f = f.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), f;
475
474
  }
476
- } catch (o) {
477
- console.error("Error in minimizeFile:", o);
475
+ } catch (n) {
476
+ console.error("Error in minimizeFile:", n);
478
477
  }
479
478
  };
480
479
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.204",
3
+ "version": "0.0.1-alpha.205",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("fs/promises"),r=require("../index-DMCrqpTd.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!/.+define[A-Z]\w+/.test(e)};exports.checkShouldRestart=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("fs/promises"),r=require("../index-BEJWepok.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!/.+define[A-Z]\w+/.test(e)};exports.checkShouldRestart=i;
package/server/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { readFile as r } from "fs/promises";
2
- import { i as e } from "../index-DOGHBmYn.js";
2
+ import { i as e } from "../index-BsRtXRDr.js";
3
3
  const f = async (t) => {
4
4
  if (!t || t.includes("node_modules") || t.includes("saltygen")) return !1;
5
5
  if (t.includes("salty.config")) return !0;
@@ -22,7 +22,7 @@ export interface CssTemplateObject {
22
22
  [key: PropertyKey]: CssTemplate;
23
23
  }
24
24
  export interface CssTemplateFunction {
25
- (value: unknown): CssTemplate;
25
+ (value: any): CssTemplate;
26
26
  }
27
27
  export interface CssTemplates {
28
28
  [key: PropertyKey]: CssTemplateObject | CssTemplateFunction;