Skip to content

Commit

Permalink
deps: graceful-fs@4.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Apr 6, 2022
1 parent 71296d5 commit 69d8343
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 40 deletions.
2 changes: 1 addition & 1 deletion node_modules/graceful-fs/LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 23 additions & 4 deletions node_modules/graceful-fs/graceful-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,43 @@ 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()

if (typeof cb === 'function')
cb.call(this, err, files)
}
})
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion node_modules/graceful-fs/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
63 changes: 35 additions & 28 deletions node_modules/graceful-fs/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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') {
Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 () {}
}
Expand Down
13 changes: 8 additions & 5 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 69d8343

Please sign in to comment.