Skip to content

Commit a56d1c7

Browse files
committed
feat: remove lodash dependency
This module is not using the vast majority of Lodash's functions. The small handful used can be replaced by more targeted dependencies that still supports the full range of Node.js versions gulp-uglify supports. Bug: #351
1 parent bcdda44 commit a56d1c7

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ matrix:
1212
- node_js: 10
1313
script: npm run lint
1414
script:
15-
- node --throw-deprecation ./node_modules/.bin/tape --require intelli-espower-loader test/*.js
15+
- node --throw-deprecation ./node_modules/.bin/tape test/*.js

lib/create-error.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict';
2-
var curry = require('lodash/fp/curry');
32
var GulpUglifyError = require('./gulp-uglify-error');
43

54
function createError(file, msg, cause) {
@@ -10,4 +9,4 @@ function createError(file, msg, cause) {
109
return perr;
1110
}
1211

13-
module.exports = curry(createError);
12+
module.exports = createError;

lib/log.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
'use strict';
22
var hasLog = require('has-gulplog');
3-
var each = require('lodash/fp/forEach');
3+
var each = require('array-each');
44

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

7-
each(function(level) {
7+
each(levels, function(level) {
88
module.exports[level] = function() {
99
if (hasLog()) {
1010
var log = require('gulplog');
1111

1212
log[level].apply(log, arguments);
1313
}
1414
};
15-
}, levels);
15+
});

lib/minify.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22
var Buffer = require('safe-buffer').Buffer;
33
var applySourceMap = require('vinyl-sourcemaps-apply');
4-
var isObject = require('lodash/fp/isObject');
5-
var defaultsDeep = require('lodash/fp/defaultsDeep');
4+
var isObject = require('isobject');
5+
var extend = require('extend-shallow');
66
var createError = require('./create-error');
77

88
module.exports = function(uglify, log) {
@@ -12,7 +12,8 @@ module.exports = function(uglify, log) {
1212
opts = {};
1313
}
1414

15-
return defaultsDeep(
15+
return extend(
16+
{},
1617
{
1718
output: {}
1819
},

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
"author": "Terin Stock <terinjokes@gmail.com>",
66
"bugs": "https://github.com/terinjokes/gulp-uglify/issues",
77
"dependencies": {
8+
"array-each": "^1.0.1",
9+
"extend-shallow": "^3.0.2",
810
"gulplog": "^1.0.0",
911
"has-gulplog": "^0.1.0",
10-
"lodash": "^4.13.1",
12+
"isobject": "^3.0.1",
1113
"make-error-cause": "^1.1.1",
1214
"safe-buffer": "^5.1.2",
1315
"through2": "^2.0.0",
@@ -21,7 +23,6 @@
2123
"eslint-plugin-no-use-extend-native": "^0.3.12",
2224
"eslint-plugin-prettier": "^2.0.1",
2325
"eslint-plugin-unicorn": "^2.1.0",
24-
"intelli-espower-loader": "^1.0.1",
2526
"power-assert": "^1.4.1",
2627
"prettier": "^1.1.0",
2728
"source-list-map": "^1.1.2",
@@ -70,7 +71,7 @@
7071
],
7172
"scripts": {
7273
"lint": "eslint *.js lib test",
73-
"test": "tape --require intelli-espower-loader test/*.js"
74+
"test": "tape test/*.js"
7475
},
7576
"greenkeeper": {
7677
"ignore": [

0 commit comments

Comments
 (0)