mirror of
https://github.com/actions/labeler
synced 2026-05-09 14:31:02 +02:00
build
This commit is contained in:
171
node_modules/graceful-fs/graceful-fs.js
generated
vendored
171
node_modules/graceful-fs/graceful-fs.js
generated
vendored
@@ -3,12 +3,32 @@ var polyfills = require('./polyfills.js')
|
||||
var legacy = require('./legacy-streams.js')
|
||||
var clone = require('./clone.js')
|
||||
|
||||
var queue = []
|
||||
|
||||
var util = require('util')
|
||||
|
||||
/* istanbul ignore next - node 0.x polyfill */
|
||||
var gracefulQueue
|
||||
var previousSymbol
|
||||
|
||||
/* istanbul ignore else - node 0.x polyfill */
|
||||
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
|
||||
gracefulQueue = Symbol.for('graceful-fs.queue')
|
||||
// This is used in testing by future versions
|
||||
previousSymbol = Symbol.for('graceful-fs.previous')
|
||||
} else {
|
||||
gracefulQueue = '___graceful-fs.queue'
|
||||
previousSymbol = '___graceful-fs.previous'
|
||||
}
|
||||
|
||||
function noop () {}
|
||||
|
||||
function publishQueue(context, queue) {
|
||||
Object.defineProperty(context, gracefulQueue, {
|
||||
get: function() {
|
||||
return queue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var debug = noop
|
||||
if (util.debuglog)
|
||||
debug = util.debuglog('gfs4')
|
||||
@@ -19,11 +39,58 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
||||
console.error(m)
|
||||
}
|
||||
|
||||
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
||||
process.on('exit', function() {
|
||||
debug(queue)
|
||||
require('assert').equal(queue.length, 0)
|
||||
})
|
||||
// Once time initialization
|
||||
if (!fs[gracefulQueue]) {
|
||||
// This queue can be shared by multiple loaded instances
|
||||
var queue = global[gracefulQueue] || []
|
||||
publishQueue(fs, queue)
|
||||
|
||||
// Patch fs.close/closeSync to shared queue version, because we need
|
||||
// to retry() whenever a close happens *anywhere* in the program.
|
||||
// This is essential when multiple graceful-fs instances are
|
||||
// in play at the same time.
|
||||
fs.close = (function (fs$close) {
|
||||
function close (fd, cb) {
|
||||
return fs$close.call(fs, fd, function (err) {
|
||||
// This function uses the graceful-fs shared queue
|
||||
if (!err) {
|
||||
retry()
|
||||
}
|
||||
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
})
|
||||
}
|
||||
|
||||
Object.defineProperty(close, previousSymbol, {
|
||||
value: fs$close
|
||||
})
|
||||
return close
|
||||
})(fs.close)
|
||||
|
||||
fs.closeSync = (function (fs$closeSync) {
|
||||
function closeSync (fd) {
|
||||
// This function uses the graceful-fs shared queue
|
||||
fs$closeSync.apply(fs, arguments)
|
||||
retry()
|
||||
}
|
||||
|
||||
Object.defineProperty(closeSync, previousSymbol, {
|
||||
value: fs$closeSync
|
||||
})
|
||||
return closeSync
|
||||
})(fs.closeSync)
|
||||
|
||||
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
||||
process.on('exit', function() {
|
||||
debug(fs[gracefulQueue])
|
||||
require('assert').equal(fs[gracefulQueue].length, 0)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!global[gracefulQueue]) {
|
||||
publishQueue(global, fs[gracefulQueue]);
|
||||
}
|
||||
|
||||
module.exports = patch(clone(fs))
|
||||
@@ -32,45 +99,11 @@ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
||||
fs.__patched = true;
|
||||
}
|
||||
|
||||
// Always patch fs.close/closeSync, because we want to
|
||||
// retry() whenever a close happens *anywhere* in the program.
|
||||
// This is essential when multiple graceful-fs instances are
|
||||
// in play at the same time.
|
||||
module.exports.close = (function (fs$close) { return function (fd, cb) {
|
||||
return fs$close.call(fs, fd, function (err) {
|
||||
if (!err)
|
||||
retry()
|
||||
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
})
|
||||
}})(fs.close)
|
||||
|
||||
module.exports.closeSync = (function (fs$closeSync) { return function (fd) {
|
||||
// Note that graceful-fs also retries when fs.closeSync() fails.
|
||||
// Looks like a bug to me, although it's probably a harmless one.
|
||||
var rval = fs$closeSync.apply(fs, arguments)
|
||||
retry()
|
||||
return rval
|
||||
}})(fs.closeSync)
|
||||
|
||||
// Only patch fs once, otherwise we'll run into a memory leak if
|
||||
// graceful-fs is loaded multiple times, such as in test environments that
|
||||
// reset the loaded modules between tests.
|
||||
// We look for the string `graceful-fs` from the comment above. This
|
||||
// way we are not adding any extra properties and it will detect if older
|
||||
// versions of graceful-fs are installed.
|
||||
if (!/\bgraceful-fs\b/.test(fs.closeSync.toString())) {
|
||||
fs.closeSync = module.exports.closeSync;
|
||||
fs.close = module.exports.close;
|
||||
}
|
||||
|
||||
function patch (fs) {
|
||||
// Everything that references the open() function needs to be in here
|
||||
polyfills(fs)
|
||||
fs.gracefulify = patch
|
||||
fs.FileReadStream = ReadStream; // Legacy name.
|
||||
fs.FileWriteStream = WriteStream; // Legacy name.
|
||||
|
||||
fs.createReadStream = createReadStream
|
||||
fs.createWriteStream = createWriteStream
|
||||
var fs$readFile = fs.readFile
|
||||
@@ -187,8 +220,50 @@ function patch (fs) {
|
||||
WriteStream.prototype.open = WriteStream$open
|
||||
}
|
||||
|
||||
fs.ReadStream = ReadStream
|
||||
fs.WriteStream = WriteStream
|
||||
Object.defineProperty(fs, 'ReadStream', {
|
||||
get: function () {
|
||||
return ReadStream
|
||||
},
|
||||
set: function (val) {
|
||||
ReadStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
Object.defineProperty(fs, 'WriteStream', {
|
||||
get: function () {
|
||||
return WriteStream
|
||||
},
|
||||
set: function (val) {
|
||||
WriteStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
|
||||
// legacy names
|
||||
var FileReadStream = ReadStream
|
||||
Object.defineProperty(fs, 'FileReadStream', {
|
||||
get: function () {
|
||||
return FileReadStream
|
||||
},
|
||||
set: function (val) {
|
||||
FileReadStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
var FileWriteStream = WriteStream
|
||||
Object.defineProperty(fs, 'FileWriteStream', {
|
||||
get: function () {
|
||||
return FileWriteStream
|
||||
},
|
||||
set: function (val) {
|
||||
FileWriteStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
|
||||
function ReadStream (path, options) {
|
||||
if (this instanceof ReadStream)
|
||||
@@ -234,11 +309,11 @@ function patch (fs) {
|
||||
}
|
||||
|
||||
function createReadStream (path, options) {
|
||||
return new ReadStream(path, options)
|
||||
return new fs.ReadStream(path, options)
|
||||
}
|
||||
|
||||
function createWriteStream (path, options) {
|
||||
return new WriteStream(path, options)
|
||||
return new fs.WriteStream(path, options)
|
||||
}
|
||||
|
||||
var fs$open = fs.open
|
||||
@@ -267,11 +342,11 @@ function patch (fs) {
|
||||
|
||||
function enqueue (elem) {
|
||||
debug('ENQUEUE', elem[0].name, elem[1])
|
||||
queue.push(elem)
|
||||
fs[gracefulQueue].push(elem)
|
||||
}
|
||||
|
||||
function retry () {
|
||||
var elem = queue.shift()
|
||||
var elem = fs[gracefulQueue].shift()
|
||||
if (elem) {
|
||||
debug('RETRY', elem[0].name, elem[1])
|
||||
elem[0].apply(null, elem[1])
|
||||
|
||||
32
node_modules/graceful-fs/package.json
generated
vendored
32
node_modules/graceful-fs/package.json
generated
vendored
@@ -1,26 +1,19 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"graceful-fs@4.2.0",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "graceful-fs@4.2.0",
|
||||
"_id": "graceful-fs@4.2.0",
|
||||
"_from": "graceful-fs@^4.1.15",
|
||||
"_id": "graceful-fs@4.2.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==",
|
||||
"_integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
|
||||
"_location": "/graceful-fs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "graceful-fs@4.2.0",
|
||||
"raw": "graceful-fs@^4.1.15",
|
||||
"name": "graceful-fs",
|
||||
"escapedName": "graceful-fs",
|
||||
"rawSpec": "4.2.0",
|
||||
"rawSpec": "^4.1.15",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.2.0"
|
||||
"fetchSpec": "^4.1.15"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@jest/core",
|
||||
@@ -33,13 +26,16 @@
|
||||
"/load-json-file",
|
||||
"/write-file-atomic"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz",
|
||||
"_spec": "4.2.0",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
|
||||
"_shasum": "2256bde14d3632958c465ebc96dc467ca07a29fb",
|
||||
"_spec": "graceful-fs@^4.1.15",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@jest/core",
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-graceful-fs/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "A drop-in replacement for fs, making various improvements.",
|
||||
"devDependencies": {
|
||||
"import-fresh": "^2.0.0",
|
||||
@@ -87,5 +83,5 @@
|
||||
"preversion": "npm test",
|
||||
"test": "node test.js | tap -"
|
||||
},
|
||||
"version": "4.2.0"
|
||||
"version": "4.2.4"
|
||||
}
|
||||
|
||||
28
node_modules/graceful-fs/polyfills.js
generated
vendored
28
node_modules/graceful-fs/polyfills.js
generated
vendored
@@ -115,20 +115,26 @@ function patch (fs) {
|
||||
}
|
||||
|
||||
// if read() returns EAGAIN, then just try it again.
|
||||
fs.read = (function (fs$read) { return function (fd, buffer, offset, length, position, callback_) {
|
||||
var callback
|
||||
if (callback_ && typeof callback_ === 'function') {
|
||||
var eagCounter = 0
|
||||
callback = function (er, _, __) {
|
||||
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
||||
eagCounter ++
|
||||
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
||||
fs.read = (function (fs$read) {
|
||||
function read (fd, buffer, offset, length, position, callback_) {
|
||||
var callback
|
||||
if (callback_ && typeof callback_ === 'function') {
|
||||
var eagCounter = 0
|
||||
callback = function (er, _, __) {
|
||||
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
||||
eagCounter ++
|
||||
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
||||
}
|
||||
callback_.apply(this, arguments)
|
||||
}
|
||||
callback_.apply(this, arguments)
|
||||
}
|
||||
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
||||
}
|
||||
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
||||
}})(fs.read)
|
||||
|
||||
// This ensures `util.promisify` works as it does for native `fs.read`.
|
||||
read.__proto__ = fs$read
|
||||
return read
|
||||
})(fs.read)
|
||||
|
||||
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
||||
var eagCounter = 0
|
||||
|
||||
Reference in New Issue
Block a user