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

babel-preset-babili

Package Overview
Dependencies
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-babili

Babel preset for all minify plugins.

  • 0.0.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
decreased by-9.87%
Maintainers
4
Weekly downloads
 
Created
Source

babel-preset-babili

Babel preset for all minify plugins.

  • Install
  • Usage
  • Options

Install

npm install --save-dev babel-preset-babili

Usage

.babelrc

{
  "presets": ["babili"]
}

or pass in options -

{
  "presets": [["babili", {
    "mangle": {
      "blacklist": ["MyCustomError"]
    },
    "unsafe": {
      "typeConstructors": false
    },
    "keepFnName": true
  }]]
}

Via CLI

babel script.js --presets babili

Via Node API

require("babel-core").transform("code", {
  presets: ["babili"]
});

Options

All options are enabled by default except the ones with an explicit mention - (Default: false)

Three types of options:

1-1 mapping with plugin

  • false to disable the plugin
  • true to enable the plugin with default plugin specific options
  • { ...pluginOpts } to enable the plugin with custom plugin options

The following options have 1-1 mapping with a plugin,

Examples

{
  "presets": [["babili", {
    "evaluate": false,
    "mangle": true
  }]]
}
{
  "presets": [["babili", {
    "mangle": {
      "blacklist": {
        "ParserError": true,
        "NetworkError": false
      }
    }
  }]]
}

Option groups

  • false to disable the entire group
  • true to enable every plugin in the group
  • { pluginKey: <1-1 mapping> } - enable/disable a particular plugin in a group (or) pass options to that plugin

The following are groups of plugins -

Examples

Disables all unsafe plugins:

{
  "presets": [["babili", {
    "unsafe": false
  }]]
}

Disables only minify-guarded-expressions, and enable all other unsafe plugins:

{
  "presets": [["babili", {
    "unsafe": {
      "guards": false
    }
  }]]
}

Passing same plugin options to multiple plugins

In babili, multiple plugins require the same set of options and it is easier to mention it in one place instead of two.

  • keepFnName - This will be passed to mangle and deadcode and will NOT be overriden if the same option exists under either mangle or deadcode.

Examples

{
  "presets": [["babili", {
    "keepFnName": true
  }]]
}

is the same as,

Plugins applied:

{
  "presets": [["babili", {
    "mangle": {
      "keepFnName": true
    },
    "deadcode": {
      "keepFnName": true
    }
  }]]
}

Keywords

FAQs

Package last updated on 03 Mar 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc