@adamlui/scss-to-css 1.7.6 → 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.6"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.6-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
 
@@ -154,7 +155,7 @@ Info commands:
154
155
 
155
156
  You can also import **scss-to-css** into your app to use its API methods, both as an ECMAScript module or a CommonJS module.
156
157
 
157
- #### ESM:
158
+ #### ESM*:
158
159
 
159
160
  ```js
160
161
  import * as scssToCSS from '@adamlui/scss-to-css';
@@ -166,6 +167,8 @@ import * as scssToCSS from '@adamlui/scss-to-css';
166
167
  const scssToCSS = require('@adamlui/scss-to-css');
167
168
  ```
168
169
 
170
+ ###### _*Node.js version 14 or higher required_
171
+
169
172
  #
170
173
 
171
174
  ### `compile(inputPath[, options])`
package/dist/cli.min.js CHANGED
@@ -6,10 +6,10 @@ ${t}Error: First argument can only be an existing file or directory.`+`
6
6
  '${p}' does not exist.`+i+`
7
7
 
8
8
  ${e}Example valid command:
9
- >> scss-to-css . output.min.css`+i+`
9
+ » scss-to-css . output.min.css`+i+`
10
10
 
11
11
  ${c}For all command options:
12
- >> scss-to-css --help`+i),process.exit(1)),f.endsWith(".scss")?[p]:o.findSCSS(p,{recursive:!l.noRecursion,verbose:!l.quietMode}));if(l.dryRun)0<m.length?(console.info(`
12
+ » scss-to-css --help`+i),process.exit(1)),f.endsWith(".scss")?[p]:o.findSCSS(p,{recursive:!l.noRecursion,verbose:!l.quietMode}));if(l.dryRun)0<m.length?(console.info(`
13
13
  ${c}SCSS files to be compiled:`+i),m.forEach(e=>console.info(e))):console.info(c+`
14
14
  No SCSS files will be compiled.`+i);else{const h=[],g=m.map(e=>{var s=o.compile(e,{minify:!l.noMinify,sourceMaps:!l.noSourceMaps,verbose:!l.quietMode});return s.error&&h.push(e),s}).filter(e=>!e.error);if(g?.forEach(({code:e,srcMap:s,srcPath:o})=>{var i=n.join(n.dirname(o),/(?:src|s[ac]ss)$/.test(n.dirname(o))?"../css":u.endsWith(".css")?n.dirname(u):u||"css"),o=(u.endsWith(".css")&&f.endsWith(".scss")?n.basename(u).replace(/(\.min)?\.css$/,""):n.basename(o,".scss"))+".min.css",o=n.join(i,o);r.existsSync(i)||r.mkdirSync(i,{recursive:!0}),r.writeFileSync(o,e,"utf8"),l.noSourceMaps||r.writeFileSync(o+".map",JSON.stringify(s),"utf8")}),0<g?.length){const S=1<g.length?"s":"";s(`
15
15
  ${e}Compilation complete!`+i),s(g.length+" CSS file"+S+(l.noSourceMaps?"":` + ${g.length} source map`+S)+" generated.")}else s(c+"No SCSS files processed."+i);0<h.length&&(s(`
@@ -1,7 +1,5 @@
1
- const c=require("fs"),l=require("path"),t=require("sass");function a(o,s={}){var e={recursive:!0,verbose:!0,dotFolders:!1};if(s={...e,...s},"string"!=typeof o)return console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string.");var r=l.resolve(process.cwd(),o);if(!c.existsSync(r))return console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory.\n"+`findSCSS() » ${r} does not exist.`);for(const t in s)if(!Object.prototype.hasOwnProperty.call(e,t)){if("isRecursing"!==t)return console.error(`findSCSS() » ERROR: \`${t}\` is an invalid option.
2
- `+`findSCSS() » Valid options: [ ${Object.keys(e).join(", ")} ]`);if("boolean"!=typeof s[t])return console.error(`findSCSS() » ERROR: [${t}] option can only be set to \`true\` or \`false\`.`)}const i=c.readdirSync(o),n=[];return s.verbose&&!s.isRecursing&&console.info("\nfindSCSS() » Searching for SCSS files..."),i.forEach(e=>{var r=l.resolve(o,e);c.statSync(r).isDirectory()&&"node_modules"!=e&&(s.dotFolders||!e.startsWith("."))&&s.recursive?n.push(...a(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${1<n.length?"s":""} found.`+("compile"===a.caller.name||require.main.filename.endsWith("cli.js")?"":"\nfindSCSS() » Check returned array.")),s.isRecursing||0<n.length?n:[]}function e(e,o={}){var r={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0};if(o={...r,...o},"string"!=typeof e)return console.error("compile() » ERROR: 1st arg <inputPath> must be a string.");if(e=l.resolve(process.cwd(),e),!c.existsSync(e))return console.error("compile() » ERROR: 1st arg <inputPath> must be an existing directory or file.\n"+`compile() » ${e} does not exist.`);for(const n in o){if(!Object.prototype.hasOwnProperty.call(r,n))return console.error(`compile() » ERROR: \`${n}\` is an invalid option.
3
- `+`compile() » Valid options: [ ${Object.keys(r).join(", ")} ]`);if("boolean"!=typeof o[n])return console.error(`compile() » ERROR: [${n}] option can only be set to \`true\` or \`false\`.`)}const s={style:o.minify?"compressed":"expanded",sourceMap:o.sourceMaps};if(c.existsSync(e)){if(!e.endsWith(".scss"))return a(e,{recursive:o.recursive,verbose:o.verbose,dotFolders:o.dotFolders})?.map(e=>{o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var r=t.compile(e,s);return{code:r.css,srcMap:r.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(`
4
2
  compile() » ERROR: ${e.message}
5
- `),{error:e}}}).filter(e=>!e.error);o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var i=t.compile(e,s);return{code:i.css,srcMap:i.sourceMap,srcPath:l.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(`
6
4
  compile() » ERROR: ${e.message}
7
- `),{error:e}}}}module.exports={compile:e,findSCSS:a};
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,13 +1,13 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.7.6",
3
+ "version": "1.7.8",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
7
7
  "email": "adam@kudoai.com",
8
8
  "url": "https://github.com/adamlui"
9
9
  },
10
- "homepage": "https://github.com/adamlui/js-utils/tree/main/scss-to-css#readme",
10
+ "homepage": "https://js-utils.com/scss-to-css",
11
11
  "license": "MIT",
12
12
  "main": "dist/scss-to-css.min.js",
13
13
  "files": [
@@ -48,7 +48,7 @@
48
48
  "stylesheets"
49
49
  ],
50
50
  "bugs": {
51
- "url": "https://github.com/adamlui/js-utils/issues"
51
+ "url": "https://js-utils.com/issues"
52
52
  },
53
53
  "dependencies": {
54
54
  "sass": "^1.72.0"
@@ -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
  }