babili-webpack-plugin
Advanced tools
Comparing version 0.0.7 to 0.0.8
"use strict"; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -90,5 +88,5 @@ | ||
babelrc: false, | ||
inputSourceMap: inputSourceMap, | ||
shouldPrintComment: function shouldPrintComment(contents) { | ||
return _shouldPrintComment(contents, commentsRegex); | ||
inputSourceMap, | ||
shouldPrintComment(contents) { | ||
return shouldPrintComment(contents, commentsRegex); | ||
} | ||
@@ -112,4 +110,4 @@ }); | ||
function _shouldPrintComment(contents, checker) { | ||
switch (typeof checker === "undefined" ? "undefined" : _typeof(checker)) { | ||
function shouldPrintComment(contents, checker) { | ||
switch (typeof checker) { | ||
case "function": | ||
@@ -116,0 +114,0 @@ return checker(contents); |
{ | ||
"name": "babili-webpack-plugin", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Babili Plugin for Webpack", | ||
@@ -23,16 +23,16 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"babel-core": "^6.18.0", | ||
"babel-preset-babili": "^0.0.8", | ||
"webpack-sources": "^0.1.2" | ||
"babel-core": "^6.22.1", | ||
"babel-preset-babili": "^0.0.10", | ||
"webpack-sources": "^0.1.4" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.18.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
"eslint": "^3.8.0", | ||
"babel-cli": "^6.22.2", | ||
"babel-preset-env": "^1.1.8", | ||
"eslint": "^3.14.0", | ||
"expect": "^1.20.2", | ||
"mocha": "^3.0.2", | ||
"mocha": "^3.2.0", | ||
"rimraf": "^2.5.4", | ||
"source-map": "^0.5.6", | ||
"webpack": "^2.1.0-beta.21" | ||
"webpack": "^2.2.0" | ||
} | ||
} |
# babili-webpack-plugin | ||
This is a [webpack plugin](https://webpack.github.io/docs/using-plugins.html) for Babili. | ||
This is a [webpack plugin](https://webpack.js.org/configuration/plugins/) for Babili. | ||
Babili - A babel based minifier - https://github.com/babel/babili | ||
# NOTE: | ||
[![Build Status](https://travis-ci.org/boopathi/babili-webpack-plugin.svg?branch=master)](https://travis-ci.org/boopathi/babili-webpack-plugin) [![npm version](https://badge.fury.io/js/babili-webpack-plugin.svg)](https://badge.fury.io/js/babili-webpack-plugin) | ||
This might NOT be the best way to use babili. You can also use it with babel-loader for webpack (include `babili` in list of presets) and should be faster than using this. Further info - [#8](https://github.com/boopathi/babili-webpack-plugin/issues/8). | ||
+ [Install](#install) | ||
+ [Usage](#usage) | ||
+ [Options](#options) | ||
+ [Why?](#why) | ||
[![Build Status](https://travis-ci.org/boopathi/babili-webpack-plugin.svg?branch=master)](https://travis-ci.org/boopathi/babili-webpack-plugin) [![npm version](https://badge.fury.io/js/babili-webpack-plugin.svg)](https://badge.fury.io/js/babili-webpack-plugin) | ||
## Install | ||
@@ -36,3 +37,3 @@ | ||
+ `test`: JS file extension regex. Default: `/\.js($|\?)/i` | ||
+ `comments`: Preserve Comments. Default: `/@preserve|@license/`. falsy value to remove all comments. Accepts function, object with property test (regex), and values. | ||
+ `comments`: Preserve Comments. Default: `/@preserve|@licen(s|c)e/`. falsy value to remove all comments. Accepts function, object with property test (regex), and values. | ||
+ `sourceMap`: Default: uses [webpackConfig.devtool](https://webpack.github.io/docs/configuration.html#devtool). Set this to override that. | ||
@@ -42,2 +43,11 @@ + `babel`: Pass in a custom babel-core instead. `require("babel-core")` | ||
## Why? | ||
You can also use [babel-loader](https://github.com/babel/babel-loader) for webpack and include `babili` [as a preset](https://github.com/babel/babili#babel-preset) and should be much faster than using this - as babili will operate on smaller file sizes. But then, why does this plugin exist at all? - | ||
+ A webpack loader operates on single files and babili preset as a webpack loader is going to consider each file to be executed directly in the browser global scope (by default) and will not optimize some things in the toplevel scope. This is going to change and you can opt-in to optimize toplevel scope - [babel/babili#210](https://github.com/babel/babili/issues/210), [babel/babili#203](https://github.com/babel/babili/issues/203), etc... | ||
+ When you exclude `node_modules` from being run through the babel-loader, babili optimizations are not applied to the excluded files as it doesn't pass through the minifier. | ||
+ When you use the babel-loader with webpack, the code generated by webpack for the module system doesn't go through the loader and is not optimized by babili. | ||
+ A webpack plugin can operate on the entire chunk/bundle output and can optimize the whole bundle and you can see some differences in minified output. But this will be a lot slower as the file size is usually really huge. So there is [another idea](https://github.com/boopathi/babili-webpack-plugin/issues/8) where we can apply some optimizations as a part of the loader and some optimizations in a plugin. | ||
## LICENSE | ||
@@ -47,2 +57,2 @@ | ||
https://boopathi.mit-license.org | ||
https://boopathi.mit-license.org/2016 |
@@ -17,3 +17,3 @@ "use strict"; | ||
const commentsRegex = typeof options.comments === "undefined" | ||
? /@preserve|@license/ | ||
? /@preserve|@licen(s|c)e/ | ||
: options.comments; | ||
@@ -20,0 +20,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
130124
56
178
+ Addedbabel-helper-evaluate-path@0.0.3(transitive)
+ Addedbabel-helper-flip-expressions@0.0.2(transitive)
+ Addedbabel-helper-to-multiple-sequence-expressions@0.0.3(transitive)
+ Addedbabel-plugin-minify-constant-folding@0.0.3(transitive)
+ Addedbabel-plugin-minify-flip-comparisons@0.0.2(transitive)
+ Addedbabel-plugin-minify-guarded-expressions@0.0.4(transitive)
+ Addedbabel-plugin-minify-infinity@0.0.3(transitive)
+ Addedbabel-plugin-minify-mangle-names@0.0.6(transitive)
+ Addedbabel-plugin-minify-simplify@0.0.6(transitive)
+ Addedbabel-plugin-minify-type-constructors@0.0.3(transitive)
+ Addedbabel-plugin-transform-inline-consecutive-adds@0.0.2(transitive)
+ Addedbabel-plugin-transform-regexp-constructors@0.0.5(transitive)
+ Addedbabel-plugin-transform-remove-console@6.9.4(transitive)
+ Addedbabel-plugin-transform-remove-debugger@6.9.4(transitive)
+ Addedbabel-plugin-transform-remove-undefined@0.0.4(transitive)
+ Addedbabel-preset-babili@0.0.10(transitive)
+ Addedlodash.isplainobject@4.0.6(transitive)
- Removedbabel-helper-flip-expressions@0.0.1(transitive)
- Removedbabel-helper-to-multiple-sequence-expressions@0.0.2(transitive)
- Removedbabel-plugin-minify-constant-folding@0.0.1(transitive)
- Removedbabel-plugin-minify-flip-comparisons@0.0.1(transitive)
- Removedbabel-plugin-minify-guarded-expressions@0.0.3(transitive)
- Removedbabel-plugin-minify-infinity@0.0.1(transitive)
- Removedbabel-plugin-minify-mangle-names@0.0.4(transitive)
- Removedbabel-plugin-minify-simplify@0.0.4(transitive)
- Removedbabel-plugin-minify-type-constructors@0.0.2(transitive)
- Removedbabel-plugin-transform-regexp-constructors@0.0.1(transitive)
- Removedbabel-preset-babili@0.0.8(transitive)
Updatedbabel-core@^6.22.1
Updatedbabel-preset-babili@^0.0.10
Updatedwebpack-sources@^0.1.4