Fix Buffer warnings during build (#10495)
The warnings about use of the unsafe Buffer constructor have been addressed by package updates and patches. The updates were: * `gulp-sourcemaps` was updated from v2 to v3, and was patched to replace remaining uses of the `Buffer` constructor * Upstream PR: https://github.com/gulp-sourcemaps/gulp-sourcemaps/pull/388 * The transitive dependency `yazl` was updated from v2.4.3 to v2.5.1 in the lockfile. * The abandoned packages `combine-source-map` and `inline-source-map` were patched.feature/default_network_editable
parent
77581256ca
commit
506fa2d744
@ -0,0 +1,22 @@ |
||||
diff --git a/node_modules/combine-source-map/node_modules/convert-source-map/index.js b/node_modules/combine-source-map/node_modules/convert-source-map/index.js
|
||||
index bfe92d1..bee1ffe 100644
|
||||
--- a/node_modules/combine-source-map/node_modules/convert-source-map/index.js
|
||||
+++ b/node_modules/combine-source-map/node_modules/convert-source-map/index.js
|
||||
@@ -9,7 +9,7 @@ var mapFileCommentRx =
|
||||
/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg
|
||||
|
||||
function decodeBase64(base64) {
|
||||
- return new Buffer(base64, 'base64').toString();
|
||||
+ return Buffer.from(base64, 'base64').toString();
|
||||
}
|
||||
|
||||
function stripComment(sm) {
|
||||
@@ -60,7 +60,7 @@ Converter.prototype.toJSON = function (space) {
|
||||
|
||||
Converter.prototype.toBase64 = function () {
|
||||
var json = this.toJSON();
|
||||
- return new Buffer(json).toString('base64');
|
||||
+ return Buffer.from(json).toString('base64');
|
||||
};
|
||||
|
||||
Converter.prototype.toComment = function (options) {
|
@ -0,0 +1,44 @@ |
||||
diff --git a/node_modules/gulp-sourcemaps/src/init/index.internals.js b/node_modules/gulp-sourcemaps/src/init/index.internals.js
|
||||
index 7104555..7dfe218 100644
|
||||
--- a/node_modules/gulp-sourcemaps/src/init/index.internals.js
|
||||
+++ b/node_modules/gulp-sourcemaps/src/init/index.internals.js
|
||||
@@ -72,7 +72,7 @@ module.exports = function(options, file, fileContent) {
|
||||
|
||||
});
|
||||
// remove source map comment from source
|
||||
- file.contents = new Buffer(sources.content, 'utf8');
|
||||
+ file.contents = Buffer.from(sources.content, 'utf8');
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/node_modules/gulp-sourcemaps/src/write/index.internals.js b/node_modules/gulp-sourcemaps/src/write/index.internals.js
|
||||
index 89cee60..adfe8d1 100644
|
||||
--- a/node_modules/gulp-sourcemaps/src/write/index.internals.js
|
||||
+++ b/node_modules/gulp-sourcemaps/src/write/index.internals.js
|
||||
@@ -99,7 +99,7 @@ module.exports = function(destPath, options) {
|
||||
|
||||
if (destPath === undefined || destPath === null) {
|
||||
// encode source map into comment
|
||||
- var base64Map = new Buffer(JSON.stringify(sourceMap)).toString('base64');
|
||||
+ var base64Map = Buffer.from(JSON.stringify(sourceMap)).toString('base64');
|
||||
comment = commentFormatter('data:application/json;charset=' + options.charset + ';base64,' + base64Map);
|
||||
} else {
|
||||
var mapFile = path.join(destPath, file.relative) + '.map';
|
||||
@@ -130,7 +130,7 @@ module.exports = function(destPath, options) {
|
||||
|
||||
var sourceMapFile = file.clone(options.clone || { deep: false, contents: false });
|
||||
sourceMapFile.path = sourceMapPath;
|
||||
- sourceMapFile.contents = new Buffer(JSON.stringify(sourceMap));
|
||||
+ sourceMapFile.contents = Buffer.from(JSON.stringify(sourceMap));
|
||||
sourceMapFile.stat = {
|
||||
isFile: function() { return true; },
|
||||
isDirectory: function() { return false; },
|
||||
@@ -164,7 +164,7 @@ module.exports = function(destPath, options) {
|
||||
|
||||
// append source map comment
|
||||
if (options.addComment) {
|
||||
- file.contents = Buffer.concat([file.contents, new Buffer(comment)]);
|
||||
+ file.contents = Buffer.concat([file.contents, Buffer.from(comment)]);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@ |
||||
diff --git a/node_modules/inline-source-map/index.js b/node_modules/inline-source-map/index.js
|
||||
index df74d61..7641aad 100644
|
||||
--- a/node_modules/inline-source-map/index.js
|
||||
+++ b/node_modules/inline-source-map/index.js
|
||||
@@ -91,7 +91,7 @@ Generator.prototype.addSourceContent = function (sourceFile, sourcesContent) {
|
||||
*/
|
||||
Generator.prototype.base64Encode = function () {
|
||||
var map = this.toString();
|
||||
- return new Buffer(map).toString('base64');
|
||||
+ return Buffer.from(map).toString('base64');
|
||||
};
|
||||
|
||||
/**
|
Loading…
Reference in new issue