diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-03-14 17:01:52 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-03-14 17:01:52 +0800 |
| commit | 7f8f993637e698d63aeb2e08f053e0948d9f4d31 (patch) | |
| tree | 52d5e508a4ff2e4fa80dde457bc52e662a3887ab /node_modules/babel-plugin-uglify | |
| parent | 7210ae26624cc6c6ad6725040e388b31991b7907 (diff) | |
fixed minifier
Diffstat (limited to 'node_modules/babel-plugin-uglify')
| -rw-r--r-- | node_modules/babel-plugin-uglify/.babelrc | 3 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/.editorconfig | 12 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/.npmignore | 3 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/LICENSE | 22 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/README.md | 41 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/dist/index.js | 55 | ||||
| l--------- | node_modules/babel-plugin-uglify/node_modules/.bin/uglifyjs | 1 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/package.json | 28 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/test/fixtures/actual.js | 6 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/test/fixtures/expected.js | 7 | ||||
| -rw-r--r-- | node_modules/babel-plugin-uglify/test/index.js | 53 |
11 files changed, 0 insertions, 231 deletions
diff --git a/node_modules/babel-plugin-uglify/.babelrc b/node_modules/babel-plugin-uglify/.babelrc deleted file mode 100644 index 4adbf344..00000000 --- a/node_modules/babel-plugin-uglify/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{
- "loose": "all"
-}
diff --git a/node_modules/babel-plugin-uglify/.editorconfig b/node_modules/babel-plugin-uglify/.editorconfig deleted file mode 100644 index ae483a20..00000000 --- a/node_modules/babel-plugin-uglify/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true
-
-[*]
-charset = utf-8
-trim_trailing_whitespace = true
-indent_style = tab
-indent_size = 4
-insert_final_newline = true
-
-[*.{json,babelrc,eslintrc}]
-indent_style = space
-indent_size = 2
diff --git a/node_modules/babel-plugin-uglify/.npmignore b/node_modules/babel-plugin-uglify/.npmignore deleted file mode 100644 index 5b023555..00000000 --- a/node_modules/babel-plugin-uglify/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -/src -*.log diff --git a/node_modules/babel-plugin-uglify/LICENSE b/node_modules/babel-plugin-uglify/LICENSE deleted file mode 100644 index 451219ec..00000000 --- a/node_modules/babel-plugin-uglify/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Ingvar Stepanyan - -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-plugin-uglify/README.md b/node_modules/babel-plugin-uglify/README.md deleted file mode 100644 index 67ea232a..00000000 --- a/node_modules/babel-plugin-uglify/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# babel-plugin-uglify - -UglifyJS integration for Babel. - -It will allow you to integrate [UglifyJS minifier](https://github.com/mishoo/UglifyJS2) into Babel pipeline without a need for generating code from Babel and parsing back into UglifyJS just to minify it and generate back again. - -You can find a bit more detailed article on this [in my blog](https://rreverser.com/using-mozilla-ast-with-uglifyjs/). - -## Installation - -```sh -$ npm install babel-plugin-uglify --save-dev -``` - -## Usage - -Note that plugin should be **always** runned after any ES6 transformers (use `:after` suffix as shown below), as UglifyJS doesn't understand ES6 at all, and thus will just break if you have anything left untransformed. - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```json -{ - "plugins": ["uglify:after"] -} -``` - -### Via CLI - -```sh -$ babel --plugins uglify:after script.js -``` - -### Via Node API - -```javascript -require('babel').transform('code', { - plugins: ['uglify:after'] -}); -``` diff --git a/node_modules/babel-plugin-uglify/dist/index.js b/node_modules/babel-plugin-uglify/dist/index.js deleted file mode 100644 index 9a0b29c6..00000000 --- a/node_modules/babel-plugin-uglify/dist/index.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _uglifyJs = require('uglify-js'); - -var compressor = _uglifyJs.Compressor(); - -var LocationFixer = (function (_TreeWalker) { - _inherits(LocationFixer, _TreeWalker); - - function LocationFixer(path) { - _classCallCheck(this, LocationFixer); - - _TreeWalker.call(this, function (node) { - node.start.file = node.end.file = path.hub.file.opts.filenameRelative; - }); - } - - return LocationFixer; -})(_uglifyJs.TreeWalker); - -exports['default'] = function (_ref) { - var Plugin = _ref.Plugin; - var t = _ref.types; - return new Plugin('uglify', { - visitor: { - Program: function Program(ast) { - // Convert to UglifyJS AST - var uAST = _uglifyJs.AST_Node.from_mozilla_ast(ast); - - // Fix locations (Babel doesn't insert `loc.source` into nodes for some reason) - uAST.walk(new LocationFixer(this)); - - // Compress - uAST.figure_out_scope(); - uAST = uAST.transform(compressor); - - // Mangle names - uAST.figure_out_scope(); - uAST.compute_char_frequency(); - uAST.mangle_names(); - - // Convert back to ESTree AST - return uAST.to_mozilla_ast(); - } - } - }); -}; - -module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/babel-plugin-uglify/node_modules/.bin/uglifyjs b/node_modules/babel-plugin-uglify/node_modules/.bin/uglifyjs deleted file mode 120000 index aaaeee8a..00000000 --- a/node_modules/babel-plugin-uglify/node_modules/.bin/uglifyjs +++ /dev/null @@ -1 +0,0 @@ -../../../uglify-js/bin/uglifyjs
\ No newline at end of file diff --git a/node_modules/babel-plugin-uglify/package.json b/node_modules/babel-plugin-uglify/package.json deleted file mode 100644 index 70b3d202..00000000 --- a/node_modules/babel-plugin-uglify/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "babel-plugin-uglify", - "version": "1.0.2", - "description": "UglifyJS integration for Babel", - "repository": "RReverser/babel-plugin-uglify", - "license": "MIT", - "main": "dist/index.js", - "dependencies": { - "uglify-js": "^2.4.24" - }, - "devDependencies": { - "babel": "^5.8.19", - "chalk": "^1.1.0", - "clear": "0.0.1", - "diff": "^1.4.0", - "watch": "^0.16.0" - }, - "scripts": { - "release": "babel src --out-dir dist", - "test": "node test", - "watch": "node test --watch" - }, - "keywords": [ - "babel-plugin", - "uglify", - "minify" - ] -} diff --git a/node_modules/babel-plugin-uglify/test/fixtures/actual.js b/node_modules/babel-plugin-uglify/test/fixtures/actual.js deleted file mode 100644 index 6f5503c3..00000000 --- a/node_modules/babel-plugin-uglify/test/fixtures/actual.js +++ /dev/null @@ -1,6 +0,0 @@ -export function doSmth(hiThere) {
- hiThere();
- if (false) {
- console.log('dead code');
- }
-};
diff --git a/node_modules/babel-plugin-uglify/test/fixtures/expected.js b/node_modules/babel-plugin-uglify/test/fixtures/expected.js deleted file mode 100644 index 8c8c7a5a..00000000 --- a/node_modules/babel-plugin-uglify/test/fixtures/expected.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -function doSmth(t) { - t(); -} - -exports.__esModule = !0, exports.doSmth = doSmth; diff --git a/node_modules/babel-plugin-uglify/test/index.js b/node_modules/babel-plugin-uglify/test/index.js deleted file mode 100644 index 127e3938..00000000 --- a/node_modules/babel-plugin-uglify/test/index.js +++ /dev/null @@ -1,53 +0,0 @@ -var assert = require('assert');
-var babel = require('babel');
-var chalk = require('chalk');
-var clear = require('clear');
-var diff = require('diff');
-var fs = require('fs');
-
-require('babel/register')(JSON.parse(fs.readFileSync(__dirname + '/../.babelrc')));
-
-var pluginPath = require.resolve('../src');
-
-function runTest() {
- var output = babel.transformFileSync(__dirname + '/fixtures/actual.js', {
- optional: ['runtime'],
- plugins: [pluginPath + ':after'],
- filenameRelative: 'test/fixtures/actual.js'
- });
-
- var expected = fs.readFileSync(__dirname + '/fixtures/expected.js', 'utf-8');
-
- function normalizeLines(str) {
- return str.trimRight().replace(/\r\n/g, '\n');
- }
-
- diff.diffLines(normalizeLines(output.code), normalizeLines(expected))
- .forEach(function (part) {
- var value = part.value;
- if (part.added) {
- value = chalk.green(part.value);
- } else if (part.removed) {
- value = chalk.red(part.value);
- }
- process.stdout.write(value);
- });
-
- console.log();
-}
-
-if (process.argv.indexOf('--watch') >= 0) {
- require('watch').watchTree(__dirname + '/..', function () {
- delete require.cache[pluginPath];
- clear();
- console.log('Press Ctrl+C to stop watching...');
- console.log('================================');
- try {
- runTest();
- } catch (e) {
- console.error(chalk.magenta(e.stack));
- }
- });
-} else {
- runTest();
-}
|
