Skip to content

Commit 7b080bf

Browse files
committedApr 19, 2019
Upgrade dependencies
Fixes #110
1 parent dfe3919 commit 7b080bf

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed
 

‎index.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ const applySourceMap = require('vinyl-sourcemaps-apply');
66
const autoprefixer = require('autoprefixer');
77
const postcss = require('postcss');
88

9-
module.exports = opts => {
10-
return through.obj((file, enc, cb) => {
9+
module.exports = options => {
10+
return through.obj((file, encoding, callback) => {
1111
if (file.isNull()) {
12-
cb(null, file);
12+
callback(null, file);
1313
return;
1414
}
1515

1616
if (file.isStream()) {
17-
cb(new PluginError('gulp-autoprefixer', 'Streaming not supported'));
17+
callback(new PluginError('gulp-autoprefixer', 'Streaming not supported'));
1818
return;
1919
}
2020

21-
postcss(autoprefixer(opts)).process(file.contents.toString(), {
21+
postcss(autoprefixer(options)).process(file.contents.toString(), {
2222
map: file.sourceMap ? {annotation: false} : false,
2323
from: file.path,
2424
to: file.path
25-
}).then(res => {
26-
file.contents = Buffer.from(res.css);
25+
}).then(result => {
26+
file.contents = Buffer.from(result.css);
2727

28-
if (res.map && file.sourceMap) {
29-
const map = res.map.toJSON();
28+
if (result.map && file.sourceMap) {
29+
const map = result.map.toJSON();
3030
map.file = file.relative;
3131
map.sources = map.sources.map(() => file.relative);
3232
applySourceMap(file, map);
3333
}
3434

35-
const warnings = res.warnings();
35+
const warnings = result.warnings();
3636

3737
if (warnings.length > 0) {
3838
fancyLog('gulp-autoprefixer:', '\n ' + warnings.join('\n '));
3939
}
4040

41-
setImmediate(cb, null, file);
41+
setImmediate(callback, null, file);
4242
}).catch(error => {
4343
const cssError = error.name === 'CssSyntaxError';
4444

@@ -47,7 +47,7 @@ module.exports = opts => {
4747
}
4848

4949
// Prevent stream unhandled exception from being suppressed by Promise
50-
setImmediate(cb, new PluginError('gulp-autoprefixer', error, {
50+
setImmediate(callback, new PluginError('gulp-autoprefixer', error, {
5151
fileName: file.path,
5252
showStack: !cssError
5353
}));

‎package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@
3030
"postcss-runner"
3131
],
3232
"dependencies": {
33-
"autoprefixer": "^9.1.3",
33+
"autoprefixer": "^9.5.1",
3434
"fancy-log": "^1.3.2",
3535
"plugin-error": "^1.0.1",
3636
"postcss": "^7.0.2",
37-
"through2": "^2.0.0",
38-
"vinyl-sourcemaps-apply": "^0.2.0"
37+
"through2": "^3.0.1",
38+
"vinyl-sourcemaps-apply": "^0.2.1"
3939
},
4040
"devDependencies": {
41-
"ava": "*",
41+
"ava": "^1.4.1",
4242
"gulp-sourcemaps": "^2.6.0",
43-
"p-event": "^2.1.0",
43+
"p-event": "^2.3.1",
4444
"vinyl": "^2.1.0",
45-
"xo": "*"
45+
"xo": "^0.24.0"
4646
}
4747
}

‎test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import test from 'ava';
33
import Vinyl from 'vinyl';
44
import sourceMaps from 'gulp-sourcemaps';
55
import pEvent from 'p-event';
6-
import m from '.';
6+
import autoprefixer from '.';
77

88
test('autoprefix CSS', async t => {
9-
const stream = m();
9+
const stream = autoprefixer();
1010
const data = pEvent(stream, 'data');
1111

1212
stream.end(new Vinyl({
@@ -27,7 +27,7 @@ test('generate source maps', async t => {
2727
const data = pEvent(write, 'data');
2828

2929
init
30-
.pipe(m({
30+
.pipe(autoprefixer({
3131
browsers: ['Firefox ESR']
3232
}))
3333
.pipe(write);
@@ -41,15 +41,15 @@ test('generate source maps', async t => {
4141
}));
4242

4343
const file = await data;
44-
t.is(file.sourceMap.mappings, 'AAAA;CACC,cAAc;CACd');
44+
t.is(file.sourceMap.mappings, 'AAAA;CACC,aAAa;AACd');
4545
const contents = file.contents.toString();
4646
t.true(/flex/.test(contents));
4747
t.true(/sourceMappingURL=data:application\/json;charset=utf8;base64/.test(contents));
4848
});
4949

5050
test('read upstream source maps', async t => {
5151
let testFile;
52-
const stream = m();
52+
const stream = autoprefixer();
5353
const write = sourceMaps.write();
5454
const sourcesContent = [
5555
'a {\n display: flex;\n}\n',

0 commit comments

Comments
 (0)
Please sign in to comment.