Skip to content

Commit

Permalink
Bump @vercel/nft to 0.17.2 (#33048)
Browse files Browse the repository at this point in the history
This bumps `@vercel/nft` to the latest version and consequently bumps `graceful-fs` to the latest version.

- Fixes #33003
- Related to vercel/nft#258
- Related to browserify/resolve#264

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
  • Loading branch information
styfle and ijjk authored Jan 6, 2022
1 parent 26ddf32 commit 62227ee
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 64 deletions.
2 changes: 1 addition & 1 deletion packages/next/compiled/@vercel/nft/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/compiled/watchpack/watchpack.js

Large diffs are not rendered by default.

181 changes: 133 additions & 48 deletions packages/next/compiled/webpack/bundle5.js
Original file line number Diff line number Diff line change
Expand Up @@ -14068,12 +14068,16 @@ module.exports = function (glob, opts) {

module.exports = clone

var getPrototypeOf = Object.getPrototypeOf || function (obj) {
return obj.__proto__
}

function clone (obj) {
if (obj === null || typeof obj !== 'object')
return obj

if (obj instanceof Object)
var copy = { __proto__: obj.__proto__ }
var copy = { __proto__: getPrototypeOf(obj) }
else
var copy = Object.create(null)

Expand Down Expand Up @@ -14146,7 +14150,7 @@ if (!fs[gracefulQueue]) {
return fs$close.call(fs, fd, function (err) {
// This function uses the graceful-fs shared queue
if (!err) {
retry()
resetQueue()
}

if (typeof cb === 'function')
Expand All @@ -14164,7 +14168,7 @@ if (!fs[gracefulQueue]) {
function closeSync (fd) {
// This function uses the graceful-fs shared queue
fs$closeSync.apply(fs, arguments)
retry()
resetQueue()
}

Object.defineProperty(closeSync, previousSymbol, {
Expand Down Expand Up @@ -14206,14 +14210,13 @@ function patch (fs) {

return go$readFile(path, options, cb)

function go$readFile (path, options, cb) {
function go$readFile (path, options, cb, startTime) {
return fs$readFile(path, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readFile, [path, options, cb]])
enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
Expand All @@ -14227,14 +14230,13 @@ function patch (fs) {

return go$writeFile(path, data, options, cb)

function go$writeFile (path, data, options, cb) {
function go$writeFile (path, data, options, cb, startTime) {
return fs$writeFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$writeFile, [path, data, options, cb]])
enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
Expand All @@ -14249,14 +14251,35 @@ function patch (fs) {

return go$appendFile(path, data, options, cb)

function go$appendFile (path, data, options, cb) {
function go$appendFile (path, data, options, cb, startTime) {
return fs$appendFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$appendFile, [path, data, options, cb]])
enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
}
})
}
}

var fs$copyFile = fs.copyFile
if (fs$copyFile)
fs.copyFile = copyFile
function copyFile (src, dest, flags, cb) {
if (typeof flags === 'function') {
cb = flags
flags = 0
}
return go$copyFile(src, dest, flags, cb)

function go$copyFile (src, dest, flags, cb, startTime) {
return fs$copyFile(src, dest, flags, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
Expand All @@ -14265,35 +14288,26 @@ function patch (fs) {
var fs$readdir = fs.readdir
fs.readdir = readdir
function readdir (path, options, cb) {
var args = [path]
if (typeof options !== 'function') {
args.push(options)
} else {
cb = options
}
args.push(go$readdir$cb)

return go$readdir(args)
if (typeof options === 'function')
cb = options, options = null

function go$readdir$cb (err, files) {
if (files && files.sort)
files.sort()
return go$readdir(path, options, cb)

if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readdir, [args]])
function go$readdir (path, options, cb, startTime) {
return fs$readdir(path, options, function (err, files) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()])
else {
if (files && files.sort)
files.sort()

else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
if (typeof cb === 'function')
cb.call(this, err, files)
}
})
}
}

function go$readdir (args) {
return fs$readdir.apply(fs, args)
}

if (process.version.substr(0, 4) === 'v0.8') {
var legStreams = legacy(fs)
ReadStream = legStreams.ReadStream
Expand Down Expand Up @@ -14416,14 +14430,13 @@ function patch (fs) {

return go$open(path, flags, mode, cb)

function go$open (path, flags, mode, cb) {
function go$open (path, flags, mode, cb, startTime) {
return fs$open(path, flags, mode, function (err, fd) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$open, [path, flags, mode, cb]])
enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
Expand All @@ -14435,13 +14448,79 @@ function patch (fs) {
function enqueue (elem) {
debug('ENQUEUE', elem[0].name, elem[1])
fs[gracefulQueue].push(elem)
retry()
}

// keep track of the timeout between retry() calls
var retryTimer

// reset the startTime and lastTime to now
// this resets the start of the 60 second overall timeout as well as the
// delay between attempts so that we'll retry these jobs sooner
function resetQueue () {
var now = Date.now()
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
// entries that are only a length of 2 are from an older version, don't
// bother modifying those since they'll be retried anyway.
if (fs[gracefulQueue][i].length > 2) {
fs[gracefulQueue][i][3] = now // startTime
fs[gracefulQueue][i][4] = now // lastTime
}
}
// call retry to make sure we're actively processing the queue
retry()
}

function retry () {
// clear the timer and remove it to help prevent unintended concurrency
clearTimeout(retryTimer)
retryTimer = undefined

if (fs[gracefulQueue].length === 0)
return

var elem = fs[gracefulQueue].shift()
if (elem) {
debug('RETRY', elem[0].name, elem[1])
elem[0].apply(null, elem[1])
var fn = elem[0]
var args = elem[1]
// these items may be unset if they were added by an older graceful-fs
var err = elem[2]
var startTime = elem[3]
var lastTime = elem[4]

// if we don't have a startTime we have no way of knowing if we've waited
// long enough, so go ahead and retry this item now
if (startTime === undefined) {
debug('RETRY', fn.name, args)
fn.apply(null, args)
} else if (Date.now() - startTime >= 60000) {
// it's been more than 60 seconds total, bail now
debug('TIMEOUT', fn.name, args)
var cb = args.pop()
if (typeof cb === 'function')
cb.call(null, err)
} else {
// the amount of time between the last attempt and right now
var sinceAttempt = Date.now() - lastTime
// the amount of time between when we first tried, and when we last tried
// rounded up to at least 1
var sinceStart = Math.max(lastTime - startTime, 1)
// backoff. wait longer than the total time we've been retrying, but only
// up to a maximum of 100ms
var desiredDelay = Math.min(sinceStart * 1.2, 100)
// it's been long enough since the last retry, do it again
if (sinceAttempt >= desiredDelay) {
debug('RETRY', fn.name, args)
fn.apply(null, args.concat([startTime]))
} else {
// if we can't do this job yet, push it to the end of the queue
// and let the next iteration check again
fs[gracefulQueue].push(elem)
}
}

// schedule our next run if one isn't already scheduled
if (retryTimer === undefined) {
retryTimer = setTimeout(retry, 0)
}
}

Expand Down Expand Up @@ -14592,10 +14671,14 @@ try {
process.cwd()
} catch (er) {}

var chdir = process.chdir
process.chdir = function(d) {
cwd = null
chdir.call(process, d)
// This check is needed until node.js 12 is required
if (typeof process.chdir === 'function') {
var chdir = process.chdir
process.chdir = function (d) {
cwd = null
chdir.call(process, d)
}
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir)
}

module.exports = patch
Expand Down Expand Up @@ -14710,7 +14793,7 @@ function patch (fs) {
}

// This ensures `util.promisify` works as it does for native `fs.read`.
read.__proto__ = fs$read
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)
return read
})(fs.read)

Expand Down Expand Up @@ -14884,8 +14967,10 @@ function patch (fs) {
return function (target, options) {
var stats = options ? orig.call(fs, target, options)
: orig.call(fs, target)
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
if (stats) {
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
}
return stats;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"@types/webpack-sources1": "npm:@types/webpack-sources@0.1.5",
"@types/ws": "8.2.0",
"@vercel/ncc": "0.33.1",
"@vercel/nft": "0.17.1",
"@vercel/nft": "0.17.2",
"acorn": "8.5.0",
"amphtml-validator": "1.0.33",
"arg": "4.1.0",
Expand Down
22 changes: 9 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5126,17 +5126,17 @@
resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.33.1.tgz#b240080a3c1ded9446a30955a06a79851bb38f71"
integrity sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==

"@vercel/nft@0.17.1":
version "0.17.1"
resolved "https://registry.yarnpkg.com/@vercel/nft/-/nft-0.17.1.tgz#d1a22f9d25594b549d237d25d10595d62e60dd05"
integrity sha512-z3zknfI7JaE0PPmmYDQVtf/TCEnAYT5Y2XrCO/BfAD1sP2Wdmg1PO0L1VRIyt0zjpr6PpBYitC0Nmy0rh+qEDA==
"@vercel/nft@0.17.2":
version "0.17.2"
resolved "https://registry.yarnpkg.com/@vercel/nft/-/nft-0.17.2.tgz#88a8e088e0e91390c68ccce2180023c071bcdc77"
integrity sha512-1ueYh62H/DmUc3PWV/HEk1x6J1c/KZq9zeNXhixn/C4lX3XOsouutUVpKhTseoDKTGlT81hx96W4TjIwpDiIAQ==
dependencies:
"@mapbox/node-pre-gyp" "^1.0.5"
acorn "^8.6.0"
bindings "^1.4.0"
estree-walker "2.0.2"
glob "^7.1.3"
graceful-fs "^4.1.15"
graceful-fs "^4.2.9"
micromatch "^4.0.2"
mkdirp "^0.5.1"
node-gyp-build "^4.2.2"
Expand Down Expand Up @@ -10403,14 +10403,10 @@ got@^9.6.0:
to-readable-stream "^1.0.0"
url-parse-lax "^3.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.2.0, graceful-fs@^4.2.3, graceful-fs@^4.2.4:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"

graceful-fs@^4.2.2:
version "4.2.6"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee"
integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==
graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.3, graceful-fs@^4.2.4, graceful-fs@^4.2.9:
version "4.2.9"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96"
integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==

"growl@~> 1.10.0":
version "1.10.5"
Expand Down

0 comments on commit 62227ee

Please sign in to comment.