1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

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.
This commit is contained in:
Mark Stacey 2021-09-27 19:05:35 -02:30 committed by GitHub
parent 77581256ca
commit 506fa2d744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 145 additions and 68 deletions

View File

@ -824,8 +824,8 @@
"@gulp-sourcemaps/identity-map": {
"packages": {
"acorn": true,
"css": true,
"normalize-path": true,
"postcss": true,
"source-map": true,
"through2": true
}
@ -962,15 +962,6 @@
"uri-js": true
}
},
"amdefine": {
"builtin": {
"path.dirname": true
},
"globals": {
"__filename": true,
"process.nextTick": true
}
},
"ansi-colors": {
"packages": {
"ansi-wrap": true
@ -1492,7 +1483,7 @@
"path.resolve": true
},
"globals": {
"Buffer": true
"Buffer.from": true
},
"packages": {
"safe-buffer": true
@ -1551,13 +1542,13 @@
"css": {
"builtin": {
"fs.readFileSync": true,
"path.dirname": true
"path.dirname": true,
"path.sep": true
},
"packages": {
"inherits": true,
"source-map": true,
"source-map-resolve": true,
"urix": true
"source-map-resolve": true
}
},
"d": {
@ -2496,7 +2487,8 @@
"path.sep": true
},
"globals": {
"Buffer": true
"Buffer.concat": true,
"Buffer.from": true
},
"packages": {
"@gulp-sourcemaps/identity-map": true,
@ -2665,7 +2657,7 @@
},
"inline-source-map": {
"globals": {
"Buffer": true
"Buffer.from": true
},
"packages": {
"source-map": true
@ -4011,16 +4003,15 @@
"console.time": true,
"console.timeEnd": true,
"fetch": true
},
"packages": {
"amdefine": true
}
},
"source-map-resolve": {
"builtin": {
"path.sep": true,
"url.resolve": true
},
"globals": {
"TextDecoder": true,
"setImmediate": true
},
"packages": {

View File

@ -279,7 +279,7 @@
"gulp-livereload": "4.0.0",
"gulp-rename": "^2.0.0",
"gulp-rtlcss": "^1.4.0",
"gulp-sourcemaps": "^2.6.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-stylelint": "^13.0.0",
"gulp-watch": "^5.0.1",
"gulp-zip": "^4.0.0",

View File

@ -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) {

View File

@ -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)]);
}
}

View File

@ -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');
};
/**

103
yarn.lock
View File

@ -2129,18 +2129,18 @@
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.13.0.tgz#fcb113d1aca4b471b709e8c9c168674fbd6e06d9"
integrity sha512-xKOeQEl5O47GPZYIMToj6uuA2syyFlq9EMSl2ui0uytjY9xbe8XS0pexNWmxrdcCyNGyDmLyYw5FtKsalBUeOg==
"@gulp-sourcemaps/identity-map@1.X":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/identity-map/-/identity-map-1.0.1.tgz#cfa23bc5840f9104ce32a65e74db7e7a974bbee1"
integrity sha1-z6I7xYQPkQTOMqZedNt+epdLvuE=
"@gulp-sourcemaps/identity-map@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/identity-map/-/identity-map-2.0.1.tgz#a6e8b1abec8f790ec6be2b8c500e6e68037c0019"
integrity sha512-Tb+nSISZku+eQ4X1lAkevcQa+jknn/OVUgZ3XCxEKIsLsqYuPoJwJOPQeaOk75X3WPftb29GWY1eqE7GLsXb1Q==
dependencies:
acorn "^5.0.3"
css "^2.2.1"
normalize-path "^2.1.1"
source-map "^0.5.6"
through2 "^2.0.3"
acorn "^6.4.1"
normalize-path "^3.0.0"
postcss "^7.0.16"
source-map "^0.6.0"
through2 "^3.0.1"
"@gulp-sourcemaps/map-sources@1.X":
"@gulp-sourcemaps/map-sources@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/map-sources/-/map-sources-1.0.0.tgz#890ae7c5d8c877f6d384860215ace9d7ec945bda"
integrity sha1-iQrnxdjId/bThIYCFazp1+yUW9o=
@ -4805,16 +4805,16 @@ acorn-walk@^7.1.1:
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc"
integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==
acorn@5.X, acorn@^5.0.3, acorn@^5.1.2, acorn@^5.2.1:
version "5.7.4"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==
acorn@^3.0.4:
version "3.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
integrity sha1-ReN/s56No/JbruP/U2niu18iAXo=
acorn@^5.1.2, acorn@^5.2.1:
version "5.7.4"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==
acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.7, acorn@^6.4.1:
version "6.4.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6"
@ -8642,7 +8642,7 @@ continuable-cache@^0.3.1:
resolved "https://registry.yarnpkg.com/continuable-cache/-/continuable-cache-0.3.1.tgz#bd727a7faed77e71ff3985ac93351a912733ad0f"
integrity sha1-vXJ6f67XfnH/OYWskzUakSczrQ8=
convert-source-map@1.7.0, convert-source-map@1.X, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.6.0, convert-source-map@^1.7.0:
convert-source-map@1.7.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.6.0, convert-source-map@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442"
integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==
@ -8654,6 +8654,13 @@ convert-source-map@^0.3.3:
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190"
integrity sha1-8dgClQr33SYxof6+BZZVDIarMZA=
convert-source-map@^1.0.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369"
integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==
dependencies:
safe-buffer "~5.1.1"
convert-source-map@~1.1.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860"
@ -9058,7 +9065,7 @@ css.escape@^1.5.1:
resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb"
integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=
css@2.X, css@^2.0.0, css@^2.2.1:
css@^2.0.0:
version "2.2.3"
resolved "https://registry.yarnpkg.com/css/-/css-2.2.3.tgz#f861f4ba61e79bedc962aa548e5780fd95cbc6be"
integrity sha512-0W171WccAjQGGTKLhw4m2nnl0zPHUlTO/I8td4XzJgIB8Hg3ZZx71qT4G4eX8OVsSiaAKiUMy73E3nsbPlg2DQ==
@ -9255,10 +9262,10 @@ debounce@^1.0.0:
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.1.0.tgz#6a1a4ee2a9dc4b7c24bb012558dbcdb05b37f408"
integrity sha512-ZQVKfRVlwRfD150ndzEK8M90ABT+Y/JQKs4Y7U4MXdpuoUkkrr4DwKbVux3YjylA5bUMUj0Nc3pMxPJX6N2QQQ==
debug-fabulous@1.X:
version "1.0.0"
resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-1.0.0.tgz#57f6648646097b1b0849dcda0017362c1ec00f8b"
integrity sha512-dsd50qQ1atDeurcxL7XOjPp4nZCGZzWIONDujDXzl1atSyC3hMbZD+v6440etw+Vt0Pr8ce4TQzHfX3KZM05Mw==
debug-fabulous@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-1.1.0.tgz#af8a08632465224ef4174a9f06308c3c2a1ebc8e"
integrity sha512-GZqvGIgKNlUnHUPQhepnUZFIMoi3dgZKQBzKDeL2g7oJF9SNAji/AAu36dusFUas0O+pae74lNeoIPHqXWDkLg==
dependencies:
debug "3.X"
memoizee "0.4.X"
@ -9671,7 +9678,7 @@ detect-libc@^1.0.2:
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
detect-newline@2.X:
detect-newline@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2"
integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=
@ -13764,7 +13771,7 @@ got@^7.1.0:
url-parse-lax "^1.0.0"
url-to-options "^1.0.1"
graceful-fs@4.X, graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.3:
graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.3:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
@ -13874,22 +13881,22 @@ gulp-rtlcss@^1.4.0:
through2 "^2.0.5"
vinyl-sourcemaps-apply "^0.2.1"
gulp-sourcemaps@^2.6.0:
version "2.6.3"
resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-2.6.3.tgz#11b033f759f909e0a5f15b7bdf47ac29cc54efa4"
integrity sha1-EbAz91n5CeCl8Vt730esKcxU76Q=
gulp-sourcemaps@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-3.0.0.tgz#2e154e1a2efed033c0e48013969e6f30337b2743"
integrity sha512-RqvUckJkuYqy4VaIH60RMal4ZtG0IbQ6PXMNkNsshEGJ9cldUPRb/YCgboYae+CLAs1HQNb4ADTKCx65HInquQ==
dependencies:
"@gulp-sourcemaps/identity-map" "1.X"
"@gulp-sourcemaps/map-sources" "1.X"
acorn "5.X"
convert-source-map "1.X"
css "2.X"
debug-fabulous "1.X"
detect-newline "2.X"
graceful-fs "4.X"
source-map "0.X"
strip-bom-string "1.X"
through2 "2.X"
"@gulp-sourcemaps/identity-map" "^2.0.1"
"@gulp-sourcemaps/map-sources" "^1.0.0"
acorn "^6.4.1"
convert-source-map "^1.0.0"
css "^3.0.0"
debug-fabulous "^1.0.0"
detect-newline "^2.0.0"
graceful-fs "^4.0.0"
source-map "^0.6.0"
strip-bom-string "^1.0.0"
through2 "^2.0.0"
gulp-stylelint@^13.0.0:
version "13.0.0"
@ -25270,11 +25277,6 @@ source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, sourc
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
source-map@0.X, source-map@^0.7.2, source-map@^0.7.3, source-map@~0.7.2:
version "0.7.3"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
source-map@^0.1.38:
version "0.1.43"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
@ -25287,6 +25289,11 @@ source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.6, source-map@^0.5.7, sour
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
source-map@^0.7.2, source-map@^0.7.3, source-map@~0.7.2:
version "0.7.3"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
sourcemap-codec@^1.4.1, sourcemap-codec@^1.4.4:
version "1.4.8"
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
@ -25861,7 +25868,7 @@ strip-bom-stream@^2.0.0:
first-chunk-stream "^2.0.0"
strip-bom "^2.0.0"
strip-bom-string@1.X:
strip-bom-string@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-bom-string/-/strip-bom-string-1.0.0.tgz#e5211e9224369fbb81d633a2f00044dc8cedad92"
integrity sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI=
@ -26444,7 +26451,7 @@ through2-filter@^2.0.0:
through2 "~2.0.0"
xtend "~4.0.0"
through2@2.X, through2@^2.0.0, through2@^2.0.1, through2@^2.0.3, through2@^2.0.5, through2@~2.0.0, through2@~2.0.3:
through2@^2.0.0, through2@^2.0.1, through2@^2.0.3, through2@^2.0.5, through2@~2.0.0, through2@~2.0.3:
version "2.0.5"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==
@ -28872,9 +28879,9 @@ yauzl@2.10.0, yauzl@^2.10.0:
fd-slicer "~1.1.0"
yazl@^2.1.0:
version "2.4.3"
resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.4.3.tgz#ec26e5cc87d5601b9df8432dbdd3cd2e5173a071"
integrity sha1-7CblzIfVYBud+EMtvdPNLlFzoHE=
version "2.5.1"
resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.5.1.tgz#a3d65d3dd659a5b0937850e8609f22fffa2b5c35"
integrity sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==
dependencies:
buffer-crc32 "~0.2.3"