14
14
var unassert = require ( 'unassert' ) ;
15
15
var through = require ( 'through2' ) ;
16
16
var PluginError = require ( 'plugin-error' ) ;
17
- var bufferFrom = require ( 'buffer-from' ) ;
18
17
var BufferStreams = require ( 'bufferstreams' ) ;
19
18
var acorn = require ( 'acorn' ) ;
20
19
var escodegen = require ( 'escodegen' ) ;
@@ -66,7 +65,7 @@ function applyUnassertWithSourceMap (file, encoding, opt) {
66
65
overwritePropertyIfExists ( 'sourceRoot' , inMap , reMap ) ;
67
66
overwritePropertyIfExists ( 'file' , inMap , reMap ) ;
68
67
69
- file . contents = bufferFrom ( instrumented . code ) ;
68
+ file . contents = Buffer . from ( instrumented . code ) ;
70
69
file . sourceMap = reMap . toObject ( ) ;
71
70
}
72
71
@@ -79,7 +78,7 @@ function transform (file, encoding, opt) {
79
78
if ( file . sourceMap ) {
80
79
applyUnassertWithSourceMap ( file , encoding , opt ) ;
81
80
} else {
82
- file . contents = bufferFrom ( applyUnassertWithoutSourceMap ( file . contents . toString ( encoding ) ) ) ;
81
+ file . contents = Buffer . from ( applyUnassertWithoutSourceMap ( file . contents . toString ( encoding ) ) ) ;
83
82
}
84
83
}
85
84
@@ -102,7 +101,7 @@ module.exports = function (opt) {
102
101
} else {
103
102
try {
104
103
var modifiedCode = applyUnassertWithoutSourceMap ( buf . toString ( encoding ) ) ;
105
- cb ( null , bufferFrom ( modifiedCode ) ) ;
104
+ cb ( null , Buffer . from ( modifiedCode ) ) ;
106
105
} catch ( innerError ) {
107
106
return callback ( new PluginError ( 'gulp-unassert' , innerError , { showStack : true } ) ) ;
108
107
}
0 commit comments