@adamlui/minify.js 1.6.2 → 1.7.0

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
@@ -23,7 +23,7 @@
23
23
 
24
24
  <a href="https://www.npmjs.com/package/@adamlui/minify.js"><img height=31 src="https://img.shields.io/npm/dm/%40adamlui%2Fminify.js?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
25
25
  <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>
26
- <a href="https://github.com/adamlui/minify.js/releases/tag/node-v1.6.2"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.6.2-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
26
+ <a href="https://github.com/adamlui/minify.js/releases/tag/node-v1.7.0"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
27
27
  <a href="https://www.npmjs.com/package/@adamlui/minify.js?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/%40adamlui%2Fminify.js?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
28
28
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_minify.js:node.js/src/minify.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_minify.js%3Anode.js%2Fsrc%2Fminify.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
29
29
  <a href="https://github.com/toolleeo/cli-apps#programming"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
@@ -57,6 +57,8 @@ $ npm install @adamlui/minify.js
57
57
 
58
58
  <br>
59
59
 
60
+ <a href="https://github.com/sponsors/adamlui"><img src="https://media.minify-js.org/images/banners/sponsor/$10/banner1660x260.png?f6118ce"></a>
61
+
60
62
  <img height=6px width="100%" src="https://media.minify-js.org/images/separators/gradient-aqua.png?8b9ed02">
61
63
 
62
64
  ## 💻 Command line usage
@@ -134,11 +136,14 @@ Boolean options:
134
136
  -D, --include-dotfiles Include dotfiles in file search.
135
137
  -R, --no-recursion Disable recursive file searching.
136
138
  -M, --no-mangle Disable mangling names.
139
+ -c, --copy Copy minified code to clipboard instead
140
+ of writing to file if single source file
141
+ is processed.
137
142
  -q, --quiet Suppress all logging except errors.
138
143
 
139
144
  Parameter options:
140
145
  --ignore-files="file1.js,file2.js" Files to exclude from minification.
141
- --comment="comment" Prepend comment to minified code.
146
+ --comment="comment" Prepend header comment to minified code.
142
147
  Separate by line using '\n'.
143
148
 
144
149
  Info commands:
@@ -206,15 +211,15 @@ minifyJS.minify(input, { dotFiles: true });
206
211
 
207
212
  Available parameters (and their default settings) are:
208
213
 
209
- Name | Type | Desciption | Default value
210
- --------------|---------|-------------------------------------------------------------------|---------------
211
- `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
212
- `verbose` | Boolean | Show logging in console/terminal. | `true`
213
- `dotFolders` | Boolean | Include dotfolders in file search. | `false`
214
- `dotFiles` | Boolean | Include dotfiles in file search. | `false`
215
- `mangle` | Boolean | Shorten variable names (typically to one character). | `true`
216
- `ignoreFiles` | Array | Files (by name) to exclude from minification. | `[]`
217
- `comment` | String | Comment to prepend to minified code. Separate by line using '\n'. | `''`
214
+ Name | Type | Desciption | Default value
215
+ --------------|---------|--------------------------------------------------------------------------|---------------
216
+ `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
217
+ `verbose` | Boolean | Show logging in console/terminal. | `true`
218
+ `dotFolders` | Boolean | Include dotfolders in file search. | `false`
219
+ `dotFiles` | Boolean | Include dotfiles in file search. | `false`
220
+ `mangle` | Boolean | Shorten variable names (typically to one character). | `true`
221
+ `ignoreFiles` | Array | Files (by name) to exclude from minification. | `[]`
222
+ `comment` | String | Header comment to prepend to minified code. Separate by line using '\n'. | `''`
218
223
 
219
224
  #
220
225
 
package/dist/cli.min.js CHANGED
@@ -4,24 +4,27 @@
4
4
  * Source: https://code.minify-js.org/node.js
5
5
  * Documentation: https://docs.minify-js.org/node.js
6
6
  */
7
- const pkgName="@adamlui/minify.js",copyright="© 2024 Adam Lui & contributors under the MIT license.",cmdFormat="minify-js [inputPath] [outputPath] [options]",srcURL="https://code.minify-js.org/node.js",docURL="https://docs.minify-js.org/node.js/#-command-line-usage";(async()=>{const i=require(__dirname.match(/src/)?"./minify":"./minify.min"),n=require("fs"),s=require("path"),r=require("child_process")["execSync"],t="",a="",l="",c="",m="";let f="en";if("win32"==process.platform)try{f=r("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){}else{var d=process.env;f=(d.LANG||d.LANGUAGE||d.LC_ALL||d.LC_MESSAGES||d.LC_NAME||"en").split(".")[0]}let p={};d=new Promise((r,t)=>{const a="https://cdn.jsdelivr.net/gh/adamlui/js-utils@2ca71a5c8c3dab0508a11c1b666237461796b508/geolocate/_locales/",e=(f?f.replace("-","_"):"en")+"/";let l=a+e+"messages.json",c=0;$(l).then(async function o(e){try{const i=await e.json(),n={};for(const s in i)"object"==typeof i[s]&&"message"in i[s]&&(n[s]=i[s].message);r(n)}catch(e){if(3==++c)return r({});$(l=f.includes("-")&&1==c?l.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):a+"en/messages.json").then(o).catch(t)}}).catch(t)});try{p=await d}catch(e){}const u={},h={flags:{dryRun:/^--?(?:n|dry-?run)$/,includeDotFolders:/^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?=?(?:true|1)?)$/,includeDotFiles:/^--?(?:df|D|(?:include-?)?dot-?files?=?(?:true|1)?)$/,noRecursion:/^--?(?:R|(?:disable|no)-?recursi(?:on|ve)|recursi(?:on|ve)=(?:false|0))$/,noMangle:/^--?(?:M|(?:disable|no)-?mangle|mangle=(?:false|0))$/,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(o=>{var e,i,n;o.startsWith("-")&&(n=Object.keys(h.flags).find(e=>h.flags[e].test(o)),e=Object.keys(h.paramOptions).find(e=>h.paramOptions[e].test(o)),i=Object.keys(h.infoCmds).find(e=>h.infoCmds[e].test(o)),n?u[n]=!0:e?(/=.+/.test(o)||(console.error(`
8
- ${a+(p.prefix_error||"ERROR")}: `+`Arg [--${o.replace(/-/g,"")}] `+`${p.error_noEqual||"requires '=' followed by a value"}.${t}`),v(),process.exit(1)),n=o.split("=")[1],u[e]=parseInt(n)||n):i||(console.error(`
9
- ${a+(p.prefix_error||"ERROR")}: `+`Arg [${o}] ${p.error_notRecognized||"not recognized"}.`),console.info(`
10
- ${l+(p.info_validArgs||"Valid arguments are below")}.`),_(["flags","paramOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>h.infoCmds.help.test(e)))_();else if(process.argv.some(e=>h.infoCmds.version.test(e))){d=r(`npm view ${pkgName} version`).toString().trim()||"none";let e,o=process.cwd();for(;"/"!=o;){var g=s.join(o,"package.json");if(n.existsSync(g)){g=require(g);e=(g.dependencies?.[pkgName]||g.devDependencies?.[pkgName])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}o=s.dirname(o)}console.info(`
11
- ${p.prefix_globalVer||"Global version"}: `+d),console.info(`${p.prefix_localVer||"Local version"}: `+e)}else{const[y="",j=""]=process.argv.slice(2).filter(e=>!e.startsWith("-")).map(e=>e.replace(/^\/*/,""));d=s.resolve(process.cwd(),y),d=(y&&!n.existsSync(d)&&(console.error(`
12
- ${a+(p.prefix_error||"ERROR")}: `+`${p.error_firstArgNotExist||"First argument can only be an existing file or directory"}.`+`
13
- ${d} ${p.error_doesNotExist||"does not exist"}.`),console.info(`
14
- ${c}${p.info_exampleValidCmd||"Example valid command"}: `+`
15
- » minify-js . output.min.js`),v(),process.exit(1)),y.endsWith(".js")?[d]:i.findJS(d,{recursive:!u.noRecursion,verbose:!u.quietMode,ignoreFiles:(u.ignoreFiles?.split(",")??[]).map(e=>e.trim())}));if(u.dryRun)0<d.length?(console.info(`
7
+ const pkgName="@adamlui/minify.js",copyright="© 2024 Adam Lui & contributors under the MIT license.",cmdFormat="minify-js [inputPath] [outputPath] [options]",srcURL="https://code.minify-js.org/node.js",docURL="https://docs.minify-js.org/node.js/#-command-line-usage";(async()=>{const o=require(__dirname.match(/src/)?"./minify":"./minify.min"),n=require("fs"),s=require("path"),i=require("node-clipboardy"),r=require("child_process")["execSync"],t="",c="",l="",a="",m="";let f="en";if("win32"==process.platform)try{f=r("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){}else{var d=process.env;f=(d.LANG||d.LANGUAGE||d.LC_ALL||d.LC_MESSAGES||d.LC_NAME||"en").split(".")[0]}let p={};d=new Promise((r,t)=>{const c="https://cdn.jsdelivr.net/gh/adamlui/minify.js@98a9c925c01a0e032834ef5bccbe2c3fa47a6b8b/_locales/",e=(f?f.replace("-","_"):"en")+"/";let l=c+e+"messages.json",a=0;$(l).then(async function i(e){try{const o=await e.json(),n={};for(const s in o)"object"==typeof o[s]&&"message"in o[s]&&(n[s]=o[s].message);r(n)}catch(e){if(3==++a)return r({});$(l=f.includes("-")&&1==a?l.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):c+"en/messages.json").then(i).catch(t)}}).catch(t)});try{p=await d}catch(e){}const u={},h={flags:{dryRun:/^--?(?:n|dry-?run)$/,includeDotFolders:/^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?=?(?:true|1)?)$/,includeDotFiles:/^--?(?:df|D|(?:include-?)?dot-?files?=?(?:true|1)?)$/,noRecursion:/^--?(?:R|(?:disable|no)-?recursi(?:on|ve)|recursi(?:on|ve)=(?:false|0))$/,noMangle:/^--?(?:M|(?:disable|no)-?mangle|mangle=(?: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(i=>{var e,o,n;i.startsWith("-")&&(n=Object.keys(h.flags).find(e=>h.flags[e].test(i)),e=Object.keys(h.paramOptions).find(e=>h.paramOptions[e].test(i)),o=Object.keys(h.infoCmds).find(e=>h.infoCmds[e].test(i)),n?u[n]=!0:e?(/=.+/.test(i)||(console.error(`
8
+ ${c+(p.prefix_error||"ERROR")}: `+`Arg [--${i.replace(/-/g,"")}] `+`${p.error_noEqual||"requires '=' followed by a value"}.${t}`),_(),process.exit(1)),n=i.split("=")[1],u[e]=parseInt(n)||n):o||(console.error(`
9
+ ${c+(p.prefix_error||"ERROR")}: `+`Arg [${i}] ${p.error_notRecognized||"not recognized"}.`),console.info(`
10
+ ${l+(p.info_validArgs||"Valid arguments are below")}.`),y(["flags","paramOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>h.infoCmds.help.test(e)))y();else if(process.argv.some(e=>h.infoCmds.version.test(e))){d=r(`npm view ${pkgName} version`).toString().trim()||"none";let e,i=process.cwd();for(;"/"!=i;){var g=s.join(i,"package.json");if(n.existsSync(g)){g=require(g);e=(g.dependencies?.[pkgName]||g.devDependencies?.[pkgName])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}i=s.dirname(i)}console.info(`
11
+ ${p.prefix_globalVer||"Global version"}: `+d),console.info(`${p.prefix_localVer||"Local version"}: `+e)}else{const[j="",S=""]=process.argv.slice(2).filter(e=>!e.startsWith("-")).map(e=>e.replace(/^\/*/,""));let e=s.resolve(process.cwd(),j);j&&!n.existsSync(e)&&(d=e+".js",n.existsSync(d)?e=d:(console.error(`
12
+ ${c+(p.prefix_error||"ERROR")}: `+`${p.error_firstArgNotExist||"First argument can only be an existing file or directory"}.`+`
13
+ ${e} ${p.error_doesNotExist||"does not exist"}.`),console.info(`
14
+ ${a}${p.info_exampleValidCmd||"Example valid command"}: `+`
15
+ » minify-js . output.min.js`),_(),process.exit(1)));d=e.endsWith(".js")?[e]:o.findJS(e,{recursive:!u.noRecursion,verbose:!u.quietMode,ignoreFiles:(u.ignoreFiles?.split(",")??[]).map(e=>e.trim())});if(u.dryRun)0<d.length?(console.info(`
16
16
  ${l+(p.info_filesToBeMinned||"JS files to be minified")}:`),d.forEach(e=>console.info(e))):console.info(`
17
- ${l+(p.info_noFilesWillBeMinned||"No JS files will be minified")}.`);else{const S=[];d=d.map(e=>{var o=i.minify(e,{verbose:!u.quietMode,mangle:!u.noMangle,comment:u.comment?.replace(/\\n/g,"\n")});return o.error&&S.push(e),o}).filter(e=>!e.error);d?.forEach(({code:e,srcPath:o})=>{var i=s.join(s.dirname(o),(/so?u?rce?$/.test(s.dirname(o))?"../":"")+(j.endsWith(".js")?s.dirname(j):j||"min")),o=(j.endsWith(".js")&&y.endsWith(".js")?s.basename(j).replace(/(\.min)?\.js$/,""):s.basename(o,".js"))+".min.js",o=s.join(i,o);n.existsSync(i)||n.mkdirSync(i,{recursive:!0}),n.writeFileSync(o,e,"utf8")}),0<d?.length?(o(`
18
- ${c+(p.info_minComplete||"Minification complete")}!`),o(m+d.length+" "+(p.info_file||"file")+`${1<d.length?"s":""} ${p.info_minified||"minified"}.${t}`)):o(l+(p.info_noFilesProcessed||"No unminified JavaScript files processed")+"."),0<S.length&&(o(`
19
- ${a+S.length} `+(p.info_file||"file")+`${1<S.length?"s":""} ${p.info_failedToMinify||"failed to minify"}:${t}`),S.forEach(e=>o(e)))}}function $(n){return new Promise((i,e)=>{var o=n.match(/^([^:]+):\/\//)[1];/^https?$/.test(o)||e(new Error(`${p.error_invalidURL||"Invalid URL"}.`)),require(o).get(n,e=>{let o="";e.on("data",e=>o+=e),e.on("end",()=>i({json:()=>JSON.parse(o)}))}).on("error",e)})}function _(e=["header","usage","pathArgs","flags","paramOptions","infoCmds"]){var o=` ${pkgName.replace(/^@[^/]+\//,"")}  `;const i={header:["\n├ "+o+(p.appCopyright||copyright),o+(p.prefix_source||"Source")+": "+srcURL],usage:[`
20
- ${m}o ${p.helpSection_usage||"Usage"}:`,` ${m}» `+c+cmdFormat+t],pathArgs:[`
17
+ ${l+(p.info_noFilesWillBeMinned||"No JS files will be minified")}.`);else{const b=[];d=d.map(e=>{var i=o.minify(e,{verbose:!u.quietMode,mangle:!u.noMangle,comment:u.comment?.replace(/\\n/g,"\n")});return i.error&&b.push(e),i}).filter(e=>!e.error);0<d?.length?(v(`
18
+ ${a+(p.info_minComplete||"Minification complete")}!`),v(m+d.length+" "+(p.info_file||"file")+`${1<d.length?"s":""} ${p.info_minified||"minified"}.${t}`)):v(`
19
+ ${l+(p.info_noFilesProcessed||"No unminified JavaScript files processed")}.`),0<b.length&&(v(`
20
+ ${c+b.length} `+(p.info_file||"file")+`${1<b.length?"s":""} ${p.info_failedToMinify||"failed to minify"}:${t}`),b.forEach(e=>v(e))),0!=d?.length&&(u.copy&&1==d?.length?(v(`
21
+ ${p.info_copying||"Copying to clipboard"}...`),i.writeSync(d[0].code)):(v(`
22
+ Writing to file${1<d?.length?"s":""}...`),d?.forEach(({code:e,srcPath:i})=>{var o=s.join(s.dirname(i),(/so?u?rce?$/.test(s.dirname(i))?"../":"")+(S.endsWith(".js")?s.dirname(S):S||"min")),i=(S.endsWith(".js")&&j.endsWith(".js")?s.basename(S).replace(/(\.min)?\.js$/,""):s.basename(i,".js"))+".min.js",i=s.join(o,i);n.existsSync(o)||n.mkdirSync(o,{recursive:!0}),n.writeFileSync(i,e,"utf8")})))}}function $(n){return new Promise((o,e)=>{var i=n.match(/^([^:]+):\/\//)[1];/^https?$/.test(i)||e(new Error(`${p.error_invalidURL||"Invalid URL"}.`)),require(i).get(n,e=>{let i="";e.on("data",e=>i+=e),e.on("end",()=>o({json:()=>JSON.parse(i)}))}).on("error",e)})}function y(e=["header","usage","pathArgs","flags","paramOptions","infoCmds"]){var i=` ${pkgName.replace(/^@[^/]+\//,"")}  `;const o={header:["\n├ "+i+(p.appCopyright||copyright),i+(p.prefix_source||"Source")+": "+srcURL],usage:[`
23
+ ${m}o ${p.helpSection_usage||"Usage"}:`,` ${m}» `+a+cmdFormat+t],pathArgs:[`
21
24
  ${m}o ${p.helpSection_pathArgs||"Path arguments"}:`," [inputPath] "+`${p.inputPathDesc_main||"Path to JS file or directory containing JS files to be minified"}, `+`${p.inputPathDesc_extra||"relative to the current working directory"}.`," [outputPath] "+`${p.outputPathDesc_main||"Path to file or directory where minified files will be stored"}, `+`${p.outputPathDesc_extra||"relative to original file location (if not provided, min/ is used)"}.`],flags:[`
22
- ${m}o ${p.helpSection_flags||"Boolean options"}:`," -n, --dry-run "+`${p.optionDesc_dryRun||"Don't actually minify the file(s), just show if they will be processed"}.`,` -d, --include-dotfolders ${p.optionDesc_dotfolders||"Include dotfolders in file search"}.`,` -D, --include-dotfiles ${p.optionDesc_dotfiles||"Include dotfiles in file search"}.`,` -R, --no-recursion ${p.optionDesc_noRecursion||"Disable recursive file searching"}.`,` -M, --no-mangle ${p.optionDesc_noMangle||"Disable mangling names"}.`,` -q, --quiet ${p.optionDesc_quiet||"Suppress all logging except errors"}.`],paramOptions:[`
23
- ${m}o ${p.helpSection_paramOptions||"Parameter options"}:`,`--ignore-files="file1.js,file2.js" ${p.optionDesc_ignoreFiles||"Files to exclude from minification"}.`,`--comment="comment" ${p.optionDesc_commentMain||"Prepend comment to minified code"}.`+` ${p.optionDesc_commentExtra||"Separate by line using '\\n'"}.`],infoCmds:[`
24
- ${m}o ${p.helpSection_infoCmds||"Info commands"}:`," -h, --help "+(p.optionDesc_help||"Display help screen."),` -v, --version ${p.optionDesc_version||"Show version number"}.`]};e.forEach(t=>{i[t]?.forEach(e=>{{var n=/header|usage/.test(t)?1:37;const s=process.stdout.columns||80,r=[],o=e.match(/\S+|\s+/g);let i="";o.forEach(e=>{var o=s-(0==r.length?0:n);i.length+"| ".length+e.length>o&&(r.push(0==r.length?i:i.trimStart()),i=""),i+=e}),r.push(0==r.length?i:i.trimStart()),r.forEach((e,o)=>console.info("| "+(0==o?e:" ".repeat(n)+e)))}})}),console.info(`
25
- ${p.info_moreHelp||"For more help"}, ${p.info_visit||"visit"}: `+m+docURL+t)}function v(){console.info(`
25
+ ${m}o ${p.helpSection_flags||"Boolean options"}:`," -n, --dry-run "+`${p.optionDesc_dryRun||"Don't actually minify the file(s), just show if they will be processed"}.`,` -d, --include-dotfolders ${p.optionDesc_dotfolders||"Include dotfolders in file search"}.`,` -D, --include-dotfiles ${p.optionDesc_dotfiles||"Include dotfiles in file search"}.`,` -R, --no-recursion ${p.optionDesc_noRecursion||"Disable recursive file searching"}.`,` -M, --no-mangle ${p.optionDesc_noMangle||"Disable mangling names"}.`,` -c, --copy ${p.optionDesc_copy||"Copy minified code to clipboard instead of writing to file if single source file is processed"}.`,` -q, --quiet ${p.optionDesc_quiet||"Suppress all logging except errors"}.`],paramOptions:[`
26
+ ${m}o ${p.helpSection_paramOptions||"Parameter options"}:`,`--ignore-files="file1.js,file2.js" ${p.optionDesc_ignoreFiles||"Files to exclude from minification"}.`,`--comment="comment" ${p.optionDesc_commentMain||"Prepend header comment to minified code"}.`+` ${p.optionDesc_commentExtra||"Separate by line using '\\n'"}.`],infoCmds:[`
27
+ ${m}o ${p.helpSection_infoCmds||"Info commands"}:`," -h, --help "+(p.optionDesc_help||"Display help screen."),` -v, --version ${p.optionDesc_version||"Show version number"}.`]};e.forEach(t=>{o[t]?.forEach(e=>{{var n=/header|usage/.test(t)?1:37;const s=process.stdout.columns||80,r=[],i=e.match(/\S+|\s+/g);let o="";i.forEach(e=>{var i=s-(0==r.length?0:n);o.length+"| ".length+e.length>i&&(r.push(0==r.length?o:o.trimStart()),o=""),o+=e}),r.push(0==r.length?o:o.trimStart()),r.forEach((e,i)=>console.info("| "+(0==i?e:" ".repeat(n)+e)))}})}),console.info(`
28
+ ${p.info_moreHelp||"For more help"}, ${p.info_visit||"visit"}: `+m+docURL+t)}function _(){console.info(`
26
29
  ${p.info_moreHelp||"For more help"},`+` ${p.info_type||"type"} 'minify-js --help'`+` ${p.info_or||"or"} ${p.info_visit||"visit"}
27
- `+m+docURL+t)}function o(e){u.quietMode||console.info(e)}})();
30
+ `+m+docURL+t)}function v(e){u.quietMode||console.info(e)}})();
package/docs/README.md CHANGED
@@ -23,7 +23,7 @@
23
23
 
24
24
  <a href="https://www.npmjs.com/package/@adamlui/minify.js"><img height=31 src="https://img.shields.io/npm/dm/%40adamlui%2Fminify.js?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
25
25
  <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>
26
- <a href="https://github.com/adamlui/minify.js/releases/tag/node-v1.6.2"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.6.2-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
26
+ <a href="https://github.com/adamlui/minify.js/releases/tag/node-v1.7.0"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
27
27
  <a href="https://www.npmjs.com/package/@adamlui/minify.js?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/%40adamlui%2Fminify.js?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
28
28
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_minify.js:node.js/src/minify.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_minify.js%3Anode.js%2Fsrc%2Fminify.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
29
29
  <a href="https://github.com/toolleeo/cli-apps#programming"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
@@ -57,6 +57,8 @@ $ npm install @adamlui/minify.js
57
57
 
58
58
  <br>
59
59
 
60
+ <a href="https://github.com/sponsors/adamlui"><img src="https://media.minify-js.org/images/banners/sponsor/$10/banner1660x260.png?f6118ce"></a>
61
+
60
62
  <img height=6px width="100%" src="https://media.minify-js.org/images/separators/gradient-aqua.png?8b9ed02">
61
63
 
62
64
  ## 💻 Command line usage
@@ -134,11 +136,14 @@ Boolean options:
134
136
  -D, --include-dotfiles Include dotfiles in file search.
135
137
  -R, --no-recursion Disable recursive file searching.
136
138
  -M, --no-mangle Disable mangling names.
139
+ -c, --copy Copy minified code to clipboard instead
140
+ of writing to file if single source file
141
+ is processed.
137
142
  -q, --quiet Suppress all logging except errors.
138
143
 
139
144
  Parameter options:
140
145
  --ignore-files="file1.js,file2.js" Files to exclude from minification.
141
- --comment="comment" Prepend comment to minified code.
146
+ --comment="comment" Prepend header comment to minified code.
142
147
  Separate by line using '\n'.
143
148
 
144
149
  Info commands:
@@ -206,15 +211,15 @@ minifyJS.minify(input, { dotFiles: true });
206
211
 
207
212
  Available parameters (and their default settings) are:
208
213
 
209
- Name | Type | Desciption | Default value
210
- --------------|---------|-------------------------------------------------------------------|---------------
211
- `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
212
- `verbose` | Boolean | Show logging in console/terminal. | `true`
213
- `dotFolders` | Boolean | Include dotfolders in file search. | `false`
214
- `dotFiles` | Boolean | Include dotfiles in file search. | `false`
215
- `mangle` | Boolean | Shorten variable names (typically to one character). | `true`
216
- `ignoreFiles` | Array | Files (by name) to exclude from minification. | `[]`
217
- `comment` | String | Comment to prepend to minified code. Separate by line using '\n'. | `''`
214
+ Name | Type | Desciption | Default value
215
+ --------------|---------|--------------------------------------------------------------------------|---------------
216
+ `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
217
+ `verbose` | Boolean | Show logging in console/terminal. | `true`
218
+ `dotFolders` | Boolean | Include dotfolders in file search. | `false`
219
+ `dotFiles` | Boolean | Include dotfiles in file search. | `false`
220
+ `mangle` | Boolean | Shorten variable names (typically to one character). | `true`
221
+ `ignoreFiles` | Array | Files (by name) to exclude from minification. | `[]`
222
+ `comment` | String | Header comment to prepend to minified code. Separate by line using '\n'. | `''`
218
223
 
219
224
  #
220
225
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/minify.js",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "description": "Recursively minify all JavaScript files",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -11,7 +11,6 @@
11
11
  "license": "MIT",
12
12
  "main": "dist/minify.min.js",
13
13
  "files": [
14
- "dist",
15
14
  "docs/",
16
15
  "!docs/*/"
17
16
  ],
@@ -53,6 +52,7 @@
53
52
  "url": "https://github.minify-js.org/issues"
54
53
  },
55
54
  "dependencies": {
55
+ "node-clipboardy": "^1.0.3",
56
56
  "uglify-js": "^3.17.4"
57
57
  },
58
58
  "funding": {