@adamlui/scss-to-css 1.10.41 → 1.10.43

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
@@ -31,8 +31,8 @@
31
31
  <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>
32
32
  <a href="#%EF%B8%8F-mit-license">
33
33
  <img height=31 src="https://img.shields.io/badge/License-MIT-fc4f2d.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
- <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.41">
35
- <img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.41-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
+ <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.43">
35
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.43-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
36
36
  <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=code">
37
37
  <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>
38
38
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/src/scss-to-css.js">
package/dist/cli.min.js CHANGED
@@ -4,27 +4,27 @@
4
4
  * Source: https://code.scsstocss.org/node.js
5
5
  * Documentation: https://docs.scsstocss.org/node.js
6
6
  */
7
- let pkgName="@adamlui/scss-to-css",copyright="© 2024 Adam Lui & contributors under the MIT license.",cmdFormat="scss-to-css [inputPath] [outputPath] [options]",srcURL="https://code.scsstocss.org/node.js",docURL="https://docs.scsstocss.org/node.js/#-command-line-usage",scssToCSS=require(__dirname.match(/src/)?"./scss-to-css":"./scss-to-css.min"),fs=require("fs"),path=require("path"),ncp=require("node-clipboardy"),execSync=require("child_process").execSync,nc="",br="",by="",bg="",bw="",config={},reArgs={flags:{dryRun:/^--?(?:n|dry-?run)$/,includeDotFolders:/^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?=?(?:true|1)?)$/,noSourceMaps:/^--?(?:S|(?:exclude|disable|no)-?so?u?rce?-?maps?|so?u?rce?-?maps?=(?:false|0))$/,noRecursion:/^--?(?:R|(?:disable|no)-?recursi(?:on|ve)|recursi(?:on|ve)=(?:false|0))$/,noMinify:/^--?(?:M|(?:disable|no)-?minif(?:y|ication)|minif(?:y|ication)=(?:false|0))$/,copy:/^--?c(?:opy)?$/,quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},paramOptions:{ignoreFiles:/^--?(?:ignore|skip|exclude)(?:d?-?files?)?(?:=.*|$)/,comment:/^--?comments?(?:=.*|$)/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(s=>{var e,o,i;s.startsWith("-")&&(i=Object.keys(reArgs.flags).find(e=>reArgs.flags[e].test(s)),e=Object.keys(reArgs.paramOptions).find(e=>reArgs.paramOptions[e].test(s)),o=Object.keys(reArgs.infoCmds).find(e=>reArgs.infoCmds[e].test(s)),i?config[i]=!0:e?(/=.+/.test(s)||(console.error(`
8
- ${br}ERROR: Arg [--${s.replace(/-/g,"")}] requires '=' followed by a value.`+nc),printHelpCmdAndDocURL(),process.exit(1)),i=s.split("=")[1],config[e]=parseInt(i)||i):o||(console.error(`
9
- ${br}ERROR: Arg [${s}] not recognized.`+nc),console.info(`
10
- ${by}Valid arguments are below.`+nc),printHelpSections(["flags","paramOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>reArgs.infoCmds.help.test(e)))printHelpSections();else if(process.argv.some(e=>reArgs.infoCmds.version.test(e))){let e=execSync(`npm view ${pkgName} version`).toString().trim()||"none",o,i=process.cwd();for(;"/"!=i;){let s=path.join(i,"package.json");if(fs.existsSync(s)){let e=require(s);o=(e.dependencies?.[pkgName]||e.devDependencies?.[pkgName])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}i=path.dirname(i)}console.info(`
11
- Global version: `+e),console.info("Local version: "+o)}else{let[n="",r=""]=process.argv.slice(2).filter(e=>!e.startsWith("-")).map(e=>e.replace(/^\/*/,"")),s=path.resolve(process.cwd(),n);if(n&&!fs.existsSync(s)){let e=s+".scss";fs.existsSync(e)?s=e:(console.error(`
12
- ${br}Error: First argument can only be an existing file or directory.`+`
13
- '${s}' does not exist.`+nc),console.info(`
14
- ${bg}Example valid command:
15
- » scss-to-css . output.min.css`+nc),printHelpCmdAndDocURL(),process.exit(1))}let e=s.endsWith(".scss")&&!fs.statSync(s).isDirectory()?[s]:scssToCSS.findSCSS(s,{recursive:!config.noRecursion,verbose:!config.quietMode,ignoreFiles:(config.ignoreFiles?.split(",")??[]).map(e=>e.trim())});if(config.dryRun)0<e.length?(console.info(`
16
- ${by}SCSS files to be compiled:`+nc),e.forEach(e=>console.info(e))):console.info(by+`
17
- No SCSS files will be compiled.`+nc);else{let o=[],s=e.map(e=>{var s=scssToCSS.compile(e,{verbose:!config.quietMode,minify:!config.noMinify,sourceMaps:!config.noSourceMaps,comment:config.comment?.replace(/\\n/g,"\n")});return s.error&&o.push(e),s}).filter(e=>!e.error);if(0<s?.length){let e=1<s.length?"s":"";printIfNotQuiet(`
18
- ${bg}Compilation complete!`+nc),printIfNotQuiet(bw+s.length+" CSS file"+e+(config.noSourceMaps?"":` + ${s.length} source map`+e)+" generated."+nc)}else printIfNotQuiet(`
19
- ${by}No SCSS files processed.`+nc);0<o.length&&(printIfNotQuiet(`
20
- `+br+o.length+" file"+(1<o.length?"s":"")+" failed to compile:"+nc),o.forEach(e=>printIfNotQuiet(e))),0==s?.length&&process.exit(0),config.copy&&1==s?.length?(console.log(`
21
- `+(bw+s[0].code+nc)),printIfNotQuiet("\nCopying to clipboard..."),ncp.writeSync(s[0].code)):(printIfNotQuiet(`
22
- Writing to file${1<s?.length?"s":""}...`),s?.forEach(({code:e,srcMap:s,srcPath:o})=>{var i=path.join(path.dirname(o),/(?:src|s[ac]ss)$/.test(path.dirname(o))?"../"+(r||"css"):r.endsWith(".css")?path.dirname(r):r||"css"),o=(r.endsWith(".css")&&n.endsWith(".scss")?path.basename(r).replace(/(\.min)?\.css$/,""):path.basename(o,".scss"))+".min.css",o=path.join(i,o);fs.existsSync(i)||fs.mkdirSync(i,{recursive:!0}),fs.writeFileSync(o,e,"utf8"),config.noSourceMaps||fs.writeFileSync(o+".map",JSON.stringify(s),"utf8")}))}}function printHelpSections(e=["header","usage","pathArgs","flags","paramOptions","infoCmds"]){var s=` ${pkgName.replace(/^@[^/]+\//,"")} ${nc} `;let o={header:[`
23
- ├ `+s+copyright,s+"Source: "+srcURL],usage:[`
24
- ${bw}o Usage:`+nc,` ${bw}» `+(bg+cmdFormat+nc)],pathArgs:[`
25
- ${bw}o Path arguments:`+nc," [inputPath] Path to SCSS file or directory containing SCSS files to be compiled, relative to the current working directory."," [outputPath] Path to file or directory where CSS + sourcemap files will be stored, relative to original file location (if not provided, css/ is used)."],flags:[`
26
- ${bw}o Boolean options:`+nc," -n, --dry-run Don't actually compile the file(s), just show if they will be processed."," -d, --include-dotfolders Include dotfolders in file search."," -S, --no-source-maps Prevent source maps from being generated."," -M, --no-minify Disable minification of output CSS."," -R, --no-recursion Disable recursive file searching."," -c, --copy Copy compiled CSS to clipboard instead of writing to file if single source file is processed."," -q, --quiet Suppress all logging except errors."],paramOptions:[`
27
- ${bw}o Parameter options:`+nc,'--ignore-files="file1.scss,file2.scss" Files to exclude from compilation.',"--comment=\"comment\" Prepend header comment to compiled CSS. Separate by line using '\\n'."],infoCmds:[`
28
- ${bw}o Info commands:`+nc," -h, --help Display help screen."," -v, --version Show version number."]};e.forEach(t=>o[t]?.forEach(s=>{{var r=/header|usage/.test(t)?1:41;let o=process.stdout.columns||80,i=[],e=s.match(/\S+|\s+/g),n="";e.forEach(e=>{var s=o-(i.length?r:0);n.length+"| ".length+e.length>s&&(i.push(i.length?n.trimStart():n),n=""),n+=e}),i.push(i.length?n.trimStart():n),i.forEach((e,s)=>console.info("| "+(0==s?e:" ".repeat(r)+e)))}})),console.info("\nFor more help, please visit: "+bw+docURL+nc)}function printHelpCmdAndDocURL(){console.info(`
7
+ (()=>{let i="@adamlui/scss-to-css",r="https://docs.scsstocss.org/node.js/#-command-line-usage",t=require(__dirname.match(/src/)?"./scss-to-css":"./scss-to-css.min"),c=require("fs"),l=require("path"),s=require("node-clipboardy"),o=require("child_process").execSync,a="",m="",p="",d="",f="",u={},n={flags:{dryRun:/^--?(?:n|dry-?run)$/,includeDotFolders:/^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?=?(?:true|1)?)$/,noSourceMaps:/^--?(?:S|(?:exclude|disable|no)-?so?u?rce?-?maps?|so?u?rce?-?maps?=(?:false|0))$/,noRecursion:/^--?(?:R|(?:disable|no)-?recursi(?:on|ve)|recursi(?:on|ve)=(?:false|0))$/,noMinify:/^--?(?:M|(?:disable|no)-?minif(?:y|ication)|minif(?:y|ication)=(?:false|0))$/,copy:/^--?c(?:opy)?$/,quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},paramOptions:{ignoreFiles:/^--?(?:ignore|skip|exclude)(?:d?-?files?)?(?:=.*|$)/,comment:/^--?comments?(?:=.*|$)/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(s=>{var e,o,i;s.startsWith("-")&&(i=Object.keys(n.flags).find(e=>n.flags[e].test(s)),e=Object.keys(n.paramOptions).find(e=>n.paramOptions[e].test(s)),o=Object.keys(n.infoCmds).find(e=>n.infoCmds[e].test(s)),i?u[i]=!0:e?(/=.+/.test(s)||(console.error(`
8
+ ${m}ERROR: Arg [--${s.replace(/-/g,"")}] requires '=' followed by a value.`),v(),process.exit(1)),i=s.split("=")[1],u[e]=parseInt(i)||i):o||(console.error(`
9
+ ${m}ERROR: Arg [${s}] not recognized.`),console.info(`
10
+ ${p}Valid arguments are below.`),y(["flags","paramOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>n.infoCmds.help.test(e)))y();else if(process.argv.some(e=>n.infoCmds.version.test(e))){var h=o(`npm view ${i} version`).toString().trim()||"none";let e,s=process.cwd();for(;"/"!=s;){var g=l.join(s,"package.json");if(c.existsSync(g)){g=require(g);e=(g.dependencies?.[i]||g.devDependencies?.[i])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}s=l.dirname(s)}console.info(`
11
+ Global version: `+h),console.info("Local version: "+e)}else{let[r="",n=""]=process.argv.slice(2).filter(e=>!e.startsWith("-")).map(e=>e.replace(/^\/*/,"")),e=l.resolve(process.cwd(),r);r&&!c.existsSync(e)&&(h=e+".scss",c.existsSync(h)?e=h:(console.error(`
12
+ ${m}Error: First argument can only be an existing file or directory.`+`
13
+ '${e}' does not exist.`),console.info(`
14
+ ${d}Example valid command:
15
+ » scss-to-css . output.min.css`),v(),process.exit(1)));h=e.endsWith(".scss")&&!c.statSync(e).isDirectory()?[e]:t.findSCSS(e,{recursive:!u.noRecursion,verbose:!u.quietMode,ignoreFiles:(u.ignoreFiles?.split(",")??[]).map(e=>e.trim())});if(u.dryRun)h.length?(console.info(`
16
+ ${p}SCSS files to be compiled:`),h.forEach(e=>console.info(e))):console.info(p+`
17
+ No SCSS files will be compiled.`);else{let o=[];var S,h=h.map(e=>{var s=t.compile(e,{verbose:!u.quietMode,minify:!u.noMinify,sourceMaps:!u.noSourceMaps,comment:u.comment?.replace(/\\n/g,"\n")});return s.error&&o.push(e),s}).filter(e=>!e.error);h?.length?(S=1<h.length?"s":"",$(`
18
+ ${d}Compilation complete!`),$(f+h.length+" CSS file"+S+(u.noSourceMaps?"":` + ${h.length} source map`+S)+" generated."+a)):$(`
19
+ ${p}No SCSS files processed.`),o.length&&($(`
20
+ `+m+o.length+" file"+(1<o.length?"s":"")+" failed to compile:"),o.forEach(e=>$(e))),0==h?.length&&process.exit(0),u.copy&&1==h?.length?(console.log(`
21
+ `+f+h[0].code+a),$("\nCopying to clipboard..."),s.writeSync(h[0].code)):($(`
22
+ Writing to file${1<h?.length?"s":""}...`),h?.forEach(({code:e,srcMap:s,srcPath:o})=>{var i=l.join(l.dirname(o),/(?:src|s[ac]ss)$/.test(l.dirname(o))?"../"+(n||"css"):n.endsWith(".css")?l.dirname(n):n||"css"),o=(n.endsWith(".css")&&r.endsWith(".scss")?l.basename(n).replace(/(\.min)?\.css$/,""):l.basename(o,".scss"))+".min.css",o=l.join(i,o);c.existsSync(i)||c.mkdirSync(i,{recursive:!0}),c.writeFileSync(o,e,"utf8"),u.noSourceMaps||c.writeFileSync(o+".map",JSON.stringify(s),"utf8")}))}}function y(e=["header","usage","pathArgs","flags","paramOptions","infoCmds"]){var s=` ${i.replace(/^@[^/]+\//,"")}  `;let o={header:[`
23
+ ├ `+s+"© 2024–2025 Adam Lui & contributors under the MIT license.",s+"Source: https://code.scsstocss.org/node.js"],usage:[`
24
+ ${f}o Usage:`,` ${f}» `+d+"scss-to-css [inputPath] [outputPath] [options]"+a],pathArgs:[`
25
+ ${f}o Path arguments:`," [inputPath] Path to SCSS file or directory containing SCSS files to be compiled, relative to the current working directory."," [outputPath] Path to file or directory where CSS + sourcemap files will be stored, relative to original file location (if not provided, css/ is used)."],flags:[`
26
+ ${f}o Boolean options:`," -n, --dry-run Don't actually compile the file(s), just show if they will be processed."," -d, --include-dotfolders Include dotfolders in file search."," -S, --no-source-maps Prevent source maps from being generated."," -M, --no-minify Disable minification of output CSS."," -R, --no-recursion Disable recursive file searching."," -c, --copy Copy compiled CSS to clipboard instead of writing to file if single source file is processed."," -q, --quiet Suppress all logging except errors."],paramOptions:[`
27
+ ${f}o Parameter options:`,'--ignore-files="file1.scss,file2.scss" Files to exclude from compilation.',"--comment=\"comment\" Prepend header comment to compiled CSS. Separate by line using '\\n'."],infoCmds:[`
28
+ ${f}o Info commands:`," -h, --help Display help screen."," -v, --version Show version number."]};e.forEach(t=>o[t]?.forEach(s=>{{var n=/header|usage/.test(t)?1:41;let o=process.stdout.columns||80,i=[],e=s.match(/\S+|\s+/g),r="";e.forEach(e=>{var s=o-(i.length?n:0);r.length+"| ".length+e.length>s&&(i.push(i.length?r.trimStart():r),r=""),r+=e}),i.push(i.length?r.trimStart():r),i.forEach((e,s)=>console.info("| "+(0==s?e:" ".repeat(n)+e)))}})),console.info("\nFor more help, please visit: "+f+r+a)}function v(){console.info(`
29
29
  For more help, type 'scss-to-css --help' or visit
30
- `+(bw+docURL+nc))}function printIfNotQuiet(e){config.quietMode||console.info(e)}
30
+ `+f+r+a)}function $(e){u.quietMode||console.info(e)}})();
@@ -1,19 +1,18 @@
1
- #!/usr/bin/env node
2
- /**
3
- * © 2024 Adam Lui & contributors under the MIT license.
4
- * Source: https://code.scsstocss.org/node.js
5
- * Documentation: https://docs.scsstocss.org/node.js
6
- */
7
- let fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(r,i={}){var e="https://docs.scsstocss.org/node.js/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1,ignoreFiles:[]};if("string"!=typeof r)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var o=path.resolve(process.cwd(),r);if(fs.existsSync(o)){if(validateOptions(i,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){i={...s,...i};let e=fs.readdirSync(r),o=[];return i.verbose&&!i.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),e.forEach(e=>{var s=path.resolve(r,e);fs.statSync(s).isDirectory()&&"node_modules"!=e&&i.recursive&&(i.dotFolders||!e.startsWith("."))?o.push(...findSCSS(s,{...i,isRecursing:!0})):e.endsWith(".scss")&&!i.ignoreFiles.includes(e)?o.push(s):i.verbose&&i.ignoreFiles.includes(e)&&console.info(`findSCSS() » ** ${e} ignored due to [options.ignoreFiles]`)}),i.verbose&&!i.isRecursing&&(console.info("findSCSS() » Search complete! "+(0==o.length?"No":o.length)+` file${1==o.length?"":"s"} found.`),"compile"!=findSCSS.caller.name)&&"undefined"!=typeof window&&console.info("findSCSS() » Check returned array."),i.isRecursing||0<o.length?o:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${o} does not exist.`),console.info("findSCSS() » For more help, please visit "+e)}}function compile(e,r={}){var s="https://docs.scsstocss.org/node.js/#compileinput-options",i={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(r,i,s,"compile('assets/scss', { recursive: false, minify: false })")){let o={style:(r={...i,...r}).minify?"compressed":"expanded",sourceMap:r.sourceMaps};if(fs.existsSync(e)){if(!e.endsWith(".scss"))return s=findSCSS(e,{recursive:r.recursive,verbose:r.verbose,dotFolders:r.dotFolders,ignoreFiles:r.ignoreFiles})?.map(e=>{r.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var s=sass.compile(e,o);return r.comment&&(s.css=t(s.css,r.comment)),{code:s.css,srcMap:s.sourceMap,srcPath:e,error:void 0}}catch(e){return console.error(`
1
+ let fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(r,i={}){var e="https://docs.scsstocss.org/node.js/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1,ignoreFiles:[]};if("string"!=typeof r)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var o=path.resolve(process.cwd(),r);if(fs.existsSync(o)){if(validateOptions(i,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){i={...s,...i};let e=fs.readdirSync(r),o=[];return i.verbose&&!i.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),e.forEach(e=>{var s=path.resolve(r,e);fs.statSync(s).isDirectory()&&"node_modules"!=e&&i.recursive&&(i.dotFolders||!e.startsWith("."))?o.push(...findSCSS(s,{...i,isRecursing:!0})):e.endsWith(".scss")&&!i.ignoreFiles.includes(e)?o.push(s):i.verbose&&i.ignoreFiles.includes(e)&&console.info(`findSCSS() » ** ${e} ignored due to [options.ignoreFiles]`)}),i.verbose&&!i.isRecursing&&(console.info("findSCSS() » Search complete! "+(0==o.length?"No":o.length)+` file${1==o.length?"":"s"} found.`),"compile"!=findSCSS.caller.name)&&"undefined"!=typeof window&&console.info("findSCSS() » Check returned array."),i.isRecursing||o.length?o:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${o} does not exist.`),console.info("findSCSS() » For more help, please visit "+e)}}function compile(e,r={}){var s="https://docs.scsstocss.org/node.js/#compileinput-options",i={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(r,i,s,"compile('assets/scss', { recursive: false, minify: false })")){let o={style:(r={...i,...r}).minify?"compressed":"expanded",sourceMap:r.sourceMaps};if(fs.existsSync(e)){if(!e.endsWith(".scss"))return s=findSCSS(e,{recursive:r.recursive,verbose:r.verbose,dotFolders:r.dotFolders,ignoreFiles:r.ignoreFiles})?.map(e=>{r.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var s=sass.compile(e,o);return r.comment&&(s.css=t(s.css,r.comment)),{code:s.css,srcMap:s.sourceMap,srcPath:e,error:void 0}}catch(e){return console.error(`
8
2
  compile() » ERROR: ${e.message}
9
- `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}).filter(e=>!e.error),r.verbose&&(0<s.length&&"undefined"!=typeof window?console.info("compile() » Compilation complete! Check returned object."):console.info("compile() » No SCSS files processed.")),s;r.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var n=sass.compile(e,o);return r.comment&&(n.css=t(n.css,r.comment)),r.verbose&&"undefined"!=typeof window&&console.info("compile() » Compilation complete! Check returned object."),{code:n.css,srcMap:n.sourceMap,srcPath:path.resolve(process.cwd(),e),error:void 0}}catch(e){return console.error(`
3
+ `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}).filter(e=>!e.error),r.verbose&&(s.length&&"undefined"!=typeof window?console.info("compile() » Compilation complete! Check returned object."):console.info("compile() » No SCSS files processed.")),s;r.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var n=sass.compile(e,o);return r.comment&&(n.css=t(n.css,r.comment)),r.verbose&&"undefined"!=typeof window&&console.info("compile() » Compilation complete! Check returned object."),{code:n.css,srcMap:n.sourceMap,srcPath:path.resolve(process.cwd(),e),error:void 0}}catch(e){return console.error(`
10
4
  compile() » ERROR: ${e.message}
11
5
  `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}else{r.verbose&&console.info("compile() » ** Compiling passed source code...");try{var c=sass.compileString(e,o);return r.comment&&(c.css=t(c.css,r.comment)),{code:c.css,srcMap:c.sourceMap,srcPath:void 0,error:void 0}}catch(e){return console.error(`
12
6
  compile() » ERROR: ${e.message}
13
7
  `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}function t(e,s){var s=s.split("\n").map(e=>" * "+e).join("\n"),o=e.indexOf("#!");return 0<=o?(o=e.indexOf("\n",o)+1,e.slice(0,o)+`/**
8
+ /**
9
+ * © 2024 Adam Lui & contributors under the MIT license.
10
+ * Source: https://code.scsstocss.org/node.js
11
+ * Documentation: https://docs.scsstocss.org/node.js
12
+ */
14
13
  ${s}
15
14
  */
16
15
  `+e.slice(o)):`/**
17
16
  ${s}
18
17
  */
19
- `+e}}}function validateOptions(e,s,o,r){let 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])),a=`${validateOptions.caller?.name||"validateOptions"}() » `;var d,p=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,f=(p+=["st","nd","rd"][p-1]||"th",()=>{console.info(a+`Valid options: [ ${n} ]`),console.info(a+"If omitted, default settings are: "+i)}),m=()=>{console.info(a+"For more help, please visit "+o)};if("object"!=typeof e)return console.error(a+`ERROR: ${"0th"==p?"[O":p+" arg [o"}ptions] can only be an object of key/values.`),console.info(a+"Example valid call: "+r),f(),m(),!1;for(d in e){if("isRecursing"!=d&&!Object.prototype.hasOwnProperty.call(s,d))return console.error(a+`ERROR: \`${d}\` is an invalid option.`),f(),m(),!1;if(c.includes(d)&&"boolean"!=typeof e[d])return console.error(a+`ERROR: [${d}] option can only be \`true\` or \`false\`.`),m(),!1;if(t.includes(d)){if(e[d]=parseInt(e[d],10),isNaN(e[d])||e[d]<1)return console.error(a+`ERROR: [${d}] option can only be an integer > 0.`),m(),!1}else if(l.includes(d))if("string"!=typeof e[d]||e[d].includes(",")){if(!Array.isArray(e[d]))return console.error(a+`ERROR: [${d}] option can only be an array.`),m(),!1}else e[d]=[e[d]]}return!0}let 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(let s in stcAliases)stcAliases[s].forEach(e=>module.exports[e]=module.exports[s]);
18
+ `+e}}}function validateOptions(e,s,o,r){let i=JSON.stringify(s,void 0,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])),a=`${validateOptions.caller?.name||"validateOptions"}() » `;var d,p=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,f=(p+=["st","nd","rd"][p-1]||"th",()=>{console.info(a+`Valid options: [ ${n} ]`),console.info(a+"If omitted, default settings are: "+i)}),m=()=>{console.info(a+"For more help, please visit "+o)};if("object"!=typeof e)return console.error(a+`ERROR: ${"0th"==p?"[O":p+" arg [o"}ptions] can only be an object of key/values.`),console.info(a+"Example valid call: "+r),f(),m(),!1;for(d in e){if("isRecursing"!=d&&!Object.prototype.hasOwnProperty.call(s,d))return console.error(a+`ERROR: \`${d}\` is an invalid option.`),f(),m(),!1;if(c.includes(d)&&"boolean"!=typeof e[d])return console.error(a+`ERROR: [${d}] option can only be \`true\` or \`false\`.`),m(),!1;if(t.includes(d)){if(e[d]=parseInt(e[d],10),isNaN(e[d])||e[d]<1)return console.error(a+`ERROR: [${d}] option can only be an integer > 0.`),m(),!1}else if(l.includes(d))if("string"!=typeof e[d]||e[d].includes(",")){if(!Array.isArray(e[d]))return console.error(a+`ERROR: [${d}] option can only be an array.`),m(),!1}else e[d]=[e[d]]}return!0}let 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(let s in stcAliases)stcAliases[s].forEach(e=>module.exports[e]=module.exports[s]);
package/docs/README.md CHANGED
@@ -31,8 +31,8 @@
31
31
  <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>
32
32
  <a href="#%EF%B8%8F-mit-license">
33
33
  <img height=31 src="https://img.shields.io/badge/License-MIT-fc4f2d.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
- <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.41">
35
- <img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.41-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
+ <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.10.43">
35
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-1.10.43-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
36
36
  <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=code">
37
37
  <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>
38
38
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/src/scss-to-css.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.10.41",
3
+ "version": "1.10.43",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "node-clipboardy": "^1.0.3",
68
- "sass": "^1.93.1"
68
+ "sass": "^1.93.3"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@adamlui/minify.js": "^1.8.6"