Skip to content

Commit

Permalink
Replace gulp-util with smaller modules (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDancingCode authored and sindresorhus committed Dec 23, 2017
1 parent 6c9bcac commit e46406b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use strict';
const path = require('path');
const gutil = require('gulp-util');
const through = require('through2');
const vinylFile = require('vinyl-file');
const revHash = require('rev-hash');
const revPath = require('rev-path');
const sortKeys = require('sort-keys');
const modifyFilename = require('modify-filename');
const Vinyl = require('vinyl');
const PluginError = require('plugin-error');

function relPath(base, filePath) {
filePath = filePath.replace(/\\/g, '/');
Expand Down Expand Up @@ -44,7 +45,7 @@ function transformFilename(file) {

const getManifestFile = opts => vinylFile.read(opts.path, opts).catch(err => {
if (err.code === 'ENOENT') {
return new gutil.File(opts);
return new Vinyl(opts);
}

throw err;
Expand All @@ -61,7 +62,7 @@ const plugin = () => {
}

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

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
"assets"
],
"dependencies": {
"gulp-util": "^3.0.0",
"modify-filename": "^1.1.0",
"plugin-error": "^0.1.2",
"rev-hash": "^2.0.0",
"rev-path": "^2.0.0",
"sort-keys": "^2.0.0",
"through2": "^2.0.0",
"vinyl": "^2.1.0",
"vinyl-file": "^3.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gutil from 'gulp-util';
import Vinyl from 'vinyl';

function createFile({path, revOrigPath, revOrigBase, origName, revName, cwd, base, contents = ''}) {
const file = new gutil.File({
const file = new Vinyl({
path,
cwd,
base,
Expand Down

0 comments on commit e46406b

Please sign in to comment.