Skip to content

Commit

Permalink
chore(pkg): update dependencies, run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
terinjokes committed Apr 15, 2017
1 parent 4656fe5 commit ad73ab8
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 31 deletions.
6 changes: 4 additions & 2 deletions lib/gulp-uglify-error.js
Expand Up @@ -5,9 +5,11 @@ var gulpUglifyError = makeErrorCause('GulpUglifyError');
gulpUglifyError.prototype.toString = function() {
var cause = this.cause || {};

return makeErrorCause.BaseError.prototype.toString.call(this) +
return (
makeErrorCause.BaseError.prototype.toString.call(this) +
(this.fileName ? '\nFile: ' + this.fileName : '') +
(cause.line ? '\nLine: ' + cause.line : '');
(cause.line ? '\nLine: ' + cause.line : '')
);
};

module.exports = gulpUglifyError;
19 changes: 8 additions & 11 deletions lib/log.js
Expand Up @@ -4,15 +4,12 @@ var each = require('lodash/fp/forEach');

var levels = ['debug', 'info', 'warn', 'error'];

each(
function(level) {
module.exports[level] = function() {
if (hasLog()) {
var log = require('gulplog');
each(function(level) {
module.exports[level] = function() {
if (hasLog()) {
var log = require('gulplog');

log[level].apply(log, arguments);
}
};
},
levels
);
log[level].apply(log, arguments);
}
};
}, levels);
17 changes: 7 additions & 10 deletions minifier.js
Expand Up @@ -76,16 +76,13 @@ module.exports = function(opts, uglify) {
);
}

var mangled = trycatch(
function() {
var map = {};
map[file.relative] = String(file.contents);
var m = uglify.minify(map, options);
m.code = new Buffer(m.code.replace(reSourceMapComment, ''));
return m;
},
createError(file, 'unable to minify JavaScript')
);
var mangled = trycatch(function() {
var map = {};
map[file.relative] = String(file.contents);
var m = uglify.minify(map, options);
m.code = new Buffer(m.code.replace(reSourceMapComment, ''));
return m;
}, createError(file, 'unable to minify JavaScript'));

if (mangled instanceof GulpUglifyError) {
return callback(mangled);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -23,16 +23,16 @@
"eslint-plugin-prettier": "^2.0.1",
"eslint-plugin-unicorn": "^2.1.0",
"gulp-concat": "^2.0.0",
"gulp-sourcemaps": "^1.0.0",
"gulp-sourcemaps": "^2.6.0",
"intelli-espower-loader": "^1.0.1",
"istanbul": "^0.4.0",
"mississippi": "^1.2.0",
"mocha": "^3.0.1",
"prettier": "^0.22.0",
"prettier": "^1.1.0",
"power-assert": "^1.4.1",
"semver": "^5.3.0",
"tape": "^4.0.0",
"testdouble": "^1.6.0",
"testdouble": "^2.1.2",
"vinyl": "^2.0.0"
},
"homepage": "https://github.com/terinjokes/gulp-uglify/",
Expand Down
3 changes: 2 additions & 1 deletion test/create-error.js
Expand Up @@ -11,7 +11,8 @@ var beforeEach = mocha.beforeEach;

describe('createError', function() {
beforeEach(function() {
var testOkContentsInput = '"use strict"; (function(console, first, second) { console.log(first + second) }(5, 10))';
var testOkContentsInput =
'"use strict"; (function(console, first, second) { console.log(first + second) }(5, 10))';
this.testFile = new Vinyl({
cwd: '/home/terin/broken-promises/',
base: '/home/terin/broken-promises/test',
Expand Down
3 changes: 2 additions & 1 deletion test/minify.js
Expand Up @@ -17,7 +17,8 @@ var it = mocha.it;
var beforeEach = mocha.beforeEach;

describe('minify', function() {
var testContentsInput = '"use strict"; (function(console, first, second) { console.log(first + second) }(5, 10))';
var testContentsInput =
'"use strict"; (function(console, first, second) { console.log(first + second) }(5, 10))';
var testContentsExpected = uglifyjs.minify(testContentsInput, {
fromString: true
}).code;
Expand Down
3 changes: 2 additions & 1 deletion test/no-compress.js
Expand Up @@ -15,7 +15,8 @@ var it = mocha.it;

describe('no-compress', function() {
it('should not compress files when `compress: false`', function(done) {
var testContentsInput = '"use strict"; (function(console, first, second) {\n\tconsole.log(first + second)\n}(5, 10))';
var testContentsInput =
'"use strict"; (function(console, first, second) {\n\tconsole.log(first + second)\n}(5, 10))';
var testContentsExpected = uglifyjs.minify(testContentsInput, {
fromString: true,
compress: false
Expand Down
6 changes: 4 additions & 2 deletions test/sourcemap.js
Expand Up @@ -17,7 +17,8 @@ var it = mocha.it;
var beforeEach = mocha.beforeEach;

describe('source maps', function() {
var testContents1Input = '(function(first, second) {\n console.log(first + second);\n}(5, 10));\n';
var testContents1Input =
'(function(first, second) {\n console.log(first + second);\n}(5, 10));\n';
var testContents1Expected = uglifyjs.minify(testContents1Input, {
fromString: true
}).code;
Expand Down Expand Up @@ -219,7 +220,8 @@ describe('source maps', function() {
});

it('should avoid "ghost" files in sourcemaps', function(done) {
var testBabelInput = '"use strict";\n\n(function (first, second) {\n console.log(first + second);\n})(5, 10);';
var testBabelInput =
'"use strict";\n\n(function (first, second) {\n console.log(first + second);\n})(5, 10);';
var testBabelExpected = uglifyjs.minify(testBabelInput, {
fromString: true
}).code;
Expand Down

0 comments on commit ad73ab8

Please sign in to comment.