@salty-css/core 0.0.1-alpha.255 → 0.0.1-alpha.256
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 +1 -1
- package/bin/main.js +2 -2
- package/compiler/index.cjs +1 -1
- package/compiler/index.js +2 -2
- package/css/keyframes.cjs +1 -1
- package/css/keyframes.js +1 -1
- package/generators/index.cjs +1 -1
- package/generators/index.js +1 -1
- package/{index-aCAHSJBW.js → index-Bul-2Xse.js} +1 -1
- package/{index-oCwSpzG5.cjs → index-Df5O3s28.cjs} +2 -2
- package/package.json +1 -1
- package/parse-styles-BFumiqfk.cjs +5 -0
- package/{parse-styles-DkygSsSC.js → parse-styles-CzXGidPn.js} +1 -1
- package/server/index.cjs +1 -1
- package/server/index.js +1 -1
- package/{should-restart-HvsS0CW1.cjs → should-restart-B2i9_wsr.cjs} +1 -1
- package/{should-restart-D2s1tQrI.js → should-restart-BxXMLKul.js} +1 -1
- package/parse-styles-BT4aa1vH.cjs +0 -5
package/bin/main.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),A=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),e=require("../index-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),A=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),e=require("../index-Df5O3s28.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-B2i9_wsr.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,v)=>{se.exec(y,x=>{if(x)return v(x);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),v=oe(`Installing packages: ${C}`).start(),x=y.join(" ");await X(`npm install ${x}`),v.succeed(`Installed packages: ${C}`)},re=()=>A.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!re())return;await X(`./node_modules/.bin/prettier --write "${y}"`),e.logger.info(`Formatted ${y} with Prettier`)}catch(C){e.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function ce(){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"))},v=async(i,a)=>{const{default:g}=await C[i],d=ne.render(g,a);return{fileName:i,content:d}},x=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:G&&G.tagName.toUpperCase()==="SCRIPT"&&G.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await x()).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}`},H=i=>{const a=i==="."?"":i,g=process.cwd();return n.join(g,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 e.logError("Salty CSS project must be initialized in a directory with a package.json file.");e.logger.info("Initializing a new Salty-CSS project!");const{dir:g=i,cssFile:d,skipInstall:p}=this.opts();if(!g)return e.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 c=process.cwd(),r=H(g),q=await Promise.all([v("salty.config.ts"),v("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=q.map(async({fileName:t,content:u})=>{const l=n.join(r,t);if(await s.readFile(l,"utf-8").catch(()=>{})!==void 0){e.logger.debug("File already exists: "+l);return}const k=t.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),e.logger.info("Creating file: "+l),await s.writeFile(l,u),await S(l)});await Promise.all(m);const w=n.relative(c,r)||".",h=n.join(c,".saltyrc.json"),f=await s.readFile(h,"utf-8").catch(()=>{});if(f===void 0){e.logger.info("Creating file: "+h);const u=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,u),await S(h)}else{const t=JSON.parse(f),u=(t==null?void 0:t.projects)||[];if(u.findIndex(o=>o.dir===w)===-1){u.push({dir:w,framework:"react"}),t.projects=[...u];const o=JSON.stringify(t,null,2);o!==f&&(e.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(c,".gitignore"),T=await s.readFile(j,"utf-8").catch(()=>{});T!==void 0&&(T.includes("saltygen")||(e.logger.info("Edit file: "+j),await s.writeFile(j,T+`
|
2
2
|
|
3
3
|
# Salty-CSS
|
4
4
|
saltygen
|
package/bin/main.js
CHANGED
@@ -3,11 +3,11 @@ import { existsSync as Q, watch as rt } from "fs";
|
|
3
3
|
import { mkdir as q, readFile as S, writeFile as C } from "fs/promises";
|
4
4
|
import { join as a, relative as z, parse as ct, format as et } from "path";
|
5
5
|
import { render as lt } from "ejs";
|
6
|
-
import { l as e, a as h, g as K, i as dt, b as ft } from "../index-
|
6
|
+
import { l as e, a as h, g as K, i as dt, b as ft } from "../index-Bul-2Xse.js";
|
7
7
|
import { p as pt } from "../pascal-case-BQpR5PdN.js";
|
8
8
|
import { exec as gt } from "child_process";
|
9
9
|
import ut from "ora";
|
10
|
-
import { c as yt } from "../should-restart-
|
10
|
+
import { c as yt } from "../should-restart-BxXMLKul.js";
|
11
11
|
const st = (u) => new Promise((v, k) => {
|
12
12
|
gt(u, ($) => {
|
13
13
|
if ($) return k($);
|
package/compiler/index.cjs
CHANGED
@@ -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-
|
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-BFumiqfk.cjs");const e=require("../index-Df5O3s28.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.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
@@ -4,8 +4,8 @@ import "../dash-case-DBThphLm.js";
|
|
4
4
|
import "path";
|
5
5
|
import "fs";
|
6
6
|
import "fs/promises";
|
7
|
-
import "../parse-styles-
|
8
|
-
import { e as g, d as F, g as y, b as x, i as S, m as c, s as f, c as C } from "../index-
|
7
|
+
import "../parse-styles-CzXGidPn.js";
|
8
|
+
import { e as g, d as F, g as y, b as x, i as S, m as c, s as f, c as C } from "../index-Bul-2Xse.js";
|
9
9
|
import "../css/merge.js";
|
10
10
|
import "../define-templates-4A2yHcMF.js";
|
11
11
|
export {
|
package/css/keyframes.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-BFumiqfk.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const n=l||w.toHash(t),r=async(s={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:i="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...s},a=`${n} ${e} ${o} ${i} ${S} ${p} ${g} ${b}`;if(!y)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await m.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:f,keyframes:t}),r};exports.keyframes=C;
|
package/css/keyframes.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { p as m } from "../parse-styles-
|
1
|
+
import { p as m } from "../parse-styles-CzXGidPn.js";
|
2
2
|
import { t as j } from "../dash-case-DBThphLm.js";
|
3
3
|
const v = async ({ animationName: $, params: f, appendInitialStyles: l, ...t }) => {
|
4
4
|
const r = $ || j(t), o = async (n = {}) => {
|
package/generators/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var C=Object.defineProperty;var N=(a,s,t)=>s in a?C(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var m=(a,s,t)=>N(a,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../parse-styles-
|
1
|
+
"use strict";var C=Object.defineProperty;var N=(a,s,t)=>s in a?C(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var m=(a,s,t)=>N(a,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../parse-styles-BFumiqfk.cjs"),n=require("../dash-case-BJEkFEGQ.cjs");class y{constructor(s){m(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:s,variants:t,compoundVariants:e}=this.params;return n.toHash({base:s,variants:t,compoundVariants:e})}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${n.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[]}=this.params,{config:i}=this.buildContext,o={...s,variants:t,compoundVariants:e};return S.parseAndJoinStyles(o,`.${this.cssClassName}`,i,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[i,o])=>(t.includes(i)&&e.push("t_"+n.toHash(n.dashCase(`${i}-${o}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}class v extends y{constructor(s){super(s),this._params=s}}class x extends y{constructor(s,t){super(t),this.tagName=s,this._params=t}get priority(){var s;return this.params.priority?this.params.priority:typeof this.tagName=="function"||typeof this.tagName=="object"?(((s=this.tagName.generator)==null?void 0:s.priority)||0)+1:0}get clientProps(){const{element:s,variants:t={},compoundVariants:e=[],defaultVariants:i={},defaultProps:o={},passProps:d}=this.params,{callerName:f,isProduction:b}=this.buildContext,h=new Set([]),l=r=>{const c=i[r];c!==void 0?h.add(`${r}=${String(c)}`):h.add(r)};Object.keys(t).forEach(l),e.map(r=>Object.keys(r).forEach(l));const p=new Set([]);if(this.params.base){const r=JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);r&&r.forEach(c=>{const u=c.replace(/\{(?:-)?props\.([^}]+)\}/gi,"$1"),g=n.dashCase(u);u&&p.add(g)})}return{element:s,variantKeys:[...h],propValueKeys:[...p],passProps:d,defaultProps:o,attr:{"data-component-name":b?void 0:f}}}}exports.ClassNameGenerator=v;exports.StyledGenerator=x;
|
package/generators/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
var C = Object.defineProperty;
|
2
2
|
var x = (a, t, s) => t in a ? C(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
|
3
3
|
var u = (a, t, s) => x(a, typeof t != "symbol" ? t + "" : t, s);
|
4
|
-
import { p as v } from "../parse-styles-
|
4
|
+
import { p as v } from "../parse-styles-CzXGidPn.js";
|
5
5
|
import { t as f, d as h } from "../dash-case-DBThphLm.js";
|
6
6
|
class y {
|
7
7
|
constructor(t) {
|
@@ -4,7 +4,7 @@ import { d as K, t as J } from "./dash-case-DBThphLm.js";
|
|
4
4
|
import { join as r, parse as tt } from "path";
|
5
5
|
import { existsSync as mt, mkdirSync as H, statSync as Et, readdirSync as Ot, readFileSync as v, writeFileSync as j } from "fs";
|
6
6
|
import { readFile as Ct } from "fs/promises";
|
7
|
-
import { p as ft, a as Mt } from "./parse-styles-
|
7
|
+
import { p as ft, a as Mt } from "./parse-styles-CzXGidPn.js";
|
8
8
|
import { createLogger as Rt, transports as Jt, format as rt } from "winston";
|
9
9
|
import { mergeObjects as I, mergeFactories as zt } from "./css/merge.js";
|
10
10
|
import { d as Wt } from "./define-templates-4A2yHcMF.js";
|
@@ -1,5 +1,5 @@
|
|
1
|
-
"use strict";const Te=require("esbuild"),ve=require("child_process"),D=require("./dash-case-BJEkFEGQ.cjs"),c=require("path"),l=require("fs"),we=require("fs/promises"),Z=require("./parse-styles-
|
2
|
-
`)},Ve=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=be(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},be=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const a=t?`${t}.${n}`:n;return typeof o=="object"?be(o,a,s):s.add(t)}),[...s]):[],$e=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return l.existsSync(t)?t:$e(c.join(e,".."))},Re=async e=>{const t=$e(e);return await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Me=async e=>{const t=await Re(e);if(t)return t.type};let H;const Fe=async e=>{if(H)return H;const t=await Me(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("index-
|
1
|
+
"use strict";const Te=require("esbuild"),ve=require("child_process"),D=require("./dash-case-BJEkFEGQ.cjs"),c=require("path"),l=require("fs"),we=require("fs/promises"),Z=require("./parse-styles-BFumiqfk.cjs"),Q=require("winston"),J=require("./css/merge.cjs"),Oe=require("./define-templates-Cunsb_Tr.cjs"),ce=require("typescript");var re=typeof document<"u"?document.currentScript:null;function Ee(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 Se=Ee(Te),je=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,a]of Object.entries(e))if(typeof a!="function")if(a&&typeof a=="object"){const i=o.trim(),m=await je(a,[...t,i]);s.push(m)}else n[o]=a;if(Object.keys(n).length){const o=t.map(D.dashCase).join("-"),a="t_"+D.toHash(o,4),i=await Z.parseAndJoinStyles(n,`.${o}, .${a}`);s.push(i)}return s.join(`
|
2
|
+
`)},Ve=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=be(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},be=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const a=t?`${t}.${n}`:n;return typeof o=="object"?be(o,a,s):s.add(t)}),[...s]):[],$e=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return l.existsSync(t)?t:$e(c.join(e,".."))},Re=async e=>{const t=$e(e);return await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Me=async e=>{const t=await Re(e);if(t)return t.type};let H;const Fe=async e=>{if(H)return H;const t=await Me(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("index-Df5O3s28.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},B=Q.createLogger({level:"debug",format:Q.format.combine(Q.format.colorize(),Q.format.cli()),transports:[new Q.transports.Console({})]}),Je=e=>{B.error(e)};function Ce(e){return e?typeof e!="string"?Ce(String(e)):e.replace(/[^\d\w]/g,"."):""}const ze={"*, *::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"}},qe=(e,t)=>new Promise((s,n)=>{const o=setTimeout(()=>{n(new Error("Timeout"))},100),a=ce.createSourceFile("temp.ts",e,ce.ScriptTarget.Latest,!0);function i(m){if(ce.isVariableDeclaration(m)&&m.name.getText()===t){const S=m.getStart(),d=m.getEnd();clearTimeout(o),s([S,d])}m.forEachChild(i)}i(a)}),O={externalModules:[],rcFile:void 0,destDir:void 0},Pe=e=>{if(O.externalModules.length>0)return O.externalModules;const s=l.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return O.externalModules=n,n},z=async e=>{if(O.destDir)return O.destDir;const t=await fe(e),s=c.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},le=["salty","css","styles","styled"],Ne=(e=[])=>new RegExp(`\\.(${[...le,...e].join("|")})\\.`),ee=(e,t=[])=>Ne(t).test(e),xe=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=c.join(e,".saltyrc.json"),s=await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):xe(c.join(e,".."))},fe=async e=>{var n,o;const t=await xe(e),s=(n=t.projects)==null?void 0:n.find(a=>e.endsWith(a.dir||""));return s||((o=t.projects)==null?void 0:o.find(a=>a.dir===t.defaultProject))},He=async e=>{const t=await fe(e),s=await z(e),n=c.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=c.join(s,"salty.config.js"),a=await Fe(e),i=Pe(n);await Se.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:a,external:i});const m=Date.now(),{config:S}=await import(`${o}?t=${m}`);return{config:S,path:o}},ke=async(e,t)=>{var de,ye;const s=await z(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async w=>{const{contents:$,outputFilePath:K}=await U(e,w,s);Object.entries($).forEach(([_,P])=>{P.isMedia?n.mediaQueries.push([_,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${_};;${K}`))})}));const{config:o,path:a}=await He(e),i={...o},{mediaQueries:m}=n;i.mediaQueries=Object.fromEntries(m.map(([w,$])=>[`@${w}`,$]));const S=m.map(([w])=>`'@${w}'`).join(" | "),d=new Set,r=async(w,$=[])=>{if(!w)return[];const K=Object.entries(w).map(async([P,M])=>{const L=async T=>{if(!T)return;if(T instanceof Promise)return await L(await T);if(typeof T=="function")return await L(await T());if(typeof T=="object")return await r(T,[...$,P]);const oe=Ce(P),ie=D.dashCase(P),ae=[...$,oe].join(".");d.add(`"${ae}"`);const Y=[...$.map(D.dashCase),ie].join("-"),ge=Z.parseVariableTokens(T);return ge?`--${Y}: ${ge.transformed};`:`--${Y}: ${T};`};return await L(M)});return(await Promise.all(K)).flat()},g=async w=>{if(!w)return[];const $=Object.entries(w).map(async([_,P])=>{const M=await r(P);return _==="base"?M.join(""):i.mediaQueries[_]?`${i.mediaQueries[_]} { ${M.join("")} }`:`${_} { ${M.join("")} }`});return(await Promise.all($)).flat()},y=async w=>{if(!w)return[];const $=Object.entries(w).map(async([_,P])=>{const M=Object.entries(P).map(async([T,oe])=>{const ie=await r(oe,[_]),ae=`.${_}-${T}, [data-${_}="${T}"]`,Y=ie.join("");return`${ae} { ${Y} }`});return(await Promise.all(M)).flat()});return(await Promise.all($)).flat()},h=w=>({...w,responsive:void 0,conditional:void 0}),p=w=>n.variables.map($=>w==="static"?h($._current):$._current[w]),F=J.mergeObjects(h(o.variables),p("static")),x=await r(F),k=J.mergeObjects((de=o.variables)==null?void 0:de.responsive,p("responsive")),E=await g(k),q=J.mergeObjects((ye=o.variables)==null?void 0:ye.conditional,p("conditional")),A=await y(q),me=c.join(s,"css/_variables.css"),V=`:root { ${x.join("")} ${E.join("")} } ${A.join("")}`;l.writeFileSync(me,V),i.staticVariables=F;const te=c.join(s,"css/_global.css"),u=J.mergeObjects(o.global,n.globalStyles),j=await Z.parseAndJoinStyles(u,"");l.writeFileSync(te,`@layer global { ${j} }`);const b=c.join(s,"css/_reset.css"),C=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:ze,N=await Z.parseAndJoinStyles(C,"");l.writeFileSync(b,`@layer reset { ${N} }`);const v=c.join(s,"css/_templates.css"),R=J.mergeObjects(o.templates,n.templates),W=await je(R),I=Ve(R);l.writeFileSync(v,`@layer templates { ${W} }`),i.templates=R;const X=o.templates?[Oe.defineTemplates(o.templates)._setPath(`config;;${a}`)]:[],se=J.mergeFactories(n.templates,X);i.templatePaths=Object.fromEntries(Object.entries(se).map(([w,$])=>[w,$._path]));const G=c.join(s,"types/css-tokens.d.ts"),De=`
|
3
3
|
// Variable types
|
4
4
|
type VariableTokens = ${[...d].join("|")};
|
5
5
|
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
package/package.json
CHANGED
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";const S=require("./dash-case-BJEkFEGQ.cjs"),U=o=>r=>{if(typeof r!="string"||!o)return;let t=r;const l=[];return Object.values(o).forEach(n=>{const{pattern:h,transform:w}=n;t=t.replace(h,v=>{const{value:x,css:E}=w(v);return E&&l.push(E),x})}),{transformed:t,additionalCss:l}},N=o=>r=>typeof r!="string"||!/\{[^{}]+\}/g.test(r)?void 0:{transformed:r.replace(/\{([^{}]+)\}/g,(...n)=>{const h=S.dashCase(n[1].replaceAll(".","-"));return h.startsWith("-")?`-${h}`:`var(--${h})`})},k=N(),q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],J=(o,r,t)=>{if(q.some(n=>typeof n=="string"?n===o:n.test(o))){const n=(t==null?void 0:t.defaultUnit)||"px";return`${r}${n}`}return`${r}`},M=["Webkit","Moz","ms","O"],Q=o=>o.startsWith("-")?o:M.some(r=>o.startsWith(r))?`-${S.dashCase(o)}`:S.dashCase(o),y=async(o,r="",t,l=!1)=>{if(!o)throw new Error("No styles provided to parseStyles function!");const n=new Set,h=Object.entries(o),w=async([f,s])=>{var C;const e=f.trim().replace(/^\?+/g,""),b=Q(e),u=(i,c=";")=>`${b}:${i}${c}`,P={scope:r,config:t};if(typeof s=="function")return w([f,s(P)]);if(s instanceof Promise)return w([f,await s]);if(t!=null&&t.templates&&t.templatePaths[e])try{const[i,c]=t.templatePaths[e].split(";;"),a=await import(c),d=c.includes("salty.config"),p=d?a[i].templates:a[i],$=d?p[e]:p.params[e];if(p&&typeof $=="function"){const j=await $(s),[m]=await y(j,"");return m}}catch(i){console.error(`Error loading template "${e}" from path "${t.templatePaths[e]}"`,i);return}if(t!=null&&t.templates&&t.templates[e]){if(l)return;const c=s.split(".").reduce((a,d)=>a[d],t.templates[e]);if(c){const[a]=await y(c,"");return a}console.warn(`Template "${e}" with path of "${s}" was not found in config!`);return}if(typeof s=="object"){if(!s)return;if(s.isColor)return u(s.toString());if(e==="defaultVariants")return;if(e==="variants"){const a=Object.entries(s);for(const[d,p]of a){if(!p)continue;const $=Object.entries(p);for(const[j,m]of $){if(!m)continue;const O=`${r}.${d}-${j}`;(await y(m,O,t)).forEach(z=>n.add(z))}}return}if(e==="compoundVariants"){for(const a of s){const{css:d,...p}=a,$=Object.entries(p).reduce((m,[O,W])=>`${m}.${O}-${W}`,r);(await y(d,$,t)).forEach(m=>n.add(m))}return}if(e.startsWith("@")){const a=((C=t==null?void 0:t.mediaQueries)==null?void 0:C[e])||e,d=await T(s,r,t),p=`${a} { ${d} }`;n.add(p);return}const i=f.includes("&")?e.replaceAll("&",r):e.startsWith(":")?`${r}${e}`:`${r} ${e}`;(await y(s,i,t)).forEach(a=>n.add(a));return}if(typeof s=="number"){const i=J(b,s,t);return u(i)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${b}`);return u(s)},v=h.map(w),{modifiers:x}=t||{},E=[N(),U(x)],A=(await Promise.all(v).then(f=>Promise.all(f.map(s=>E.reduce(async(e,b)=>{const u=await e;if(!u)return u;const P=await b(u);if(!P)return u;const{transformed:C,additionalCss:i}=P;let c="";if(i)for(const a of i)c+=await T(a,"");return`${c}${C}`},Promise.resolve(s)))))).filter(f=>f!==void 0).join(`
|
2
|
+
`);if(!A.trim())return Array.from(n);const V=r?`${r} {
|
3
|
+
${A}
|
4
|
+
}`:A;return n.has(V)?Array.from(n):[V,...n]},T=async(o,r,t,l=!1)=>(await y(o,r,t,l)).join(`
|
5
|
+
`);exports.parseAndJoinStyles=T;exports.parseVariableTokens=k;
|
@@ -44,7 +44,7 @@ const U = (o) => (r) => {
|
|
44
44
|
if (!o) throw new Error("No styles provided to parseStyles function!");
|
45
45
|
const n = /* @__PURE__ */ new Set(), h = Object.entries(o), w = async ([l, s]) => {
|
46
46
|
var j;
|
47
|
-
const e = l.trim(), b = k(e), m = (a, c = ";") => `${b}:${a}${c}`, P = { scope: r, config: t };
|
47
|
+
const e = l.trim().replace(/^\?+/g, ""), b = k(e), m = (a, c = ";") => `${b}:${a}${c}`, P = { scope: r, config: t };
|
48
48
|
if (typeof s == "function") return w([l, s(P)]);
|
49
49
|
if (s instanceof Promise) return w([l, await s]);
|
50
50
|
if (t != null && t.templates && t.templatePaths[e])
|
package/server/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-B2i9_wsr.cjs");exports.checkShouldRestart=e.checkShouldRestart;
|
package/server/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";const s=require("fs/promises"),r=require("./index-
|
1
|
+
"use strict";const s=require("fs/promises"),r=require("./index-Df5O3s28.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)||/.+keyframes\(.+/.test(e))};exports.checkShouldRestart=i;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { readFile as r } from "fs/promises";
|
2
|
-
import { i as e } from "./index-
|
2
|
+
import { i as e } from "./index-Bul-2Xse.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;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
"use strict";const S=require("./dash-case-BJEkFEGQ.cjs"),U=o=>r=>{if(typeof r!="string"||!o)return;let t=r;const l=[];return Object.values(o).forEach(n=>{const{pattern:h,transform:w}=n;t=t.replace(h,v=>{const{value:x,css:E}=w(v);return E&&l.push(E),x})}),{transformed:t,additionalCss:l}},N=o=>r=>typeof r!="string"||!/\{[^{}]+\}/g.test(r)?void 0:{transformed:r.replace(/\{([^{}]+)\}/g,(...n)=>{const h=S.dashCase(n[1].replaceAll(".","-"));return h.startsWith("-")?`-${h}`:`var(--${h})`})},k=N(),q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],J=(o,r,t)=>{if(q.some(n=>typeof n=="string"?n===o:n.test(o))){const n=(t==null?void 0:t.defaultUnit)||"px";return`${r}${n}`}return`${r}`},M=["Webkit","Moz","ms","O"],Q=o=>o.startsWith("-")?o:M.some(r=>o.startsWith(r))?`-${S.dashCase(o)}`:S.dashCase(o),y=async(o,r="",t,l=!1)=>{if(!o)throw new Error("No styles provided to parseStyles function!");const n=new Set,h=Object.entries(o),w=async([f,s])=>{var C;const e=f.trim(),b=Q(e),u=(i,c=";")=>`${b}:${i}${c}`,P={scope:r,config:t};if(typeof s=="function")return w([f,s(P)]);if(s instanceof Promise)return w([f,await s]);if(t!=null&&t.templates&&t.templatePaths[e])try{const[i,c]=t.templatePaths[e].split(";;"),a=await import(c),d=c.includes("salty.config"),p=d?a[i].templates:a[i],$=d?p[e]:p.params[e];if(p&&typeof $=="function"){const j=await $(s),[m]=await y(j,"");return m}}catch(i){console.error(`Error loading template "${e}" from path "${t.templatePaths[e]}"`,i);return}if(t!=null&&t.templates&&t.templates[e]){if(l)return;const c=s.split(".").reduce((a,d)=>a[d],t.templates[e]);if(c){const[a]=await y(c,"");return a}console.warn(`Template "${e}" with path of "${s}" was not found in config!`);return}if(typeof s=="object"){if(!s)return;if(s.isColor)return u(s.toString());if(e==="defaultVariants")return;if(e==="variants"){const a=Object.entries(s);for(const[d,p]of a){if(!p)continue;const $=Object.entries(p);for(const[j,m]of $){if(!m)continue;const O=`${r}.${d}-${j}`;(await y(m,O,t)).forEach(z=>n.add(z))}}return}if(e==="compoundVariants"){for(const a of s){const{css:d,...p}=a,$=Object.entries(p).reduce((m,[O,W])=>`${m}.${O}-${W}`,r);(await y(d,$,t)).forEach(m=>n.add(m))}return}if(e.startsWith("@")){const a=((C=t==null?void 0:t.mediaQueries)==null?void 0:C[e])||e,d=await T(s,r,t),p=`${a} { ${d} }`;n.add(p);return}const i=f.includes("&")?e.replaceAll("&",r):e.startsWith(":")?`${r}${e}`:`${r} ${e}`;(await y(s,i,t)).forEach(a=>n.add(a));return}if(typeof s=="number"){const i=J(b,s,t);return u(i)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${b}`);return u(s)},v=h.map(w),{modifiers:x}=t||{},E=[N(),U(x)],A=(await Promise.all(v).then(f=>Promise.all(f.map(s=>E.reduce(async(e,b)=>{const u=await e;if(!u)return u;const P=await b(u);if(!P)return u;const{transformed:C,additionalCss:i}=P;let c="";if(i)for(const a of i)c+=await T(a,"");return`${c}${C}`},Promise.resolve(s)))))).filter(f=>f!==void 0).join(`
|
2
|
-
`);if(!A.trim())return Array.from(n);const V=r?`${r} {
|
3
|
-
${A}
|
4
|
-
}`:A;return n.has(V)?Array.from(n):[V,...n]},T=async(o,r,t,l=!1)=>(await y(o,r,t,l)).join(`
|
5
|
-
`);exports.parseAndJoinStyles=T;exports.parseVariableTokens=k;
|