Gathering detailed insights and metrics for @putout/plugin-minify
Gathering detailed insights and metrics for @putout/plugin-minify
Gathering detailed insights and metrics for @putout/plugin-minify
Gathering detailed insights and metrics for @putout/plugin-minify
🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement 💪 with built-in support for js, jsx, typescript, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
npm install @putout/plugin-minify
Typescript
Module System
Min. Node Version
Node Version
NPM Version
46.5
Supply Chain
82.5
Quality
81.6
Maintenance
100
Vulnerability
97.9
License
JavaScript (99.09%)
TypeScript (0.65%)
HTML (0.17%)
WebAssembly (0.05%)
CSS (0.02%)
Svelte (0.01%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
20,705
Last Day
17
Last Week
150
Last Month
651
Last Year
7,261
MIT License
728 Stars
14,968 Commits
40 Forks
11 Watchers
46 Branches
23 Contributors
Updated on Feb 12, 2025
Minified
Minified + Gzipped
Latest Version
9.0.0
Package Id
@putout/plugin-minify@9.0.0
Unpacked Size
36.14 kB
Size
9.40 kB
File Count
25
NPM Version
10.9.0
Node Version
22.11.0
Published on
Dec 10, 2024
Cumulative downloads
Total Downloads
Last Day
142.9%
17
Compared to previous day
Last Week
50%
150
Compared to previous week
Last Month
18.1%
651
Compared to previous month
Last Year
-46%
7,261
Compared to previous year
🐊Putout plugin adds support of minifiers used in @putout/minify
and minify
.
npm i @putout/plugin-putout -D
1{ 2 "rules": { 3 "minify/apply-ternary": "on", 4 "minify/apply-template-literal": "on", 5 "minify/convert-var-to-const": "on", 6 "minify/convert-if-to-logical": "on", 7 "minify/convert-strict-equal-to-equal": "on", 8 "minify/convert-array-from-to-spread": "on", 9 "minify/convert-return-to-sequence-expression": "on", 10 "minify/extract-body": "on", 11 "minify/expand-bindings": "on", 12 "minify/mangle-names": ["on", { 13 "mangleClassNames": true 14 }], 15 "minify/merge-assignment-expressions": "on", 16 "minify/merge-variables": "on", 17 "minify/merge-loops": "on", 18 "minify/remove-var-undefined": "on", 19 "minify/remove-return-undefined": "on", 20 "minify/simplify-floor": "on", 21 "minify/shorten-names": "on", 22 "minify/join-continued-strings": "on", 23 "minify/inline": "on", 24 "minify/types": "on" 25 } 26}
Check out in 🐊Putout Editor.
1if (a) 2 b(); 3else 4 c();
1a ? b() : c();
Not only short, but also fast:
1// 34.795ms 2for (let i = 0; i < 1_000_000; i++) 3 String(i); 4 5// 28.302ms 6for (let i = 0; i < 1_000_000; i++) 7 i.toString(); 8 9// 24.818ms 10for (let i = 0; i < 1_000_000; i++) 11 `${i}`;
1x.toString();
2String(x);
1String(x);
Check out in 🐊Putout Editor.
1if (a) 2 console.log('hello'); 3 4if (b) { 5 console.log('hello'); 6 console.log('world'); 7} 8 9if (a) { 10 console.log(1); 11 console.log(2); 12} else { 13 console.log(3); 14 console.log(4); 15}
1a && console.log('hello');
2
3b && (console.log('hello'), console.log('world'));
4
5a ? (console.log(1), console.log(2)) : (console.log(3), console.log(4));
1const a = 5;
1var a = 5;
Check out in 🐊Putout Editor.
1() => { 2 d(); 3 return 1; 4};
1() => { 2 d(); 3 return 1; 4};
Check out in 🐊Putout Editor.
1a === b;
1a == b;
1Array 2 .from(a) 3 .map((x, i) => `${i}: ${x}`);
1[...a].map((x, i) => `${i}: ${x}`);
Check out in 🐊Putout Editor.
1if (x) 2 return; 3 4const hello = () => { 5 return 'world'; 6};
1if (x) 2 return; 3 4const hello = () => 'world';
Check out in 🐊Putout Editor.
1const y = 'abc'; 2const x = y; 3const fn = require(x); 4 5const a = 5; 6const b = a; 7const c = b; 8 9fn(c);
1require('abc')(5);
Checkout in 🐊Putout Editor.
1var a = undefined;
1var a;
1const fn = () => { 2 if (a) 3 return undefined; 4 5 return undefined; 6};
1const fn = () => { 2 if (a) 3 return; 4};
Check out in 🐊Putout Editor.
1function generate() { 2 const hello = 'hi'; 3 return hello; 4}
1function generate() { 2 const a = 'hi'; 3 return a; 4}
When you want to preserve class names use
1{ 2 "rules": { 3 "minify/mangle-names": ["on", { 4 "mangleClassNames": false 5 }] 6 } 7}
In this case you will see:
1class Hello { 2 world() { 3 const hello = 'hello'; 4 return hello; 5 } 6}
1class Hello { 2 world() { 3 const a = 'hello'; 4 return a; 5 } 6}
Check out in 🐊Putout Editor.
1a = 'hello'; 2b = 'hello'; 3c = 'hello'; 4d = 'hello';
1a = b = c = d = 'hello';
Check out in 🐊Putout Editor.
1var a; 2var b;
1var a, b;
Check out in 🐊Putout Editor.
1for (const aa of a) 2 d.push(aa); 3 4for (const bb of b) 5 d.push(bb);
1for (const aa of [...a, ...b]) 2 d.push(aa);
Not only shorter, but faster:
1// 5.027ms 2for (let i = 0; i < 1_000_000; i++) 3 Math.floor(i + 0.5); 4 5// 3.493ms 6for (let i = 0; i < 1_000_000; i++) 7 ~~(i + 0.5);
1Math.floor(x);
1~~x;
Feats good to @putout/plugin-declare
.
Check out in 🐊Putout Editor.
1const a = (b) => { 2 Object.keys(b); 3}; 4 5const b = (keys) => { 6 Object.keys(keys); 7}; 8 9Object.freeze(a); 10Object.defineProperty(b);
1const a = (b) => { 2 keys(b); 3}; 4 5const b = (keys) => { 6 Object.keys(keys); 7}; 8 9freeze(a); 10defineProperty(b);
Check out in 🐊Putout Editor.
1const a = undefined; 2const b = true; 3const c = false;
1const a = void 0; 2const b = !0; 3const c = !1;
Join continued strings to one line. Check out in 🐊Putout Editor.
1console.log(`\ 2 1\ 3 2\ 4 3`, '\ 5 a\ 6 b\ 7 c');
1console.log(` 1 2 3`, ' a b c');
Check out in 🐊Putout Editor.
1let x = 1; 2--x; 3 4if (!x) 5 console.log('hello');
1let x = 1; 2 3if (!--x) 4 console.log('hello');
MIT
No vulnerabilities found.
Reason
30 commit(s) and 4 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More