![Malicious npm Package Typosquats react-login-page to Deploy Keylogger](https://cdn.sanity.io/images/cgdhsj6q/production/007b21d9cf9e03ae0bb3f577d1bd59b9d715645a-1024x1024.webp?w=400&fit=max&auto=format)
Research
Security News
Malicious npm Package Typosquats react-login-page to Deploy Keylogger
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
babel-plugin-minify-dead-code-elimination
Advanced tools
Package description
The babel-plugin-minify-dead-code-elimination package is a Babel plugin that helps in removing dead code from your JavaScript files. This can significantly reduce the size of your code by eliminating code that is never executed, such as unreachable code, unused variables, and functions.
Remove Unreachable Code
This feature removes code that is never executed. In the example, the `if` block will be removed because the condition is always false.
const condition = false;
if (condition) {
console.log('This will never be logged');
}
Remove Unused Variables
This feature removes variables that are declared but never used. In the example, `unusedVar` will be removed because it is never used.
const unusedVar = 42;
const usedVar = 24;
console.log(usedVar);
Remove Unused Functions
This feature removes functions that are declared but never called. In the example, `unusedFunction` will be removed because it is never called.
function unusedFunction() {
return 'I am not used';
}
function usedFunction() {
return 'I am used';
}
console.log(usedFunction());
UglifyJS is a JavaScript parser, minifier, compressor, and beautifier toolkit. It can also remove dead code, but it is a more general-purpose tool compared to babel-plugin-minify-dead-code-elimination, which is specifically designed for dead code elimination.
Terser is a JavaScript parser and mangler/compressor toolkit for ES6+. It is a fork of UglifyJS and offers similar functionalities, including dead code elimination. Terser is often used in modern JavaScript projects for minification and dead code removal.
This is a Rollup plugin that integrates Terser for minification and dead code elimination. It is specifically designed to work with Rollup, a module bundler for JavaScript, making it a good choice for projects that use Rollup.
Readme
Inlines bindings when possible. Tries to evaluate expressions and prunes unreachable as a result.
In
function foo() {var x = 1;}
function bar() { var x = f(); }
function baz() {
var x = 1;
console.log(x);
}
foo(0 && bar());
Out
function foo() {}
function bar() { f(); }
function baz() {
console.log(1);
}
foo(0);
$ npm install babel-plugin-minify-dead-code-elimination
.babelrc
(Recommended).babelrc
// without options
{
"plugins": ["minify-dead-code-elimination"]
}
// with options
{
"plugins": ["minify-dead-code-elimination", { "optimizeRawSize": true }]
}
$ babel --plugins minify-dead-code-elimination script.js
require("babel-core").transform("code", {
plugins: ["minify-dead-code-elimination"]
});
FAQs
Unknown package
We found that babel-plugin-minify-dead-code-elimination demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
Security News
The JavaScript community has launched the e18e initiative to improve ecosystem performance by cleaning up dependency trees, speeding up critical parts of the ecosystem, and documenting lighter alternatives to established tools.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.