Socket
Socket
Sign inDemoInstall

babel-plugin-minify-mangle-names

Package Overview
Dependencies
1
Maintainers
5
Versions
87
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-minify-mangle-names

Context- and scope- aware variable renaming.


Version published
Weekly downloads
432K
increased by2.75%
Maintainers
5
Install size
42.0 kB
Created
Weekly downloads
 

Readme

Source

babel-plugin-minify-mangle-names

Context- and scope- aware variable renaming.

Example

In

var globalVariableName = 42;
function foo() {
  var longLocalVariableName = 1;
  if (longLocalVariableName) {
    console.log(longLocalVariableName);
  }
}

Out

var globalVariableName = 42;
function foo() {
  var a = 1;
  if (a) {
    console.log(a);
  }
}

Installation

npm install babel-plugin-minify-mangle-names --save-dev

Usage

.babelrc

// without options
{
  "plugins": ["minify-mangle-names"]
}
// with options
{
  "plugins": [
    ["minify-mangle-names", { "exclude": { "foo": true, "bar": true} }]
  ]
}

Via CLI

babel --plugins minify-mangle-names script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["minify-mangle-names"]
});

Options

  • exclude - A plain JS Object with keys as identifier names and values indicating whether to exclude (default: {})
  • eval - mangle identifiers in scopes accessible by eval (default: false)
  • keepFnName - prevent mangler from altering function names. Useful for code depending on fn.name (default: false)
  • topLevel - mangle topLevel Identifiers (default: false)
  • keepClassName - prevent mangler from altering class names (default: false).

Keywords

FAQs

Last updated on 06 May 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc