diff --git a/node_modules/graceful-fs/LICENSE b/node_modules/graceful-fs/LICENSE index 9d2c8036969be..e906a25acfb5e 100644 --- a/node_modules/graceful-fs/LICENSE +++ b/node_modules/graceful-fs/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js index 947cd94bb41bc..8d5b89e4fa7fd 100644 --- a/node_modules/graceful-fs/graceful-fs.js +++ b/node_modules/graceful-fs/graceful-fs.js @@ -191,16 +191,35 @@ function patch (fs) { var fs$readdir = fs.readdir fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ function readdir (path, options, cb) { if (typeof options === 'function') cb = options, options = null + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + return go$readdir(path, options, cb) - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) else { if (files && files.sort) files.sort() @@ -208,7 +227,7 @@ function patch (fs) { if (typeof cb === 'function') cb.call(this, err, files) } - }) + } } } diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json index e1cb584739202..305785687247c 100644 --- a/node_modules/graceful-fs/package.json +++ b/node_modules/graceful-fs/package.json @@ -1,7 +1,7 @@ { "name": "graceful-fs", "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.9", + "version": "4.2.10", "repository": { "type": "git", "url": "https://github.com/isaacs/node-graceful-fs" diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js index 26804ef0a6852..46dea36cc490f 100644 --- a/node_modules/graceful-fs/polyfills.js +++ b/node_modules/graceful-fs/polyfills.js @@ -71,13 +71,13 @@ function patch (fs) { fs.lstatSync = statFixSync(fs.lstatSync) // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { + if (fs.chmod && !fs.lchmod) { fs.lchmod = function (path, mode, cb) { if (cb) process.nextTick(cb) } fs.lchmodSync = function () {} } - if (!fs.lchown) { + if (fs.chown && !fs.lchown) { fs.lchown = function (path, uid, gid, cb) { if (cb) process.nextTick(cb) } @@ -94,32 +94,38 @@ function patch (fs) { // CPU to a busy looping process, which can cause the program causing the lock // contention to be starved of CPU by node, so the contention doesn't resolve. if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) } // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { function read (fd, buffer, offset, length, position, callback_) { var callback if (callback_ && typeof callback_ === 'function') { @@ -140,7 +146,8 @@ function patch (fs) { return read })(fs.read) - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { var eagCounter = 0 while (true) { try { @@ -199,7 +206,7 @@ function patch (fs) { } function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { fs.lutimes = function (path, at, mt, cb) { fs.open(path, constants.O_SYMLINK, function (er, fd) { if (er) { @@ -233,7 +240,7 @@ function patch (fs) { return ret } - } else { + } else if (fs.futimes) { fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } fs.lutimesSync = function () {} } diff --git a/package-lock.json b/package-lock.json index 0502ac6b942f9..e0ddcc99cb134 100644 --- a/package-lock.json +++ b/package-lock.json @@ -107,7 +107,7 @@ "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.12", "glob": "^7.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "hosted-git-info": "^5.0.0", "ini": "^3.0.0", "init-package-json": "^3.0.2", @@ -3200,9 +3200,10 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.9", - "inBundle": true, - "license": "ISC" + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "inBundle": true }, "node_modules/handlebars": { "version": "4.7.7", @@ -11925,7 +11926,9 @@ "dev": true }, "graceful-fs": { - "version": "4.2.9" + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "handlebars": { "version": "4.7.7", diff --git a/package.json b/package.json index dc5b1ce9a42c4..5aabeb95c6c83 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.12", "glob": "^7.2.0", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.10", "hosted-git-info": "^5.0.0", "ini": "^3.0.0", "init-package-json": "^3.0.2",