@vercel/ruby 1.3.38 → 1.3.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1810 -948
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -103,1167 +103,1167 @@ module.exports = eos;
|
|
|
103
103
|
|
|
104
104
|
/***/ }),
|
|
105
105
|
|
|
106
|
-
/***/
|
|
107
|
-
/***/ ((module) => {
|
|
106
|
+
/***/ 228:
|
|
107
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
var fs = __webpack_require__(5747)
|
|
110
|
+
var core
|
|
111
|
+
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
|
|
112
|
+
core = __webpack_require__(7214)
|
|
113
|
+
} else {
|
|
114
|
+
core = __webpack_require__(5211)
|
|
115
|
+
}
|
|
110
116
|
|
|
117
|
+
module.exports = isexe
|
|
118
|
+
isexe.sync = sync
|
|
111
119
|
|
|
112
|
-
|
|
120
|
+
function isexe (path, options, cb) {
|
|
121
|
+
if (typeof options === 'function') {
|
|
122
|
+
cb = options
|
|
123
|
+
options = {}
|
|
124
|
+
}
|
|
113
125
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
if (!cb) {
|
|
127
|
+
if (typeof Promise !== 'function') {
|
|
128
|
+
throw new TypeError('callback not provided')
|
|
129
|
+
}
|
|
117
130
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
return new Promise(function (resolve, reject) {
|
|
132
|
+
isexe(path, options || {}, function (er, is) {
|
|
133
|
+
if (er) {
|
|
134
|
+
reject(er)
|
|
135
|
+
} else {
|
|
136
|
+
resolve(is)
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
}
|
|
122
141
|
|
|
123
|
-
|
|
124
|
-
|
|
142
|
+
core(path, options || {}, function (er, is) {
|
|
143
|
+
// ignore EACCES because that just means we aren't allowed to run it
|
|
144
|
+
if (er) {
|
|
145
|
+
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
|
146
|
+
er = null
|
|
147
|
+
is = false
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
cb(er, is)
|
|
125
151
|
})
|
|
152
|
+
}
|
|
126
153
|
|
|
127
|
-
|
|
154
|
+
function sync (path, options) {
|
|
155
|
+
// my kingdom for a filtered catch
|
|
156
|
+
try {
|
|
157
|
+
return core.sync(path, options || {})
|
|
158
|
+
} catch (er) {
|
|
159
|
+
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
|
160
|
+
return false
|
|
161
|
+
} else {
|
|
162
|
+
throw er
|
|
163
|
+
}
|
|
164
|
+
}
|
|
128
165
|
}
|
|
129
166
|
|
|
130
167
|
|
|
131
168
|
/***/ }),
|
|
132
169
|
|
|
133
|
-
/***/
|
|
170
|
+
/***/ 5211:
|
|
134
171
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
135
172
|
|
|
173
|
+
module.exports = isexe
|
|
174
|
+
isexe.sync = sync
|
|
175
|
+
|
|
136
176
|
var fs = __webpack_require__(5747)
|
|
137
|
-
var polyfills = __webpack_require__(1290)
|
|
138
|
-
var legacy = __webpack_require__(4410)
|
|
139
|
-
var clone = __webpack_require__(9132)
|
|
140
177
|
|
|
141
|
-
|
|
178
|
+
function isexe (path, options, cb) {
|
|
179
|
+
fs.stat(path, function (er, stat) {
|
|
180
|
+
cb(er, er ? false : checkStat(stat, options))
|
|
181
|
+
})
|
|
182
|
+
}
|
|
142
183
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
184
|
+
function sync (path, options) {
|
|
185
|
+
return checkStat(fs.statSync(path), options)
|
|
186
|
+
}
|
|
146
187
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
gracefulQueue = Symbol.for('graceful-fs.queue')
|
|
150
|
-
// This is used in testing by future versions
|
|
151
|
-
previousSymbol = Symbol.for('graceful-fs.previous')
|
|
152
|
-
} else {
|
|
153
|
-
gracefulQueue = '___graceful-fs.queue'
|
|
154
|
-
previousSymbol = '___graceful-fs.previous'
|
|
188
|
+
function checkStat (stat, options) {
|
|
189
|
+
return stat.isFile() && checkMode(stat, options)
|
|
155
190
|
}
|
|
156
191
|
|
|
157
|
-
function
|
|
192
|
+
function checkMode (stat, options) {
|
|
193
|
+
var mod = stat.mode
|
|
194
|
+
var uid = stat.uid
|
|
195
|
+
var gid = stat.gid
|
|
158
196
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
197
|
+
var myUid = options.uid !== undefined ?
|
|
198
|
+
options.uid : process.getuid && process.getuid()
|
|
199
|
+
var myGid = options.gid !== undefined ?
|
|
200
|
+
options.gid : process.getgid && process.getgid()
|
|
201
|
+
|
|
202
|
+
var u = parseInt('100', 8)
|
|
203
|
+
var g = parseInt('010', 8)
|
|
204
|
+
var o = parseInt('001', 8)
|
|
205
|
+
var ug = u | g
|
|
206
|
+
|
|
207
|
+
var ret = (mod & o) ||
|
|
208
|
+
(mod & g) && gid === myGid ||
|
|
209
|
+
(mod & u) && uid === myUid ||
|
|
210
|
+
(mod & ug) && myUid === 0
|
|
211
|
+
|
|
212
|
+
return ret
|
|
165
213
|
}
|
|
166
214
|
|
|
167
|
-
var debug = noop
|
|
168
|
-
if (util.debuglog)
|
|
169
|
-
debug = util.debuglog('gfs4')
|
|
170
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
|
171
|
-
debug = function() {
|
|
172
|
-
var m = util.format.apply(util, arguments)
|
|
173
|
-
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
|
|
174
|
-
console.error(m)
|
|
175
|
-
}
|
|
176
215
|
|
|
177
|
-
|
|
178
|
-
if (!fs[gracefulQueue]) {
|
|
179
|
-
// This queue can be shared by multiple loaded instances
|
|
180
|
-
var queue = global[gracefulQueue] || []
|
|
181
|
-
publishQueue(fs, queue)
|
|
216
|
+
/***/ }),
|
|
182
217
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// This is essential when multiple graceful-fs instances are
|
|
186
|
-
// in play at the same time.
|
|
187
|
-
fs.close = (function (fs$close) {
|
|
188
|
-
function close (fd, cb) {
|
|
189
|
-
return fs$close.call(fs, fd, function (err) {
|
|
190
|
-
// This function uses the graceful-fs shared queue
|
|
191
|
-
if (!err) {
|
|
192
|
-
retry()
|
|
193
|
-
}
|
|
218
|
+
/***/ 7214:
|
|
219
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
194
220
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
})
|
|
198
|
-
}
|
|
221
|
+
module.exports = isexe
|
|
222
|
+
isexe.sync = sync
|
|
199
223
|
|
|
200
|
-
|
|
201
|
-
value: fs$close
|
|
202
|
-
})
|
|
203
|
-
return close
|
|
204
|
-
})(fs.close)
|
|
224
|
+
var fs = __webpack_require__(5747)
|
|
205
225
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
fs$closeSync.apply(fs, arguments)
|
|
210
|
-
retry()
|
|
211
|
-
}
|
|
226
|
+
function checkPathExt (path, options) {
|
|
227
|
+
var pathext = options.pathExt !== undefined ?
|
|
228
|
+
options.pathExt : process.env.PATHEXT
|
|
212
229
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return closeSync
|
|
217
|
-
})(fs.closeSync)
|
|
230
|
+
if (!pathext) {
|
|
231
|
+
return true
|
|
232
|
+
}
|
|
218
233
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
234
|
+
pathext = pathext.split(';')
|
|
235
|
+
if (pathext.indexOf('') !== -1) {
|
|
236
|
+
return true
|
|
237
|
+
}
|
|
238
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
239
|
+
var p = pathext[i].toLowerCase()
|
|
240
|
+
if (p && path.substr(-p.length).toLowerCase() === p) {
|
|
241
|
+
return true
|
|
242
|
+
}
|
|
224
243
|
}
|
|
244
|
+
return false
|
|
225
245
|
}
|
|
226
246
|
|
|
227
|
-
|
|
228
|
-
|
|
247
|
+
function checkStat (stat, path, options) {
|
|
248
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
249
|
+
return false
|
|
250
|
+
}
|
|
251
|
+
return checkPathExt(path, options)
|
|
229
252
|
}
|
|
230
253
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
254
|
+
function isexe (path, options, cb) {
|
|
255
|
+
fs.stat(path, function (er, stat) {
|
|
256
|
+
cb(er, er ? false : checkStat(stat, path, options))
|
|
257
|
+
})
|
|
235
258
|
}
|
|
236
259
|
|
|
237
|
-
function
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
fs.gracefulify = patch
|
|
260
|
+
function sync (path, options) {
|
|
261
|
+
return checkStat(fs.statSync(path), path, options)
|
|
262
|
+
}
|
|
241
263
|
|
|
242
|
-
fs.createReadStream = createReadStream
|
|
243
|
-
fs.createWriteStream = createWriteStream
|
|
244
|
-
var fs$readFile = fs.readFile
|
|
245
|
-
fs.readFile = readFile
|
|
246
|
-
function readFile (path, options, cb) {
|
|
247
|
-
if (typeof options === 'function')
|
|
248
|
-
cb = options, options = null
|
|
249
264
|
|
|
250
|
-
|
|
265
|
+
/***/ }),
|
|
251
266
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
267
|
+
/***/ 1215:
|
|
268
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
269
|
+
|
|
270
|
+
var _fs
|
|
271
|
+
try {
|
|
272
|
+
_fs = __webpack_require__(853)
|
|
273
|
+
} catch (_) {
|
|
274
|
+
_fs = __webpack_require__(5747)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function readFile (file, options, callback) {
|
|
278
|
+
if (callback == null) {
|
|
279
|
+
callback = options
|
|
280
|
+
options = {}
|
|
263
281
|
}
|
|
264
282
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (typeof options === 'function')
|
|
269
|
-
cb = options, options = null
|
|
283
|
+
if (typeof options === 'string') {
|
|
284
|
+
options = {encoding: options}
|
|
285
|
+
}
|
|
270
286
|
|
|
271
|
-
|
|
287
|
+
options = options || {}
|
|
288
|
+
var fs = options.fs || _fs
|
|
272
289
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
enqueue([go$writeFile, [path, data, options, cb]])
|
|
277
|
-
else {
|
|
278
|
-
if (typeof cb === 'function')
|
|
279
|
-
cb.apply(this, arguments)
|
|
280
|
-
retry()
|
|
281
|
-
}
|
|
282
|
-
})
|
|
283
|
-
}
|
|
290
|
+
var shouldThrow = true
|
|
291
|
+
if ('throws' in options) {
|
|
292
|
+
shouldThrow = options.throws
|
|
284
293
|
}
|
|
285
294
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
fs.appendFile = appendFile
|
|
289
|
-
function appendFile (path, data, options, cb) {
|
|
290
|
-
if (typeof options === 'function')
|
|
291
|
-
cb = options, options = null
|
|
295
|
+
fs.readFile(file, options, function (err, data) {
|
|
296
|
+
if (err) return callback(err)
|
|
292
297
|
|
|
293
|
-
|
|
298
|
+
data = stripBom(data)
|
|
294
299
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
300
|
+
var obj
|
|
301
|
+
try {
|
|
302
|
+
obj = JSON.parse(data, options ? options.reviver : null)
|
|
303
|
+
} catch (err2) {
|
|
304
|
+
if (shouldThrow) {
|
|
305
|
+
err2.message = file + ': ' + err2.message
|
|
306
|
+
return callback(err2)
|
|
307
|
+
} else {
|
|
308
|
+
return callback(null, null)
|
|
309
|
+
}
|
|
305
310
|
}
|
|
306
|
-
}
|
|
307
311
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
var args = [path]
|
|
312
|
-
if (typeof options !== 'function') {
|
|
313
|
-
args.push(options)
|
|
314
|
-
} else {
|
|
315
|
-
cb = options
|
|
316
|
-
}
|
|
317
|
-
args.push(go$readdir$cb)
|
|
312
|
+
callback(null, obj)
|
|
313
|
+
})
|
|
314
|
+
}
|
|
318
315
|
|
|
319
|
-
|
|
316
|
+
function readFileSync (file, options) {
|
|
317
|
+
options = options || {}
|
|
318
|
+
if (typeof options === 'string') {
|
|
319
|
+
options = {encoding: options}
|
|
320
|
+
}
|
|
320
321
|
|
|
321
|
-
|
|
322
|
-
if (files && files.sort)
|
|
323
|
-
files.sort()
|
|
322
|
+
var fs = options.fs || _fs
|
|
324
323
|
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
var shouldThrow = true
|
|
325
|
+
if ('throws' in options) {
|
|
326
|
+
shouldThrow = options.throws
|
|
327
|
+
}
|
|
327
328
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
329
|
+
try {
|
|
330
|
+
var content = fs.readFileSync(file, options)
|
|
331
|
+
content = stripBom(content)
|
|
332
|
+
return JSON.parse(content, options.reviver)
|
|
333
|
+
} catch (err) {
|
|
334
|
+
if (shouldThrow) {
|
|
335
|
+
err.message = file + ': ' + err.message
|
|
336
|
+
throw err
|
|
337
|
+
} else {
|
|
338
|
+
return null
|
|
333
339
|
}
|
|
334
340
|
}
|
|
341
|
+
}
|
|
335
342
|
|
|
336
|
-
|
|
337
|
-
|
|
343
|
+
function stringify (obj, options) {
|
|
344
|
+
var spaces
|
|
345
|
+
var EOL = '\n'
|
|
346
|
+
if (typeof options === 'object' && options !== null) {
|
|
347
|
+
if (options.spaces) {
|
|
348
|
+
spaces = options.spaces
|
|
349
|
+
}
|
|
350
|
+
if (options.EOL) {
|
|
351
|
+
EOL = options.EOL
|
|
352
|
+
}
|
|
338
353
|
}
|
|
339
354
|
|
|
340
|
-
|
|
341
|
-
var legStreams = legacy(fs)
|
|
342
|
-
ReadStream = legStreams.ReadStream
|
|
343
|
-
WriteStream = legStreams.WriteStream
|
|
344
|
-
}
|
|
355
|
+
var str = JSON.stringify(obj, options ? options.replacer : null, spaces)
|
|
345
356
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
357
|
+
return str.replace(/\n/g, EOL) + EOL
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function writeFile (file, obj, options, callback) {
|
|
361
|
+
if (callback == null) {
|
|
362
|
+
callback = options
|
|
363
|
+
options = {}
|
|
350
364
|
}
|
|
365
|
+
options = options || {}
|
|
366
|
+
var fs = options.fs || _fs
|
|
351
367
|
|
|
352
|
-
var
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
368
|
+
var str = ''
|
|
369
|
+
try {
|
|
370
|
+
str = stringify(obj, options)
|
|
371
|
+
} catch (err) {
|
|
372
|
+
// Need to return whether a callback was passed or not
|
|
373
|
+
if (callback) callback(err, null)
|
|
374
|
+
return
|
|
356
375
|
}
|
|
357
376
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
return ReadStream
|
|
361
|
-
},
|
|
362
|
-
set: function (val) {
|
|
363
|
-
ReadStream = val
|
|
364
|
-
},
|
|
365
|
-
enumerable: true,
|
|
366
|
-
configurable: true
|
|
367
|
-
})
|
|
368
|
-
Object.defineProperty(fs, 'WriteStream', {
|
|
369
|
-
get: function () {
|
|
370
|
-
return WriteStream
|
|
371
|
-
},
|
|
372
|
-
set: function (val) {
|
|
373
|
-
WriteStream = val
|
|
374
|
-
},
|
|
375
|
-
enumerable: true,
|
|
376
|
-
configurable: true
|
|
377
|
-
})
|
|
377
|
+
fs.writeFile(file, str, options, callback)
|
|
378
|
+
}
|
|
378
379
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
get: function () {
|
|
383
|
-
return FileReadStream
|
|
384
|
-
},
|
|
385
|
-
set: function (val) {
|
|
386
|
-
FileReadStream = val
|
|
387
|
-
},
|
|
388
|
-
enumerable: true,
|
|
389
|
-
configurable: true
|
|
390
|
-
})
|
|
391
|
-
var FileWriteStream = WriteStream
|
|
392
|
-
Object.defineProperty(fs, 'FileWriteStream', {
|
|
393
|
-
get: function () {
|
|
394
|
-
return FileWriteStream
|
|
395
|
-
},
|
|
396
|
-
set: function (val) {
|
|
397
|
-
FileWriteStream = val
|
|
398
|
-
},
|
|
399
|
-
enumerable: true,
|
|
400
|
-
configurable: true
|
|
401
|
-
})
|
|
380
|
+
function writeFileSync (file, obj, options) {
|
|
381
|
+
options = options || {}
|
|
382
|
+
var fs = options.fs || _fs
|
|
402
383
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
|
|
408
|
-
}
|
|
384
|
+
var str = stringify(obj, options)
|
|
385
|
+
// not sure if fs.writeFileSync returns anything, but just in case
|
|
386
|
+
return fs.writeFileSync(file, str, options)
|
|
387
|
+
}
|
|
409
388
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
389
|
+
function stripBom (content) {
|
|
390
|
+
// we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
|
|
391
|
+
if (Buffer.isBuffer(content)) content = content.toString('utf8')
|
|
392
|
+
content = content.replace(/^\uFEFF/, '')
|
|
393
|
+
return content
|
|
394
|
+
}
|
|
416
395
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
})
|
|
424
|
-
}
|
|
396
|
+
var jsonfile = {
|
|
397
|
+
readFile: readFile,
|
|
398
|
+
readFileSync: readFileSync,
|
|
399
|
+
writeFile: writeFile,
|
|
400
|
+
writeFileSync: writeFileSync
|
|
401
|
+
}
|
|
425
402
|
|
|
426
|
-
|
|
427
|
-
if (this instanceof WriteStream)
|
|
428
|
-
return fs$WriteStream.apply(this, arguments), this
|
|
429
|
-
else
|
|
430
|
-
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
|
|
431
|
-
}
|
|
403
|
+
module.exports = jsonfile
|
|
432
404
|
|
|
433
|
-
function WriteStream$open () {
|
|
434
|
-
var that = this
|
|
435
|
-
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
436
|
-
if (err) {
|
|
437
|
-
that.destroy()
|
|
438
|
-
that.emit('error', err)
|
|
439
|
-
} else {
|
|
440
|
-
that.fd = fd
|
|
441
|
-
that.emit('open', fd)
|
|
442
|
-
}
|
|
443
|
-
})
|
|
444
|
-
}
|
|
445
405
|
|
|
446
|
-
|
|
447
|
-
return new fs.ReadStream(path, options)
|
|
448
|
-
}
|
|
406
|
+
/***/ }),
|
|
449
407
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
408
|
+
/***/ 741:
|
|
409
|
+
/***/ ((module) => {
|
|
453
410
|
|
|
454
|
-
|
|
455
|
-
fs.open = open
|
|
456
|
-
function open (path, flags, mode, cb) {
|
|
457
|
-
if (typeof mode === 'function')
|
|
458
|
-
cb = mode, mode = null
|
|
411
|
+
"use strict";
|
|
459
412
|
|
|
460
|
-
return go$open(path, flags, mode, cb)
|
|
461
413
|
|
|
462
|
-
|
|
463
|
-
return fs$open(path, flags, mode, function (err, fd) {
|
|
464
|
-
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
465
|
-
enqueue([go$open, [path, flags, mode, cb]])
|
|
466
|
-
else {
|
|
467
|
-
if (typeof cb === 'function')
|
|
468
|
-
cb.apply(this, arguments)
|
|
469
|
-
retry()
|
|
470
|
-
}
|
|
471
|
-
})
|
|
472
|
-
}
|
|
473
|
-
}
|
|
414
|
+
module.exports = clone
|
|
474
415
|
|
|
475
|
-
|
|
476
|
-
|
|
416
|
+
function clone (obj) {
|
|
417
|
+
if (obj === null || typeof obj !== 'object')
|
|
418
|
+
return obj
|
|
477
419
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
420
|
+
if (obj instanceof Object)
|
|
421
|
+
var copy = { __proto__: obj.__proto__ }
|
|
422
|
+
else
|
|
423
|
+
var copy = Object.create(null)
|
|
482
424
|
|
|
483
|
-
function
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
425
|
+
Object.getOwnPropertyNames(obj).forEach(function (key) {
|
|
426
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
return copy
|
|
489
430
|
}
|
|
490
431
|
|
|
491
432
|
|
|
492
433
|
/***/ }),
|
|
493
434
|
|
|
494
|
-
/***/
|
|
435
|
+
/***/ 853:
|
|
495
436
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
496
437
|
|
|
497
|
-
var
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
function legacy (fs) {
|
|
502
|
-
return {
|
|
503
|
-
ReadStream: ReadStream,
|
|
504
|
-
WriteStream: WriteStream
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function ReadStream (path, options) {
|
|
508
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
509
|
-
|
|
510
|
-
Stream.call(this);
|
|
438
|
+
var fs = __webpack_require__(5747)
|
|
439
|
+
var polyfills = __webpack_require__(2289)
|
|
440
|
+
var legacy = __webpack_require__(5453)
|
|
441
|
+
var clone = __webpack_require__(741)
|
|
511
442
|
|
|
512
|
-
|
|
443
|
+
var util = __webpack_require__(1669)
|
|
513
444
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
this.paused = false;
|
|
445
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
446
|
+
var gracefulQueue
|
|
447
|
+
var previousSymbol
|
|
518
448
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
449
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
450
|
+
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
|
|
451
|
+
gracefulQueue = Symbol.for('graceful-fs.queue')
|
|
452
|
+
// This is used in testing by future versions
|
|
453
|
+
previousSymbol = Symbol.for('graceful-fs.previous')
|
|
454
|
+
} else {
|
|
455
|
+
gracefulQueue = '___graceful-fs.queue'
|
|
456
|
+
previousSymbol = '___graceful-fs.previous'
|
|
457
|
+
}
|
|
522
458
|
|
|
523
|
-
|
|
459
|
+
function noop () {}
|
|
524
460
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
this[key] = options[key];
|
|
461
|
+
function publishQueue(context, queue) {
|
|
462
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
463
|
+
get: function() {
|
|
464
|
+
return queue
|
|
530
465
|
}
|
|
466
|
+
})
|
|
467
|
+
}
|
|
531
468
|
|
|
532
|
-
|
|
469
|
+
var debug = noop
|
|
470
|
+
if (util.debuglog)
|
|
471
|
+
debug = util.debuglog('gfs4')
|
|
472
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
|
473
|
+
debug = function() {
|
|
474
|
+
var m = util.format.apply(util, arguments)
|
|
475
|
+
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
|
|
476
|
+
console.error(m)
|
|
477
|
+
}
|
|
533
478
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
this.end = Infinity;
|
|
540
|
-
} else if ('number' !== typeof this.end) {
|
|
541
|
-
throw TypeError('end must be a Number');
|
|
542
|
-
}
|
|
479
|
+
// Once time initialization
|
|
480
|
+
if (!fs[gracefulQueue]) {
|
|
481
|
+
// This queue can be shared by multiple loaded instances
|
|
482
|
+
var queue = global[gracefulQueue] || []
|
|
483
|
+
publishQueue(fs, queue)
|
|
543
484
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
485
|
+
// Patch fs.close/closeSync to shared queue version, because we need
|
|
486
|
+
// to retry() whenever a close happens *anywhere* in the program.
|
|
487
|
+
// This is essential when multiple graceful-fs instances are
|
|
488
|
+
// in play at the same time.
|
|
489
|
+
fs.close = (function (fs$close) {
|
|
490
|
+
function close (fd, cb) {
|
|
491
|
+
return fs$close.call(fs, fd, function (err) {
|
|
492
|
+
// This function uses the graceful-fs shared queue
|
|
493
|
+
if (!err) {
|
|
494
|
+
retry()
|
|
495
|
+
}
|
|
547
496
|
|
|
548
|
-
|
|
497
|
+
if (typeof cb === 'function')
|
|
498
|
+
cb.apply(this, arguments)
|
|
499
|
+
})
|
|
549
500
|
}
|
|
550
501
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
502
|
+
Object.defineProperty(close, previousSymbol, {
|
|
503
|
+
value: fs$close
|
|
504
|
+
})
|
|
505
|
+
return close
|
|
506
|
+
})(fs.close)
|
|
507
|
+
|
|
508
|
+
fs.closeSync = (function (fs$closeSync) {
|
|
509
|
+
function closeSync (fd) {
|
|
510
|
+
// This function uses the graceful-fs shared queue
|
|
511
|
+
fs$closeSync.apply(fs, arguments)
|
|
512
|
+
retry()
|
|
556
513
|
}
|
|
557
514
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}
|
|
515
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
516
|
+
value: fs$closeSync
|
|
517
|
+
})
|
|
518
|
+
return closeSync
|
|
519
|
+
})(fs.closeSync)
|
|
564
520
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
521
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
522
|
+
process.on('exit', function() {
|
|
523
|
+
debug(fs[gracefulQueue])
|
|
524
|
+
__webpack_require__(2357).equal(fs[gracefulQueue].length, 0)
|
|
568
525
|
})
|
|
569
526
|
}
|
|
527
|
+
}
|
|
570
528
|
|
|
571
|
-
|
|
572
|
-
|
|
529
|
+
if (!global[gracefulQueue]) {
|
|
530
|
+
publishQueue(global, fs[gracefulQueue]);
|
|
531
|
+
}
|
|
573
532
|
|
|
574
|
-
|
|
533
|
+
module.exports = patch(clone(fs))
|
|
534
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
535
|
+
module.exports = patch(fs)
|
|
536
|
+
fs.__patched = true;
|
|
537
|
+
}
|
|
575
538
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
539
|
+
function patch (fs) {
|
|
540
|
+
// Everything that references the open() function needs to be in here
|
|
541
|
+
polyfills(fs)
|
|
542
|
+
fs.gracefulify = patch
|
|
579
543
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
544
|
+
fs.createReadStream = createReadStream
|
|
545
|
+
fs.createWriteStream = createWriteStream
|
|
546
|
+
var fs$readFile = fs.readFile
|
|
547
|
+
fs.readFile = readFile
|
|
548
|
+
function readFile (path, options, cb) {
|
|
549
|
+
if (typeof options === 'function')
|
|
550
|
+
cb = options, options = null
|
|
584
551
|
|
|
585
|
-
|
|
552
|
+
return go$readFile(path, options, cb)
|
|
586
553
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
554
|
+
function go$readFile (path, options, cb) {
|
|
555
|
+
return fs$readFile(path, options, function (err) {
|
|
556
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
557
|
+
enqueue([go$readFile, [path, options, cb]])
|
|
558
|
+
else {
|
|
559
|
+
if (typeof cb === 'function')
|
|
560
|
+
cb.apply(this, arguments)
|
|
561
|
+
retry()
|
|
562
|
+
}
|
|
563
|
+
})
|
|
592
564
|
}
|
|
565
|
+
}
|
|
593
566
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
throw new Error('start must be >= zero');
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
this.pos = this.start;
|
|
603
|
-
}
|
|
567
|
+
var fs$writeFile = fs.writeFile
|
|
568
|
+
fs.writeFile = writeFile
|
|
569
|
+
function writeFile (path, data, options, cb) {
|
|
570
|
+
if (typeof options === 'function')
|
|
571
|
+
cb = options, options = null
|
|
604
572
|
|
|
605
|
-
|
|
606
|
-
this._queue = [];
|
|
573
|
+
return go$writeFile(path, data, options, cb)
|
|
607
574
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
575
|
+
function go$writeFile (path, data, options, cb) {
|
|
576
|
+
return fs$writeFile(path, data, options, function (err) {
|
|
577
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
578
|
+
enqueue([go$writeFile, [path, data, options, cb]])
|
|
579
|
+
else {
|
|
580
|
+
if (typeof cb === 'function')
|
|
581
|
+
cb.apply(this, arguments)
|
|
582
|
+
retry()
|
|
583
|
+
}
|
|
584
|
+
})
|
|
612
585
|
}
|
|
613
586
|
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
/***/ }),
|
|
618
|
-
|
|
619
|
-
/***/ 1290:
|
|
620
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
621
|
-
|
|
622
|
-
var constants = __webpack_require__(7619)
|
|
623
587
|
|
|
624
|
-
var
|
|
625
|
-
|
|
588
|
+
var fs$appendFile = fs.appendFile
|
|
589
|
+
if (fs$appendFile)
|
|
590
|
+
fs.appendFile = appendFile
|
|
591
|
+
function appendFile (path, data, options, cb) {
|
|
592
|
+
if (typeof options === 'function')
|
|
593
|
+
cb = options, options = null
|
|
626
594
|
|
|
627
|
-
|
|
595
|
+
return go$appendFile(path, data, options, cb)
|
|
628
596
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
597
|
+
function go$appendFile (path, data, options, cb) {
|
|
598
|
+
return fs$appendFile(path, data, options, function (err) {
|
|
599
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
600
|
+
enqueue([go$appendFile, [path, data, options, cb]])
|
|
601
|
+
else {
|
|
602
|
+
if (typeof cb === 'function')
|
|
603
|
+
cb.apply(this, arguments)
|
|
604
|
+
retry()
|
|
605
|
+
}
|
|
606
|
+
})
|
|
607
|
+
}
|
|
608
|
+
}
|
|
637
609
|
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
610
|
+
var fs$readdir = fs.readdir
|
|
611
|
+
fs.readdir = readdir
|
|
612
|
+
function readdir (path, options, cb) {
|
|
613
|
+
var args = [path]
|
|
614
|
+
if (typeof options !== 'function') {
|
|
615
|
+
args.push(options)
|
|
616
|
+
} else {
|
|
617
|
+
cb = options
|
|
618
|
+
}
|
|
619
|
+
args.push(go$readdir$cb)
|
|
643
620
|
|
|
644
|
-
|
|
621
|
+
return go$readdir(args)
|
|
645
622
|
|
|
646
|
-
function
|
|
647
|
-
|
|
623
|
+
function go$readdir$cb (err, files) {
|
|
624
|
+
if (files && files.sort)
|
|
625
|
+
files.sort()
|
|
648
626
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
627
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
628
|
+
enqueue([go$readdir, [args]])
|
|
629
|
+
|
|
630
|
+
else {
|
|
631
|
+
if (typeof cb === 'function')
|
|
632
|
+
cb.apply(this, arguments)
|
|
633
|
+
retry()
|
|
634
|
+
}
|
|
635
|
+
}
|
|
654
636
|
}
|
|
655
637
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
patchLutimes(fs)
|
|
638
|
+
function go$readdir (args) {
|
|
639
|
+
return fs$readdir.apply(fs, args)
|
|
659
640
|
}
|
|
660
641
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
642
|
+
if (process.version.substr(0, 4) === 'v0.8') {
|
|
643
|
+
var legStreams = legacy(fs)
|
|
644
|
+
ReadStream = legStreams.ReadStream
|
|
645
|
+
WriteStream = legStreams.WriteStream
|
|
646
|
+
}
|
|
665
647
|
|
|
666
|
-
fs
|
|
667
|
-
|
|
668
|
-
|
|
648
|
+
var fs$ReadStream = fs.ReadStream
|
|
649
|
+
if (fs$ReadStream) {
|
|
650
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
|
|
651
|
+
ReadStream.prototype.open = ReadStream$open
|
|
652
|
+
}
|
|
669
653
|
|
|
670
|
-
fs
|
|
671
|
-
|
|
672
|
-
|
|
654
|
+
var fs$WriteStream = fs.WriteStream
|
|
655
|
+
if (fs$WriteStream) {
|
|
656
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
|
|
657
|
+
WriteStream.prototype.open = WriteStream$open
|
|
658
|
+
}
|
|
673
659
|
|
|
674
|
-
fs
|
|
675
|
-
|
|
676
|
-
|
|
660
|
+
Object.defineProperty(fs, 'ReadStream', {
|
|
661
|
+
get: function () {
|
|
662
|
+
return ReadStream
|
|
663
|
+
},
|
|
664
|
+
set: function (val) {
|
|
665
|
+
ReadStream = val
|
|
666
|
+
},
|
|
667
|
+
enumerable: true,
|
|
668
|
+
configurable: true
|
|
669
|
+
})
|
|
670
|
+
Object.defineProperty(fs, 'WriteStream', {
|
|
671
|
+
get: function () {
|
|
672
|
+
return WriteStream
|
|
673
|
+
},
|
|
674
|
+
set: function (val) {
|
|
675
|
+
WriteStream = val
|
|
676
|
+
},
|
|
677
|
+
enumerable: true,
|
|
678
|
+
configurable: true
|
|
679
|
+
})
|
|
677
680
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
fs
|
|
681
|
+
// legacy names
|
|
682
|
+
var FileReadStream = ReadStream
|
|
683
|
+
Object.defineProperty(fs, 'FileReadStream', {
|
|
684
|
+
get: function () {
|
|
685
|
+
return FileReadStream
|
|
686
|
+
},
|
|
687
|
+
set: function (val) {
|
|
688
|
+
FileReadStream = val
|
|
689
|
+
},
|
|
690
|
+
enumerable: true,
|
|
691
|
+
configurable: true
|
|
692
|
+
})
|
|
693
|
+
var FileWriteStream = WriteStream
|
|
694
|
+
Object.defineProperty(fs, 'FileWriteStream', {
|
|
695
|
+
get: function () {
|
|
696
|
+
return FileWriteStream
|
|
697
|
+
},
|
|
698
|
+
set: function (val) {
|
|
699
|
+
FileWriteStream = val
|
|
700
|
+
},
|
|
701
|
+
enumerable: true,
|
|
702
|
+
configurable: true
|
|
703
|
+
})
|
|
681
704
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
705
|
+
function ReadStream (path, options) {
|
|
706
|
+
if (this instanceof ReadStream)
|
|
707
|
+
return fs$ReadStream.apply(this, arguments), this
|
|
708
|
+
else
|
|
709
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
|
|
710
|
+
}
|
|
685
711
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
712
|
+
function ReadStream$open () {
|
|
713
|
+
var that = this
|
|
714
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
715
|
+
if (err) {
|
|
716
|
+
if (that.autoClose)
|
|
717
|
+
that.destroy()
|
|
689
718
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
719
|
+
that.emit('error', err)
|
|
720
|
+
} else {
|
|
721
|
+
that.fd = fd
|
|
722
|
+
that.emit('open', fd)
|
|
723
|
+
that.read()
|
|
724
|
+
}
|
|
725
|
+
})
|
|
696
726
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
727
|
+
|
|
728
|
+
function WriteStream (path, options) {
|
|
729
|
+
if (this instanceof WriteStream)
|
|
730
|
+
return fs$WriteStream.apply(this, arguments), this
|
|
731
|
+
else
|
|
732
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
|
|
702
733
|
}
|
|
703
734
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
735
|
+
function WriteStream$open () {
|
|
736
|
+
var that = this
|
|
737
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
738
|
+
if (err) {
|
|
739
|
+
that.destroy()
|
|
740
|
+
that.emit('error', err)
|
|
741
|
+
} else {
|
|
742
|
+
that.fd = fd
|
|
743
|
+
that.emit('open', fd)
|
|
744
|
+
}
|
|
745
|
+
})
|
|
746
|
+
}
|
|
707
747
|
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
// failures. Also, take care to yield the scheduler. Windows scheduling gives
|
|
711
|
-
// CPU to a busy looping process, which can cause the program causing the lock
|
|
712
|
-
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
713
|
-
if (platform === "win32") {
|
|
714
|
-
fs.rename = (function (fs$rename) { return function (from, to, cb) {
|
|
715
|
-
var start = Date.now()
|
|
716
|
-
var backoff = 0;
|
|
717
|
-
fs$rename(from, to, function CB (er) {
|
|
718
|
-
if (er
|
|
719
|
-
&& (er.code === "EACCES" || er.code === "EPERM")
|
|
720
|
-
&& Date.now() - start < 60000) {
|
|
721
|
-
setTimeout(function() {
|
|
722
|
-
fs.stat(to, function (stater, st) {
|
|
723
|
-
if (stater && stater.code === "ENOENT")
|
|
724
|
-
fs$rename(from, to, CB);
|
|
725
|
-
else
|
|
726
|
-
cb(er)
|
|
727
|
-
})
|
|
728
|
-
}, backoff)
|
|
729
|
-
if (backoff < 100)
|
|
730
|
-
backoff += 10;
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
if (cb) cb(er)
|
|
734
|
-
})
|
|
735
|
-
}})(fs.rename)
|
|
748
|
+
function createReadStream (path, options) {
|
|
749
|
+
return new fs.ReadStream(path, options)
|
|
736
750
|
}
|
|
737
751
|
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
752
|
+
function createWriteStream (path, options) {
|
|
753
|
+
return new fs.WriteStream(path, options)
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
var fs$open = fs.open
|
|
757
|
+
fs.open = open
|
|
758
|
+
function open (path, flags, mode, cb) {
|
|
759
|
+
if (typeof mode === 'function')
|
|
760
|
+
cb = mode, mode = null
|
|
761
|
+
|
|
762
|
+
return go$open(path, flags, mode, cb)
|
|
763
|
+
|
|
764
|
+
function go$open (path, flags, mode, cb) {
|
|
765
|
+
return fs$open(path, flags, mode, function (err, fd) {
|
|
766
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
767
|
+
enqueue([go$open, [path, flags, mode, cb]])
|
|
768
|
+
else {
|
|
769
|
+
if (typeof cb === 'function')
|
|
770
|
+
cb.apply(this, arguments)
|
|
771
|
+
retry()
|
|
750
772
|
}
|
|
751
|
-
}
|
|
752
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
773
|
+
})
|
|
753
774
|
}
|
|
775
|
+
}
|
|
754
776
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
return read
|
|
758
|
-
})(fs.read)
|
|
777
|
+
return fs
|
|
778
|
+
}
|
|
759
779
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
return fs$readSync.call(fs, fd, buffer, offset, length, position)
|
|
765
|
-
} catch (er) {
|
|
766
|
-
if (er.code === 'EAGAIN' && eagCounter < 10) {
|
|
767
|
-
eagCounter ++
|
|
768
|
-
continue
|
|
769
|
-
}
|
|
770
|
-
throw er
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
}})(fs.readSync)
|
|
780
|
+
function enqueue (elem) {
|
|
781
|
+
debug('ENQUEUE', elem[0].name, elem[1])
|
|
782
|
+
fs[gracefulQueue].push(elem)
|
|
783
|
+
}
|
|
774
784
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
if (callback) callback(err)
|
|
783
|
-
return
|
|
784
|
-
}
|
|
785
|
-
// prefer to return the chmod error, if one occurs,
|
|
786
|
-
// but still try to close, and report closing errors if they occur.
|
|
787
|
-
fs.fchmod(fd, mode, function (err) {
|
|
788
|
-
fs.close(fd, function(err2) {
|
|
789
|
-
if (callback) callback(err || err2)
|
|
790
|
-
})
|
|
791
|
-
})
|
|
792
|
-
})
|
|
793
|
-
}
|
|
785
|
+
function retry () {
|
|
786
|
+
var elem = fs[gracefulQueue].shift()
|
|
787
|
+
if (elem) {
|
|
788
|
+
debug('RETRY', elem[0].name, elem[1])
|
|
789
|
+
elem[0].apply(null, elem[1])
|
|
790
|
+
}
|
|
791
|
+
}
|
|
794
792
|
|
|
795
|
-
fs.lchmodSync = function (path, mode) {
|
|
796
|
-
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
|
|
797
793
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
fs.closeSync(fd)
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
return ret
|
|
815
|
-
}
|
|
794
|
+
/***/ }),
|
|
795
|
+
|
|
796
|
+
/***/ 5453:
|
|
797
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
798
|
+
|
|
799
|
+
var Stream = __webpack_require__(2413).Stream
|
|
800
|
+
|
|
801
|
+
module.exports = legacy
|
|
802
|
+
|
|
803
|
+
function legacy (fs) {
|
|
804
|
+
return {
|
|
805
|
+
ReadStream: ReadStream,
|
|
806
|
+
WriteStream: WriteStream
|
|
816
807
|
}
|
|
817
808
|
|
|
818
|
-
function
|
|
819
|
-
if (
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
809
|
+
function ReadStream (path, options) {
|
|
810
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
811
|
+
|
|
812
|
+
Stream.call(this);
|
|
813
|
+
|
|
814
|
+
var self = this;
|
|
815
|
+
|
|
816
|
+
this.path = path;
|
|
817
|
+
this.fd = null;
|
|
818
|
+
this.readable = true;
|
|
819
|
+
this.paused = false;
|
|
820
|
+
|
|
821
|
+
this.flags = 'r';
|
|
822
|
+
this.mode = 438; /*=0666*/
|
|
823
|
+
this.bufferSize = 64 * 1024;
|
|
824
|
+
|
|
825
|
+
options = options || {};
|
|
826
|
+
|
|
827
|
+
// Mixin options into this
|
|
828
|
+
var keys = Object.keys(options);
|
|
829
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
830
|
+
var key = keys[index];
|
|
831
|
+
this[key] = options[key];
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
835
|
+
|
|
836
|
+
if (this.start !== undefined) {
|
|
837
|
+
if ('number' !== typeof this.start) {
|
|
838
|
+
throw TypeError('start must be a Number');
|
|
839
|
+
}
|
|
840
|
+
if (this.end === undefined) {
|
|
841
|
+
this.end = Infinity;
|
|
842
|
+
} else if ('number' !== typeof this.end) {
|
|
843
|
+
throw TypeError('end must be a Number');
|
|
832
844
|
}
|
|
833
845
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
var ret
|
|
837
|
-
var threw = true
|
|
838
|
-
try {
|
|
839
|
-
ret = fs.futimesSync(fd, at, mt)
|
|
840
|
-
threw = false
|
|
841
|
-
} finally {
|
|
842
|
-
if (threw) {
|
|
843
|
-
try {
|
|
844
|
-
fs.closeSync(fd)
|
|
845
|
-
} catch (er) {}
|
|
846
|
-
} else {
|
|
847
|
-
fs.closeSync(fd)
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
return ret
|
|
846
|
+
if (this.start > this.end) {
|
|
847
|
+
throw new Error('start must be <= end');
|
|
851
848
|
}
|
|
852
849
|
|
|
853
|
-
|
|
854
|
-
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
|
|
855
|
-
fs.lutimesSync = function () {}
|
|
850
|
+
this.pos = this.start;
|
|
856
851
|
}
|
|
857
|
-
}
|
|
858
852
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
if (cb) cb.apply(this, arguments)
|
|
865
|
-
})
|
|
853
|
+
if (this.fd !== null) {
|
|
854
|
+
process.nextTick(function() {
|
|
855
|
+
self._read();
|
|
856
|
+
});
|
|
857
|
+
return;
|
|
866
858
|
}
|
|
867
|
-
}
|
|
868
859
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
return
|
|
874
|
-
} catch (er) {
|
|
875
|
-
if (!chownErOk(er)) throw er
|
|
860
|
+
fs.open(this.path, this.flags, this.mode, function (err, fd) {
|
|
861
|
+
if (err) {
|
|
862
|
+
self.emit('error', err);
|
|
863
|
+
self.readable = false;
|
|
864
|
+
return;
|
|
876
865
|
}
|
|
877
|
-
|
|
866
|
+
|
|
867
|
+
self.fd = fd;
|
|
868
|
+
self.emit('open', fd);
|
|
869
|
+
self._read();
|
|
870
|
+
})
|
|
878
871
|
}
|
|
879
872
|
|
|
873
|
+
function WriteStream (path, options) {
|
|
874
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
880
875
|
|
|
881
|
-
|
|
882
|
-
if (!orig) return orig
|
|
883
|
-
return function (target, uid, gid, cb) {
|
|
884
|
-
return orig.call(fs, target, uid, gid, function (er) {
|
|
885
|
-
if (chownErOk(er)) er = null
|
|
886
|
-
if (cb) cb.apply(this, arguments)
|
|
887
|
-
})
|
|
888
|
-
}
|
|
889
|
-
}
|
|
876
|
+
Stream.call(this);
|
|
890
877
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
878
|
+
this.path = path;
|
|
879
|
+
this.fd = null;
|
|
880
|
+
this.writable = true;
|
|
881
|
+
|
|
882
|
+
this.flags = 'w';
|
|
883
|
+
this.encoding = 'binary';
|
|
884
|
+
this.mode = 438; /*=0666*/
|
|
885
|
+
this.bytesWritten = 0;
|
|
886
|
+
|
|
887
|
+
options = options || {};
|
|
888
|
+
|
|
889
|
+
// Mixin options into this
|
|
890
|
+
var keys = Object.keys(options);
|
|
891
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
892
|
+
var key = keys[index];
|
|
893
|
+
this[key] = options[key];
|
|
899
894
|
}
|
|
900
|
-
}
|
|
901
895
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
// uid + gid.
|
|
906
|
-
return function (target, options, cb) {
|
|
907
|
-
if (typeof options === 'function') {
|
|
908
|
-
cb = options
|
|
909
|
-
options = null
|
|
896
|
+
if (this.start !== undefined) {
|
|
897
|
+
if ('number' !== typeof this.start) {
|
|
898
|
+
throw TypeError('start must be a Number');
|
|
910
899
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
if (stats.uid < 0) stats.uid += 0x100000000
|
|
914
|
-
if (stats.gid < 0) stats.gid += 0x100000000
|
|
915
|
-
}
|
|
916
|
-
if (cb) cb.apply(this, arguments)
|
|
900
|
+
if (this.start < 0) {
|
|
901
|
+
throw new Error('start must be >= zero');
|
|
917
902
|
}
|
|
918
|
-
|
|
919
|
-
|
|
903
|
+
|
|
904
|
+
this.pos = this.start;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
this.busy = false;
|
|
908
|
+
this._queue = [];
|
|
909
|
+
|
|
910
|
+
if (this.fd === null) {
|
|
911
|
+
this._open = fs.open;
|
|
912
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
913
|
+
this.flush();
|
|
920
914
|
}
|
|
921
915
|
}
|
|
922
|
-
|
|
923
|
-
function statFixSync (orig) {
|
|
924
|
-
if (!orig) return orig
|
|
925
|
-
// Older versions of Node erroneously returned signed integers for
|
|
926
|
-
// uid + gid.
|
|
927
|
-
return function (target, options) {
|
|
928
|
-
var stats = options ? orig.call(fs, target, options)
|
|
929
|
-
: orig.call(fs, target)
|
|
930
|
-
if (stats.uid < 0) stats.uid += 0x100000000
|
|
931
|
-
if (stats.gid < 0) stats.gid += 0x100000000
|
|
932
|
-
return stats;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
// ENOSYS means that the fs doesn't support the op. Just ignore
|
|
937
|
-
// that, because it doesn't matter.
|
|
938
|
-
//
|
|
939
|
-
// if there's no getuid, or if getuid() is something other
|
|
940
|
-
// than 0, and the error is EINVAL or EPERM, then just ignore
|
|
941
|
-
// it.
|
|
942
|
-
//
|
|
943
|
-
// This specific case is a silent failure in cp, install, tar,
|
|
944
|
-
// and most other unix tools that manage permissions.
|
|
945
|
-
//
|
|
946
|
-
// When running as root, or if other types of errors are
|
|
947
|
-
// encountered, then it's strict.
|
|
948
|
-
function chownErOk (er) {
|
|
949
|
-
if (!er)
|
|
950
|
-
return true
|
|
951
|
-
|
|
952
|
-
if (er.code === "ENOSYS")
|
|
953
|
-
return true
|
|
954
|
-
|
|
955
|
-
var nonroot = !process.getuid || process.getuid() !== 0
|
|
956
|
-
if (nonroot) {
|
|
957
|
-
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
958
|
-
return true
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
return false
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
/***/ }),
|
|
967
|
-
|
|
968
|
-
/***/ 228:
|
|
969
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
970
|
-
|
|
971
|
-
var fs = __webpack_require__(5747)
|
|
972
|
-
var core
|
|
973
|
-
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
|
|
974
|
-
core = __webpack_require__(7214)
|
|
975
|
-
} else {
|
|
976
|
-
core = __webpack_require__(5211)
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
module.exports = isexe
|
|
980
|
-
isexe.sync = sync
|
|
981
|
-
|
|
982
|
-
function isexe (path, options, cb) {
|
|
983
|
-
if (typeof options === 'function') {
|
|
984
|
-
cb = options
|
|
985
|
-
options = {}
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
if (!cb) {
|
|
989
|
-
if (typeof Promise !== 'function') {
|
|
990
|
-
throw new TypeError('callback not provided')
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
return new Promise(function (resolve, reject) {
|
|
994
|
-
isexe(path, options || {}, function (er, is) {
|
|
995
|
-
if (er) {
|
|
996
|
-
reject(er)
|
|
997
|
-
} else {
|
|
998
|
-
resolve(is)
|
|
999
|
-
}
|
|
1000
|
-
})
|
|
1001
|
-
})
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
core(path, options || {}, function (er, is) {
|
|
1005
|
-
// ignore EACCES because that just means we aren't allowed to run it
|
|
1006
|
-
if (er) {
|
|
1007
|
-
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
|
1008
|
-
er = null
|
|
1009
|
-
is = false
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
cb(er, is)
|
|
1013
|
-
})
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
function sync (path, options) {
|
|
1017
|
-
// my kingdom for a filtered catch
|
|
1018
|
-
try {
|
|
1019
|
-
return core.sync(path, options || {})
|
|
1020
|
-
} catch (er) {
|
|
1021
|
-
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
|
1022
|
-
return false
|
|
1023
|
-
} else {
|
|
1024
|
-
throw er
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
916
|
+
}
|
|
1028
917
|
|
|
1029
918
|
|
|
1030
919
|
/***/ }),
|
|
1031
920
|
|
|
1032
|
-
/***/
|
|
921
|
+
/***/ 2289:
|
|
1033
922
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1034
923
|
|
|
1035
|
-
|
|
1036
|
-
isexe.sync = sync
|
|
924
|
+
var constants = __webpack_require__(7619)
|
|
1037
925
|
|
|
1038
|
-
var
|
|
926
|
+
var origCwd = process.cwd
|
|
927
|
+
var cwd = null
|
|
1039
928
|
|
|
1040
|
-
|
|
1041
|
-
fs.stat(path, function (er, stat) {
|
|
1042
|
-
cb(er, er ? false : checkStat(stat, options))
|
|
1043
|
-
})
|
|
1044
|
-
}
|
|
929
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
|
|
1045
930
|
|
|
1046
|
-
|
|
1047
|
-
|
|
931
|
+
process.cwd = function() {
|
|
932
|
+
if (!cwd)
|
|
933
|
+
cwd = origCwd.call(process)
|
|
934
|
+
return cwd
|
|
1048
935
|
}
|
|
936
|
+
try {
|
|
937
|
+
process.cwd()
|
|
938
|
+
} catch (er) {}
|
|
1049
939
|
|
|
1050
|
-
|
|
1051
|
-
|
|
940
|
+
var chdir = process.chdir
|
|
941
|
+
process.chdir = function(d) {
|
|
942
|
+
cwd = null
|
|
943
|
+
chdir.call(process, d)
|
|
1052
944
|
}
|
|
1053
945
|
|
|
1054
|
-
|
|
1055
|
-
var mod = stat.mode
|
|
1056
|
-
var uid = stat.uid
|
|
1057
|
-
var gid = stat.gid
|
|
1058
|
-
|
|
1059
|
-
var myUid = options.uid !== undefined ?
|
|
1060
|
-
options.uid : process.getuid && process.getuid()
|
|
1061
|
-
var myGid = options.gid !== undefined ?
|
|
1062
|
-
options.gid : process.getgid && process.getgid()
|
|
946
|
+
module.exports = patch
|
|
1063
947
|
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
var o = parseInt('001', 8)
|
|
1067
|
-
var ug = u | g
|
|
948
|
+
function patch (fs) {
|
|
949
|
+
// (re-)implement some things that are known busted or missing.
|
|
1068
950
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
951
|
+
// lchmod, broken prior to 0.6.2
|
|
952
|
+
// back-port the fix here.
|
|
953
|
+
if (constants.hasOwnProperty('O_SYMLINK') &&
|
|
954
|
+
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
955
|
+
patchLchmod(fs)
|
|
956
|
+
}
|
|
1073
957
|
|
|
1074
|
-
|
|
1075
|
-
|
|
958
|
+
// lutimes implementation, or no-op
|
|
959
|
+
if (!fs.lutimes) {
|
|
960
|
+
patchLutimes(fs)
|
|
961
|
+
}
|
|
1076
962
|
|
|
963
|
+
// https://github.com/isaacs/node-graceful-fs/issues/4
|
|
964
|
+
// Chown should not fail on einval or eperm if non-root.
|
|
965
|
+
// It should not fail on enosys ever, as this just indicates
|
|
966
|
+
// that a fs doesn't support the intended operation.
|
|
1077
967
|
|
|
1078
|
-
|
|
968
|
+
fs.chown = chownFix(fs.chown)
|
|
969
|
+
fs.fchown = chownFix(fs.fchown)
|
|
970
|
+
fs.lchown = chownFix(fs.lchown)
|
|
1079
971
|
|
|
1080
|
-
|
|
1081
|
-
|
|
972
|
+
fs.chmod = chmodFix(fs.chmod)
|
|
973
|
+
fs.fchmod = chmodFix(fs.fchmod)
|
|
974
|
+
fs.lchmod = chmodFix(fs.lchmod)
|
|
1082
975
|
|
|
1083
|
-
|
|
1084
|
-
|
|
976
|
+
fs.chownSync = chownFixSync(fs.chownSync)
|
|
977
|
+
fs.fchownSync = chownFixSync(fs.fchownSync)
|
|
978
|
+
fs.lchownSync = chownFixSync(fs.lchownSync)
|
|
1085
979
|
|
|
1086
|
-
|
|
980
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync)
|
|
981
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync)
|
|
982
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync)
|
|
1087
983
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
984
|
+
fs.stat = statFix(fs.stat)
|
|
985
|
+
fs.fstat = statFix(fs.fstat)
|
|
986
|
+
fs.lstat = statFix(fs.lstat)
|
|
1091
987
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
988
|
+
fs.statSync = statFixSync(fs.statSync)
|
|
989
|
+
fs.fstatSync = statFixSync(fs.fstatSync)
|
|
990
|
+
fs.lstatSync = statFixSync(fs.lstatSync)
|
|
1095
991
|
|
|
1096
|
-
|
|
1097
|
-
if (
|
|
1098
|
-
|
|
992
|
+
// if lchmod/lchown do not exist, then make them no-ops
|
|
993
|
+
if (!fs.lchmod) {
|
|
994
|
+
fs.lchmod = function (path, mode, cb) {
|
|
995
|
+
if (cb) process.nextTick(cb)
|
|
996
|
+
}
|
|
997
|
+
fs.lchmodSync = function () {}
|
|
1099
998
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
return true
|
|
999
|
+
if (!fs.lchown) {
|
|
1000
|
+
fs.lchown = function (path, uid, gid, cb) {
|
|
1001
|
+
if (cb) process.nextTick(cb)
|
|
1104
1002
|
}
|
|
1003
|
+
fs.lchownSync = function () {}
|
|
1105
1004
|
}
|
|
1106
|
-
return false
|
|
1107
|
-
}
|
|
1108
1005
|
|
|
1109
|
-
|
|
1110
|
-
if
|
|
1111
|
-
|
|
1006
|
+
// on Windows, A/V software can lock the directory, causing this
|
|
1007
|
+
// to fail with an EACCES or EPERM if the directory contains newly
|
|
1008
|
+
// created files. Try again on failure, for up to 60 seconds.
|
|
1009
|
+
|
|
1010
|
+
// Set the timeout this long because some Windows Anti-Virus, such as Parity
|
|
1011
|
+
// bit9, may lock files for up to a minute, causing npm package install
|
|
1012
|
+
// failures. Also, take care to yield the scheduler. Windows scheduling gives
|
|
1013
|
+
// CPU to a busy looping process, which can cause the program causing the lock
|
|
1014
|
+
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
1015
|
+
if (platform === "win32") {
|
|
1016
|
+
fs.rename = (function (fs$rename) { return function (from, to, cb) {
|
|
1017
|
+
var start = Date.now()
|
|
1018
|
+
var backoff = 0;
|
|
1019
|
+
fs$rename(from, to, function CB (er) {
|
|
1020
|
+
if (er
|
|
1021
|
+
&& (er.code === "EACCES" || er.code === "EPERM")
|
|
1022
|
+
&& Date.now() - start < 60000) {
|
|
1023
|
+
setTimeout(function() {
|
|
1024
|
+
fs.stat(to, function (stater, st) {
|
|
1025
|
+
if (stater && stater.code === "ENOENT")
|
|
1026
|
+
fs$rename(from, to, CB);
|
|
1027
|
+
else
|
|
1028
|
+
cb(er)
|
|
1029
|
+
})
|
|
1030
|
+
}, backoff)
|
|
1031
|
+
if (backoff < 100)
|
|
1032
|
+
backoff += 10;
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
if (cb) cb(er)
|
|
1036
|
+
})
|
|
1037
|
+
}})(fs.rename)
|
|
1112
1038
|
}
|
|
1113
|
-
return checkPathExt(path, options)
|
|
1114
|
-
}
|
|
1115
1039
|
|
|
1116
|
-
|
|
1117
|
-
fs.
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
function
|
|
1123
|
-
|
|
1124
|
-
|
|
1040
|
+
// if read() returns EAGAIN, then just try it again.
|
|
1041
|
+
fs.read = (function (fs$read) {
|
|
1042
|
+
function read (fd, buffer, offset, length, position, callback_) {
|
|
1043
|
+
var callback
|
|
1044
|
+
if (callback_ && typeof callback_ === 'function') {
|
|
1045
|
+
var eagCounter = 0
|
|
1046
|
+
callback = function (er, _, __) {
|
|
1047
|
+
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
|
1048
|
+
eagCounter ++
|
|
1049
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
1050
|
+
}
|
|
1051
|
+
callback_.apply(this, arguments)
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
1055
|
+
}
|
|
1125
1056
|
|
|
1057
|
+
// This ensures `util.promisify` works as it does for native `fs.read`.
|
|
1058
|
+
read.__proto__ = fs$read
|
|
1059
|
+
return read
|
|
1060
|
+
})(fs.read)
|
|
1126
1061
|
|
|
1127
|
-
|
|
1062
|
+
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
|
1063
|
+
var eagCounter = 0
|
|
1064
|
+
while (true) {
|
|
1065
|
+
try {
|
|
1066
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position)
|
|
1067
|
+
} catch (er) {
|
|
1068
|
+
if (er.code === 'EAGAIN' && eagCounter < 10) {
|
|
1069
|
+
eagCounter ++
|
|
1070
|
+
continue
|
|
1071
|
+
}
|
|
1072
|
+
throw er
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}})(fs.readSync)
|
|
1128
1076
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1077
|
+
function patchLchmod (fs) {
|
|
1078
|
+
fs.lchmod = function (path, mode, callback) {
|
|
1079
|
+
fs.open( path
|
|
1080
|
+
, constants.O_WRONLY | constants.O_SYMLINK
|
|
1081
|
+
, mode
|
|
1082
|
+
, function (err, fd) {
|
|
1083
|
+
if (err) {
|
|
1084
|
+
if (callback) callback(err)
|
|
1085
|
+
return
|
|
1086
|
+
}
|
|
1087
|
+
// prefer to return the chmod error, if one occurs,
|
|
1088
|
+
// but still try to close, and report closing errors if they occur.
|
|
1089
|
+
fs.fchmod(fd, mode, function (err) {
|
|
1090
|
+
fs.close(fd, function(err2) {
|
|
1091
|
+
if (callback) callback(err || err2)
|
|
1092
|
+
})
|
|
1093
|
+
})
|
|
1094
|
+
})
|
|
1095
|
+
}
|
|
1131
1096
|
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
_fs = __webpack_require__(552)
|
|
1135
|
-
} catch (_) {
|
|
1136
|
-
_fs = __webpack_require__(5747)
|
|
1137
|
-
}
|
|
1097
|
+
fs.lchmodSync = function (path, mode) {
|
|
1098
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
|
|
1138
1099
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1100
|
+
// prefer to return the chmod error, if one occurs,
|
|
1101
|
+
// but still try to close, and report closing errors if they occur.
|
|
1102
|
+
var threw = true
|
|
1103
|
+
var ret
|
|
1104
|
+
try {
|
|
1105
|
+
ret = fs.fchmodSync(fd, mode)
|
|
1106
|
+
threw = false
|
|
1107
|
+
} finally {
|
|
1108
|
+
if (threw) {
|
|
1109
|
+
try {
|
|
1110
|
+
fs.closeSync(fd)
|
|
1111
|
+
} catch (er) {}
|
|
1112
|
+
} else {
|
|
1113
|
+
fs.closeSync(fd)
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
return ret
|
|
1117
|
+
}
|
|
1143
1118
|
}
|
|
1144
1119
|
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1120
|
+
function patchLutimes (fs) {
|
|
1121
|
+
if (constants.hasOwnProperty("O_SYMLINK")) {
|
|
1122
|
+
fs.lutimes = function (path, at, mt, cb) {
|
|
1123
|
+
fs.open(path, constants.O_SYMLINK, function (er, fd) {
|
|
1124
|
+
if (er) {
|
|
1125
|
+
if (cb) cb(er)
|
|
1126
|
+
return
|
|
1127
|
+
}
|
|
1128
|
+
fs.futimes(fd, at, mt, function (er) {
|
|
1129
|
+
fs.close(fd, function (er2) {
|
|
1130
|
+
if (cb) cb(er || er2)
|
|
1131
|
+
})
|
|
1132
|
+
})
|
|
1133
|
+
})
|
|
1134
|
+
}
|
|
1148
1135
|
|
|
1149
|
-
|
|
1150
|
-
|
|
1136
|
+
fs.lutimesSync = function (path, at, mt) {
|
|
1137
|
+
var fd = fs.openSync(path, constants.O_SYMLINK)
|
|
1138
|
+
var ret
|
|
1139
|
+
var threw = true
|
|
1140
|
+
try {
|
|
1141
|
+
ret = fs.futimesSync(fd, at, mt)
|
|
1142
|
+
threw = false
|
|
1143
|
+
} finally {
|
|
1144
|
+
if (threw) {
|
|
1145
|
+
try {
|
|
1146
|
+
fs.closeSync(fd)
|
|
1147
|
+
} catch (er) {}
|
|
1148
|
+
} else {
|
|
1149
|
+
fs.closeSync(fd)
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
return ret
|
|
1153
|
+
}
|
|
1151
1154
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
+
} else {
|
|
1156
|
+
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
|
|
1157
|
+
fs.lutimesSync = function () {}
|
|
1158
|
+
}
|
|
1155
1159
|
}
|
|
1156
1160
|
|
|
1157
|
-
|
|
1158
|
-
if (
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
+
function chmodFix (orig) {
|
|
1162
|
+
if (!orig) return orig
|
|
1163
|
+
return function (target, mode, cb) {
|
|
1164
|
+
return orig.call(fs, target, mode, function (er) {
|
|
1165
|
+
if (chownErOk(er)) er = null
|
|
1166
|
+
if (cb) cb.apply(this, arguments)
|
|
1167
|
+
})
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1161
1170
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
} else {
|
|
1170
|
-
return callback(null, null)
|
|
1171
|
+
function chmodFixSync (orig) {
|
|
1172
|
+
if (!orig) return orig
|
|
1173
|
+
return function (target, mode) {
|
|
1174
|
+
try {
|
|
1175
|
+
return orig.call(fs, target, mode)
|
|
1176
|
+
} catch (er) {
|
|
1177
|
+
if (!chownErOk(er)) throw er
|
|
1171
1178
|
}
|
|
1172
1179
|
}
|
|
1173
|
-
|
|
1174
|
-
callback(null, obj)
|
|
1175
|
-
})
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
function readFileSync (file, options) {
|
|
1179
|
-
options = options || {}
|
|
1180
|
-
if (typeof options === 'string') {
|
|
1181
|
-
options = {encoding: options}
|
|
1182
1180
|
}
|
|
1183
1181
|
|
|
1184
|
-
var fs = options.fs || _fs
|
|
1185
1182
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1183
|
+
function chownFix (orig) {
|
|
1184
|
+
if (!orig) return orig
|
|
1185
|
+
return function (target, uid, gid, cb) {
|
|
1186
|
+
return orig.call(fs, target, uid, gid, function (er) {
|
|
1187
|
+
if (chownErOk(er)) er = null
|
|
1188
|
+
if (cb) cb.apply(this, arguments)
|
|
1189
|
+
})
|
|
1190
|
+
}
|
|
1189
1191
|
}
|
|
1190
1192
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
} else {
|
|
1200
|
-
return null
|
|
1193
|
+
function chownFixSync (orig) {
|
|
1194
|
+
if (!orig) return orig
|
|
1195
|
+
return function (target, uid, gid) {
|
|
1196
|
+
try {
|
|
1197
|
+
return orig.call(fs, target, uid, gid)
|
|
1198
|
+
} catch (er) {
|
|
1199
|
+
if (!chownErOk(er)) throw er
|
|
1200
|
+
}
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
|
-
}
|
|
1204
1203
|
|
|
1205
|
-
function
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1204
|
+
function statFix (orig) {
|
|
1205
|
+
if (!orig) return orig
|
|
1206
|
+
// Older versions of Node erroneously returned signed integers for
|
|
1207
|
+
// uid + gid.
|
|
1208
|
+
return function (target, options, cb) {
|
|
1209
|
+
if (typeof options === 'function') {
|
|
1210
|
+
cb = options
|
|
1211
|
+
options = null
|
|
1212
|
+
}
|
|
1213
|
+
function callback (er, stats) {
|
|
1214
|
+
if (stats) {
|
|
1215
|
+
if (stats.uid < 0) stats.uid += 0x100000000
|
|
1216
|
+
if (stats.gid < 0) stats.gid += 0x100000000
|
|
1217
|
+
}
|
|
1218
|
+
if (cb) cb.apply(this, arguments)
|
|
1219
|
+
}
|
|
1220
|
+
return options ? orig.call(fs, target, options, callback)
|
|
1221
|
+
: orig.call(fs, target, callback)
|
|
1214
1222
|
}
|
|
1215
1223
|
}
|
|
1216
1224
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1225
|
+
function statFixSync (orig) {
|
|
1226
|
+
if (!orig) return orig
|
|
1227
|
+
// Older versions of Node erroneously returned signed integers for
|
|
1228
|
+
// uid + gid.
|
|
1229
|
+
return function (target, options) {
|
|
1230
|
+
var stats = options ? orig.call(fs, target, options)
|
|
1231
|
+
: orig.call(fs, target)
|
|
1232
|
+
if (stats.uid < 0) stats.uid += 0x100000000
|
|
1233
|
+
if (stats.gid < 0) stats.gid += 0x100000000
|
|
1234
|
+
return stats;
|
|
1235
|
+
}
|
|
1226
1236
|
}
|
|
1227
|
-
options = options || {}
|
|
1228
|
-
var fs = options.fs || _fs
|
|
1229
1237
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
function
|
|
1243
|
-
|
|
1244
|
-
|
|
1238
|
+
// ENOSYS means that the fs doesn't support the op. Just ignore
|
|
1239
|
+
// that, because it doesn't matter.
|
|
1240
|
+
//
|
|
1241
|
+
// if there's no getuid, or if getuid() is something other
|
|
1242
|
+
// than 0, and the error is EINVAL or EPERM, then just ignore
|
|
1243
|
+
// it.
|
|
1244
|
+
//
|
|
1245
|
+
// This specific case is a silent failure in cp, install, tar,
|
|
1246
|
+
// and most other unix tools that manage permissions.
|
|
1247
|
+
//
|
|
1248
|
+
// When running as root, or if other types of errors are
|
|
1249
|
+
// encountered, then it's strict.
|
|
1250
|
+
function chownErOk (er) {
|
|
1251
|
+
if (!er)
|
|
1252
|
+
return true
|
|
1245
1253
|
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
return fs.writeFileSync(file, str, options)
|
|
1249
|
-
}
|
|
1254
|
+
if (er.code === "ENOSYS")
|
|
1255
|
+
return true
|
|
1250
1256
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
}
|
|
1257
|
+
var nonroot = !process.getuid || process.getuid() !== 0
|
|
1258
|
+
if (nonroot) {
|
|
1259
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
1260
|
+
return true
|
|
1261
|
+
}
|
|
1257
1262
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
readFileSync: readFileSync,
|
|
1261
|
-
writeFile: writeFile,
|
|
1262
|
-
writeFileSync: writeFileSync
|
|
1263
|
+
return false
|
|
1264
|
+
}
|
|
1263
1265
|
}
|
|
1264
1266
|
|
|
1265
|
-
module.exports = jsonfile
|
|
1266
|
-
|
|
1267
1267
|
|
|
1268
1268
|
/***/ }),
|
|
1269
1269
|
|
|
@@ -4697,7 +4697,7 @@ module.exports = {
|
|
|
4697
4697
|
"use strict";
|
|
4698
4698
|
|
|
4699
4699
|
|
|
4700
|
-
const fs = __webpack_require__(
|
|
4700
|
+
const fs = __webpack_require__(7907)
|
|
4701
4701
|
const path = __webpack_require__(5622)
|
|
4702
4702
|
const mkdirpSync = __webpack_require__(9181).mkdirsSync
|
|
4703
4703
|
const utimesSync = __webpack_require__(8605).utimesMillisSync
|
|
@@ -4911,7 +4911,7 @@ module.exports = {
|
|
|
4911
4911
|
"use strict";
|
|
4912
4912
|
|
|
4913
4913
|
|
|
4914
|
-
const fs = __webpack_require__(
|
|
4914
|
+
const fs = __webpack_require__(7907)
|
|
4915
4915
|
const path = __webpack_require__(5622)
|
|
4916
4916
|
const mkdirp = __webpack_require__(9181).mkdirs
|
|
4917
4917
|
const pathExists = __webpack_require__(5516).pathExists
|
|
@@ -5237,7 +5237,7 @@ module.exports = {
|
|
|
5237
5237
|
|
|
5238
5238
|
const u = __webpack_require__(2703)/* .fromCallback */ .E
|
|
5239
5239
|
const path = __webpack_require__(5622)
|
|
5240
|
-
const fs = __webpack_require__(
|
|
5240
|
+
const fs = __webpack_require__(7907)
|
|
5241
5241
|
const mkdir = __webpack_require__(9181)
|
|
5242
5242
|
const pathExists = __webpack_require__(5516).pathExists
|
|
5243
5243
|
|
|
@@ -5325,7 +5325,7 @@ module.exports = {
|
|
|
5325
5325
|
|
|
5326
5326
|
const u = __webpack_require__(2703)/* .fromCallback */ .E
|
|
5327
5327
|
const path = __webpack_require__(5622)
|
|
5328
|
-
const fs = __webpack_require__(
|
|
5328
|
+
const fs = __webpack_require__(7907)
|
|
5329
5329
|
const mkdir = __webpack_require__(9181)
|
|
5330
5330
|
const pathExists = __webpack_require__(5516).pathExists
|
|
5331
5331
|
|
|
@@ -5393,7 +5393,7 @@ module.exports = {
|
|
|
5393
5393
|
|
|
5394
5394
|
|
|
5395
5395
|
const path = __webpack_require__(5622)
|
|
5396
|
-
const fs = __webpack_require__(
|
|
5396
|
+
const fs = __webpack_require__(7907)
|
|
5397
5397
|
const pathExists = __webpack_require__(5516).pathExists
|
|
5398
5398
|
|
|
5399
5399
|
/**
|
|
@@ -5499,7 +5499,7 @@ module.exports = {
|
|
|
5499
5499
|
"use strict";
|
|
5500
5500
|
|
|
5501
5501
|
|
|
5502
|
-
const fs = __webpack_require__(
|
|
5502
|
+
const fs = __webpack_require__(7907)
|
|
5503
5503
|
|
|
5504
5504
|
function symlinkType (srcpath, type, callback) {
|
|
5505
5505
|
callback = (typeof type === 'function') ? type : callback
|
|
@@ -5540,7 +5540,7 @@ module.exports = {
|
|
|
5540
5540
|
|
|
5541
5541
|
const u = __webpack_require__(2703)/* .fromCallback */ .E
|
|
5542
5542
|
const path = __webpack_require__(5622)
|
|
5543
|
-
const fs = __webpack_require__(
|
|
5543
|
+
const fs = __webpack_require__(7907)
|
|
5544
5544
|
const _mkdirs = __webpack_require__(9181)
|
|
5545
5545
|
const mkdirs = _mkdirs.mkdirs
|
|
5546
5546
|
const mkdirsSync = _mkdirs.mkdirsSync
|
|
@@ -5611,7 +5611,7 @@ module.exports = {
|
|
|
5611
5611
|
// This is adapted from https://github.com/normalize/mz
|
|
5612
5612
|
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
|
5613
5613
|
const u = __webpack_require__(2703)/* .fromCallback */ .E
|
|
5614
|
-
const fs = __webpack_require__(
|
|
5614
|
+
const fs = __webpack_require__(7907)
|
|
5615
5615
|
|
|
5616
5616
|
const api = [
|
|
5617
5617
|
'access',
|
|
@@ -5801,7 +5801,7 @@ module.exports = {
|
|
|
5801
5801
|
"use strict";
|
|
5802
5802
|
|
|
5803
5803
|
|
|
5804
|
-
const fs = __webpack_require__(
|
|
5804
|
+
const fs = __webpack_require__(7907)
|
|
5805
5805
|
const path = __webpack_require__(5622)
|
|
5806
5806
|
const mkdir = __webpack_require__(9181)
|
|
5807
5807
|
const jsonFile = __webpack_require__(2855)
|
|
@@ -5884,7 +5884,7 @@ module.exports = {
|
|
|
5884
5884
|
"use strict";
|
|
5885
5885
|
|
|
5886
5886
|
|
|
5887
|
-
const fs = __webpack_require__(
|
|
5887
|
+
const fs = __webpack_require__(7907)
|
|
5888
5888
|
const path = __webpack_require__(5622)
|
|
5889
5889
|
const invalidWin32Path = __webpack_require__(3727).invalidWin32Path
|
|
5890
5890
|
|
|
@@ -5946,7 +5946,7 @@ module.exports = mkdirsSync
|
|
|
5946
5946
|
"use strict";
|
|
5947
5947
|
|
|
5948
5948
|
|
|
5949
|
-
const fs = __webpack_require__(
|
|
5949
|
+
const fs = __webpack_require__(7907)
|
|
5950
5950
|
const path = __webpack_require__(5622)
|
|
5951
5951
|
const invalidWin32Path = __webpack_require__(3727).invalidWin32Path
|
|
5952
5952
|
|
|
@@ -6050,7 +6050,7 @@ module.exports = {
|
|
|
6050
6050
|
"use strict";
|
|
6051
6051
|
|
|
6052
6052
|
|
|
6053
|
-
const fs = __webpack_require__(
|
|
6053
|
+
const fs = __webpack_require__(7907)
|
|
6054
6054
|
const path = __webpack_require__(5622)
|
|
6055
6055
|
const copySync = __webpack_require__(9567).copySync
|
|
6056
6056
|
const removeSync = __webpack_require__(4879).removeSync
|
|
@@ -6176,7 +6176,7 @@ module.exports = {
|
|
|
6176
6176
|
|
|
6177
6177
|
|
|
6178
6178
|
const u = __webpack_require__(2703)/* .fromCallback */ .E
|
|
6179
|
-
const fs = __webpack_require__(
|
|
6179
|
+
const fs = __webpack_require__(7907)
|
|
6180
6180
|
const path = __webpack_require__(5622)
|
|
6181
6181
|
const copy = __webpack_require__(8852).copy
|
|
6182
6182
|
const remove = __webpack_require__(4879).remove
|
|
@@ -6266,7 +6266,7 @@ module.exports = {
|
|
|
6266
6266
|
|
|
6267
6267
|
|
|
6268
6268
|
const u = __webpack_require__(2703)/* .fromCallback */ .E
|
|
6269
|
-
const fs = __webpack_require__(
|
|
6269
|
+
const fs = __webpack_require__(7907)
|
|
6270
6270
|
const path = __webpack_require__(5622)
|
|
6271
6271
|
const mkdir = __webpack_require__(9181)
|
|
6272
6272
|
const pathExists = __webpack_require__(5516).pathExists
|
|
@@ -6350,7 +6350,7 @@ module.exports = {
|
|
|
6350
6350
|
"use strict";
|
|
6351
6351
|
|
|
6352
6352
|
|
|
6353
|
-
const fs = __webpack_require__(
|
|
6353
|
+
const fs = __webpack_require__(7907)
|
|
6354
6354
|
const path = __webpack_require__(5622)
|
|
6355
6355
|
const assert = __webpack_require__(2357)
|
|
6356
6356
|
|
|
@@ -6692,7 +6692,7 @@ module.exports = function (size) {
|
|
|
6692
6692
|
"use strict";
|
|
6693
6693
|
|
|
6694
6694
|
|
|
6695
|
-
const fs = __webpack_require__(
|
|
6695
|
+
const fs = __webpack_require__(7907)
|
|
6696
6696
|
const os = __webpack_require__(2087)
|
|
6697
6697
|
const path = __webpack_require__(5622)
|
|
6698
6698
|
|
|
@@ -6897,6 +6897,868 @@ module.exports.array = (stream, options) => getStream(stream, {...options, array
|
|
|
6897
6897
|
module.exports.MaxBufferError = MaxBufferError;
|
|
6898
6898
|
|
|
6899
6899
|
|
|
6900
|
+
/***/ }),
|
|
6901
|
+
|
|
6902
|
+
/***/ 982:
|
|
6903
|
+
/***/ ((module) => {
|
|
6904
|
+
|
|
6905
|
+
"use strict";
|
|
6906
|
+
|
|
6907
|
+
|
|
6908
|
+
module.exports = clone
|
|
6909
|
+
|
|
6910
|
+
function clone (obj) {
|
|
6911
|
+
if (obj === null || typeof obj !== 'object')
|
|
6912
|
+
return obj
|
|
6913
|
+
|
|
6914
|
+
if (obj instanceof Object)
|
|
6915
|
+
var copy = { __proto__: obj.__proto__ }
|
|
6916
|
+
else
|
|
6917
|
+
var copy = Object.create(null)
|
|
6918
|
+
|
|
6919
|
+
Object.getOwnPropertyNames(obj).forEach(function (key) {
|
|
6920
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
|
|
6921
|
+
})
|
|
6922
|
+
|
|
6923
|
+
return copy
|
|
6924
|
+
}
|
|
6925
|
+
|
|
6926
|
+
|
|
6927
|
+
/***/ }),
|
|
6928
|
+
|
|
6929
|
+
/***/ 7907:
|
|
6930
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6931
|
+
|
|
6932
|
+
var fs = __webpack_require__(5747)
|
|
6933
|
+
var polyfills = __webpack_require__(664)
|
|
6934
|
+
var legacy = __webpack_require__(3968)
|
|
6935
|
+
var clone = __webpack_require__(982)
|
|
6936
|
+
|
|
6937
|
+
var util = __webpack_require__(1669)
|
|
6938
|
+
|
|
6939
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
6940
|
+
var gracefulQueue
|
|
6941
|
+
var previousSymbol
|
|
6942
|
+
|
|
6943
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
6944
|
+
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
|
|
6945
|
+
gracefulQueue = Symbol.for('graceful-fs.queue')
|
|
6946
|
+
// This is used in testing by future versions
|
|
6947
|
+
previousSymbol = Symbol.for('graceful-fs.previous')
|
|
6948
|
+
} else {
|
|
6949
|
+
gracefulQueue = '___graceful-fs.queue'
|
|
6950
|
+
previousSymbol = '___graceful-fs.previous'
|
|
6951
|
+
}
|
|
6952
|
+
|
|
6953
|
+
function noop () {}
|
|
6954
|
+
|
|
6955
|
+
function publishQueue(context, queue) {
|
|
6956
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
6957
|
+
get: function() {
|
|
6958
|
+
return queue
|
|
6959
|
+
}
|
|
6960
|
+
})
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6963
|
+
var debug = noop
|
|
6964
|
+
if (util.debuglog)
|
|
6965
|
+
debug = util.debuglog('gfs4')
|
|
6966
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
|
6967
|
+
debug = function() {
|
|
6968
|
+
var m = util.format.apply(util, arguments)
|
|
6969
|
+
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
|
|
6970
|
+
console.error(m)
|
|
6971
|
+
}
|
|
6972
|
+
|
|
6973
|
+
// Once time initialization
|
|
6974
|
+
if (!fs[gracefulQueue]) {
|
|
6975
|
+
// This queue can be shared by multiple loaded instances
|
|
6976
|
+
var queue = global[gracefulQueue] || []
|
|
6977
|
+
publishQueue(fs, queue)
|
|
6978
|
+
|
|
6979
|
+
// Patch fs.close/closeSync to shared queue version, because we need
|
|
6980
|
+
// to retry() whenever a close happens *anywhere* in the program.
|
|
6981
|
+
// This is essential when multiple graceful-fs instances are
|
|
6982
|
+
// in play at the same time.
|
|
6983
|
+
fs.close = (function (fs$close) {
|
|
6984
|
+
function close (fd, cb) {
|
|
6985
|
+
return fs$close.call(fs, fd, function (err) {
|
|
6986
|
+
// This function uses the graceful-fs shared queue
|
|
6987
|
+
if (!err) {
|
|
6988
|
+
retry()
|
|
6989
|
+
}
|
|
6990
|
+
|
|
6991
|
+
if (typeof cb === 'function')
|
|
6992
|
+
cb.apply(this, arguments)
|
|
6993
|
+
})
|
|
6994
|
+
}
|
|
6995
|
+
|
|
6996
|
+
Object.defineProperty(close, previousSymbol, {
|
|
6997
|
+
value: fs$close
|
|
6998
|
+
})
|
|
6999
|
+
return close
|
|
7000
|
+
})(fs.close)
|
|
7001
|
+
|
|
7002
|
+
fs.closeSync = (function (fs$closeSync) {
|
|
7003
|
+
function closeSync (fd) {
|
|
7004
|
+
// This function uses the graceful-fs shared queue
|
|
7005
|
+
fs$closeSync.apply(fs, arguments)
|
|
7006
|
+
retry()
|
|
7007
|
+
}
|
|
7008
|
+
|
|
7009
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
7010
|
+
value: fs$closeSync
|
|
7011
|
+
})
|
|
7012
|
+
return closeSync
|
|
7013
|
+
})(fs.closeSync)
|
|
7014
|
+
|
|
7015
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
7016
|
+
process.on('exit', function() {
|
|
7017
|
+
debug(fs[gracefulQueue])
|
|
7018
|
+
__webpack_require__(2357).equal(fs[gracefulQueue].length, 0)
|
|
7019
|
+
})
|
|
7020
|
+
}
|
|
7021
|
+
}
|
|
7022
|
+
|
|
7023
|
+
if (!global[gracefulQueue]) {
|
|
7024
|
+
publishQueue(global, fs[gracefulQueue]);
|
|
7025
|
+
}
|
|
7026
|
+
|
|
7027
|
+
module.exports = patch(clone(fs))
|
|
7028
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
7029
|
+
module.exports = patch(fs)
|
|
7030
|
+
fs.__patched = true;
|
|
7031
|
+
}
|
|
7032
|
+
|
|
7033
|
+
function patch (fs) {
|
|
7034
|
+
// Everything that references the open() function needs to be in here
|
|
7035
|
+
polyfills(fs)
|
|
7036
|
+
fs.gracefulify = patch
|
|
7037
|
+
|
|
7038
|
+
fs.createReadStream = createReadStream
|
|
7039
|
+
fs.createWriteStream = createWriteStream
|
|
7040
|
+
var fs$readFile = fs.readFile
|
|
7041
|
+
fs.readFile = readFile
|
|
7042
|
+
function readFile (path, options, cb) {
|
|
7043
|
+
if (typeof options === 'function')
|
|
7044
|
+
cb = options, options = null
|
|
7045
|
+
|
|
7046
|
+
return go$readFile(path, options, cb)
|
|
7047
|
+
|
|
7048
|
+
function go$readFile (path, options, cb) {
|
|
7049
|
+
return fs$readFile(path, options, function (err) {
|
|
7050
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
7051
|
+
enqueue([go$readFile, [path, options, cb]])
|
|
7052
|
+
else {
|
|
7053
|
+
if (typeof cb === 'function')
|
|
7054
|
+
cb.apply(this, arguments)
|
|
7055
|
+
retry()
|
|
7056
|
+
}
|
|
7057
|
+
})
|
|
7058
|
+
}
|
|
7059
|
+
}
|
|
7060
|
+
|
|
7061
|
+
var fs$writeFile = fs.writeFile
|
|
7062
|
+
fs.writeFile = writeFile
|
|
7063
|
+
function writeFile (path, data, options, cb) {
|
|
7064
|
+
if (typeof options === 'function')
|
|
7065
|
+
cb = options, options = null
|
|
7066
|
+
|
|
7067
|
+
return go$writeFile(path, data, options, cb)
|
|
7068
|
+
|
|
7069
|
+
function go$writeFile (path, data, options, cb) {
|
|
7070
|
+
return fs$writeFile(path, data, options, function (err) {
|
|
7071
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
7072
|
+
enqueue([go$writeFile, [path, data, options, cb]])
|
|
7073
|
+
else {
|
|
7074
|
+
if (typeof cb === 'function')
|
|
7075
|
+
cb.apply(this, arguments)
|
|
7076
|
+
retry()
|
|
7077
|
+
}
|
|
7078
|
+
})
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
|
|
7082
|
+
var fs$appendFile = fs.appendFile
|
|
7083
|
+
if (fs$appendFile)
|
|
7084
|
+
fs.appendFile = appendFile
|
|
7085
|
+
function appendFile (path, data, options, cb) {
|
|
7086
|
+
if (typeof options === 'function')
|
|
7087
|
+
cb = options, options = null
|
|
7088
|
+
|
|
7089
|
+
return go$appendFile(path, data, options, cb)
|
|
7090
|
+
|
|
7091
|
+
function go$appendFile (path, data, options, cb) {
|
|
7092
|
+
return fs$appendFile(path, data, options, function (err) {
|
|
7093
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
7094
|
+
enqueue([go$appendFile, [path, data, options, cb]])
|
|
7095
|
+
else {
|
|
7096
|
+
if (typeof cb === 'function')
|
|
7097
|
+
cb.apply(this, arguments)
|
|
7098
|
+
retry()
|
|
7099
|
+
}
|
|
7100
|
+
})
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
|
|
7104
|
+
var fs$readdir = fs.readdir
|
|
7105
|
+
fs.readdir = readdir
|
|
7106
|
+
function readdir (path, options, cb) {
|
|
7107
|
+
var args = [path]
|
|
7108
|
+
if (typeof options !== 'function') {
|
|
7109
|
+
args.push(options)
|
|
7110
|
+
} else {
|
|
7111
|
+
cb = options
|
|
7112
|
+
}
|
|
7113
|
+
args.push(go$readdir$cb)
|
|
7114
|
+
|
|
7115
|
+
return go$readdir(args)
|
|
7116
|
+
|
|
7117
|
+
function go$readdir$cb (err, files) {
|
|
7118
|
+
if (files && files.sort)
|
|
7119
|
+
files.sort()
|
|
7120
|
+
|
|
7121
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
7122
|
+
enqueue([go$readdir, [args]])
|
|
7123
|
+
|
|
7124
|
+
else {
|
|
7125
|
+
if (typeof cb === 'function')
|
|
7126
|
+
cb.apply(this, arguments)
|
|
7127
|
+
retry()
|
|
7128
|
+
}
|
|
7129
|
+
}
|
|
7130
|
+
}
|
|
7131
|
+
|
|
7132
|
+
function go$readdir (args) {
|
|
7133
|
+
return fs$readdir.apply(fs, args)
|
|
7134
|
+
}
|
|
7135
|
+
|
|
7136
|
+
if (process.version.substr(0, 4) === 'v0.8') {
|
|
7137
|
+
var legStreams = legacy(fs)
|
|
7138
|
+
ReadStream = legStreams.ReadStream
|
|
7139
|
+
WriteStream = legStreams.WriteStream
|
|
7140
|
+
}
|
|
7141
|
+
|
|
7142
|
+
var fs$ReadStream = fs.ReadStream
|
|
7143
|
+
if (fs$ReadStream) {
|
|
7144
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
|
|
7145
|
+
ReadStream.prototype.open = ReadStream$open
|
|
7146
|
+
}
|
|
7147
|
+
|
|
7148
|
+
var fs$WriteStream = fs.WriteStream
|
|
7149
|
+
if (fs$WriteStream) {
|
|
7150
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
|
|
7151
|
+
WriteStream.prototype.open = WriteStream$open
|
|
7152
|
+
}
|
|
7153
|
+
|
|
7154
|
+
Object.defineProperty(fs, 'ReadStream', {
|
|
7155
|
+
get: function () {
|
|
7156
|
+
return ReadStream
|
|
7157
|
+
},
|
|
7158
|
+
set: function (val) {
|
|
7159
|
+
ReadStream = val
|
|
7160
|
+
},
|
|
7161
|
+
enumerable: true,
|
|
7162
|
+
configurable: true
|
|
7163
|
+
})
|
|
7164
|
+
Object.defineProperty(fs, 'WriteStream', {
|
|
7165
|
+
get: function () {
|
|
7166
|
+
return WriteStream
|
|
7167
|
+
},
|
|
7168
|
+
set: function (val) {
|
|
7169
|
+
WriteStream = val
|
|
7170
|
+
},
|
|
7171
|
+
enumerable: true,
|
|
7172
|
+
configurable: true
|
|
7173
|
+
})
|
|
7174
|
+
|
|
7175
|
+
// legacy names
|
|
7176
|
+
var FileReadStream = ReadStream
|
|
7177
|
+
Object.defineProperty(fs, 'FileReadStream', {
|
|
7178
|
+
get: function () {
|
|
7179
|
+
return FileReadStream
|
|
7180
|
+
},
|
|
7181
|
+
set: function (val) {
|
|
7182
|
+
FileReadStream = val
|
|
7183
|
+
},
|
|
7184
|
+
enumerable: true,
|
|
7185
|
+
configurable: true
|
|
7186
|
+
})
|
|
7187
|
+
var FileWriteStream = WriteStream
|
|
7188
|
+
Object.defineProperty(fs, 'FileWriteStream', {
|
|
7189
|
+
get: function () {
|
|
7190
|
+
return FileWriteStream
|
|
7191
|
+
},
|
|
7192
|
+
set: function (val) {
|
|
7193
|
+
FileWriteStream = val
|
|
7194
|
+
},
|
|
7195
|
+
enumerable: true,
|
|
7196
|
+
configurable: true
|
|
7197
|
+
})
|
|
7198
|
+
|
|
7199
|
+
function ReadStream (path, options) {
|
|
7200
|
+
if (this instanceof ReadStream)
|
|
7201
|
+
return fs$ReadStream.apply(this, arguments), this
|
|
7202
|
+
else
|
|
7203
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
|
|
7204
|
+
}
|
|
7205
|
+
|
|
7206
|
+
function ReadStream$open () {
|
|
7207
|
+
var that = this
|
|
7208
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
7209
|
+
if (err) {
|
|
7210
|
+
if (that.autoClose)
|
|
7211
|
+
that.destroy()
|
|
7212
|
+
|
|
7213
|
+
that.emit('error', err)
|
|
7214
|
+
} else {
|
|
7215
|
+
that.fd = fd
|
|
7216
|
+
that.emit('open', fd)
|
|
7217
|
+
that.read()
|
|
7218
|
+
}
|
|
7219
|
+
})
|
|
7220
|
+
}
|
|
7221
|
+
|
|
7222
|
+
function WriteStream (path, options) {
|
|
7223
|
+
if (this instanceof WriteStream)
|
|
7224
|
+
return fs$WriteStream.apply(this, arguments), this
|
|
7225
|
+
else
|
|
7226
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
|
|
7227
|
+
}
|
|
7228
|
+
|
|
7229
|
+
function WriteStream$open () {
|
|
7230
|
+
var that = this
|
|
7231
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
7232
|
+
if (err) {
|
|
7233
|
+
that.destroy()
|
|
7234
|
+
that.emit('error', err)
|
|
7235
|
+
} else {
|
|
7236
|
+
that.fd = fd
|
|
7237
|
+
that.emit('open', fd)
|
|
7238
|
+
}
|
|
7239
|
+
})
|
|
7240
|
+
}
|
|
7241
|
+
|
|
7242
|
+
function createReadStream (path, options) {
|
|
7243
|
+
return new fs.ReadStream(path, options)
|
|
7244
|
+
}
|
|
7245
|
+
|
|
7246
|
+
function createWriteStream (path, options) {
|
|
7247
|
+
return new fs.WriteStream(path, options)
|
|
7248
|
+
}
|
|
7249
|
+
|
|
7250
|
+
var fs$open = fs.open
|
|
7251
|
+
fs.open = open
|
|
7252
|
+
function open (path, flags, mode, cb) {
|
|
7253
|
+
if (typeof mode === 'function')
|
|
7254
|
+
cb = mode, mode = null
|
|
7255
|
+
|
|
7256
|
+
return go$open(path, flags, mode, cb)
|
|
7257
|
+
|
|
7258
|
+
function go$open (path, flags, mode, cb) {
|
|
7259
|
+
return fs$open(path, flags, mode, function (err, fd) {
|
|
7260
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
7261
|
+
enqueue([go$open, [path, flags, mode, cb]])
|
|
7262
|
+
else {
|
|
7263
|
+
if (typeof cb === 'function')
|
|
7264
|
+
cb.apply(this, arguments)
|
|
7265
|
+
retry()
|
|
7266
|
+
}
|
|
7267
|
+
})
|
|
7268
|
+
}
|
|
7269
|
+
}
|
|
7270
|
+
|
|
7271
|
+
return fs
|
|
7272
|
+
}
|
|
7273
|
+
|
|
7274
|
+
function enqueue (elem) {
|
|
7275
|
+
debug('ENQUEUE', elem[0].name, elem[1])
|
|
7276
|
+
fs[gracefulQueue].push(elem)
|
|
7277
|
+
}
|
|
7278
|
+
|
|
7279
|
+
function retry () {
|
|
7280
|
+
var elem = fs[gracefulQueue].shift()
|
|
7281
|
+
if (elem) {
|
|
7282
|
+
debug('RETRY', elem[0].name, elem[1])
|
|
7283
|
+
elem[0].apply(null, elem[1])
|
|
7284
|
+
}
|
|
7285
|
+
}
|
|
7286
|
+
|
|
7287
|
+
|
|
7288
|
+
/***/ }),
|
|
7289
|
+
|
|
7290
|
+
/***/ 3968:
|
|
7291
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
7292
|
+
|
|
7293
|
+
var Stream = __webpack_require__(2413).Stream
|
|
7294
|
+
|
|
7295
|
+
module.exports = legacy
|
|
7296
|
+
|
|
7297
|
+
function legacy (fs) {
|
|
7298
|
+
return {
|
|
7299
|
+
ReadStream: ReadStream,
|
|
7300
|
+
WriteStream: WriteStream
|
|
7301
|
+
}
|
|
7302
|
+
|
|
7303
|
+
function ReadStream (path, options) {
|
|
7304
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
7305
|
+
|
|
7306
|
+
Stream.call(this);
|
|
7307
|
+
|
|
7308
|
+
var self = this;
|
|
7309
|
+
|
|
7310
|
+
this.path = path;
|
|
7311
|
+
this.fd = null;
|
|
7312
|
+
this.readable = true;
|
|
7313
|
+
this.paused = false;
|
|
7314
|
+
|
|
7315
|
+
this.flags = 'r';
|
|
7316
|
+
this.mode = 438; /*=0666*/
|
|
7317
|
+
this.bufferSize = 64 * 1024;
|
|
7318
|
+
|
|
7319
|
+
options = options || {};
|
|
7320
|
+
|
|
7321
|
+
// Mixin options into this
|
|
7322
|
+
var keys = Object.keys(options);
|
|
7323
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
7324
|
+
var key = keys[index];
|
|
7325
|
+
this[key] = options[key];
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7328
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
7329
|
+
|
|
7330
|
+
if (this.start !== undefined) {
|
|
7331
|
+
if ('number' !== typeof this.start) {
|
|
7332
|
+
throw TypeError('start must be a Number');
|
|
7333
|
+
}
|
|
7334
|
+
if (this.end === undefined) {
|
|
7335
|
+
this.end = Infinity;
|
|
7336
|
+
} else if ('number' !== typeof this.end) {
|
|
7337
|
+
throw TypeError('end must be a Number');
|
|
7338
|
+
}
|
|
7339
|
+
|
|
7340
|
+
if (this.start > this.end) {
|
|
7341
|
+
throw new Error('start must be <= end');
|
|
7342
|
+
}
|
|
7343
|
+
|
|
7344
|
+
this.pos = this.start;
|
|
7345
|
+
}
|
|
7346
|
+
|
|
7347
|
+
if (this.fd !== null) {
|
|
7348
|
+
process.nextTick(function() {
|
|
7349
|
+
self._read();
|
|
7350
|
+
});
|
|
7351
|
+
return;
|
|
7352
|
+
}
|
|
7353
|
+
|
|
7354
|
+
fs.open(this.path, this.flags, this.mode, function (err, fd) {
|
|
7355
|
+
if (err) {
|
|
7356
|
+
self.emit('error', err);
|
|
7357
|
+
self.readable = false;
|
|
7358
|
+
return;
|
|
7359
|
+
}
|
|
7360
|
+
|
|
7361
|
+
self.fd = fd;
|
|
7362
|
+
self.emit('open', fd);
|
|
7363
|
+
self._read();
|
|
7364
|
+
})
|
|
7365
|
+
}
|
|
7366
|
+
|
|
7367
|
+
function WriteStream (path, options) {
|
|
7368
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
7369
|
+
|
|
7370
|
+
Stream.call(this);
|
|
7371
|
+
|
|
7372
|
+
this.path = path;
|
|
7373
|
+
this.fd = null;
|
|
7374
|
+
this.writable = true;
|
|
7375
|
+
|
|
7376
|
+
this.flags = 'w';
|
|
7377
|
+
this.encoding = 'binary';
|
|
7378
|
+
this.mode = 438; /*=0666*/
|
|
7379
|
+
this.bytesWritten = 0;
|
|
7380
|
+
|
|
7381
|
+
options = options || {};
|
|
7382
|
+
|
|
7383
|
+
// Mixin options into this
|
|
7384
|
+
var keys = Object.keys(options);
|
|
7385
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
7386
|
+
var key = keys[index];
|
|
7387
|
+
this[key] = options[key];
|
|
7388
|
+
}
|
|
7389
|
+
|
|
7390
|
+
if (this.start !== undefined) {
|
|
7391
|
+
if ('number' !== typeof this.start) {
|
|
7392
|
+
throw TypeError('start must be a Number');
|
|
7393
|
+
}
|
|
7394
|
+
if (this.start < 0) {
|
|
7395
|
+
throw new Error('start must be >= zero');
|
|
7396
|
+
}
|
|
7397
|
+
|
|
7398
|
+
this.pos = this.start;
|
|
7399
|
+
}
|
|
7400
|
+
|
|
7401
|
+
this.busy = false;
|
|
7402
|
+
this._queue = [];
|
|
7403
|
+
|
|
7404
|
+
if (this.fd === null) {
|
|
7405
|
+
this._open = fs.open;
|
|
7406
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
7407
|
+
this.flush();
|
|
7408
|
+
}
|
|
7409
|
+
}
|
|
7410
|
+
}
|
|
7411
|
+
|
|
7412
|
+
|
|
7413
|
+
/***/ }),
|
|
7414
|
+
|
|
7415
|
+
/***/ 664:
|
|
7416
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
7417
|
+
|
|
7418
|
+
var constants = __webpack_require__(7619)
|
|
7419
|
+
|
|
7420
|
+
var origCwd = process.cwd
|
|
7421
|
+
var cwd = null
|
|
7422
|
+
|
|
7423
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
|
|
7424
|
+
|
|
7425
|
+
process.cwd = function() {
|
|
7426
|
+
if (!cwd)
|
|
7427
|
+
cwd = origCwd.call(process)
|
|
7428
|
+
return cwd
|
|
7429
|
+
}
|
|
7430
|
+
try {
|
|
7431
|
+
process.cwd()
|
|
7432
|
+
} catch (er) {}
|
|
7433
|
+
|
|
7434
|
+
var chdir = process.chdir
|
|
7435
|
+
process.chdir = function(d) {
|
|
7436
|
+
cwd = null
|
|
7437
|
+
chdir.call(process, d)
|
|
7438
|
+
}
|
|
7439
|
+
|
|
7440
|
+
module.exports = patch
|
|
7441
|
+
|
|
7442
|
+
function patch (fs) {
|
|
7443
|
+
// (re-)implement some things that are known busted or missing.
|
|
7444
|
+
|
|
7445
|
+
// lchmod, broken prior to 0.6.2
|
|
7446
|
+
// back-port the fix here.
|
|
7447
|
+
if (constants.hasOwnProperty('O_SYMLINK') &&
|
|
7448
|
+
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
7449
|
+
patchLchmod(fs)
|
|
7450
|
+
}
|
|
7451
|
+
|
|
7452
|
+
// lutimes implementation, or no-op
|
|
7453
|
+
if (!fs.lutimes) {
|
|
7454
|
+
patchLutimes(fs)
|
|
7455
|
+
}
|
|
7456
|
+
|
|
7457
|
+
// https://github.com/isaacs/node-graceful-fs/issues/4
|
|
7458
|
+
// Chown should not fail on einval or eperm if non-root.
|
|
7459
|
+
// It should not fail on enosys ever, as this just indicates
|
|
7460
|
+
// that a fs doesn't support the intended operation.
|
|
7461
|
+
|
|
7462
|
+
fs.chown = chownFix(fs.chown)
|
|
7463
|
+
fs.fchown = chownFix(fs.fchown)
|
|
7464
|
+
fs.lchown = chownFix(fs.lchown)
|
|
7465
|
+
|
|
7466
|
+
fs.chmod = chmodFix(fs.chmod)
|
|
7467
|
+
fs.fchmod = chmodFix(fs.fchmod)
|
|
7468
|
+
fs.lchmod = chmodFix(fs.lchmod)
|
|
7469
|
+
|
|
7470
|
+
fs.chownSync = chownFixSync(fs.chownSync)
|
|
7471
|
+
fs.fchownSync = chownFixSync(fs.fchownSync)
|
|
7472
|
+
fs.lchownSync = chownFixSync(fs.lchownSync)
|
|
7473
|
+
|
|
7474
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync)
|
|
7475
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync)
|
|
7476
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync)
|
|
7477
|
+
|
|
7478
|
+
fs.stat = statFix(fs.stat)
|
|
7479
|
+
fs.fstat = statFix(fs.fstat)
|
|
7480
|
+
fs.lstat = statFix(fs.lstat)
|
|
7481
|
+
|
|
7482
|
+
fs.statSync = statFixSync(fs.statSync)
|
|
7483
|
+
fs.fstatSync = statFixSync(fs.fstatSync)
|
|
7484
|
+
fs.lstatSync = statFixSync(fs.lstatSync)
|
|
7485
|
+
|
|
7486
|
+
// if lchmod/lchown do not exist, then make them no-ops
|
|
7487
|
+
if (!fs.lchmod) {
|
|
7488
|
+
fs.lchmod = function (path, mode, cb) {
|
|
7489
|
+
if (cb) process.nextTick(cb)
|
|
7490
|
+
}
|
|
7491
|
+
fs.lchmodSync = function () {}
|
|
7492
|
+
}
|
|
7493
|
+
if (!fs.lchown) {
|
|
7494
|
+
fs.lchown = function (path, uid, gid, cb) {
|
|
7495
|
+
if (cb) process.nextTick(cb)
|
|
7496
|
+
}
|
|
7497
|
+
fs.lchownSync = function () {}
|
|
7498
|
+
}
|
|
7499
|
+
|
|
7500
|
+
// on Windows, A/V software can lock the directory, causing this
|
|
7501
|
+
// to fail with an EACCES or EPERM if the directory contains newly
|
|
7502
|
+
// created files. Try again on failure, for up to 60 seconds.
|
|
7503
|
+
|
|
7504
|
+
// Set the timeout this long because some Windows Anti-Virus, such as Parity
|
|
7505
|
+
// bit9, may lock files for up to a minute, causing npm package install
|
|
7506
|
+
// failures. Also, take care to yield the scheduler. Windows scheduling gives
|
|
7507
|
+
// CPU to a busy looping process, which can cause the program causing the lock
|
|
7508
|
+
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
7509
|
+
if (platform === "win32") {
|
|
7510
|
+
fs.rename = (function (fs$rename) { return function (from, to, cb) {
|
|
7511
|
+
var start = Date.now()
|
|
7512
|
+
var backoff = 0;
|
|
7513
|
+
fs$rename(from, to, function CB (er) {
|
|
7514
|
+
if (er
|
|
7515
|
+
&& (er.code === "EACCES" || er.code === "EPERM")
|
|
7516
|
+
&& Date.now() - start < 60000) {
|
|
7517
|
+
setTimeout(function() {
|
|
7518
|
+
fs.stat(to, function (stater, st) {
|
|
7519
|
+
if (stater && stater.code === "ENOENT")
|
|
7520
|
+
fs$rename(from, to, CB);
|
|
7521
|
+
else
|
|
7522
|
+
cb(er)
|
|
7523
|
+
})
|
|
7524
|
+
}, backoff)
|
|
7525
|
+
if (backoff < 100)
|
|
7526
|
+
backoff += 10;
|
|
7527
|
+
return;
|
|
7528
|
+
}
|
|
7529
|
+
if (cb) cb(er)
|
|
7530
|
+
})
|
|
7531
|
+
}})(fs.rename)
|
|
7532
|
+
}
|
|
7533
|
+
|
|
7534
|
+
// if read() returns EAGAIN, then just try it again.
|
|
7535
|
+
fs.read = (function (fs$read) {
|
|
7536
|
+
function read (fd, buffer, offset, length, position, callback_) {
|
|
7537
|
+
var callback
|
|
7538
|
+
if (callback_ && typeof callback_ === 'function') {
|
|
7539
|
+
var eagCounter = 0
|
|
7540
|
+
callback = function (er, _, __) {
|
|
7541
|
+
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
|
7542
|
+
eagCounter ++
|
|
7543
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
7544
|
+
}
|
|
7545
|
+
callback_.apply(this, arguments)
|
|
7546
|
+
}
|
|
7547
|
+
}
|
|
7548
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
7549
|
+
}
|
|
7550
|
+
|
|
7551
|
+
// This ensures `util.promisify` works as it does for native `fs.read`.
|
|
7552
|
+
read.__proto__ = fs$read
|
|
7553
|
+
return read
|
|
7554
|
+
})(fs.read)
|
|
7555
|
+
|
|
7556
|
+
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
|
7557
|
+
var eagCounter = 0
|
|
7558
|
+
while (true) {
|
|
7559
|
+
try {
|
|
7560
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position)
|
|
7561
|
+
} catch (er) {
|
|
7562
|
+
if (er.code === 'EAGAIN' && eagCounter < 10) {
|
|
7563
|
+
eagCounter ++
|
|
7564
|
+
continue
|
|
7565
|
+
}
|
|
7566
|
+
throw er
|
|
7567
|
+
}
|
|
7568
|
+
}
|
|
7569
|
+
}})(fs.readSync)
|
|
7570
|
+
|
|
7571
|
+
function patchLchmod (fs) {
|
|
7572
|
+
fs.lchmod = function (path, mode, callback) {
|
|
7573
|
+
fs.open( path
|
|
7574
|
+
, constants.O_WRONLY | constants.O_SYMLINK
|
|
7575
|
+
, mode
|
|
7576
|
+
, function (err, fd) {
|
|
7577
|
+
if (err) {
|
|
7578
|
+
if (callback) callback(err)
|
|
7579
|
+
return
|
|
7580
|
+
}
|
|
7581
|
+
// prefer to return the chmod error, if one occurs,
|
|
7582
|
+
// but still try to close, and report closing errors if they occur.
|
|
7583
|
+
fs.fchmod(fd, mode, function (err) {
|
|
7584
|
+
fs.close(fd, function(err2) {
|
|
7585
|
+
if (callback) callback(err || err2)
|
|
7586
|
+
})
|
|
7587
|
+
})
|
|
7588
|
+
})
|
|
7589
|
+
}
|
|
7590
|
+
|
|
7591
|
+
fs.lchmodSync = function (path, mode) {
|
|
7592
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
|
|
7593
|
+
|
|
7594
|
+
// prefer to return the chmod error, if one occurs,
|
|
7595
|
+
// but still try to close, and report closing errors if they occur.
|
|
7596
|
+
var threw = true
|
|
7597
|
+
var ret
|
|
7598
|
+
try {
|
|
7599
|
+
ret = fs.fchmodSync(fd, mode)
|
|
7600
|
+
threw = false
|
|
7601
|
+
} finally {
|
|
7602
|
+
if (threw) {
|
|
7603
|
+
try {
|
|
7604
|
+
fs.closeSync(fd)
|
|
7605
|
+
} catch (er) {}
|
|
7606
|
+
} else {
|
|
7607
|
+
fs.closeSync(fd)
|
|
7608
|
+
}
|
|
7609
|
+
}
|
|
7610
|
+
return ret
|
|
7611
|
+
}
|
|
7612
|
+
}
|
|
7613
|
+
|
|
7614
|
+
function patchLutimes (fs) {
|
|
7615
|
+
if (constants.hasOwnProperty("O_SYMLINK")) {
|
|
7616
|
+
fs.lutimes = function (path, at, mt, cb) {
|
|
7617
|
+
fs.open(path, constants.O_SYMLINK, function (er, fd) {
|
|
7618
|
+
if (er) {
|
|
7619
|
+
if (cb) cb(er)
|
|
7620
|
+
return
|
|
7621
|
+
}
|
|
7622
|
+
fs.futimes(fd, at, mt, function (er) {
|
|
7623
|
+
fs.close(fd, function (er2) {
|
|
7624
|
+
if (cb) cb(er || er2)
|
|
7625
|
+
})
|
|
7626
|
+
})
|
|
7627
|
+
})
|
|
7628
|
+
}
|
|
7629
|
+
|
|
7630
|
+
fs.lutimesSync = function (path, at, mt) {
|
|
7631
|
+
var fd = fs.openSync(path, constants.O_SYMLINK)
|
|
7632
|
+
var ret
|
|
7633
|
+
var threw = true
|
|
7634
|
+
try {
|
|
7635
|
+
ret = fs.futimesSync(fd, at, mt)
|
|
7636
|
+
threw = false
|
|
7637
|
+
} finally {
|
|
7638
|
+
if (threw) {
|
|
7639
|
+
try {
|
|
7640
|
+
fs.closeSync(fd)
|
|
7641
|
+
} catch (er) {}
|
|
7642
|
+
} else {
|
|
7643
|
+
fs.closeSync(fd)
|
|
7644
|
+
}
|
|
7645
|
+
}
|
|
7646
|
+
return ret
|
|
7647
|
+
}
|
|
7648
|
+
|
|
7649
|
+
} else {
|
|
7650
|
+
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
|
|
7651
|
+
fs.lutimesSync = function () {}
|
|
7652
|
+
}
|
|
7653
|
+
}
|
|
7654
|
+
|
|
7655
|
+
function chmodFix (orig) {
|
|
7656
|
+
if (!orig) return orig
|
|
7657
|
+
return function (target, mode, cb) {
|
|
7658
|
+
return orig.call(fs, target, mode, function (er) {
|
|
7659
|
+
if (chownErOk(er)) er = null
|
|
7660
|
+
if (cb) cb.apply(this, arguments)
|
|
7661
|
+
})
|
|
7662
|
+
}
|
|
7663
|
+
}
|
|
7664
|
+
|
|
7665
|
+
function chmodFixSync (orig) {
|
|
7666
|
+
if (!orig) return orig
|
|
7667
|
+
return function (target, mode) {
|
|
7668
|
+
try {
|
|
7669
|
+
return orig.call(fs, target, mode)
|
|
7670
|
+
} catch (er) {
|
|
7671
|
+
if (!chownErOk(er)) throw er
|
|
7672
|
+
}
|
|
7673
|
+
}
|
|
7674
|
+
}
|
|
7675
|
+
|
|
7676
|
+
|
|
7677
|
+
function chownFix (orig) {
|
|
7678
|
+
if (!orig) return orig
|
|
7679
|
+
return function (target, uid, gid, cb) {
|
|
7680
|
+
return orig.call(fs, target, uid, gid, function (er) {
|
|
7681
|
+
if (chownErOk(er)) er = null
|
|
7682
|
+
if (cb) cb.apply(this, arguments)
|
|
7683
|
+
})
|
|
7684
|
+
}
|
|
7685
|
+
}
|
|
7686
|
+
|
|
7687
|
+
function chownFixSync (orig) {
|
|
7688
|
+
if (!orig) return orig
|
|
7689
|
+
return function (target, uid, gid) {
|
|
7690
|
+
try {
|
|
7691
|
+
return orig.call(fs, target, uid, gid)
|
|
7692
|
+
} catch (er) {
|
|
7693
|
+
if (!chownErOk(er)) throw er
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7697
|
+
|
|
7698
|
+
function statFix (orig) {
|
|
7699
|
+
if (!orig) return orig
|
|
7700
|
+
// Older versions of Node erroneously returned signed integers for
|
|
7701
|
+
// uid + gid.
|
|
7702
|
+
return function (target, options, cb) {
|
|
7703
|
+
if (typeof options === 'function') {
|
|
7704
|
+
cb = options
|
|
7705
|
+
options = null
|
|
7706
|
+
}
|
|
7707
|
+
function callback (er, stats) {
|
|
7708
|
+
if (stats) {
|
|
7709
|
+
if (stats.uid < 0) stats.uid += 0x100000000
|
|
7710
|
+
if (stats.gid < 0) stats.gid += 0x100000000
|
|
7711
|
+
}
|
|
7712
|
+
if (cb) cb.apply(this, arguments)
|
|
7713
|
+
}
|
|
7714
|
+
return options ? orig.call(fs, target, options, callback)
|
|
7715
|
+
: orig.call(fs, target, callback)
|
|
7716
|
+
}
|
|
7717
|
+
}
|
|
7718
|
+
|
|
7719
|
+
function statFixSync (orig) {
|
|
7720
|
+
if (!orig) return orig
|
|
7721
|
+
// Older versions of Node erroneously returned signed integers for
|
|
7722
|
+
// uid + gid.
|
|
7723
|
+
return function (target, options) {
|
|
7724
|
+
var stats = options ? orig.call(fs, target, options)
|
|
7725
|
+
: orig.call(fs, target)
|
|
7726
|
+
if (stats.uid < 0) stats.uid += 0x100000000
|
|
7727
|
+
if (stats.gid < 0) stats.gid += 0x100000000
|
|
7728
|
+
return stats;
|
|
7729
|
+
}
|
|
7730
|
+
}
|
|
7731
|
+
|
|
7732
|
+
// ENOSYS means that the fs doesn't support the op. Just ignore
|
|
7733
|
+
// that, because it doesn't matter.
|
|
7734
|
+
//
|
|
7735
|
+
// if there's no getuid, or if getuid() is something other
|
|
7736
|
+
// than 0, and the error is EINVAL or EPERM, then just ignore
|
|
7737
|
+
// it.
|
|
7738
|
+
//
|
|
7739
|
+
// This specific case is a silent failure in cp, install, tar,
|
|
7740
|
+
// and most other unix tools that manage permissions.
|
|
7741
|
+
//
|
|
7742
|
+
// When running as root, or if other types of errors are
|
|
7743
|
+
// encountered, then it's strict.
|
|
7744
|
+
function chownErOk (er) {
|
|
7745
|
+
if (!er)
|
|
7746
|
+
return true
|
|
7747
|
+
|
|
7748
|
+
if (er.code === "ENOSYS")
|
|
7749
|
+
return true
|
|
7750
|
+
|
|
7751
|
+
var nonroot = !process.getuid || process.getuid() !== 0
|
|
7752
|
+
if (nonroot) {
|
|
7753
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
7754
|
+
return true
|
|
7755
|
+
}
|
|
7756
|
+
|
|
7757
|
+
return false
|
|
7758
|
+
}
|
|
7759
|
+
}
|
|
7760
|
+
|
|
7761
|
+
|
|
6900
7762
|
/***/ }),
|
|
6901
7763
|
|
|
6902
7764
|
/***/ 5845:
|