@salty-css/core 0.0.1-alpha.61 → 0.0.1-alpha.62
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 Z=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ee=require("ejs"),te=require("../compiler/index.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),_=require("winston"),ne=require("child_process"),se=require("ora");var H=typeof document<"u"?document.currentScript:null;const t=_.createLogger({level:"debug",format:_.format.combine(_.format.colorize(),_.format.cli()),transports:[new _.transports.Console({})]}),m=r=>{t.error(r)},B=r=>new Promise((h,C)=>{ne.exec(r,P=>{if(P)return C(P);h()})}),b=async(...r)=>{const h=r.map(F=>F.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),C=se(`Installing packages: ${h}`).start(),P=r.join(" ");await B(`npm install ${P}`),C.succeed(`Installed packages: ${h}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function A(r){try{if(!ae())return;await B(`./node_modules/.bin/prettier --write "${r}"`),t.info(`Formatted ${r} with Prettier`)}catch(h){t.error(`Error formatting ${r} with Prettier:`,h)}}async function oe(){const r=new Z.Command;r.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const h={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ee=require("ejs"),te=require("../compiler/index.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),_=require("winston"),ne=require("child_process"),se=require("ora");var H=typeof document<"u"?document.currentScript:null;const t=_.createLogger({level:"debug",format:_.format.combine(_.format.colorize(),_.format.cli()),transports:[new _.transports.Console({})]}),m=r=>{t.error(r)},B=r=>new Promise((h,C)=>{ne.exec(r,P=>{if(P)return C(P);h()})}),b=async(...r)=>{const h=r.map(F=>F.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),C=se(`Installing packages: ${h}`).start(),P=r.join(" ");await B(`npm install ${P}`),C.succeed(`Installed packages: ${h}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function A(r){try{if(!ae())return;await B(`./node_modules/.bin/prettier --write "${r}"`),t.info(`Formatted ${r} with Prettier`)}catch(h){t.error(`Error formatting ${r} with Prettier:`,h)}}async function oe(){const r=new Z.Command;r.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const h={"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"))},C=async(i,a)=>{const{default:o}=await h[i],u=ee.render(o,a);return{fileName:i,content:u}},P=async()=>{const i=n.join(process.cwd(),".saltyrc");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},F=n.join(process.cwd(),"package.json"),$=async(i=F)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},V=async(i,a=F)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},z=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:H&&H.tagName.toUpperCase()==="SCRIPT"&&H.src||new URL("bin/main.cjs",document.baseURI).href);return $(i)},M=await(async()=>(await P()).defaultProject)(),k=await z(),J={core:`@salty-css/core@${k.version}`,react:`@salty-css/react@${k.version}`,eslintPluginCore:`@salty-css/eslint-plugin-core@${k.version}`,vite:`@salty-css/vite@${k.version}`,next:`@salty-css/next@${k.version}`},T=i=>{const a=i==="."?"":i,o=process.cwd();return n.join(o,a)};r.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 $().catch(()=>{}))return m("Salty CSS project must be initialized in a directory with a package.json file.");t.info("Initializing a new Salty-CSS project!");const{dir:o=i,cssFile:u,skipInstall:g}=this.opts();if(!o)return m("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");g||(await b(J.core,J.react),await b(`-D ${J.eslintPluginCore}`));const f=process.cwd(),l=T(o),j=await Promise.all([C("salty.config.ts"),C("saltygen/index.css")]);await s.mkdir(l,{recursive:!0});const y=j.map(async({fileName:e,content:d})=>{const c=n.join(l,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.debug("File already exists: "+c);return}const v=e.split("/").slice(0,-1).join("/");v&&await s.mkdir(n.join(l,v),{recursive:!0}),t.info("Creating file: "+c),await s.writeFile(c,d),await A(c)});await Promise.all(y);const D=n.relative(f,l)||".",p=n.join(f,".saltyrc"),w=await s.readFile(p,"utf-8").catch(()=>{});if(w===void 0){t.info("Creating file: "+p);const d=JSON.stringify({defaultProject:D,projects:[D]},null,2);await s.writeFile(p,d)}else{t.info("Edit file: "+p);const e=JSON.parse(w),d=new Set((e==null?void 0:e.projects)||[]);d.add(D),e.projects=[...d];const c=JSON.stringify(e,null,2);await s.writeFile(p,c)}const E=n.join(f,".gitignore"),I=await s.readFile(E,"utf-8").catch(()=>{});I!==void 0&&(I.includes("saltygen")||(t.info("Edit file: "+E),await s.writeFile(E,I+`
|
2
2
|
|
3
3
|
# Salty-CSS
|
4
4
|
saltygen
|
package/bin/main.js
CHANGED
@@ -36,7 +36,7 @@ async function xt() {
|
|
36
36
|
o.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");
|
37
37
|
const h = {
|
38
38
|
// Core files
|
39
|
-
"salty.config.ts": import("../salty.config-
|
39
|
+
"salty.config.ts": import("../salty.config-BhBY_oOk.js"),
|
40
40
|
"saltygen/index.css": import("../index-D_732b92.js"),
|
41
41
|
// React
|
42
42
|
"react/react-styled-file.ts": import("../react-styled-file-CGVf5n1B.js")
|
package/config/config-types.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { CssStyles } from '../types';
|
2
|
+
import { OrString } from '../types/util-types';
|
2
3
|
type CssTemplate = CssStyles | {
|
3
4
|
[key: PropertyKey]: CssTemplate;
|
4
5
|
};
|
@@ -55,5 +56,9 @@ export interface SaltyConfig {
|
|
55
56
|
* The modifiers that can transform css values.
|
56
57
|
*/
|
57
58
|
modifiers?: CssModifiers;
|
59
|
+
/**
|
60
|
+
* Define modules that should not be bundled when generating the css file. This improves the performance of the css generation and can help with issues relared to external packages being imported in an environment that does not support them.
|
61
|
+
*/
|
62
|
+
externalModules?: ('react' | 'react-dom' | OrString)[];
|
58
63
|
}
|
59
64
|
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { defineConfig } from '@salty-css/core/config';
|
2
2
|
|
3
3
|
export const config = defineConfig({
|
4
4
|
// Add your custom config here
|
5
|
+
externalModules: ['react', 'react-dom']
|
5
6
|
});
|
6
|
-
`;exports.default=
|
7
|
+
`;exports.default=e;
|