@adamlui/scss-to-css 1.10.1 → 1.10.2

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
@@ -29,7 +29,7 @@
29
29
 
30
30
  <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>
31
31
  <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>
32
- <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.1"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.1-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
32
+ <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.2"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.2-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
33
33
  <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>
34
34
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/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_scss-to-css%3Anode.js%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>
35
35
  <a href="https://github.com/toolleeo/cli-apps#conversion"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
@@ -170,7 +170,7 @@ You can also import **scss-to-css** into your app to use its API methods, both a
170
170
  #### ECMAScript*:
171
171
 
172
172
  ```js
173
- import * as scssToCSS from '@adamlui/scss-to-css';
173
+ import scssToCSS from '@adamlui/scss-to-css';
174
174
  ```
175
175
 
176
176
  #### CJS:
@@ -4,9 +4,9 @@
4
4
  * Source: https://code.scsstocss.org/node.js
5
5
  * Documentation: https://docs.scsstocss.org/node.js
6
6
  */
7
- const fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(o,r={}){var e="https://docs.scsstocss.org/node.js/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1,ignoreFiles:[]};if("string"!=typeof o)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var i=path.resolve(process.cwd(),o);if(fs.existsSync(i)){if(validateOptions(r,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){r={...s,...r};const n=fs.readdirSync(o),c=[];return r.verbose&&!r.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),n.forEach(e=>{var s=path.resolve(o,e);fs.statSync(s).isDirectory()&&"node_modules"!=e&&r.recursive&&(r.dotFolders||!e.startsWith("."))?c.push(...findSCSS(s,{...r,isRecursing:!0})):e.endsWith(".scss")&&!r.ignoreFiles.includes(e)?c.push(s):r.verbose&&r.ignoreFiles.includes(e)&&console.info(`findSCSS() » ** ${e} ignored due to [options.ignoreFiles]`)}),!r.isRecursing&&r.verbose&&(console.info("findSCSS() » Search complete! "+(0==c.length?"No":c.length)+` file${1==c.length?"":"s"} found.`),"compile"==findSCSS.caller.name||/cli(?:\.min)?\.js$/.test(require.main.filename)||console.info("findSCSS() » Check returned array.")),r.isRecursing||0<c.length?c:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${i} does not exist.`),console.info("findSCSS() » For more help, please visit "+e)}}function compile(e,o={}){var s="https://docs.scsstocss.org/node.js/#compileinput-options",r={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0,ignoreFiles:[],comment:""};if("string"!=typeof e)console.error("compile() » ERROR: 1st arg <input> must be a string."),console.info("compile() » For more help, please visit "+s);else if(validateOptions(o,r,s,"compile('assets/scss', { recursive: false, minify: false })")){const t={style:(o={...r,...o}).minify?"compressed":"expanded",sourceMap:o.sourceMaps};if(fs.existsSync(e)){if(!e.endsWith(".scss"))return s=findSCSS(e,{recursive:o.recursive,verbose:o.verbose,dotFolders:o.dotFolders,ignoreFiles:o.ignoreFiles})?.map(e=>{o.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var s=sass.compile(e,t);return o.comment&&(s.css=c(s.css,o.comment)),{code:s.css,srcMap:s.sourceMap,srcPath:e,error:void 0}}catch(e){return console.error(`
7
+ const fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(o,r={}){var e="https://docs.scsstocss.org/node.js/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1,ignoreFiles:[]};if("string"!=typeof o)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var i=path.resolve(process.cwd(),o);if(fs.existsSync(i)){if(validateOptions(r,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){r={...s,...r};const n=fs.readdirSync(o),c=[];return r.verbose&&!r.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),n.forEach(e=>{var s=path.resolve(o,e);fs.statSync(s).isDirectory()&&"node_modules"!=e&&r.recursive&&(r.dotFolders||!e.startsWith("."))?c.push(...findSCSS(s,{...r,isRecursing:!0})):e.endsWith(".scss")&&!r.ignoreFiles.includes(e)?c.push(s):r.verbose&&r.ignoreFiles.includes(e)&&console.info(`findSCSS() » ** ${e} ignored due to [options.ignoreFiles]`)}),r.verbose&&!r.isRecursing&&(console.info("findSCSS() » Search complete! "+(0==c.length?"No":c.length)+` file${1==c.length?"":"s"} found.`),"compile"!=findSCSS.caller.name)&&"undefined"!=typeof window&&console.info("findSCSS() » Check returned array."),r.isRecursing||0<c.length?c:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${i} does not exist.`),console.info("findSCSS() » For more help, please visit "+e)}}function compile(e,o={}){var s="https://docs.scsstocss.org/node.js/#compileinput-options",r={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0,ignoreFiles:[],comment:""};if("string"!=typeof e)console.error("compile() » ERROR: 1st arg <input> must be a string."),console.info("compile() » For more help, please visit "+s);else if(validateOptions(o,r,s,"compile('assets/scss', { recursive: false, minify: false })")){const t={style:(o={...r,...o}).minify?"compressed":"expanded",sourceMap:o.sourceMaps};if(fs.existsSync(e)){if(!e.endsWith(".scss"))return s=findSCSS(e,{recursive:o.recursive,verbose:o.verbose,dotFolders:o.dotFolders,ignoreFiles:o.ignoreFiles})?.map(e=>{o.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var s=sass.compile(e,t);return o.comment&&(s.css=c(s.css,o.comment)),{code:s.css,srcMap:s.sourceMap,srcPath:e,error:void 0}}catch(e){return console.error(`
8
8
  compile() » ERROR: ${e.message}
9
- `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}).filter(e=>!e.error),o.verbose&&(0<s.length?console.info("compile() » Compilation complete! Check returned object."):console.info("compile() » No SCSS files processed.")),s;o.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var i=sass.compile(e,t);return o.comment&&(i.css=c(i.css,o.comment)),o.verbose&&!/cli(?:\.min)?\.js$/.test(require.main.filename)&&console.info("compile() » Compilation complete! Check returned object."),{code:i.css,srcMap:i.sourceMap,srcPath:path.resolve(process.cwd(),e),error:void 0}}catch(e){return console.error(`
9
+ `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}).filter(e=>!e.error),o.verbose&&(0<s.length&&"undefined"!=typeof window?console.info("compile() » Compilation complete! Check returned object."):console.info("compile() » No SCSS files processed.")),s;o.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var i=sass.compile(e,t);return o.comment&&(i.css=c(i.css,o.comment)),o.verbose&&"undefined"!=typeof window&&console.info("compile() » Compilation complete! Check returned object."),{code:i.css,srcMap:i.sourceMap,srcPath:path.resolve(process.cwd(),e),error:void 0}}catch(e){return console.error(`
10
10
  compile() » ERROR: ${e.message}
11
11
  `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}else{o.verbose&&console.info("compile() » ** Compiling passed source code...");try{var n=sass.compileString(e,t);return o.comment&&(n.css=c(n.css,o.comment)),{code:n.css,srcMap:n.sourceMap,srcPath:void 0,error:void 0}}catch(e){return console.error(`
12
12
  compile() » ERROR: ${e.message}
@@ -16,4 +16,4 @@ ${s}
16
16
  `+e.slice(o)):`/**
17
17
  ${s}
18
18
  */
19
- `+e}}}function validateOptions(e,s,o,r){const i=JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(s).join(", "),c=Object.keys(s).filter(e=>"boolean"==typeof s[e]),t=Object.keys(s).filter(e=>Number.isInteger(s[e])),l=Object.keys(s).filter(e=>Array.isArray(s[e]));let a="validateOptions() » ";try{a=validateOptions.caller?.name+"() » "}catch(e){}var d=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,p=(d+=["st","nd","rd"][d-1]||"th",()=>{console.info(`${a}Valid options: [ ${n} ]`),console.info(a+"If omitted, default settings are: "+i)}),f=()=>{console.info(a+"For more help, please visit "+o)};if("object"!=typeof e)return console.error(a+`ERROR: ${"0th"==d?"[O":d+" arg [o"}ptions] can only be an object of key/values.`),console.info(a+"Example valid call: "+r),p(),f(),!1;for(const m in e){if("isRecursing"!=m&&!Object.prototype.hasOwnProperty.call(s,m))return console.error(`${a}ERROR: \`${m}\` is an invalid option.`),p(),f(),!1;if(c.includes(m)&&"boolean"!=typeof e[m])return console.error(`${a}ERROR: [${m}] option can only be \`true\` or \`false\`.`),f(),!1;if(t.includes(m)){if(e[m]=parseInt(e[m],10),isNaN(e[m])||e[m]<1)return console.error(`${a}ERROR: [${m}] option can only be an integer > 0.`),f(),!1}else if(l.includes(m))if("string"!=typeof e[m]||e[m].includes(",")){if(!Array.isArray(e[m]))return console.error(`${a}ERROR: [${m}] option can only be an array.`),f(),!1}else e[m]=[e[m]]}return!0}const funcAliases={compile:["build","Build","Compile","compress","Compress","minify","Minify"],findSCSS:["find","Find","findscss","findScss","Findscss","FindScss","FindSCSS","search","Search"]};module.exports={compile:compile,findSCSS:findSCSS};for(const Z in funcAliases)funcAliases[Z].forEach(e=>module.exports[e]=module.exports[Z]);
19
+ `+e}}}function validateOptions(e,s,o,r){const i=JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(s).join(", "),c=Object.keys(s).filter(e=>"boolean"==typeof s[e]),t=Object.keys(s).filter(e=>Number.isInteger(s[e])),l=Object.keys(s).filter(e=>Array.isArray(s[e]));let a="validateOptions() » ";try{a=validateOptions.caller?.name+"() » "}catch(e){}var d=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,p=(d+=["st","nd","rd"][d-1]||"th",()=>{console.info(`${a}Valid options: [ ${n} ]`),console.info(a+"If omitted, default settings are: "+i)}),f=()=>{console.info(a+"For more help, please visit "+o)};if("object"!=typeof e)return console.error(a+`ERROR: ${"0th"==d?"[O":d+" arg [o"}ptions] can only be an object of key/values.`),console.info(a+"Example valid call: "+r),p(),f(),!1;for(const m in e){if("isRecursing"!=m&&!Object.prototype.hasOwnProperty.call(s,m))return console.error(`${a}ERROR: \`${m}\` is an invalid option.`),p(),f(),!1;if(c.includes(m)&&"boolean"!=typeof e[m])return console.error(`${a}ERROR: [${m}] option can only be \`true\` or \`false\`.`),f(),!1;if(t.includes(m)){if(e[m]=parseInt(e[m],10),isNaN(e[m])||e[m]<1)return console.error(`${a}ERROR: [${m}] option can only be an integer > 0.`),f(),!1}else if(l.includes(m))if("string"!=typeof e[m]||e[m].includes(",")){if(!Array.isArray(e[m]))return console.error(`${a}ERROR: [${m}] option can only be an array.`),f(),!1}else e[m]=[e[m]]}return!0}const stcAliases={compile:["build","Build","Compile","compress","Compress","minify","Minify"],findSCSS:["find","Find","findscss","findScss","Findscss","FindScss","FindSCSS","search","Search"]};module.exports={compile:compile,findSCSS:findSCSS};for(const Z in stcAliases)stcAliases[Z].forEach(e=>module.exports[e]=module.exports[Z]);
package/docs/README.md CHANGED
@@ -29,7 +29,7 @@
29
29
 
30
30
  <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>
31
31
  <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>
32
- <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.1"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.1-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
32
+ <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.2"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.2-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
33
33
  <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>
34
34
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/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_scss-to-css%3Anode.js%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>
35
35
  <a href="https://github.com/toolleeo/cli-apps#conversion"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
@@ -170,7 +170,7 @@ You can also import **scss-to-css** into your app to use its API methods, both a
170
170
  #### ECMAScript*:
171
171
 
172
172
  ```js
173
- import * as scssToCSS from '@adamlui/scss-to-css';
173
+ import scssToCSS from '@adamlui/scss-to-css';
174
174
  ```
175
175
 
176
176
  #### CJS:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -55,9 +55,9 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "node-clipboardy": "^1.0.3",
58
- "sass": "^1.77.2"
58
+ "sass": "^1.77.4"
59
59
  },
60
60
  "devDependencies": {
61
- "@adamlui/minify.js": "^1.7.0"
61
+ "@adamlui/minify.js": "^1.8.0"
62
62
  }
63
63
  }