Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scorpiocoding #35

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
package-lock.json
17 changes: 12 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
'use strict';

//2018-01-02 sc mod: gulp-util deprecation
//2018-01-02 sc mod: require plugin-error to replace gutil.PluginError
//2018-01-02 sc mod: require ansi-colors to replace gutil.colors
//2018-01-02 sc mod: require vinyl to replace gutil.File

var through = require('through2'),
uglify = require('uglify-es'),
gutil = require('gulp-util'),
minimatch = require('minimatch'),
path = require('path'),
PluginError = gutil.PluginError,
PluginError = require('plugin-error'),
colors = require('ansi-colors'),
File = require('vinyl'),
reSourceMapComment = /\n\/\/# sourceMappingURL=.+?$/,
pathSeparatorRe = /[\/\\]/g;

Expand Down Expand Up @@ -39,9 +46,9 @@ function formatError(error, file) {
filePath = filePath ? filePath : file.path;
relativePath = path.relative(process.cwd(), filePath);

message += gutil.colors.underline(relativePath) + '\n';
message += colors.underline(relativePath) + '\n';
message += error.message + ' (line: ' + error.line + ', col: ' + error.col + ', pos: ' + error.pos;
error.message = gutil.colors.red(message);
error.message = colors.red(message);
return error;
}

Expand Down Expand Up @@ -104,7 +111,7 @@ module.exports = function(opt) {
}
options.fromString = options.hasOwnProperty("fromString") ? options.fromString : true;

var min_file = new gutil.File({
var min_file = new File({
path: Array.isArray(ext.min) ? file.path.replace(ext.min[0], ext.min[1]) : file.path.replace(/\.js$/, ext.min),
base: file.base
});
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
},
"author": "taojie.hjp@taobao.com",
"dependencies": {
"gulp-util": "^2.2.14",
"ansi-colors": "^1.0.1",
"minimatch": "^3.0.2",
"plugin-error": "^0.1.2",
"through2": "^0.4.0",
"uglify-es": "^3.0.3"
"uglify-es": "^3.0.3",
"vinyl": "^2.1.0"
},
"license": "ISC",
"bugs": {
Expand Down