diff options
Diffstat (limited to 'node_modules/babel-preset-minify')
| -rw-r--r-- | node_modules/babel-preset-minify/LICENSE | 22 | ||||
| -rw-r--r-- | node_modules/babel-preset-minify/README.md | 171 | ||||
| -rw-r--r-- | node_modules/babel-preset-minify/lib/index.js | 114 | ||||
| -rw-r--r-- | node_modules/babel-preset-minify/package.json | 42 |
4 files changed, 0 insertions, 349 deletions
diff --git a/node_modules/babel-preset-minify/LICENSE b/node_modules/babel-preset-minify/LICENSE deleted file mode 100644 index f9f0a7f3..00000000 --- a/node_modules/babel-preset-minify/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2015-2016 Amjad Masad <amjad.masad@gmail.com> - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/babel-preset-minify/README.md b/node_modules/babel-preset-minify/README.md deleted file mode 100644 index 57f7bbfe..00000000 --- a/node_modules/babel-preset-minify/README.md +++ /dev/null @@ -1,171 +0,0 @@ -# babel-preset-minify - -Babel preset for all minify plugins. - -+ [Install](#install) -+ [Usage](#usage) -+ [Options](#options) - -## Install - -```sh -npm install babel-preset-minify --save-dev -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```json -{ - "presets": ["minify"] -} -``` - -or pass in options - - -```json -{ - "presets": [["minify", { - "mangle": { - "exclude": ["MyCustomError"] - }, - "unsafe": { - "typeConstructors": false - }, - "keepFnName": true - }]] -} -``` - -### Via CLI - -```sh -babel script.js --presets minify -``` - -### Via Node API - -```javascript -const babel = require("@babel/core"); -const fs = require("fs"); - -const code = fs.readFileSync("./input.js").toString(); - -const minified = babel.transform(code, { - presets: ["minify"] -}); -``` - -## Options - -Two types of options: - -1. 1-1 mapping with plugin -2. The same option passed to multiple plugins - -#### 1-1 mapping with plugin - -+ `false` - disable plugin -+ `true` - enable plugin -+ `{ ...pluginOpts }` - enable plugin and pass pluginOpts to plugin - -OptionName | Plugin | DefaultValue ----------- | ------ | ------------ -booleans | [transform-minify-booleans][booleans] | true -builtIns | [minify-builtins][builtIns] | true -consecutiveAdds | [transform-inline-consecutive-adds][consecutiveAdds] | true -deadcode | [minify-dead-code-elimination][deadcode] | true -evaluate | [minify-constant-folding][evaluate] | true -flipComparisons | [minify-flip-comparisons][flipComparisons] | true -guards | [minify-guarded-expressions][guards] | true -infinity | [minify-infinity][infinity] | true -mangle | [minify-mangle-names][mangle] | true -memberExpressions | [transform-member-expression-literals][memberExpressions] | true -mergeVars | [transform-merge-sibling-variables][mergeVars] | true -numericLiterals | [minify-numeric-literals][numericLiterals] | true -propertyLiterals | [transform-property-literals][propertyLiterals] | true -regexpConstructors | [transform-regexp-constructors][regexpConstructors] | true -removeConsole | [transform-remove-console][removeConsole] | false -removeDebugger | [transform-remove-debugger][removeDebugger] | false -removeUndefined | [transform-remove-undefined][removeUndefined] | true -replace | [minify-replace][replace] | true -simplify | [minify-simplify][simplify] | true -simplifyComparisons | [transform-simplify-comparison-operators][simplifyComparisons] | true -typeConstructors | [minify-type-constructors][typeConstructors] | true -undefinedToVoid | [transform-undefined-to-void][undefinedToVoid] | true - -#### The same option passed to multiple plugins - -+ When multiple plugins require the same option, it's easier to declare it in one place. These options are passed on to two or more plugins. - -OptionName | Plugins ----------- | ------- -keepFnName | Passed to [mangle][mangle] & [deadcode][deadcode] -keepClassName | Passed to [mangle][mangle] & [deadcode][deadcode] -tdz | Passed to [builtIns][builtIns], [evaluate][evaluate], [deadcode][deadcode], [removeUndefined][removeUndefined] - -**Examples** - -```json -{ - "presets": [["minify", { - "evaluate": false, - "mangle": true - }]] -} -``` - -```json -{ - "presets": [["minify", { - "mangle": { - "exclude": ["ParserError", "NetworkError"] - } - }]] -} -``` - -```json -{ - "presets": [["minify", { - "keepFnName": true - }]] -} -// is the same as -{ - "presets": [["minify", { - "mangle": { - "keepFnName": true - }, - "deadcode": { - "keepFnName": true - } - }]] -} -``` - -[booleans]: ../../packages/babel-plugin-transform-minify-booleans -[builtIns]: ../../packages/babel-plugin-minify-builtins -[consecutiveAdds]: ../../packages/babel-plugin-transform-inline-consecutive-adds -[deadcode]: ../../packages/babel-plugin-minify-dead-code-elimination -[evaluate]: ../../packages/babel-plugin-minify-constant-folding -[flipComparisons]: ../../packages/babel-plugin-minify-flip-comparisons -[guards]: ../../packages/babel-plugin-minify-guarded-expressions -[infinity]: ../../packages/babel-plugin-minify-infinity -[mangle]: ../../packages/babel-plugin-minify-mangle-names -[memberExpressions]: ../../packages/babel-plugin-transform-member-expression-literals -[mergeVars]: ../../packages/babel-plugin-transform-merge-sibling-variables -[numericLiterals]: ../../packages/babel-plugin-minify-numeric-literals -[propertyLiterals]: ../../packages/babel-plugin-transform-property-literals -[regexpConstructors]: ../../packages/babel-plugin-transform-regexp-constructors -[removeConsole]: ../../packages/babel-plugin-transform-remove-console -[removeDebugger]: ../../packages/babel-plugin-transform-remove-debugger -[removeUndefined]: ../../packages/babel-plugin-transform-remove-undefined -[replace]: ../../packages/babel-plugin-minify-replace -[simplify]: ../../packages/babel-plugin-minify-simplify -[simplifyComparisons]: ../../packages/babel-plugin-transform-simplify-comparison-operators -[typeConstructors]: ../../packages/babel-plugin-minify-type-constructors -[undefinedToVoid]: ../../packages/babel-plugin-transform-undefined-to-void diff --git a/node_modules/babel-preset-minify/lib/index.js b/node_modules/babel-preset-minify/lib/index.js deleted file mode 100644 index a51f9256..00000000 --- a/node_modules/babel-preset-minify/lib/index.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -const isPlainObject = require("lodash/isPlainObject"); // the flat plugin map -// This is to prevent dynamic requires - require('babel-plugin-' + name); -// as it suffers during bundling of this code with webpack/browserify -// sorted by option name -// prettier-ignore - - -const PLUGINS = [// [optionname, plugin, default], -["booleans", require("babel-plugin-transform-minify-booleans"), true], ["builtIns", require("babel-plugin-minify-builtins"), true], ["consecutiveAdds", require("babel-plugin-transform-inline-consecutive-adds"), true], ["deadcode", require("babel-plugin-minify-dead-code-elimination"), true], ["evaluate", require("babel-plugin-minify-constant-folding"), true], ["flipComparisons", require("babel-plugin-minify-flip-comparisons"), true], ["guards", require("babel-plugin-minify-guarded-expressions"), true], ["infinity", require("babel-plugin-minify-infinity"), true], ["mangle", require("babel-plugin-minify-mangle-names"), true], ["memberExpressions", require("babel-plugin-transform-member-expression-literals"), true], ["mergeVars", require("babel-plugin-transform-merge-sibling-variables"), true], ["numericLiterals", require("babel-plugin-minify-numeric-literals"), true], ["propertyLiterals", require("babel-plugin-transform-property-literals"), true], ["regexpConstructors", require("babel-plugin-transform-regexp-constructors"), true], ["removeConsole", require("babel-plugin-transform-remove-console"), false], ["removeDebugger", require("babel-plugin-transform-remove-debugger"), false], ["removeUndefined", require("babel-plugin-transform-remove-undefined"), true], ["replace", require("babel-plugin-minify-replace"), true], ["simplify", require("babel-plugin-minify-simplify"), true], ["simplifyComparisons", require("babel-plugin-transform-simplify-comparison-operators"), true], ["typeConstructors", require("babel-plugin-minify-type-constructors"), true], ["undefinedToVoid", require("babel-plugin-transform-undefined-to-void"), true]]; -const PROXIES = { - keepFnName: ["mangle", "deadcode"], - keepClassName: ["mangle", "deadcode"], - tdz: ["builtIns", "evaluate", "deadcode", "removeUndefined"] -}; -module.exports = preset; - -function preset(context, _opts = {}) { - const opts = isPlainObject(_opts) ? _opts : {}; // validate options - - const validOptions = [...PLUGINS.map(p => p[0]), ...Object.keys(PROXIES)]; - - for (let name in opts) { - if (validOptions.indexOf(name) < 0) { - throw new Error(`Invalid option "${name}"`); - } - } // build a plugins map from the plugin table above - - - const pluginsMap = PLUGINS.reduce((acc, [name, plugin, defaultValue]) => Object.assign(acc, { - [name]: { - plugin, - options: null, - enabled: defaultValue - } - }), {}); // handle plugins and their options - - var _iterator = _createForOfIteratorHelper(PLUGINS), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - const _step$value = _slicedToArray(_step.value, 1), - name = _step$value[0]; - - if (isPlainObject(opts[name])) { - // for plugins disabled by default - pluginsMap[name].enabled = true; - pluginsMap[name].options = opts[name]; - } else if (opts[name] !== void 0) { - pluginsMap[name].enabled = !!opts[name]; - } - } // handle proxies - - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - for (let proxyname in PROXIES) { - if (opts[proxyname] !== void 0) { - var _iterator2 = _createForOfIteratorHelper(PROXIES[proxyname]), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - const to = _step2.value; - - if (!pluginsMap[to].options) { - pluginsMap[to].options = {}; - } - - if (!hop(pluginsMap[to].options, proxyname)) { - pluginsMap[to].options[proxyname] = opts[proxyname]; - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - } // get the array of plugins - - - const plugins = Object.keys(pluginsMap).map(name => pluginsMap[name]).filter(plugin => plugin.enabled).map(plugin => plugin.options ? [plugin.plugin, plugin.options] : plugin.plugin); - return { - minified: true, - presets: [{ - plugins - }], - passPerPreset: true - }; -} - -function hop(o, key) { - return Object.prototype.hasOwnProperty.call(o, key); -}
\ No newline at end of file diff --git a/node_modules/babel-preset-minify/package.json b/node_modules/babel-preset-minify/package.json deleted file mode 100644 index 2f04a886..00000000 --- a/node_modules/babel-preset-minify/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "babel-preset-minify", - "version": "0.5.2", - "description": "", - "keywords": [ - "babel-minify", - "babel-preset", - "minify" - ], - "homepage": "https://github.com/babel/minify#readme", - "bugs": "https://github.com/babel/minify/issues", - "license": "MIT", - "author": "amasad", - "main": "lib/index.js", - "repository": "https://github.com/babel/minify/tree/master/packages/babel-preset-minify", - "dependencies": { - "babel-plugin-minify-builtins": "^0.5.0", - "babel-plugin-minify-constant-folding": "^0.5.0", - "babel-plugin-minify-dead-code-elimination": "^0.5.2", - "babel-plugin-minify-flip-comparisons": "^0.4.3", - "babel-plugin-minify-guarded-expressions": "^0.4.4", - "babel-plugin-minify-infinity": "^0.4.3", - "babel-plugin-minify-mangle-names": "^0.5.1", - "babel-plugin-minify-numeric-literals": "^0.4.3", - "babel-plugin-minify-replace": "^0.5.0", - "babel-plugin-minify-simplify": "^0.5.1", - "babel-plugin-minify-type-constructors": "^0.4.3", - "babel-plugin-transform-inline-consecutive-adds": "^0.4.3", - "babel-plugin-transform-member-expression-literals": "^6.9.4", - "babel-plugin-transform-merge-sibling-variables": "^6.9.5", - "babel-plugin-transform-minify-booleans": "^6.9.4", - "babel-plugin-transform-property-literals": "^6.9.4", - "babel-plugin-transform-regexp-constructors": "^0.4.3", - "babel-plugin-transform-remove-console": "^6.9.4", - "babel-plugin-transform-remove-debugger": "^6.9.4", - "babel-plugin-transform-remove-undefined": "^0.5.0", - "babel-plugin-transform-simplify-comparison-operators": "^6.9.4", - "babel-plugin-transform-undefined-to-void": "^6.9.4", - "lodash": "^4.17.11" - }, - "gitHead": "8f9c7c0a32103653bd6793d0ce44730f937e1ddf" -} |
