Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-minify-dead-code-elimination

Package Overview
Dependencies
Maintainers
4
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-minify-dead-code-elimination - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

51

lib/index.js

@@ -775,3 +775,3 @@ "use strict";

// `function.name` all minifiers do it and hence became a standard.
"FunctionExpression|ClassExpression"(path) {
"FunctionExpression"(path) {
if (!this.keepFnName) {

@@ -782,2 +782,9 @@ removeUnreferencedId(path);

// remove class names
"ClassExpression"(path) {
if (!this.keepClassName) {
removeUnreferencedId(path);
}
},
// Put the `var` in the left if feasible.

@@ -831,21 +838,29 @@ ForInStatement(path) {

},
Program(path) {
var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref4$opts = _ref4.opts;
Program: {
exit(path) {
var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref4$opts = _ref4.opts;
_ref4$opts = _ref4$opts === undefined ? {} : _ref4$opts;
var _ref4$opts$optimizeRa = _ref4$opts.optimizeRawSize,
optimizeRawSize = _ref4$opts$optimizeRa === undefined ? false : _ref4$opts$optimizeRa,
_ref4$opts$keepFnName = _ref4$opts.keepFnName,
keepFnName = _ref4$opts$keepFnName === undefined ? false : _ref4$opts$keepFnName,
_ref4$opts$keepFnArgs = _ref4$opts.keepFnArgs,
keepFnArgs = _ref4$opts$keepFnArgs === undefined ? false : _ref4$opts$keepFnArgs;
_ref4$opts = _ref4$opts === undefined ? {} : _ref4$opts;
var _ref4$opts$optimizeRa = _ref4$opts.optimizeRawSize,
optimizeRawSize = _ref4$opts$optimizeRa === undefined ? false : _ref4$opts$optimizeRa,
_ref4$opts$keepFnName = _ref4$opts.keepFnName,
keepFnName = _ref4$opts$keepFnName === undefined ? false : _ref4$opts$keepFnName,
_ref4$opts$keepClassN = _ref4$opts.keepClassName,
keepClassName = _ref4$opts$keepClassN === undefined ? false : _ref4$opts$keepClassN,
_ref4$opts$keepFnArgs = _ref4$opts.keepFnArgs,
keepFnArgs = _ref4$opts$keepFnArgs === undefined ? false : _ref4$opts$keepFnArgs;
// We need to run this plugin in isolation.
path.traverse(main, {
functionToBindings: new Map(),
optimizeRawSize,
keepFnName,
keepFnArgs
});
traverse.clearCache();
path.scope.crawl();
// We need to run this plugin in isolation.
path.traverse(main, {
functionToBindings: new Map(),
optimizeRawSize,
keepFnName,
keepClassName,
keepFnArgs
});
}
}

@@ -852,0 +867,0 @@ }

{
"name": "babel-plugin-minify-dead-code-elimination",
"version": "0.1.1",
"version": "0.1.2",
"description": "",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/babel/babili#readme",

@@ -15,4 +15,6 @@ # babel-plugin-minify-dead-code-elimination

console.log(x);
function unused() {
return 5;
}
}
foo(0 && bar());
```

@@ -28,3 +30,2 @@

}
foo(0);
```

@@ -35,3 +36,3 @@

```sh
$ npm install babel-plugin-minify-dead-code-elimination
npm install babel-plugin-minify-dead-code-elimination
```

@@ -60,3 +61,3 @@

```sh
$ babel --plugins minify-dead-code-elimination script.js
babel --plugins minify-dead-code-elimination script.js
```

@@ -76,1 +77,2 @@

+ `keepFnArgs` - prevent plugin from removing function args. Useful for code depending on `fn.length`
+ `keepClassName` - prevent mangler from altering class names.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc