@salty-css/core 0.0.1-alpha.287 → 0.0.1-alpha.289

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"),A=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),e=require("../index-Dg98Xd3x.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-2eX-l4VO.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+`
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-CxAphBMJ.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-Cp2E_1Lh.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-6JCRY_wd.js";
6
+ import { l as e, a as h, g as K, i as dt, b as ft } from "../index-C8WlBhQE.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-YBRJU0GU.js";
10
+ import { c as yt } from "../should-restart-DaT4pHXq.js";
11
11
  const st = (u) => new Promise((v, k) => {
12
12
  gt(u, ($) => {
13
13
  if ($) return k($);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("fs/promises"),r=require("path"),t=require("../helpers-DVANmpVz.cjs"),i=async()=>{const o=t.getCorePackageRoot(),c=r.join(o,"cache/config-cache.json"),e=await n.readFile(c,"utf8");if(!e)throw new Error("Could not find config cache file");return JSON.parse(e)};exports.resolveDynamicConfigCache=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("fs/promises"),r=require("path"),t=require("../helpers-CC5pFyba.cjs"),i=async()=>{const o=t.getCorePackageRoot(),c=r.join(o,"cache/config-cache.json"),e=await n.readFile(c,"utf8");if(!e)throw new Error("Could not find config cache file");return JSON.parse(e)};exports.resolveDynamicConfigCache=i;
@@ -1,6 +1,6 @@
1
1
  import { readFile as r } from "fs/promises";
2
2
  import { join as t } from "path";
3
- import { g as n } from "../helpers-C1RIrlCB.js";
3
+ import { g as n } from "../helpers-nHqH4L9L.js";
4
4
  const s = async () => {
5
5
  const e = n(), c = t(e, "cache/config-cache.json"), o = await r(c, "utf8");
6
6
  if (!o) throw new Error("Could not find config cache file");
@@ -1 +1,2 @@
1
1
  export declare const getCorePackageRoot: () => string;
2
+ export declare const resolveExportValue: <T>(value: unknown, maxLevel?: number, _level?: number) => Promise<T>;
@@ -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-DZYIEhB4.cjs");require("../parsers/index.cjs");const e=require("../index-Dg98Xd3x.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.cjs");require("../helpers-DVANmpVz.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-DZYIEhB4.cjs");require("../parsers/index.cjs");const e=require("../index-CxAphBMJ.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.cjs");require("../helpers-CC5pFyba.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
@@ -6,10 +6,10 @@ import "fs";
6
6
  import "fs/promises";
7
7
  import "../parse-styles-DLPgVsVQ.js";
8
8
  import "../parsers/index.js";
9
- import { e as y, d as x, g as S, b as c, i as f, m as C, s as E, c as b } from "../index-6JCRY_wd.js";
9
+ import { e as y, d as x, g as S, b as c, i as f, m as C, s as E, c as b } from "../index-C8WlBhQE.js";
10
10
  import "../css/merge.js";
11
11
  import "../define-templates-4A2yHcMF.js";
12
- import "../helpers-C1RIrlCB.js";
12
+ import "../helpers-nHqH4L9L.js";
13
13
  export {
14
14
  y as compileSaltyFile,
15
15
  x as generateConfigStyles,
package/css/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-DZYIEhB4.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../parse-styles-DZYIEhB4.cjs"),O=require("../dash-case-BJEkFEGQ.cjs"),h=({animationName:l,params:y,appendInitialStyles:$,...t})=>{const i=async(d={})=>{const n=l||O.toHash(t),r=async()=>{const{duration:s="500ms",easing:e="ease-in-out",delay:o="0s",iterationCount:c="1",direction:g="normal",fillMode:b="forwards",playState:j="running"}={...y,...d},a=`${n} ${s} ${e} ${o} ${c} ${g} ${b} ${j}`;if(!$)return a;const m=t.from||t["0%"];if(!m)return a;const w=await u.parseAndJoinStyles(m,"");return`${a};${w}`},f=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await u.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),S=(await Promise.all(f)).join(""),p=`@keyframes ${n} {${S}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:p,keyframes:t}),r};return Object.assign(i,{_shouldResolve:!0}),i};exports.keyframes=h;
@@ -18,5 +18,5 @@ interface KeyframesParams {
18
18
  playState?: StyleValue<'animationPlayState'>;
19
19
  }
20
20
  type KeyframesProps = Keyframes & KeyframesConfig;
21
- export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => Promise<(params?: KeyframesParams) => Promise<string>>;
21
+ export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => Promise<() => Promise<string>>;
22
22
  export {};
package/css/keyframes.js CHANGED
@@ -1,34 +1,39 @@
1
- import { p as m } from "../parse-styles-DLPgVsVQ.js";
2
- import { t as j } from "../dash-case-DBThphLm.js";
3
- const v = async ({ animationName: $, params: f, appendInitialStyles: l, ...t }) => {
4
- const r = $ || j(t), o = async (n = {}) => {
5
- const {
6
- duration: s = "500ms",
7
- easing: e = "ease-in-out",
8
- delay: i = "0s",
9
- iterationCount: d = "1",
10
- direction: S = "normal",
11
- fillMode: g = "forwards",
12
- playState: w = "running"
13
- } = { ...f, ...n }, a = `${r} ${s} ${e} ${i} ${d} ${S} ${g} ${w}`;
14
- if (!l) return a;
15
- const c = t.from || t["0%"];
16
- if (!c) return a;
17
- const b = await m(c, "");
18
- return `${a};${b}`;
19
- }, u = Object.entries(t).map(async ([n, s]) => {
20
- if (!s) return "";
21
- const e = await m(s, "");
22
- return `${typeof n == "number" ? `${n}%` : n}{${e}}`;
23
- }), p = (await Promise.all(u)).join(""), y = `@keyframes ${r} {${p}}`;
24
- return Object.assign(o, {
25
- toString: o,
26
- isKeyframes: !0,
27
- animationName: r,
28
- css: y,
29
- keyframes: t
30
- }), o;
1
+ import { p as $ } from "../parse-styles-DLPgVsVQ.js";
2
+ import { t as O } from "../dash-case-DBThphLm.js";
3
+ const N = ({ animationName: u, params: f, appendInitialStyles: l, ...t }) => {
4
+ const i = async (y = {}) => {
5
+ const r = u || O(t), e = async () => {
6
+ const {
7
+ duration: s = "500ms",
8
+ easing: n = "ease-in-out",
9
+ delay: o = "0s",
10
+ iterationCount: c = "1",
11
+ direction: S = "normal",
12
+ fillMode: b = "forwards",
13
+ playState: j = "running"
14
+ } = { ...f, ...y }, a = `${r} ${s} ${n} ${o} ${c} ${S} ${b} ${j}`;
15
+ if (!l) return a;
16
+ const m = t.from || t["0%"];
17
+ if (!m) return a;
18
+ const w = await $(m, "");
19
+ return `${a};${w}`;
20
+ }, d = Object.entries(t).map(async ([s, n]) => {
21
+ if (!n) return "";
22
+ const o = await $(n, "");
23
+ return `${typeof s == "number" ? `${s}%` : s}{${o}}`;
24
+ }), p = (await Promise.all(d)).join(""), g = `@keyframes ${r} {${p}}`;
25
+ return Object.assign(e, {
26
+ toString: e,
27
+ isKeyframes: !0,
28
+ animationName: r,
29
+ css: g,
30
+ keyframes: t
31
+ }), e;
32
+ };
33
+ return Object.assign(i, {
34
+ _shouldResolve: !0
35
+ }), i;
31
36
  };
32
37
  export {
33
- v as keyframes
38
+ N as keyframes
34
39
  };
@@ -0,0 +1 @@
1
+ "use strict";const i=require("path");var n=typeof document<"u"?document.currentScript:null;const c=()=>{let{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:n&&n.tagName.toUpperCase()==="SCRIPT"&&n.src||new URL("helpers-CC5pFyba.cjs",document.baseURI).href);for(;/core\/?(src\/)?$/.test(e)===!1;)e=i.join(e,"../");return e},o=async(e,t=10,r=0)=>r>=t?e:e instanceof Promise?await o(await e,r+1,t):typeof e=="function"&&"_shouldResolve"in e?await o(await e(),r+1,t):e;exports.getCorePackageRoot=c;exports.resolveExportValue=o;
@@ -0,0 +1,11 @@
1
+ import { join as i } from "path";
2
+ const a = () => {
3
+ let { pathname: t } = new URL(import.meta.url);
4
+ for (; /core\/?(src\/)?$/.test(t) === !1; )
5
+ t = i(t, "../");
6
+ return t;
7
+ }, n = async (t, r = 10, o = 0) => o >= r ? t : t instanceof Promise ? await n(await t, o + 1, r) : typeof t == "function" && "_shouldResolve" in t ? await n(await t(), o + 1, r) : t;
8
+ export {
9
+ a as g,
10
+ n as r
11
+ };