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

github.com/babel/minify

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/babel/minify

  • v0.0.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

babili (babel-minify)

An ES6+ aware minifier based on the Babel toolchain.

Travis Status Slack Status

  • NOTE: We are in a feature freeze as we're trying to hammer out all the bugs to get to beta release. The best way to contribute is to test, report bugs, and add test cases.

  • Checkout our CONTRIBUTING.md if you want to help out!

  • babili is consumable via API, CLI, or babel preset.

CLI

PackageVersionDependencies
babilinpmDependency Status

This is simple wrapper around the regular babel-cli and thus takes in the same cli options as running babel on its own. You can use this if you don't already use babel or want to run it standalone.

Usage

babili src -d lib

Equivalent to: babel src -d lib --presets=babili

Babel preset

PackageVersionDependencies
babel-preset-babilinpmDependency Status

It's a babel preset (like babel-preset-es2015).

Usage

You'll most likely want to use it only in the production environment. Check out the env docs for more help.

Options specific to a certain environment are merged into and overwrite non-env specific options.

.babelrc:

{
  "presets": ["es2015"],
  "env": {
    "production": {
      "presets": ["minify"]
    }
  }
}

Then you'll need to set the env variable which could be something like BABEL_ENV=production npm run build

Plugins (in babel-preset-babili)

The babili repo is comprised of many npm packages. It is a lerna monorepo similar to babel itself.

The npm package babel-preset-babili is at the path packages/babel-preset-babili

PackageVersionDependencies
babel-plugin-minify-constant-foldingnpmDependency Status
babel-plugin-minify-dead-code-eliminationnpmDependency Status
babel-plugin-minify-flip-comparisonsnpmDependency Status
babel-plugin-minify-guarded-expressionsnpmDependency Status
babel-plugin-minify-infinitynpmDependency Status
babel-plugin-minify-mangle-namesnpmDependency Status
babel-plugin-minify-replacenpmDependency Status
babel-plugin-minify-simplifynpmDependency Status
babel-plugin-minify-type-constructorsnpmDependency Status
babel-plugin-transform-member-expression-literalsnpmDependency Status
babel-plugin-transform-merge-sibling-variablesnpmDependency Status
babel-plugin-transform-minify-booleansnpmDependency Status
babel-plugin-transform-property-literalsnpmDependency Status
babel-plugin-transform-simplify-comparison-operatorsnpmDependency Status
babel-plugin-transform-undefined-to-voidnpmDependency Status

Usage

Normally you wouldn't be consuming the plugins directly since the preset is available.

Add to your .babelrc's plugins array.

{
  "plugins": ["babel-plugin-transform-undefined-to-void"]
}

Other

PackageVersionDependencies
babel-plugin-minify-empty-functionnpmDependency Status
babel-plugin-transform-inline-environment-variablesnpmDependency Status
babel-plugin-transform-node-env-inlinenpmDependency Status
babel-plugin-transform-remove-consolenpmDependency Status
babel-plugin-transform-remove-debuggernpmDependency Status

Benchmarks

Running the benchmarks: ./scripts/benchmark.js file.js

Backbone.js:

        raw     raw win gzip   gzip win parse time run
babel   21.74kB 222%    7.28kB 170%     2ms        831ms
uglify  21.82kB 220%    7.32kB 169%     1ms        359ms
closure 21.67kB 223%    7.37kB 167%     2ms        3455ms

Run with: ./scripts/benchmark.js ./scripts/fixtures/backbone.js

React:

        raw      raw win gzip    gzip win parse time run
babel   176.09kB 256%    52.88kB 168%     12ms       3506ms
closure 171.46kB 265%    52.97kB 168%     12ms       9785ms
uglify  176.41kB 255%    53.18kB 167%     12ms       2187ms

Run with: ./scripts/benchmark.js ./scripts/fixtures/react.js

jQuery:

        raw     raw win gzip    gzip win parse time run
uglify  94.4kB  217%    32.82kB 157%     8ms        1449ms
babel   93.63kB 220%    32.95kB 156%     8ms        3623ms
closure 94.23kB 218%    33.38kB 153%     10ms       9001ms

Run with: ./scripts/benchmark.js ./scripts/fixtures/jquery.js

FAQs

Package last updated on 26 Aug 2016

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