@adamlui/scss-to-css 1.7.7 → 1.7.8

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/README.md CHANGED
@@ -26,11 +26,12 @@
26
26
 
27
27
  ### Recursively compile all SCSS files into minified CSS.
28
28
 
29
- <a href="https://www.npmjs.com/package/@adamlui/scss-to-css"><img height=31 src="https://img.shields.io/npm/dt/%40adamlui%2Fscss-to-css?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
29
+ <a href="https://www.npmjs.com/package/@adamlui/scss-to-css"><img height=31 src="https://img.shields.io/npm/dm/%40adamlui%2Fscss-to-css?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
30
30
  <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
31
- <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.7.7"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.7-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
31
+ <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.7.8"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.8-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
32
32
  <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/%40adamlui%2Fscss-to-css?style=for-the-badge&logo=ebox&logoColor=white&color=blue&labelColor=464646"></a>
33
33
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:scss-to-css/src/scss-to-css.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Ascss-to-css%2Fsrc%2Fscss-to-css.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
34
+ <a href="https://github.com/toolleeo/cli-apps#conversion"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-fc7bb7?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
35
 
35
36
  <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
36
37
 
@@ -1,5 +1,5 @@
1
- const f=require("fs"),p=require("path"),a=require("sass");function d(r,s={}){var e={recursive:!0,verbose:!0,dotFolders:!1};if("string"!=typeof r)return console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string.");var o=p.resolve(process.cwd(),r);if(f.existsSync(o)){const i=JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),c=Object.keys(e).join(", ");var n=()=>{console.info(`findSCSS() » Valid options: [ ${c} ]`),console.info("findSCSS() » If omitted, default settings are: "+i)};if("object"==typeof s){for(const a in s){if(!Object.prototype.hasOwnProperty.call(e,a)&&"isRecursing"!==a)return console.error(`findSCSS() » ERROR: \`${a}\` is an invalid option.`),void n();if("boolean"!=typeof s[a])return console.error(`findSCSS() » ERROR: [${a}] option can only be \`true\` or \`false\`.`)}s={...e,...s};const t=f.readdirSync(r),l=[];return s.verbose&&!s.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),t.forEach(e=>{var o=p.resolve(r,e);f.statSync(o).isDirectory()&&"node_modules"!=e&&(s.dotFolders||!e.startsWith("."))&&s.recursive?l.push(...d(o,{...s,isRecursing:!0})):e.endsWith(".scss")&&l.push(o)}),!s.isRecursing&&s.verbose&&(console.info("findSCSS() » Search complete! "+(0===l.length?"No":l.length)+` file${1<l.length?"s":""} found.`),"compile"===d.caller.name||require.main.filename.endsWith("cli.js")||console.info("findSCSS() » Check returned array.")),s.isRecursing||0<l.length?l:[]}console.error("findSCSS() » ERROR: 2nd arg [options] can only be an object of key/values."),console.info("findSCSS() » Example valid call: findSCSS('assets/scss', { verbose: false, dotFolders: true })"),n()}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${o} does not exist.`)}function e(e,r={}){var o={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0};if("string"!=typeof e)return console.error("compile() » ERROR: 1st arg <inputPath> must be a string.");if(e=p.resolve(process.cwd(),e),f.existsSync(e)){const i=JSON.stringify(o,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),c=Object.keys(o).join(", ");var s=()=>{console.info(`compile() » Valid options: [ ${c} ]`),console.info("compile() » If omitted, default settings are: "+i)};if("object"!=typeof r)console.error("compile() » ERROR: 2nd [options] can only be an object of key/values."),console.info("compile() » Example valid call: compile('assets/scss', { recursive: false, minify: false })"),s();else{for(const l in r){if(!Object.prototype.hasOwnProperty.call(o,l))return console.error(`compile() » ERROR: \`${l}\` is an invalid option.`),void s();if("boolean"!=typeof r[l])return console.error(`compile() » ERROR: [${l}] option can only be \`true\` or \`false\`.`)}const t={style:(r={...o,...r}).minify?"compressed":"expanded",sourceMap:r.sourceMaps};if(f.existsSync(e)){if(!e.endsWith(".scss"))return d(e,{recursive:r.recursive,verbose:r.verbose,dotFolders:r.dotFolders})?.map(e=>{r.verbose&&console.info(`compile() » Compiling ${e}...`);try{var o=a.compile(e,t);return{code:o.css,srcMap:o.sourceMap,srcPath:e}}catch(e){return console.error(`
1
+ const c=require("fs"),t=require("path"),n=require("sass");function l(o,s={}){var e={recursive:!0,verbose:!0,dotFolders:!1};if("string"!=typeof o)return console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string.");var r=t.resolve(process.cwd(),o);if(c.existsSync(r)){if(f(s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){s={...e,...s};const i=c.readdirSync(o),n=[];return s.verbose&&!s.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),i.forEach(e=>{var r=t.resolve(o,e);c.statSync(r).isDirectory()&&"node_modules"!=e&&(s.dotFolders||!e.startsWith("."))&&s.recursive?n.push(...l(r,{...s,isRecursing:!0})):e.endsWith(".scss")&&n.push(r)}),!s.isRecursing&&s.verbose&&(console.info("findSCSS() » Search complete! "+(0===n.length?"No":n.length)+` file${0==n.length||1<n.length?"s":""} found.`),"compile"===l.caller.name||require.main.filename.endsWith("cli.js")||console.info("findSCSS() » Check returned array.")),s.isRecursing||0<n.length?n:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${r} does not exist.`)}function e(e,o={}){var r={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0};if("string"!=typeof e)return console.error("compile() » ERROR: 1st arg <inputPath> must be a string.");if(e=t.resolve(process.cwd(),e),c.existsSync(e)){if(f(o,r,"compile('assets/scss', { recursive: false, minify: false })")){const i={style:(o={...r,...o}).minify?"compressed":"expanded",sourceMap:o.sourceMaps};if(c.existsSync(e)){if(!e.endsWith(".scss"))return r=l(e,{recursive:o.recursive,verbose:o.verbose,dotFolders:o.dotFolders})?.map(e=>{o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var r=n.compile(e,i);return{code:r.css,srcMap:r.sourceMap,srcPath:e}}catch(e){return console.error(`
2
2
  compile() » ERROR: ${e.message}
3
- `),{error:e}}}).filter(e=>!e.error);r.verbose&&console.info(`compile() » Compiling ${e}...`);try{var n=a.compile(e,t);return{code:n.css,srcMap:n.sourceMap,srcPath:p.resolve(process.cwd(),e)}}catch(e){return console.error(`
3
+ `),{error:e}}}).filter(e=>!e.error),o.verbose&&(0<r.length?console.info("compile() » Compilation complete. Check returned object."):console.info("compile() » No SCSS files processed.")),r;o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var s=n.compile(e,i);return o.verbose&&!require.main.filename.endsWith("cli.js")&&console.info("compile() » Compilation complete. Check returned object."),{code:s.css,srcMap:s.sourceMap,srcPath:t.resolve(process.cwd(),e)}}catch(e){return console.error(`
4
4
  compile() » ERROR: ${e.message}
5
- `),{error:e}}}}}else console.error("compile() » ERROR: 1st arg <inputPath> must be an existing directory or file."),console.error(`compile() » ${e} does not exist.`)}module.exports={compile:e,findSCSS:d};
5
+ `),{error:e}}}}}else console.error("compile() » ERROR: 1st arg <inputPath> must be an existing directory or file."),console.error(`compile() » ${e} does not exist.`)}function f(e,r,o){const s=(f.caller?.name||"validateOptions")+"() » ",i=JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(r).join(", "),c=Object.keys(r).filter(e=>"boolean"==typeof r[e]),t=Object.keys(r).filter(e=>Number.isInteger(r[e]));var l=()=>{console.info(s+`Valid options: [ ${n} ]`),console.info(s+"If omitted, default settings are: "+i)};if("object"!=typeof e)return console.error(s+"ERROR: [options] can only be an object of key/values."),console.info(s+"Example valid call: "+o),l(),!1;for(const a in e){if("isRecursing"!=a&&!Object.prototype.hasOwnProperty.call(r,a))return console.error(s+`ERROR: \`${a}\` is an invalid option.`),l(),!1;if(c.includes(a)&&"boolean"!=typeof e[a])return console.error(s+`ERROR: [${a}] option can only be \`true\` or \`false\`.`),!1;if(t.includes(a)&&(e[a]=parseInt(e[a],10),isNaN(e[a])||e[a]<1))return console.error(s+`ERROR: [${a}] option can only be an integer > 0.`),!1}return!0}module.exports={compile:e,findSCSS:l};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.7.7",
3
+ "version": "1.7.8",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -58,6 +58,6 @@
58
58
  "url": "https://github.com/sponsors/adamlui"
59
59
  },
60
60
  "devDependencies": {
61
- "@adamlui/minify.js": "^1.4.8"
61
+ "@adamlui/minify.js": "^1.4.10"
62
62
  }
63
63
  }