Skip to content

Commit

Permalink
Fix: Drop dependency on gulp-util
Browse files Browse the repository at this point in the history
Backport of #137
  • Loading branch information
demurgos committed Jan 26, 2018
1 parent 6cb45a1 commit dcd652e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const path = require('path');
const gutil = require('gulp-util');
const PluginError = require('plugin-error');
const through = require('through2');
const applySourceMap = require('vinyl-sourcemaps-apply');
const replaceExt = require('replace-ext');
Expand All @@ -20,7 +20,7 @@ module.exports = function (opts) {
}

if (file.isStream()) {
cb(new gutil.PluginError('gulp-babel', 'Streaming not supported'));
cb(new PluginError('gulp-babel', 'Streaming not supported'));
return;
}

Expand Down Expand Up @@ -51,7 +51,7 @@ module.exports = function (opts) {

this.push(file);
} catch (err) {
this.emit('error', new gutil.PluginError('gulp-babel', err, {
this.emit('error', new PluginError('gulp-babel', err, {
fileName: file.path,
showProperties: false
}));
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"compiler"
],
"dependencies": {
"gulp-util": "^3.0.0",
"plugin-error": "^1.0.1",
"replace-ext": "0.0.1",
"through2": "^2.0.0",
"vinyl-sourcemaps-apply": "^0.2.0"
Expand All @@ -49,6 +49,7 @@
"babel-plugin-transform-es2015-classes": "7.0.0-alpha.18",
"gulp-sourcemaps": "^1.1.1",
"mocha": "*",
"vinyl": "^2.1.0",
"xo": "*"
},
"xo": {
Expand Down
14 changes: 7 additions & 7 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const path = require('path');
const assert = require('assert');
const gutil = require('gulp-util');
const Vinyl = require('vinyl');
const sourceMaps = require('gulp-sourcemaps');
const babel = require('./');

Expand All @@ -17,7 +17,7 @@ it('should transpile with Babel', cb => {

stream.on('end', cb);

stream.write(new gutil.File({
stream.write(new Vinyl({
cwd: __dirname,
base: path.join(__dirname, 'fixture'),
path: path.join(__dirname, 'fixture/fixture.jsx'),
Expand Down Expand Up @@ -45,7 +45,7 @@ it('should generate source maps', cb => {
cb();
});

init.write(new gutil.File({
init.write(new Vinyl({
cwd: __dirname,
base: path.join(__dirname, 'fixture'),
path: path.join(__dirname, 'fixture/fixture.es2015'),
Expand Down Expand Up @@ -74,7 +74,7 @@ it('should generate source maps for file in nested folder', cb => {
cb();
});

init.write(new gutil.File({
init.write(new Vinyl({
cwd: __dirname,
base: path.join(__dirname, 'fixture'),
path: path.join(__dirname, 'fixture/nested/fixture.es2015'),
Expand All @@ -96,7 +96,7 @@ it('should list used helpers in file.babel', cb => {

stream.on('end', cb);

stream.write(new gutil.File({
stream.write(new Vinyl({
cwd: __dirname,
base: path.join(__dirname, 'fixture'),
path: path.join(__dirname, 'fixture/fixture.js'),
Expand Down Expand Up @@ -125,7 +125,7 @@ it('should not rename ignored files', cb => {
assert.equal(file.relative, inputFile.basename);
})
.on('end', cb)
.end(new gutil.File(inputFile));
.end(new Vinyl(inputFile));
});

it('should not rename files without an extension', cb => {
Expand All @@ -145,5 +145,5 @@ it('should not rename files without an extension', cb => {
assert.equal(file.relative, inputFile.basename);
})
.on('end', cb)
.end(new gutil.File(inputFile));
.end(new Vinyl(inputFile));
});

0 comments on commit dcd652e

Please sign in to comment.