diff --git a/.gitignore b/.gitignore index 6704566..adb2c19 100644 --- a/.gitignore +++ b/.gitignore @@ -80,7 +80,6 @@ typings/ # Nuxt.js build / generate output .nuxt -dist # Gatsby files .cache/ diff --git a/dist/plugin.es.js b/dist/plugin.es.js new file mode 100644 index 0000000..cce83bb --- /dev/null +++ b/dist/plugin.es.js @@ -0,0 +1,33 @@ +import { minify } from 'uglify-js'; + +function uglify(options) { + if (options === void 0) { options = {}; } + return { + name: 'uglify', + transform: function (code) { + var _this = this; + if (typeof options.sourceMap === 'undefined') { + options.sourceMap = true; + } + if (typeof options.warnings === 'undefined') { + options.warnings = true; + } + var result = minify(code, options); + if (result.error) { + throw result.error; + } + if (result.warnings) { + result.warnings.forEach(function (warning) { + _this.warn(warning); + }); + } + return { + code: result.code, + map: result.map + }; + } + }; +} + +export default uglify; +//# sourceMappingURL=plugin.es.js.map diff --git a/dist/plugin.es.js.map b/dist/plugin.es.js.map new file mode 100644 index 0000000..9517869 --- /dev/null +++ b/dist/plugin.es.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugin.js b/dist/plugin.js new file mode 100644 index 0000000..4be103b --- /dev/null +++ b/dist/plugin.js @@ -0,0 +1,39 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uglify-js')) : + typeof define === 'function' && define.amd ? define(['uglify-js'], factory) : + (global = global || self, global.uglify = factory(global.uglifyJs)); +}(this, (function (uglifyJs) { 'use strict'; + + function uglify(options) { + if (options === void 0) { options = {}; } + return { + name: 'uglify', + transform: function (code) { + var _this = this; + if (typeof options.sourceMap === 'undefined') { + options.sourceMap = true; + } + if (typeof options.warnings === 'undefined') { + options.warnings = true; + } + var result = uglifyJs.minify(code, options); + if (result.error) { + throw result.error; + } + if (result.warnings) { + result.warnings.forEach(function (warning) { + _this.warn(warning); + }); + } + return { + code: result.code, + map: result.map + }; + } + }; + } + + return uglify; + +}))); +//# sourceMappingURL=plugin.js.map diff --git a/dist/plugin.js.map b/dist/plugin.js.map new file mode 100644 index 0000000..f66a2b8 --- /dev/null +++ b/dist/plugin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file