prebundle 1.1.0 → 1.2.0

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.
@@ -1,2818 +1,2152 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ var __webpack_modules__ = ({
3
-
4
- /***/ 524:
5
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
6
-
7
- "use strict";
8
-
9
-
10
- const fs = __nccwpck_require__(804)
11
- const path = __nccwpck_require__(17)
12
- const mkdirsSync = (__nccwpck_require__(516).mkdirsSync)
13
- const utimesMillisSync = (__nccwpck_require__(227).utimesMillisSync)
14
- const stat = __nccwpck_require__(826)
15
-
16
- function copySync (src, dest, opts) {
17
- if (typeof opts === 'function') {
18
- opts = { filter: opts }
19
- }
20
-
21
- opts = opts || {}
22
- opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
23
- opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
24
-
25
- // Warn about using preserveTimestamps on 32-bit node
26
- if (opts.preserveTimestamps && process.arch === 'ia32') {
27
- process.emitWarning(
28
- 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
29
- '\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
30
- 'Warning', 'fs-extra-WARN0002'
31
- )
32
- }
33
-
34
- const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
35
- stat.checkParentPathsSync(src, srcStat, dest, 'copy')
36
- if (opts.filter && !opts.filter(src, dest)) return
37
- const destParent = path.dirname(dest)
38
- if (!fs.existsSync(destParent)) mkdirsSync(destParent)
39
- return getStats(destStat, src, dest, opts)
40
- }
41
-
42
- function getStats (destStat, src, dest, opts) {
43
- const statSync = opts.dereference ? fs.statSync : fs.lstatSync
44
- const srcStat = statSync(src)
45
-
46
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
47
- else if (srcStat.isFile() ||
48
- srcStat.isCharacterDevice() ||
49
- srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
50
- else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
51
- else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
52
- else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
53
- throw new Error(`Unknown file: ${src}`)
54
- }
55
-
56
- function onFile (srcStat, destStat, src, dest, opts) {
57
- if (!destStat) return copyFile(srcStat, src, dest, opts)
58
- return mayCopyFile(srcStat, src, dest, opts)
59
- }
60
-
61
- function mayCopyFile (srcStat, src, dest, opts) {
62
- if (opts.overwrite) {
63
- fs.unlinkSync(dest)
64
- return copyFile(srcStat, src, dest, opts)
65
- } else if (opts.errorOnExist) {
66
- throw new Error(`'${dest}' already exists`)
67
- }
68
- }
69
-
70
- function copyFile (srcStat, src, dest, opts) {
71
- fs.copyFileSync(src, dest)
72
- if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
73
- return setDestMode(dest, srcStat.mode)
74
- }
75
-
76
- function handleTimestamps (srcMode, src, dest) {
77
- // Make sure the file is writable before setting the timestamp
78
- // otherwise open fails with EPERM when invoked with 'r+'
79
- // (through utimes call)
80
- if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
81
- return setDestTimestamps(src, dest)
82
- }
83
-
84
- function fileIsNotWritable (srcMode) {
85
- return (srcMode & 0o200) === 0
86
- }
87
-
88
- function makeFileWritable (dest, srcMode) {
89
- return setDestMode(dest, srcMode | 0o200)
90
- }
91
-
92
- function setDestMode (dest, srcMode) {
93
- return fs.chmodSync(dest, srcMode)
94
- }
95
-
96
- function setDestTimestamps (src, dest) {
97
- // The initial srcStat.atime cannot be trusted
98
- // because it is modified by the read(2) system call
99
- // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
100
- const updatedSrcStat = fs.statSync(src)
101
- return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
102
- }
103
-
104
- function onDir (srcStat, destStat, src, dest, opts) {
105
- if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
106
- return copyDir(src, dest, opts)
107
- }
108
-
109
- function mkDirAndCopy (srcMode, src, dest, opts) {
110
- fs.mkdirSync(dest)
111
- copyDir(src, dest, opts)
112
- return setDestMode(dest, srcMode)
113
- }
114
-
115
- function copyDir (src, dest, opts) {
116
- fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))
117
- }
118
-
119
- function copyDirItem (item, src, dest, opts) {
120
- const srcItem = path.join(src, item)
121
- const destItem = path.join(dest, item)
122
- if (opts.filter && !opts.filter(srcItem, destItem)) return
123
- const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
124
- return getStats(destStat, srcItem, destItem, opts)
125
- }
126
-
127
- function onLink (destStat, src, dest, opts) {
128
- let resolvedSrc = fs.readlinkSync(src)
129
- if (opts.dereference) {
130
- resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
131
- }
132
-
133
- if (!destStat) {
134
- return fs.symlinkSync(resolvedSrc, dest)
135
- } else {
136
- let resolvedDest
137
- try {
138
- resolvedDest = fs.readlinkSync(dest)
139
- } catch (err) {
140
- // dest exists and is a regular file or directory,
141
- // Windows may throw UNKNOWN error. If dest already exists,
142
- // fs throws error anyway, so no need to guard against it here.
143
- if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)
144
- throw err
145
- }
146
- if (opts.dereference) {
147
- resolvedDest = path.resolve(process.cwd(), resolvedDest)
148
- }
149
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
150
- throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
151
- }
152
-
153
- // prevent copy if src is a subdir of dest since unlinking
154
- // dest in this case would result in removing src contents
155
- // and therefore a broken symlink would be created.
156
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
157
- throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
158
- }
159
- return copyLink(resolvedSrc, dest)
160
- }
161
- }
162
-
163
- function copyLink (resolvedSrc, dest) {
164
- fs.unlinkSync(dest)
165
- return fs.symlinkSync(resolvedSrc, dest)
166
- }
167
-
168
- module.exports = copySync
169
-
170
-
171
- /***/ }),
172
-
173
- /***/ 770:
174
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
175
-
176
- "use strict";
177
-
178
-
179
- const fs = __nccwpck_require__(845)
180
- const path = __nccwpck_require__(17)
181
- const { mkdirs } = __nccwpck_require__(516)
182
- const { pathExists } = __nccwpck_require__(667)
183
- const { utimesMillis } = __nccwpck_require__(227)
184
- const stat = __nccwpck_require__(826)
185
-
186
- async function copy (src, dest, opts = {}) {
187
- if (typeof opts === 'function') {
188
- opts = { filter: opts }
189
- }
190
-
191
- opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
192
- opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
193
-
194
- // Warn about using preserveTimestamps on 32-bit node
195
- if (opts.preserveTimestamps && process.arch === 'ia32') {
196
- process.emitWarning(
197
- 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
198
- '\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
199
- 'Warning', 'fs-extra-WARN0001'
200
- )
201
- }
202
-
203
- const { srcStat, destStat } = await stat.checkPaths(src, dest, 'copy', opts)
204
-
205
- await stat.checkParentPaths(src, srcStat, dest, 'copy')
206
-
207
- const include = await runFilter(src, dest, opts)
208
-
209
- if (!include) return
210
-
211
- // check if the parent of dest exists, and create it if it doesn't exist
212
- const destParent = path.dirname(dest)
213
- const dirExists = await pathExists(destParent)
214
- if (!dirExists) {
215
- await mkdirs(destParent)
216
- }
217
-
218
- await getStatsAndPerformCopy(destStat, src, dest, opts)
219
- }
220
-
221
- async function runFilter (src, dest, opts) {
222
- if (!opts.filter) return true
223
- return opts.filter(src, dest)
224
- }
225
-
226
- async function getStatsAndPerformCopy (destStat, src, dest, opts) {
227
- const statFn = opts.dereference ? fs.stat : fs.lstat
228
- const srcStat = await statFn(src)
229
-
230
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
231
-
232
- if (
233
- srcStat.isFile() ||
234
- srcStat.isCharacterDevice() ||
235
- srcStat.isBlockDevice()
236
- ) return onFile(srcStat, destStat, src, dest, opts)
237
-
238
- if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
239
- if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
240
- if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
241
- throw new Error(`Unknown file: ${src}`)
242
- }
243
-
244
- async function onFile (srcStat, destStat, src, dest, opts) {
245
- if (!destStat) return copyFile(srcStat, src, dest, opts)
246
-
247
- if (opts.overwrite) {
248
- await fs.unlink(dest)
249
- return copyFile(srcStat, src, dest, opts)
250
- }
251
- if (opts.errorOnExist) {
252
- throw new Error(`'${dest}' already exists`)
253
- }
254
- }
255
-
256
- async function copyFile (srcStat, src, dest, opts) {
257
- await fs.copyFile(src, dest)
258
- if (opts.preserveTimestamps) {
259
- // Make sure the file is writable before setting the timestamp
260
- // otherwise open fails with EPERM when invoked with 'r+'
261
- // (through utimes call)
262
- if (fileIsNotWritable(srcStat.mode)) {
263
- await makeFileWritable(dest, srcStat.mode)
264
- }
265
-
266
- // Set timestamps and mode correspondingly
267
-
268
- // Note that The initial srcStat.atime cannot be trusted
269
- // because it is modified by the read(2) system call
270
- // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
271
- const updatedSrcStat = await fs.stat(src)
272
- await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
273
- }
274
-
275
- return fs.chmod(dest, srcStat.mode)
276
- }
277
-
278
- function fileIsNotWritable (srcMode) {
279
- return (srcMode & 0o200) === 0
280
- }
281
-
282
- function makeFileWritable (dest, srcMode) {
283
- return fs.chmod(dest, srcMode | 0o200)
284
- }
285
-
286
- async function onDir (srcStat, destStat, src, dest, opts) {
287
- // the dest directory might not exist, create it
288
- if (!destStat) {
289
- await fs.mkdir(dest)
290
- }
291
-
292
- const items = await fs.readdir(src)
293
-
294
- // loop through the files in the current directory to copy everything
295
- await Promise.all(items.map(async item => {
296
- const srcItem = path.join(src, item)
297
- const destItem = path.join(dest, item)
298
-
299
- // skip the item if it is matches by the filter function
300
- const include = await runFilter(srcItem, destItem, opts)
301
- if (!include) return
302
-
303
- const { destStat } = await stat.checkPaths(srcItem, destItem, 'copy', opts)
304
-
305
- // If the item is a copyable file, `getStatsAndPerformCopy` will copy it
306
- // If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively
307
- return getStatsAndPerformCopy(destStat, srcItem, destItem, opts)
308
- }))
309
-
310
- if (!destStat) {
311
- await fs.chmod(dest, srcStat.mode)
312
- }
313
- }
314
-
315
- async function onLink (destStat, src, dest, opts) {
316
- let resolvedSrc = await fs.readlink(src)
317
- if (opts.dereference) {
318
- resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
319
- }
320
- if (!destStat) {
321
- return fs.symlink(resolvedSrc, dest)
322
- }
323
-
324
- let resolvedDest = null
325
- try {
326
- resolvedDest = await fs.readlink(dest)
327
- } catch (e) {
328
- // dest exists and is a regular file or directory,
329
- // Windows may throw UNKNOWN error. If dest already exists,
330
- // fs throws error anyway, so no need to guard against it here.
331
- if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest)
332
- throw e
333
- }
334
- if (opts.dereference) {
335
- resolvedDest = path.resolve(process.cwd(), resolvedDest)
336
- }
337
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
338
- throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
339
- }
340
-
341
- // do not copy if src is a subdir of dest since unlinking
342
- // dest in this case would result in removing src contents
343
- // and therefore a broken symlink would be created.
344
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
345
- throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
346
- }
347
-
348
- // copy the link
349
- await fs.unlink(dest)
350
- return fs.symlink(resolvedSrc, dest)
351
- }
352
-
353
- module.exports = copy
354
-
355
-
356
- /***/ }),
357
-
358
- /***/ 852:
359
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
360
-
361
- "use strict";
362
-
363
-
364
- const u = (__nccwpck_require__(59).fromPromise)
365
- module.exports = {
366
- copy: u(__nccwpck_require__(770)),
367
- copySync: __nccwpck_require__(524)
368
- }
369
-
370
-
371
- /***/ }),
372
-
373
- /***/ 783:
374
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
375
-
376
- "use strict";
377
-
378
-
379
- const u = (__nccwpck_require__(59).fromPromise)
380
- const fs = __nccwpck_require__(845)
381
- const path = __nccwpck_require__(17)
382
- const mkdir = __nccwpck_require__(516)
383
- const remove = __nccwpck_require__(58)
384
-
385
- const emptyDir = u(async function emptyDir (dir) {
386
- let items
387
- try {
388
- items = await fs.readdir(dir)
389
- } catch {
390
- return mkdir.mkdirs(dir)
391
- }
392
-
393
- return Promise.all(items.map(item => remove.remove(path.join(dir, item))))
394
- })
395
-
396
- function emptyDirSync (dir) {
397
- let items
398
- try {
399
- items = fs.readdirSync(dir)
400
- } catch {
401
- return mkdir.mkdirsSync(dir)
402
- }
403
-
404
- items.forEach(item => {
405
- item = path.join(dir, item)
406
- remove.removeSync(item)
407
- })
408
- }
409
-
410
- module.exports = {
411
- emptyDirSync,
412
- emptydirSync: emptyDirSync,
413
- emptyDir,
414
- emptydir: emptyDir
415
- }
416
-
417
-
418
- /***/ }),
419
-
420
- /***/ 530:
421
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
422
-
423
- "use strict";
424
-
425
-
426
- const u = (__nccwpck_require__(59).fromPromise)
427
- const path = __nccwpck_require__(17)
428
- const fs = __nccwpck_require__(845)
429
- const mkdir = __nccwpck_require__(516)
430
-
431
- async function createFile (file) {
432
- let stats
433
- try {
434
- stats = await fs.stat(file)
435
- } catch { }
436
- if (stats && stats.isFile()) return
437
-
438
- const dir = path.dirname(file)
439
-
440
- let dirStats = null
441
- try {
442
- dirStats = await fs.stat(dir)
443
- } catch (err) {
444
- // if the directory doesn't exist, make it
445
- if (err.code === 'ENOENT') {
446
- await mkdir.mkdirs(dir)
447
- await fs.writeFile(file, '')
448
- return
449
- } else {
450
- throw err
451
- }
452
- }
453
-
454
- if (dirStats.isDirectory()) {
455
- await fs.writeFile(file, '')
456
- } else {
457
- // parent is not a directory
458
- // This is just to cause an internal ENOTDIR error to be thrown
459
- await fs.readdir(dir)
460
- }
461
- }
462
-
463
- function createFileSync (file) {
464
- let stats
465
- try {
466
- stats = fs.statSync(file)
467
- } catch { }
468
- if (stats && stats.isFile()) return
469
-
470
- const dir = path.dirname(file)
471
- try {
472
- if (!fs.statSync(dir).isDirectory()) {
473
- // parent is not a directory
474
- // This is just to cause an internal ENOTDIR error to be thrown
475
- fs.readdirSync(dir)
476
- }
477
- } catch (err) {
478
- // If the stat call above failed because the directory doesn't exist, create it
479
- if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)
480
- else throw err
481
- }
482
-
483
- fs.writeFileSync(file, '')
484
- }
485
-
486
- module.exports = {
487
- createFile: u(createFile),
488
- createFileSync
489
- }
490
-
491
-
492
- /***/ }),
493
-
494
- /***/ 960:
495
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
496
-
497
- "use strict";
498
-
499
-
500
- const { createFile, createFileSync } = __nccwpck_require__(530)
501
- const { createLink, createLinkSync } = __nccwpck_require__(404)
502
- const { createSymlink, createSymlinkSync } = __nccwpck_require__(425)
503
-
504
- module.exports = {
505
- // file
506
- createFile,
507
- createFileSync,
508
- ensureFile: createFile,
509
- ensureFileSync: createFileSync,
510
- // link
511
- createLink,
512
- createLinkSync,
513
- ensureLink: createLink,
514
- ensureLinkSync: createLinkSync,
515
- // symlink
516
- createSymlink,
517
- createSymlinkSync,
518
- ensureSymlink: createSymlink,
519
- ensureSymlinkSync: createSymlinkSync
520
- }
521
-
522
-
523
- /***/ }),
524
-
525
- /***/ 404:
526
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
527
-
528
- "use strict";
529
-
530
-
531
- const u = (__nccwpck_require__(59).fromPromise)
532
- const path = __nccwpck_require__(17)
533
- const fs = __nccwpck_require__(845)
534
- const mkdir = __nccwpck_require__(516)
535
- const { pathExists } = __nccwpck_require__(667)
536
- const { areIdentical } = __nccwpck_require__(826)
537
-
538
- async function createLink (srcpath, dstpath) {
539
- let dstStat
540
- try {
541
- dstStat = await fs.lstat(dstpath)
542
- } catch {
543
- // ignore error
544
- }
545
-
546
- let srcStat
547
- try {
548
- srcStat = await fs.lstat(srcpath)
549
- } catch (err) {
550
- err.message = err.message.replace('lstat', 'ensureLink')
551
- throw err
552
- }
553
-
554
- if (dstStat && areIdentical(srcStat, dstStat)) return
555
-
556
- const dir = path.dirname(dstpath)
557
-
558
- const dirExists = await pathExists(dir)
559
-
560
- if (!dirExists) {
561
- await mkdir.mkdirs(dir)
562
- }
563
-
564
- await fs.link(srcpath, dstpath)
565
- }
566
-
567
- function createLinkSync (srcpath, dstpath) {
568
- let dstStat
569
- try {
570
- dstStat = fs.lstatSync(dstpath)
571
- } catch {}
572
-
573
- try {
574
- const srcStat = fs.lstatSync(srcpath)
575
- if (dstStat && areIdentical(srcStat, dstStat)) return
576
- } catch (err) {
577
- err.message = err.message.replace('lstat', 'ensureLink')
578
- throw err
579
- }
580
-
581
- const dir = path.dirname(dstpath)
582
- const dirExists = fs.existsSync(dir)
583
- if (dirExists) return fs.linkSync(srcpath, dstpath)
584
- mkdir.mkdirsSync(dir)
585
-
586
- return fs.linkSync(srcpath, dstpath)
587
- }
588
-
589
- module.exports = {
590
- createLink: u(createLink),
591
- createLinkSync
592
- }
593
-
594
-
595
- /***/ }),
596
-
597
- /***/ 687:
598
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
599
-
600
- "use strict";
601
-
602
-
603
- const path = __nccwpck_require__(17)
604
- const fs = __nccwpck_require__(845)
605
- const { pathExists } = __nccwpck_require__(667)
606
-
607
- const u = (__nccwpck_require__(59).fromPromise)
608
-
609
- /**
610
- * Function that returns two types of paths, one relative to symlink, and one
611
- * relative to the current working directory. Checks if path is absolute or
612
- * relative. If the path is relative, this function checks if the path is
613
- * relative to symlink or relative to current working directory. This is an
614
- * initiative to find a smarter `srcpath` to supply when building symlinks.
615
- * This allows you to determine which path to use out of one of three possible
616
- * types of source paths. The first is an absolute path. This is detected by
617
- * `path.isAbsolute()`. When an absolute path is provided, it is checked to
618
- * see if it exists. If it does it's used, if not an error is returned
619
- * (callback)/ thrown (sync). The other two options for `srcpath` are a
620
- * relative url. By default Node's `fs.symlink` works by creating a symlink
621
- * using `dstpath` and expects the `srcpath` to be relative to the newly
622
- * created symlink. If you provide a `srcpath` that does not exist on the file
623
- * system it results in a broken symlink. To minimize this, the function
624
- * checks to see if the 'relative to symlink' source file exists, and if it
625
- * does it will use it. If it does not, it checks if there's a file that
626
- * exists that is relative to the current working directory, if does its used.
627
- * This preserves the expectations of the original fs.symlink spec and adds
628
- * the ability to pass in `relative to current working direcotry` paths.
629
- */
630
-
631
- async function symlinkPaths (srcpath, dstpath) {
632
- if (path.isAbsolute(srcpath)) {
633
- try {
634
- await fs.lstat(srcpath)
635
- } catch (err) {
636
- err.message = err.message.replace('lstat', 'ensureSymlink')
637
- throw err
638
- }
639
-
640
- return {
641
- toCwd: srcpath,
642
- toDst: srcpath
643
- }
644
- }
645
-
646
- const dstdir = path.dirname(dstpath)
647
- const relativeToDst = path.join(dstdir, srcpath)
648
-
649
- const exists = await pathExists(relativeToDst)
650
- if (exists) {
651
- return {
652
- toCwd: relativeToDst,
653
- toDst: srcpath
654
- }
655
- }
656
-
657
- try {
658
- await fs.lstat(srcpath)
659
- } catch (err) {
660
- err.message = err.message.replace('lstat', 'ensureSymlink')
661
- throw err
662
- }
663
-
664
- return {
665
- toCwd: srcpath,
666
- toDst: path.relative(dstdir, srcpath)
667
- }
668
- }
669
-
670
- function symlinkPathsSync (srcpath, dstpath) {
671
- if (path.isAbsolute(srcpath)) {
672
- const exists = fs.existsSync(srcpath)
673
- if (!exists) throw new Error('absolute srcpath does not exist')
674
- return {
675
- toCwd: srcpath,
676
- toDst: srcpath
677
- }
678
- }
679
-
680
- const dstdir = path.dirname(dstpath)
681
- const relativeToDst = path.join(dstdir, srcpath)
682
- const exists = fs.existsSync(relativeToDst)
683
- if (exists) {
684
- return {
685
- toCwd: relativeToDst,
686
- toDst: srcpath
687
- }
688
- }
689
-
690
- const srcExists = fs.existsSync(srcpath)
691
- if (!srcExists) throw new Error('relative srcpath does not exist')
692
- return {
693
- toCwd: srcpath,
694
- toDst: path.relative(dstdir, srcpath)
695
- }
696
- }
697
-
698
- module.exports = {
699
- symlinkPaths: u(symlinkPaths),
700
- symlinkPathsSync
701
- }
702
-
703
-
704
- /***/ }),
705
-
706
- /***/ 725:
707
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
708
-
709
- "use strict";
710
-
711
-
712
- const fs = __nccwpck_require__(845)
713
- const u = (__nccwpck_require__(59).fromPromise)
714
-
715
- async function symlinkType (srcpath, type) {
716
- if (type) return type
717
-
718
- let stats
719
- try {
720
- stats = await fs.lstat(srcpath)
721
- } catch {
722
- return 'file'
723
- }
724
-
725
- return (stats && stats.isDirectory()) ? 'dir' : 'file'
726
- }
727
-
728
- function symlinkTypeSync (srcpath, type) {
729
- if (type) return type
730
-
731
- let stats
732
- try {
733
- stats = fs.lstatSync(srcpath)
734
- } catch {
735
- return 'file'
736
- }
737
- return (stats && stats.isDirectory()) ? 'dir' : 'file'
738
- }
739
-
740
- module.exports = {
741
- symlinkType: u(symlinkType),
742
- symlinkTypeSync
743
- }
744
-
745
-
746
- /***/ }),
747
-
748
- /***/ 425:
749
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
750
-
751
- "use strict";
752
-
753
-
754
- const u = (__nccwpck_require__(59).fromPromise)
755
- const path = __nccwpck_require__(17)
756
- const fs = __nccwpck_require__(845)
757
-
758
- const { mkdirs, mkdirsSync } = __nccwpck_require__(516)
759
-
760
- const { symlinkPaths, symlinkPathsSync } = __nccwpck_require__(687)
761
- const { symlinkType, symlinkTypeSync } = __nccwpck_require__(725)
762
-
763
- const { pathExists } = __nccwpck_require__(667)
764
-
765
- const { areIdentical } = __nccwpck_require__(826)
766
-
767
- async function createSymlink (srcpath, dstpath, type) {
768
- let stats
769
- try {
770
- stats = await fs.lstat(dstpath)
771
- } catch { }
772
-
773
- if (stats && stats.isSymbolicLink()) {
774
- const [srcStat, dstStat] = await Promise.all([
775
- fs.stat(srcpath),
776
- fs.stat(dstpath)
777
- ])
778
-
779
- if (areIdentical(srcStat, dstStat)) return
780
- }
781
-
782
- const relative = await symlinkPaths(srcpath, dstpath)
783
- srcpath = relative.toDst
784
- const toType = await symlinkType(relative.toCwd, type)
785
- const dir = path.dirname(dstpath)
786
-
787
- if (!(await pathExists(dir))) {
788
- await mkdirs(dir)
789
- }
790
-
791
- return fs.symlink(srcpath, dstpath, toType)
792
- }
793
-
794
- function createSymlinkSync (srcpath, dstpath, type) {
795
- let stats
796
- try {
797
- stats = fs.lstatSync(dstpath)
798
- } catch { }
799
- if (stats && stats.isSymbolicLink()) {
800
- const srcStat = fs.statSync(srcpath)
801
- const dstStat = fs.statSync(dstpath)
802
- if (areIdentical(srcStat, dstStat)) return
803
- }
804
-
805
- const relative = symlinkPathsSync(srcpath, dstpath)
806
- srcpath = relative.toDst
807
- type = symlinkTypeSync(relative.toCwd, type)
808
- const dir = path.dirname(dstpath)
809
- const exists = fs.existsSync(dir)
810
- if (exists) return fs.symlinkSync(srcpath, dstpath, type)
811
- mkdirsSync(dir)
812
- return fs.symlinkSync(srcpath, dstpath, type)
813
- }
814
-
815
- module.exports = {
816
- createSymlink: u(createSymlink),
817
- createSymlinkSync
818
- }
819
-
820
-
821
- /***/ }),
822
-
823
- /***/ 845:
824
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
825
-
826
- "use strict";
827
-
828
- // This is adapted from https://github.com/normalize/mz
829
- // Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
830
- const u = (__nccwpck_require__(59).fromCallback)
831
- const fs = __nccwpck_require__(804)
832
-
833
- const api = [
834
- 'access',
835
- 'appendFile',
836
- 'chmod',
837
- 'chown',
838
- 'close',
839
- 'copyFile',
840
- 'fchmod',
841
- 'fchown',
842
- 'fdatasync',
843
- 'fstat',
844
- 'fsync',
845
- 'ftruncate',
846
- 'futimes',
847
- 'lchmod',
848
- 'lchown',
849
- 'link',
850
- 'lstat',
851
- 'mkdir',
852
- 'mkdtemp',
853
- 'open',
854
- 'opendir',
855
- 'readdir',
856
- 'readFile',
857
- 'readlink',
858
- 'realpath',
859
- 'rename',
860
- 'rm',
861
- 'rmdir',
862
- 'stat',
863
- 'symlink',
864
- 'truncate',
865
- 'unlink',
866
- 'utimes',
867
- 'writeFile'
868
- ].filter(key => {
869
- // Some commands are not available on some systems. Ex:
870
- // fs.cp was added in Node.js v16.7.0
871
- // fs.lchown is not available on at least some Linux
872
- return typeof fs[key] === 'function'
873
- })
874
-
875
- // Export cloned fs:
876
- Object.assign(exports, fs)
877
-
878
- // Universalify async methods:
879
- api.forEach(method => {
880
- exports[method] = u(fs[method])
881
- })
882
-
883
- // We differ from mz/fs in that we still ship the old, broken, fs.exists()
884
- // since we are a drop-in replacement for the native module
885
- exports.exists = function (filename, callback) {
886
- if (typeof callback === 'function') {
887
- return fs.exists(filename, callback)
888
- }
889
- return new Promise(resolve => {
890
- return fs.exists(filename, resolve)
891
- })
892
- }
893
-
894
- // fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args
895
-
896
- exports.read = function (fd, buffer, offset, length, position, callback) {
897
- if (typeof callback === 'function') {
898
- return fs.read(fd, buffer, offset, length, position, callback)
899
- }
900
- return new Promise((resolve, reject) => {
901
- fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
902
- if (err) return reject(err)
903
- resolve({ bytesRead, buffer })
904
- })
905
- })
906
- }
907
-
908
- // Function signature can be
909
- // fs.write(fd, buffer[, offset[, length[, position]]], callback)
910
- // OR
911
- // fs.write(fd, string[, position[, encoding]], callback)
912
- // We need to handle both cases, so we use ...args
913
- exports.write = function (fd, buffer, ...args) {
914
- if (typeof args[args.length - 1] === 'function') {
915
- return fs.write(fd, buffer, ...args)
916
- }
917
-
918
- return new Promise((resolve, reject) => {
919
- fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
920
- if (err) return reject(err)
921
- resolve({ bytesWritten, buffer })
922
- })
923
- })
924
- }
925
-
926
- // Function signature is
927
- // s.readv(fd, buffers[, position], callback)
928
- // We need to handle the optional arg, so we use ...args
929
- exports.readv = function (fd, buffers, ...args) {
930
- if (typeof args[args.length - 1] === 'function') {
931
- return fs.readv(fd, buffers, ...args)
932
- }
933
-
934
- return new Promise((resolve, reject) => {
935
- fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
936
- if (err) return reject(err)
937
- resolve({ bytesRead, buffers })
938
- })
939
- })
940
- }
941
-
942
- // Function signature is
943
- // s.writev(fd, buffers[, position], callback)
944
- // We need to handle the optional arg, so we use ...args
945
- exports.writev = function (fd, buffers, ...args) {
946
- if (typeof args[args.length - 1] === 'function') {
947
- return fs.writev(fd, buffers, ...args)
948
- }
949
-
950
- return new Promise((resolve, reject) => {
951
- fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
952
- if (err) return reject(err)
953
- resolve({ bytesWritten, buffers })
954
- })
955
- })
956
- }
957
-
958
- // fs.realpath.native sometimes not available if fs is monkey-patched
959
- if (typeof fs.realpath.native === 'function') {
960
- exports.realpath.native = u(fs.realpath.native)
961
- } else {
962
- process.emitWarning(
963
- 'fs.realpath.native is not a function. Is fs being monkey-patched?',
964
- 'Warning', 'fs-extra-WARN0003'
965
- )
966
- }
967
-
968
-
969
- /***/ }),
970
-
971
- /***/ 175:
972
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
973
-
974
- "use strict";
975
-
976
-
977
- module.exports = {
978
- // Export promiseified graceful-fs:
979
- ...__nccwpck_require__(845),
980
- // Export extra methods:
981
- ...__nccwpck_require__(852),
982
- ...__nccwpck_require__(783),
983
- ...__nccwpck_require__(960),
984
- ...__nccwpck_require__(540),
985
- ...__nccwpck_require__(516),
986
- ...__nccwpck_require__(135),
987
- ...__nccwpck_require__(987),
988
- ...__nccwpck_require__(667),
989
- ...__nccwpck_require__(58)
990
- }
991
-
992
-
993
- /***/ }),
994
-
995
- /***/ 540:
996
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
997
-
998
- "use strict";
999
-
1000
-
1001
- const u = (__nccwpck_require__(59).fromPromise)
1002
- const jsonFile = __nccwpck_require__(869)
1003
-
1004
- jsonFile.outputJson = u(__nccwpck_require__(201))
1005
- jsonFile.outputJsonSync = __nccwpck_require__(709)
1006
- // aliases
1007
- jsonFile.outputJSON = jsonFile.outputJson
1008
- jsonFile.outputJSONSync = jsonFile.outputJsonSync
1009
- jsonFile.writeJSON = jsonFile.writeJson
1010
- jsonFile.writeJSONSync = jsonFile.writeJsonSync
1011
- jsonFile.readJSON = jsonFile.readJson
1012
- jsonFile.readJSONSync = jsonFile.readJsonSync
1013
-
1014
- module.exports = jsonFile
1015
-
1016
-
1017
- /***/ }),
1018
-
1019
- /***/ 869:
1020
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1021
-
1022
- "use strict";
1023
-
1024
-
1025
- const jsonFile = __nccwpck_require__(449)
1026
-
1027
- module.exports = {
1028
- // jsonfile exports
1029
- readJson: jsonFile.readFile,
1030
- readJsonSync: jsonFile.readFileSync,
1031
- writeJson: jsonFile.writeFile,
1032
- writeJsonSync: jsonFile.writeFileSync
1033
- }
1034
-
1035
-
1036
- /***/ }),
1037
-
1038
- /***/ 709:
1039
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1040
-
1041
- "use strict";
1042
-
1043
-
1044
- const { stringify } = __nccwpck_require__(213)
1045
- const { outputFileSync } = __nccwpck_require__(987)
1046
-
1047
- function outputJsonSync (file, data, options) {
1048
- const str = stringify(data, options)
1049
-
1050
- outputFileSync(file, str, options)
1051
- }
1052
-
1053
- module.exports = outputJsonSync
1054
-
1055
-
1056
- /***/ }),
1057
-
1058
- /***/ 201:
1059
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1060
-
1061
- "use strict";
1062
-
1063
-
1064
- const { stringify } = __nccwpck_require__(213)
1065
- const { outputFile } = __nccwpck_require__(987)
1066
-
1067
- async function outputJson (file, data, options = {}) {
1068
- const str = stringify(data, options)
1069
-
1070
- await outputFile(file, str, options)
1071
- }
1072
-
1073
- module.exports = outputJson
1074
-
1075
-
1076
- /***/ }),
1077
-
1078
- /***/ 516:
1079
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1080
-
1081
- "use strict";
1082
-
1083
- const u = (__nccwpck_require__(59).fromPromise)
1084
- const { makeDir: _makeDir, makeDirSync } = __nccwpck_require__(368)
1085
- const makeDir = u(_makeDir)
1086
-
1087
- module.exports = {
1088
- mkdirs: makeDir,
1089
- mkdirsSync: makeDirSync,
1090
- // alias
1091
- mkdirp: makeDir,
1092
- mkdirpSync: makeDirSync,
1093
- ensureDir: makeDir,
1094
- ensureDirSync: makeDirSync
1095
- }
1096
-
1097
-
1098
- /***/ }),
1099
-
1100
- /***/ 368:
1101
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1102
-
1103
- "use strict";
1104
-
1105
- const fs = __nccwpck_require__(845)
1106
- const { checkPath } = __nccwpck_require__(676)
1107
-
1108
- const getMode = options => {
1109
- const defaults = { mode: 0o777 }
1110
- if (typeof options === 'number') return options
1111
- return ({ ...defaults, ...options }).mode
1112
- }
1113
-
1114
- module.exports.makeDir = async (dir, options) => {
1115
- checkPath(dir)
1116
-
1117
- return fs.mkdir(dir, {
1118
- mode: getMode(options),
1119
- recursive: true
1120
- })
1121
- }
1122
-
1123
- module.exports.makeDirSync = (dir, options) => {
1124
- checkPath(dir)
1125
-
1126
- return fs.mkdirSync(dir, {
1127
- mode: getMode(options),
1128
- recursive: true
1129
- })
1130
- }
1131
-
1132
-
1133
- /***/ }),
1134
-
1135
- /***/ 676:
1136
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1137
-
1138
- "use strict";
1139
- // Adapted from https://github.com/sindresorhus/make-dir
1140
- // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1141
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1142
- // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1143
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1144
-
1145
- const path = __nccwpck_require__(17)
1146
-
1147
- // https://github.com/nodejs/node/issues/8987
1148
- // https://github.com/libuv/libuv/pull/1088
1149
- module.exports.checkPath = function checkPath (pth) {
1150
- if (process.platform === 'win32') {
1151
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
1152
-
1153
- if (pathHasInvalidWinCharacters) {
1154
- const error = new Error(`Path contains invalid characters: ${pth}`)
1155
- error.code = 'EINVAL'
1156
- throw error
1157
- }
1158
- }
1159
- }
1160
-
1161
-
1162
- /***/ }),
1163
-
1164
- /***/ 135:
1165
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1166
-
1167
- "use strict";
1168
-
1169
-
1170
- const u = (__nccwpck_require__(59).fromPromise)
1171
- module.exports = {
1172
- move: u(__nccwpck_require__(497)),
1173
- moveSync: __nccwpck_require__(801)
1174
- }
1175
-
1176
-
1177
- /***/ }),
1178
-
1179
- /***/ 801:
1180
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1181
-
1182
- "use strict";
1183
-
1184
-
1185
- const fs = __nccwpck_require__(804)
1186
- const path = __nccwpck_require__(17)
1187
- const copySync = (__nccwpck_require__(852).copySync)
1188
- const removeSync = (__nccwpck_require__(58).removeSync)
1189
- const mkdirpSync = (__nccwpck_require__(516).mkdirpSync)
1190
- const stat = __nccwpck_require__(826)
1191
-
1192
- function moveSync (src, dest, opts) {
1193
- opts = opts || {}
1194
- const overwrite = opts.overwrite || opts.clobber || false
1195
-
1196
- const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
1197
- stat.checkParentPathsSync(src, srcStat, dest, 'move')
1198
- if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
1199
- return doRename(src, dest, overwrite, isChangingCase)
1200
- }
1201
-
1202
- function isParentRoot (dest) {
1203
- const parent = path.dirname(dest)
1204
- const parsedPath = path.parse(parent)
1205
- return parsedPath.root === parent
1206
- }
1207
-
1208
- function doRename (src, dest, overwrite, isChangingCase) {
1209
- if (isChangingCase) return rename(src, dest, overwrite)
1210
- if (overwrite) {
1211
- removeSync(dest)
1212
- return rename(src, dest, overwrite)
1213
- }
1214
- if (fs.existsSync(dest)) throw new Error('dest already exists.')
1215
- return rename(src, dest, overwrite)
1216
- }
1217
-
1218
- function rename (src, dest, overwrite) {
1219
- try {
1220
- fs.renameSync(src, dest)
1221
- } catch (err) {
1222
- if (err.code !== 'EXDEV') throw err
1223
- return moveAcrossDevice(src, dest, overwrite)
1224
- }
1225
- }
1226
-
1227
- function moveAcrossDevice (src, dest, overwrite) {
1228
- const opts = {
1229
- overwrite,
1230
- errorOnExist: true,
1231
- preserveTimestamps: true
1232
- }
1233
- copySync(src, dest, opts)
1234
- return removeSync(src)
1235
- }
1236
-
1237
- module.exports = moveSync
1238
-
1239
-
1240
- /***/ }),
1241
-
1242
- /***/ 497:
1243
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1244
-
1245
- "use strict";
1246
-
1247
-
1248
- const fs = __nccwpck_require__(845)
1249
- const path = __nccwpck_require__(17)
1250
- const { copy } = __nccwpck_require__(852)
1251
- const { remove } = __nccwpck_require__(58)
1252
- const { mkdirp } = __nccwpck_require__(516)
1253
- const { pathExists } = __nccwpck_require__(667)
1254
- const stat = __nccwpck_require__(826)
1255
-
1256
- async function move (src, dest, opts = {}) {
1257
- const overwrite = opts.overwrite || opts.clobber || false
1258
-
1259
- const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, 'move', opts)
1260
-
1261
- await stat.checkParentPaths(src, srcStat, dest, 'move')
1262
-
1263
- // If the parent of dest is not root, make sure it exists before proceeding
1264
- const destParent = path.dirname(dest)
1265
- const parsedParentPath = path.parse(destParent)
1266
- if (parsedParentPath.root !== destParent) {
1267
- await mkdirp(destParent)
1268
- }
1269
-
1270
- return doRename(src, dest, overwrite, isChangingCase)
1271
- }
1272
-
1273
- async function doRename (src, dest, overwrite, isChangingCase) {
1274
- if (!isChangingCase) {
1275
- if (overwrite) {
1276
- await remove(dest)
1277
- } else if (await pathExists(dest)) {
1278
- throw new Error('dest already exists.')
1279
- }
1280
- }
1281
-
1282
- try {
1283
- // Try w/ rename first, and try copy + remove if EXDEV
1284
- await fs.rename(src, dest)
1285
- } catch (err) {
1286
- if (err.code !== 'EXDEV') {
1287
- throw err
1288
- }
1289
- await moveAcrossDevice(src, dest, overwrite)
1290
- }
1291
- }
1292
-
1293
- async function moveAcrossDevice (src, dest, overwrite) {
1294
- const opts = {
1295
- overwrite,
1296
- errorOnExist: true,
1297
- preserveTimestamps: true
1298
- }
1299
-
1300
- await copy(src, dest, opts)
1301
- return remove(src)
1302
- }
1303
-
1304
- module.exports = move
1305
-
1306
-
1307
- /***/ }),
1308
-
1309
- /***/ 987:
1310
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1311
-
1312
- "use strict";
1313
-
1314
-
1315
- const u = (__nccwpck_require__(59).fromPromise)
1316
- const fs = __nccwpck_require__(845)
1317
- const path = __nccwpck_require__(17)
1318
- const mkdir = __nccwpck_require__(516)
1319
- const pathExists = (__nccwpck_require__(667).pathExists)
1320
-
1321
- async function outputFile (file, data, encoding = 'utf-8') {
1322
- const dir = path.dirname(file)
1323
-
1324
- if (!(await pathExists(dir))) {
1325
- await mkdir.mkdirs(dir)
1326
- }
1327
-
1328
- return fs.writeFile(file, data, encoding)
1329
- }
1330
-
1331
- function outputFileSync (file, ...args) {
1332
- const dir = path.dirname(file)
1333
- if (!fs.existsSync(dir)) {
1334
- mkdir.mkdirsSync(dir)
1335
- }
1336
-
1337
- fs.writeFileSync(file, ...args)
1338
- }
1339
-
1340
- module.exports = {
1341
- outputFile: u(outputFile),
1342
- outputFileSync
1343
- }
1344
-
1345
-
1346
- /***/ }),
1347
-
1348
- /***/ 667:
1349
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1350
-
1351
- "use strict";
1352
-
1353
- const u = (__nccwpck_require__(59).fromPromise)
1354
- const fs = __nccwpck_require__(845)
1355
-
1356
- function pathExists (path) {
1357
- return fs.access(path).then(() => true).catch(() => false)
1358
- }
1359
-
1360
- module.exports = {
1361
- pathExists: u(pathExists),
1362
- pathExistsSync: fs.existsSync
1363
- }
1364
-
1365
-
1366
- /***/ }),
1367
-
1368
- /***/ 58:
1369
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1370
-
1371
- "use strict";
1372
-
1373
-
1374
- const fs = __nccwpck_require__(804)
1375
- const u = (__nccwpck_require__(59).fromCallback)
1376
-
1377
- function remove (path, callback) {
1378
- fs.rm(path, { recursive: true, force: true }, callback)
1379
- }
1380
-
1381
- function removeSync (path) {
1382
- fs.rmSync(path, { recursive: true, force: true })
1383
- }
1384
-
1385
- module.exports = {
1386
- remove: u(remove),
1387
- removeSync
1388
- }
1389
-
1390
-
1391
- /***/ }),
1392
-
1393
- /***/ 826:
1394
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1395
-
1396
- "use strict";
1397
-
1398
-
1399
- const fs = __nccwpck_require__(845)
1400
- const path = __nccwpck_require__(17)
1401
- const u = (__nccwpck_require__(59).fromPromise)
1402
-
1403
- function getStats (src, dest, opts) {
1404
- const statFunc = opts.dereference
1405
- ? (file) => fs.stat(file, { bigint: true })
1406
- : (file) => fs.lstat(file, { bigint: true })
1407
- return Promise.all([
1408
- statFunc(src),
1409
- statFunc(dest).catch(err => {
1410
- if (err.code === 'ENOENT') return null
1411
- throw err
1412
- })
1413
- ]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
1414
- }
1415
-
1416
- function getStatsSync (src, dest, opts) {
1417
- let destStat
1418
- const statFunc = opts.dereference
1419
- ? (file) => fs.statSync(file, { bigint: true })
1420
- : (file) => fs.lstatSync(file, { bigint: true })
1421
- const srcStat = statFunc(src)
1422
- try {
1423
- destStat = statFunc(dest)
1424
- } catch (err) {
1425
- if (err.code === 'ENOENT') return { srcStat, destStat: null }
1426
- throw err
1427
- }
1428
- return { srcStat, destStat }
1429
- }
1430
-
1431
- async function checkPaths (src, dest, funcName, opts) {
1432
- const { srcStat, destStat } = await getStats(src, dest, opts)
1433
- if (destStat) {
1434
- if (areIdentical(srcStat, destStat)) {
1435
- const srcBaseName = path.basename(src)
1436
- const destBaseName = path.basename(dest)
1437
- if (funcName === 'move' &&
1438
- srcBaseName !== destBaseName &&
1439
- srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1440
- return { srcStat, destStat, isChangingCase: true }
1441
- }
1442
- throw new Error('Source and destination must not be the same.')
1443
- }
1444
- if (srcStat.isDirectory() && !destStat.isDirectory()) {
1445
- throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
1446
- }
1447
- if (!srcStat.isDirectory() && destStat.isDirectory()) {
1448
- throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
1449
- }
1450
- }
1451
-
1452
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1453
- throw new Error(errMsg(src, dest, funcName))
1454
- }
1455
-
1456
- return { srcStat, destStat }
1457
- }
1458
-
1459
- function checkPathsSync (src, dest, funcName, opts) {
1460
- const { srcStat, destStat } = getStatsSync(src, dest, opts)
1461
-
1462
- if (destStat) {
1463
- if (areIdentical(srcStat, destStat)) {
1464
- const srcBaseName = path.basename(src)
1465
- const destBaseName = path.basename(dest)
1466
- if (funcName === 'move' &&
1467
- srcBaseName !== destBaseName &&
1468
- srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1469
- return { srcStat, destStat, isChangingCase: true }
1470
- }
1471
- throw new Error('Source and destination must not be the same.')
1472
- }
1473
- if (srcStat.isDirectory() && !destStat.isDirectory()) {
1474
- throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
1475
- }
1476
- if (!srcStat.isDirectory() && destStat.isDirectory()) {
1477
- throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
1478
- }
1479
- }
1480
-
1481
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1482
- throw new Error(errMsg(src, dest, funcName))
1483
- }
1484
- return { srcStat, destStat }
1485
- }
1486
-
1487
- // recursively check if dest parent is a subdirectory of src.
1488
- // It works for all file types including symlinks since it
1489
- // checks the src and dest inodes. It starts from the deepest
1490
- // parent and stops once it reaches the src parent or the root path.
1491
- async function checkParentPaths (src, srcStat, dest, funcName) {
1492
- const srcParent = path.resolve(path.dirname(src))
1493
- const destParent = path.resolve(path.dirname(dest))
1494
- if (destParent === srcParent || destParent === path.parse(destParent).root) return
1495
-
1496
- let destStat
1497
- try {
1498
- destStat = await fs.stat(destParent, { bigint: true })
1499
- } catch (err) {
1500
- if (err.code === 'ENOENT') return
1501
- throw err
1502
- }
1503
-
1504
- if (areIdentical(srcStat, destStat)) {
1505
- throw new Error(errMsg(src, dest, funcName))
1506
- }
1507
-
1508
- return checkParentPaths(src, srcStat, destParent, funcName)
1509
- }
1510
-
1511
- function checkParentPathsSync (src, srcStat, dest, funcName) {
1512
- const srcParent = path.resolve(path.dirname(src))
1513
- const destParent = path.resolve(path.dirname(dest))
1514
- if (destParent === srcParent || destParent === path.parse(destParent).root) return
1515
- let destStat
1516
- try {
1517
- destStat = fs.statSync(destParent, { bigint: true })
1518
- } catch (err) {
1519
- if (err.code === 'ENOENT') return
1520
- throw err
1521
- }
1522
- if (areIdentical(srcStat, destStat)) {
1523
- throw new Error(errMsg(src, dest, funcName))
1524
- }
1525
- return checkParentPathsSync(src, srcStat, destParent, funcName)
1526
- }
1527
-
1528
- function areIdentical (srcStat, destStat) {
1529
- return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev
1530
- }
1531
-
1532
- // return true if dest is a subdir of src, otherwise false.
1533
- // It only checks the path strings.
1534
- function isSrcSubdir (src, dest) {
1535
- const srcArr = path.resolve(src).split(path.sep).filter(i => i)
1536
- const destArr = path.resolve(dest).split(path.sep).filter(i => i)
1537
- return srcArr.every((cur, i) => destArr[i] === cur)
1538
- }
1539
-
1540
- function errMsg (src, dest, funcName) {
1541
- return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
1542
- }
1543
-
1544
- module.exports = {
1545
- // checkPaths
1546
- checkPaths: u(checkPaths),
1547
- checkPathsSync,
1548
- // checkParent
1549
- checkParentPaths: u(checkParentPaths),
1550
- checkParentPathsSync,
1551
- // Misc
1552
- isSrcSubdir,
1553
- areIdentical
1554
- }
1555
-
1556
-
1557
- /***/ }),
1558
-
1559
- /***/ 227:
1560
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1561
-
1562
- "use strict";
1563
-
1564
-
1565
- const fs = __nccwpck_require__(845)
1566
- const u = (__nccwpck_require__(59).fromPromise)
1567
-
1568
- async function utimesMillis (path, atime, mtime) {
1569
- // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
1570
- const fd = await fs.open(path, 'r+')
1571
-
1572
- let closeErr = null
1573
-
1574
- try {
1575
- await fs.futimes(fd, atime, mtime)
1576
- } finally {
1577
- try {
1578
- await fs.close(fd)
1579
- } catch (e) {
1580
- closeErr = e
1581
- }
1582
- }
1583
-
1584
- if (closeErr) {
1585
- throw closeErr
1586
- }
1587
- }
1588
-
1589
- function utimesMillisSync (path, atime, mtime) {
1590
- const fd = fs.openSync(path, 'r+')
1591
- fs.futimesSync(fd, atime, mtime)
1592
- return fs.closeSync(fd)
1593
- }
1594
-
1595
- module.exports = {
1596
- utimesMillis: u(utimesMillis),
1597
- utimesMillisSync
1598
- }
1599
-
1600
-
1601
- /***/ }),
1602
-
1603
- /***/ 691:
1604
- /***/ ((module) => {
1605
-
1606
- "use strict";
1607
-
1608
-
1609
- module.exports = clone
1610
-
1611
- var getPrototypeOf = Object.getPrototypeOf || function (obj) {
1612
- return obj.__proto__
1613
- }
1614
-
1615
- function clone (obj) {
1616
- if (obj === null || typeof obj !== 'object')
1617
- return obj
1618
-
1619
- if (obj instanceof Object)
1620
- var copy = { __proto__: getPrototypeOf(obj) }
1621
- else
1622
- var copy = Object.create(null)
1623
-
1624
- Object.getOwnPropertyNames(obj).forEach(function (key) {
1625
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
1626
- })
1627
-
1628
- return copy
1629
- }
1630
-
1631
-
1632
- /***/ }),
1633
-
1634
- /***/ 804:
1635
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1636
-
1637
- var fs = __nccwpck_require__(147)
1638
- var polyfills = __nccwpck_require__(567)
1639
- var legacy = __nccwpck_require__(915)
1640
- var clone = __nccwpck_require__(691)
1641
-
1642
- var util = __nccwpck_require__(837)
1643
-
1644
- /* istanbul ignore next - node 0.x polyfill */
1645
- var gracefulQueue
1646
- var previousSymbol
1647
-
1648
- /* istanbul ignore else - node 0.x polyfill */
1649
- if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
1650
- gracefulQueue = Symbol.for('graceful-fs.queue')
1651
- // This is used in testing by future versions
1652
- previousSymbol = Symbol.for('graceful-fs.previous')
1653
- } else {
1654
- gracefulQueue = '___graceful-fs.queue'
1655
- previousSymbol = '___graceful-fs.previous'
1656
- }
1657
-
1658
- function noop () {}
1659
-
1660
- function publishQueue(context, queue) {
1661
- Object.defineProperty(context, gracefulQueue, {
1662
- get: function() {
1663
- return queue
1664
- }
1665
- })
1666
- }
1667
-
1668
- var debug = noop
1669
- if (util.debuglog)
1670
- debug = util.debuglog('gfs4')
1671
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
1672
- debug = function() {
1673
- var m = util.format.apply(util, arguments)
1674
- m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
1675
- console.error(m)
1676
- }
1677
-
1678
- // Once time initialization
1679
- if (!fs[gracefulQueue]) {
1680
- // This queue can be shared by multiple loaded instances
1681
- var queue = global[gracefulQueue] || []
1682
- publishQueue(fs, queue)
1683
-
1684
- // Patch fs.close/closeSync to shared queue version, because we need
1685
- // to retry() whenever a close happens *anywhere* in the program.
1686
- // This is essential when multiple graceful-fs instances are
1687
- // in play at the same time.
1688
- fs.close = (function (fs$close) {
1689
- function close (fd, cb) {
1690
- return fs$close.call(fs, fd, function (err) {
1691
- // This function uses the graceful-fs shared queue
1692
- if (!err) {
1693
- resetQueue()
1694
- }
1695
-
1696
- if (typeof cb === 'function')
1697
- cb.apply(this, arguments)
1698
- })
1699
- }
1700
-
1701
- Object.defineProperty(close, previousSymbol, {
1702
- value: fs$close
1703
- })
1704
- return close
1705
- })(fs.close)
1706
-
1707
- fs.closeSync = (function (fs$closeSync) {
1708
- function closeSync (fd) {
1709
- // This function uses the graceful-fs shared queue
1710
- fs$closeSync.apply(fs, arguments)
1711
- resetQueue()
1712
- }
1713
-
1714
- Object.defineProperty(closeSync, previousSymbol, {
1715
- value: fs$closeSync
1716
- })
1717
- return closeSync
1718
- })(fs.closeSync)
1719
-
1720
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
1721
- process.on('exit', function() {
1722
- debug(fs[gracefulQueue])
1723
- __nccwpck_require__(491).equal(fs[gracefulQueue].length, 0)
1724
- })
1725
- }
1726
- }
1727
-
1728
- if (!global[gracefulQueue]) {
1729
- publishQueue(global, fs[gracefulQueue]);
1730
- }
1731
-
1732
- module.exports = patch(clone(fs))
1733
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
1734
- module.exports = patch(fs)
1735
- fs.__patched = true;
1736
- }
1737
-
1738
- function patch (fs) {
1739
- // Everything that references the open() function needs to be in here
1740
- polyfills(fs)
1741
- fs.gracefulify = patch
1742
-
1743
- fs.createReadStream = createReadStream
1744
- fs.createWriteStream = createWriteStream
1745
- var fs$readFile = fs.readFile
1746
- fs.readFile = readFile
1747
- function readFile (path, options, cb) {
1748
- if (typeof options === 'function')
1749
- cb = options, options = null
1750
-
1751
- return go$readFile(path, options, cb)
1752
-
1753
- function go$readFile (path, options, cb, startTime) {
1754
- return fs$readFile(path, options, function (err) {
1755
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
1756
- enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])
1757
- else {
1758
- if (typeof cb === 'function')
1759
- cb.apply(this, arguments)
1760
- }
1761
- })
1762
- }
1763
- }
1764
-
1765
- var fs$writeFile = fs.writeFile
1766
- fs.writeFile = writeFile
1767
- function writeFile (path, data, options, cb) {
1768
- if (typeof options === 'function')
1769
- cb = options, options = null
1770
-
1771
- return go$writeFile(path, data, options, cb)
1772
-
1773
- function go$writeFile (path, data, options, cb, startTime) {
1774
- return fs$writeFile(path, data, options, function (err) {
1775
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
1776
- enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
1777
- else {
1778
- if (typeof cb === 'function')
1779
- cb.apply(this, arguments)
1780
- }
1781
- })
1782
- }
1783
- }
1784
-
1785
- var fs$appendFile = fs.appendFile
1786
- if (fs$appendFile)
1787
- fs.appendFile = appendFile
1788
- function appendFile (path, data, options, cb) {
1789
- if (typeof options === 'function')
1790
- cb = options, options = null
1791
-
1792
- return go$appendFile(path, data, options, cb)
1793
-
1794
- function go$appendFile (path, data, options, cb, startTime) {
1795
- return fs$appendFile(path, data, options, function (err) {
1796
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
1797
- enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
1798
- else {
1799
- if (typeof cb === 'function')
1800
- cb.apply(this, arguments)
1801
- }
1802
- })
1803
- }
1804
- }
1805
-
1806
- var fs$copyFile = fs.copyFile
1807
- if (fs$copyFile)
1808
- fs.copyFile = copyFile
1809
- function copyFile (src, dest, flags, cb) {
1810
- if (typeof flags === 'function') {
1811
- cb = flags
1812
- flags = 0
1813
- }
1814
- return go$copyFile(src, dest, flags, cb)
1815
-
1816
- function go$copyFile (src, dest, flags, cb, startTime) {
1817
- return fs$copyFile(src, dest, flags, function (err) {
1818
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
1819
- enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])
1820
- else {
1821
- if (typeof cb === 'function')
1822
- cb.apply(this, arguments)
1823
- }
1824
- })
1825
- }
1826
- }
1827
-
1828
- var fs$readdir = fs.readdir
1829
- fs.readdir = readdir
1830
- var noReaddirOptionVersions = /^v[0-5]\./
1831
- function readdir (path, options, cb) {
1832
- if (typeof options === 'function')
1833
- cb = options, options = null
1834
-
1835
- var go$readdir = noReaddirOptionVersions.test(process.version)
1836
- ? function go$readdir (path, options, cb, startTime) {
1837
- return fs$readdir(path, fs$readdirCallback(
1838
- path, options, cb, startTime
1839
- ))
1840
- }
1841
- : function go$readdir (path, options, cb, startTime) {
1842
- return fs$readdir(path, options, fs$readdirCallback(
1843
- path, options, cb, startTime
1844
- ))
1845
- }
1846
-
1847
- return go$readdir(path, options, cb)
1848
-
1849
- function fs$readdirCallback (path, options, cb, startTime) {
1850
- return function (err, files) {
1851
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
1852
- enqueue([
1853
- go$readdir,
1854
- [path, options, cb],
1855
- err,
1856
- startTime || Date.now(),
1857
- Date.now()
1858
- ])
1859
- else {
1860
- if (files && files.sort)
1861
- files.sort()
1862
-
1863
- if (typeof cb === 'function')
1864
- cb.call(this, err, files)
1
+ (() => {
2
+ var __webpack_modules__ = {
3
+ 524: (module1, __unused_webpack_exports, __nccwpck_require__) => {
4
+ "use strict";
5
+ const fs = __nccwpck_require__(804);
6
+ const path = __nccwpck_require__(17);
7
+ const mkdirsSync = __nccwpck_require__(516).mkdirsSync;
8
+ const utimesMillisSync = __nccwpck_require__(227).utimesMillisSync;
9
+ const stat = __nccwpck_require__(826);
10
+ function copySync(src, dest, opts) {
11
+ if (typeof opts === "function") {
12
+ opts = { filter: opts };
13
+ }
14
+ opts = opts || {};
15
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
16
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
17
+ if (opts.preserveTimestamps && process.arch === "ia32") {
18
+ process.emitWarning(
19
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n" +
20
+ " see https://github.com/jprichardson/node-fs-extra/issues/269",
21
+ "Warning",
22
+ "fs-extra-WARN0002",
23
+ );
1865
24
  }
25
+ const { srcStat, destStat } = stat.checkPathsSync(
26
+ src,
27
+ dest,
28
+ "copy",
29
+ opts,
30
+ );
31
+ stat.checkParentPathsSync(src, srcStat, dest, "copy");
32
+ if (opts.filter && !opts.filter(src, dest)) return;
33
+ const destParent = path.dirname(dest);
34
+ if (!fs.existsSync(destParent)) mkdirsSync(destParent);
35
+ return getStats(destStat, src, dest, opts);
1866
36
  }
1867
- }
1868
- }
1869
-
1870
- if (process.version.substr(0, 4) === 'v0.8') {
1871
- var legStreams = legacy(fs)
1872
- ReadStream = legStreams.ReadStream
1873
- WriteStream = legStreams.WriteStream
1874
- }
1875
-
1876
- var fs$ReadStream = fs.ReadStream
1877
- if (fs$ReadStream) {
1878
- ReadStream.prototype = Object.create(fs$ReadStream.prototype)
1879
- ReadStream.prototype.open = ReadStream$open
1880
- }
1881
-
1882
- var fs$WriteStream = fs.WriteStream
1883
- if (fs$WriteStream) {
1884
- WriteStream.prototype = Object.create(fs$WriteStream.prototype)
1885
- WriteStream.prototype.open = WriteStream$open
1886
- }
1887
-
1888
- Object.defineProperty(fs, 'ReadStream', {
1889
- get: function () {
1890
- return ReadStream
37
+ function getStats(destStat, src, dest, opts) {
38
+ const statSync = opts.dereference ? fs.statSync : fs.lstatSync;
39
+ const srcStat = statSync(src);
40
+ if (srcStat.isDirectory())
41
+ return onDir(srcStat, destStat, src, dest, opts);
42
+ else if (
43
+ srcStat.isFile() ||
44
+ srcStat.isCharacterDevice() ||
45
+ srcStat.isBlockDevice()
46
+ )
47
+ return onFile(srcStat, destStat, src, dest, opts);
48
+ else if (srcStat.isSymbolicLink())
49
+ return onLink(destStat, src, dest, opts);
50
+ else if (srcStat.isSocket())
51
+ throw new Error(`Cannot copy a socket file: ${src}`);
52
+ else if (srcStat.isFIFO())
53
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
54
+ throw new Error(`Unknown file: ${src}`);
55
+ }
56
+ function onFile(srcStat, destStat, src, dest, opts) {
57
+ if (!destStat) return copyFile(srcStat, src, dest, opts);
58
+ return mayCopyFile(srcStat, src, dest, opts);
59
+ }
60
+ function mayCopyFile(srcStat, src, dest, opts) {
61
+ if (opts.overwrite) {
62
+ fs.unlinkSync(dest);
63
+ return copyFile(srcStat, src, dest, opts);
64
+ } else if (opts.errorOnExist) {
65
+ throw new Error(`'${dest}' already exists`);
66
+ }
67
+ }
68
+ function copyFile(srcStat, src, dest, opts) {
69
+ fs.copyFileSync(src, dest);
70
+ if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
71
+ return setDestMode(dest, srcStat.mode);
72
+ }
73
+ function handleTimestamps(srcMode, src, dest) {
74
+ if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
75
+ return setDestTimestamps(src, dest);
76
+ }
77
+ function fileIsNotWritable(srcMode) {
78
+ return (srcMode & 128) === 0;
79
+ }
80
+ function makeFileWritable(dest, srcMode) {
81
+ return setDestMode(dest, srcMode | 128);
82
+ }
83
+ function setDestMode(dest, srcMode) {
84
+ return fs.chmodSync(dest, srcMode);
85
+ }
86
+ function setDestTimestamps(src, dest) {
87
+ const updatedSrcStat = fs.statSync(src);
88
+ return utimesMillisSync(
89
+ dest,
90
+ updatedSrcStat.atime,
91
+ updatedSrcStat.mtime,
92
+ );
93
+ }
94
+ function onDir(srcStat, destStat, src, dest, opts) {
95
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
96
+ return copyDir(src, dest, opts);
97
+ }
98
+ function mkDirAndCopy(srcMode, src, dest, opts) {
99
+ fs.mkdirSync(dest);
100
+ copyDir(src, dest, opts);
101
+ return setDestMode(dest, srcMode);
102
+ }
103
+ function copyDir(src, dest, opts) {
104
+ fs.readdirSync(src).forEach((item) =>
105
+ copyDirItem(item, src, dest, opts),
106
+ );
107
+ }
108
+ function copyDirItem(item, src, dest, opts) {
109
+ const srcItem = path.join(src, item);
110
+ const destItem = path.join(dest, item);
111
+ if (opts.filter && !opts.filter(srcItem, destItem)) return;
112
+ const { destStat } = stat.checkPathsSync(
113
+ srcItem,
114
+ destItem,
115
+ "copy",
116
+ opts,
117
+ );
118
+ return getStats(destStat, srcItem, destItem, opts);
119
+ }
120
+ function onLink(destStat, src, dest, opts) {
121
+ let resolvedSrc = fs.readlinkSync(src);
122
+ if (opts.dereference) {
123
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
124
+ }
125
+ if (!destStat) {
126
+ return fs.symlinkSync(resolvedSrc, dest);
127
+ } else {
128
+ let resolvedDest;
129
+ try {
130
+ resolvedDest = fs.readlinkSync(dest);
131
+ } catch (err) {
132
+ if (err.code === "EINVAL" || err.code === "UNKNOWN")
133
+ return fs.symlinkSync(resolvedSrc, dest);
134
+ throw err;
135
+ }
136
+ if (opts.dereference) {
137
+ resolvedDest = path.resolve(process.cwd(), resolvedDest);
138
+ }
139
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
140
+ throw new Error(
141
+ `Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`,
142
+ );
143
+ }
144
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
145
+ throw new Error(
146
+ `Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`,
147
+ );
148
+ }
149
+ return copyLink(resolvedSrc, dest);
150
+ }
151
+ }
152
+ function copyLink(resolvedSrc, dest) {
153
+ fs.unlinkSync(dest);
154
+ return fs.symlinkSync(resolvedSrc, dest);
155
+ }
156
+ module1.exports = copySync;
1891
157
  },
1892
- set: function (val) {
1893
- ReadStream = val
158
+ 770: (module1, __unused_webpack_exports, __nccwpck_require__) => {
159
+ "use strict";
160
+ const fs = __nccwpck_require__(845);
161
+ const path = __nccwpck_require__(17);
162
+ const { mkdirs } = __nccwpck_require__(516);
163
+ const { pathExists } = __nccwpck_require__(667);
164
+ const { utimesMillis } = __nccwpck_require__(227);
165
+ const stat = __nccwpck_require__(826);
166
+ async function copy(src, dest, opts = {}) {
167
+ if (typeof opts === "function") {
168
+ opts = { filter: opts };
169
+ }
170
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
171
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
172
+ if (opts.preserveTimestamps && process.arch === "ia32") {
173
+ process.emitWarning(
174
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n" +
175
+ " see https://github.com/jprichardson/node-fs-extra/issues/269",
176
+ "Warning",
177
+ "fs-extra-WARN0001",
178
+ );
179
+ }
180
+ const { srcStat, destStat } = await stat.checkPaths(
181
+ src,
182
+ dest,
183
+ "copy",
184
+ opts,
185
+ );
186
+ await stat.checkParentPaths(src, srcStat, dest, "copy");
187
+ const include = await runFilter(src, dest, opts);
188
+ if (!include) return;
189
+ const destParent = path.dirname(dest);
190
+ const dirExists = await pathExists(destParent);
191
+ if (!dirExists) {
192
+ await mkdirs(destParent);
193
+ }
194
+ await getStatsAndPerformCopy(destStat, src, dest, opts);
195
+ }
196
+ async function runFilter(src, dest, opts) {
197
+ if (!opts.filter) return true;
198
+ return opts.filter(src, dest);
199
+ }
200
+ async function getStatsAndPerformCopy(destStat, src, dest, opts) {
201
+ const statFn = opts.dereference ? fs.stat : fs.lstat;
202
+ const srcStat = await statFn(src);
203
+ if (srcStat.isDirectory())
204
+ return onDir(srcStat, destStat, src, dest, opts);
205
+ if (
206
+ srcStat.isFile() ||
207
+ srcStat.isCharacterDevice() ||
208
+ srcStat.isBlockDevice()
209
+ )
210
+ return onFile(srcStat, destStat, src, dest, opts);
211
+ if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
212
+ if (srcStat.isSocket())
213
+ throw new Error(`Cannot copy a socket file: ${src}`);
214
+ if (srcStat.isFIFO())
215
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
216
+ throw new Error(`Unknown file: ${src}`);
217
+ }
218
+ async function onFile(srcStat, destStat, src, dest, opts) {
219
+ if (!destStat) return copyFile(srcStat, src, dest, opts);
220
+ if (opts.overwrite) {
221
+ await fs.unlink(dest);
222
+ return copyFile(srcStat, src, dest, opts);
223
+ }
224
+ if (opts.errorOnExist) {
225
+ throw new Error(`'${dest}' already exists`);
226
+ }
227
+ }
228
+ async function copyFile(srcStat, src, dest, opts) {
229
+ await fs.copyFile(src, dest);
230
+ if (opts.preserveTimestamps) {
231
+ if (fileIsNotWritable(srcStat.mode)) {
232
+ await makeFileWritable(dest, srcStat.mode);
233
+ }
234
+ const updatedSrcStat = await fs.stat(src);
235
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
236
+ }
237
+ return fs.chmod(dest, srcStat.mode);
238
+ }
239
+ function fileIsNotWritable(srcMode) {
240
+ return (srcMode & 128) === 0;
241
+ }
242
+ function makeFileWritable(dest, srcMode) {
243
+ return fs.chmod(dest, srcMode | 128);
244
+ }
245
+ async function onDir(srcStat, destStat, src, dest, opts) {
246
+ if (!destStat) {
247
+ await fs.mkdir(dest);
248
+ }
249
+ const items = await fs.readdir(src);
250
+ await Promise.all(
251
+ items.map(async (item) => {
252
+ const srcItem = path.join(src, item);
253
+ const destItem = path.join(dest, item);
254
+ const include = await runFilter(srcItem, destItem, opts);
255
+ if (!include) return;
256
+ const { destStat } = await stat.checkPaths(
257
+ srcItem,
258
+ destItem,
259
+ "copy",
260
+ opts,
261
+ );
262
+ return getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
263
+ }),
264
+ );
265
+ if (!destStat) {
266
+ await fs.chmod(dest, srcStat.mode);
267
+ }
268
+ }
269
+ async function onLink(destStat, src, dest, opts) {
270
+ let resolvedSrc = await fs.readlink(src);
271
+ if (opts.dereference) {
272
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
273
+ }
274
+ if (!destStat) {
275
+ return fs.symlink(resolvedSrc, dest);
276
+ }
277
+ let resolvedDest = null;
278
+ try {
279
+ resolvedDest = await fs.readlink(dest);
280
+ } catch (e) {
281
+ if (e.code === "EINVAL" || e.code === "UNKNOWN")
282
+ return fs.symlink(resolvedSrc, dest);
283
+ throw e;
284
+ }
285
+ if (opts.dereference) {
286
+ resolvedDest = path.resolve(process.cwd(), resolvedDest);
287
+ }
288
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
289
+ throw new Error(
290
+ `Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`,
291
+ );
292
+ }
293
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
294
+ throw new Error(
295
+ `Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`,
296
+ );
297
+ }
298
+ await fs.unlink(dest);
299
+ return fs.symlink(resolvedSrc, dest);
300
+ }
301
+ module1.exports = copy;
1894
302
  },
1895
- enumerable: true,
1896
- configurable: true
1897
- })
1898
- Object.defineProperty(fs, 'WriteStream', {
1899
- get: function () {
1900
- return WriteStream
303
+ 852: (module1, __unused_webpack_exports, __nccwpck_require__) => {
304
+ "use strict";
305
+ const u = __nccwpck_require__(59).fromPromise;
306
+ module1.exports = {
307
+ copy: u(__nccwpck_require__(770)),
308
+ copySync: __nccwpck_require__(524),
309
+ };
1901
310
  },
1902
- set: function (val) {
1903
- WriteStream = val
311
+ 783: (module1, __unused_webpack_exports, __nccwpck_require__) => {
312
+ "use strict";
313
+ const u = __nccwpck_require__(59).fromPromise;
314
+ const fs = __nccwpck_require__(845);
315
+ const path = __nccwpck_require__(17);
316
+ const mkdir = __nccwpck_require__(516);
317
+ const remove = __nccwpck_require__(58);
318
+ const emptyDir = u(async function emptyDir(dir) {
319
+ let items;
320
+ try {
321
+ items = await fs.readdir(dir);
322
+ } catch {
323
+ return mkdir.mkdirs(dir);
324
+ }
325
+ return Promise.all(
326
+ items.map((item) => remove.remove(path.join(dir, item))),
327
+ );
328
+ });
329
+ function emptyDirSync(dir) {
330
+ let items;
331
+ try {
332
+ items = fs.readdirSync(dir);
333
+ } catch {
334
+ return mkdir.mkdirsSync(dir);
335
+ }
336
+ items.forEach((item) => {
337
+ item = path.join(dir, item);
338
+ remove.removeSync(item);
339
+ });
340
+ }
341
+ module1.exports = {
342
+ emptyDirSync,
343
+ emptydirSync: emptyDirSync,
344
+ emptyDir,
345
+ emptydir: emptyDir,
346
+ };
1904
347
  },
1905
- enumerable: true,
1906
- configurable: true
1907
- })
1908
-
1909
- // legacy names
1910
- var FileReadStream = ReadStream
1911
- Object.defineProperty(fs, 'FileReadStream', {
1912
- get: function () {
1913
- return FileReadStream
348
+ 530: (module1, __unused_webpack_exports, __nccwpck_require__) => {
349
+ "use strict";
350
+ const u = __nccwpck_require__(59).fromPromise;
351
+ const path = __nccwpck_require__(17);
352
+ const fs = __nccwpck_require__(845);
353
+ const mkdir = __nccwpck_require__(516);
354
+ async function createFile(file) {
355
+ let stats;
356
+ try {
357
+ stats = await fs.stat(file);
358
+ } catch {}
359
+ if (stats && stats.isFile()) return;
360
+ const dir = path.dirname(file);
361
+ let dirStats = null;
362
+ try {
363
+ dirStats = await fs.stat(dir);
364
+ } catch (err) {
365
+ if (err.code === "ENOENT") {
366
+ await mkdir.mkdirs(dir);
367
+ await fs.writeFile(file, "");
368
+ return;
369
+ } else {
370
+ throw err;
371
+ }
372
+ }
373
+ if (dirStats.isDirectory()) {
374
+ await fs.writeFile(file, "");
375
+ } else {
376
+ await fs.readdir(dir);
377
+ }
378
+ }
379
+ function createFileSync(file) {
380
+ let stats;
381
+ try {
382
+ stats = fs.statSync(file);
383
+ } catch {}
384
+ if (stats && stats.isFile()) return;
385
+ const dir = path.dirname(file);
386
+ try {
387
+ if (!fs.statSync(dir).isDirectory()) {
388
+ fs.readdirSync(dir);
389
+ }
390
+ } catch (err) {
391
+ if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
392
+ else throw err;
393
+ }
394
+ fs.writeFileSync(file, "");
395
+ }
396
+ module1.exports = { createFile: u(createFile), createFileSync };
1914
397
  },
1915
- set: function (val) {
1916
- FileReadStream = val
398
+ 960: (module1, __unused_webpack_exports, __nccwpck_require__) => {
399
+ "use strict";
400
+ const { createFile, createFileSync } = __nccwpck_require__(530);
401
+ const { createLink, createLinkSync } = __nccwpck_require__(404);
402
+ const { createSymlink, createSymlinkSync } = __nccwpck_require__(425);
403
+ module1.exports = {
404
+ createFile,
405
+ createFileSync,
406
+ ensureFile: createFile,
407
+ ensureFileSync: createFileSync,
408
+ createLink,
409
+ createLinkSync,
410
+ ensureLink: createLink,
411
+ ensureLinkSync: createLinkSync,
412
+ createSymlink,
413
+ createSymlinkSync,
414
+ ensureSymlink: createSymlink,
415
+ ensureSymlinkSync: createSymlinkSync,
416
+ };
1917
417
  },
1918
- enumerable: true,
1919
- configurable: true
1920
- })
1921
- var FileWriteStream = WriteStream
1922
- Object.defineProperty(fs, 'FileWriteStream', {
1923
- get: function () {
1924
- return FileWriteStream
418
+ 404: (module1, __unused_webpack_exports, __nccwpck_require__) => {
419
+ "use strict";
420
+ const u = __nccwpck_require__(59).fromPromise;
421
+ const path = __nccwpck_require__(17);
422
+ const fs = __nccwpck_require__(845);
423
+ const mkdir = __nccwpck_require__(516);
424
+ const { pathExists } = __nccwpck_require__(667);
425
+ const { areIdentical } = __nccwpck_require__(826);
426
+ async function createLink(srcpath, dstpath) {
427
+ let dstStat;
428
+ try {
429
+ dstStat = await fs.lstat(dstpath);
430
+ } catch {}
431
+ let srcStat;
432
+ try {
433
+ srcStat = await fs.lstat(srcpath);
434
+ } catch (err) {
435
+ err.message = err.message.replace("lstat", "ensureLink");
436
+ throw err;
437
+ }
438
+ if (dstStat && areIdentical(srcStat, dstStat)) return;
439
+ const dir = path.dirname(dstpath);
440
+ const dirExists = await pathExists(dir);
441
+ if (!dirExists) {
442
+ await mkdir.mkdirs(dir);
443
+ }
444
+ await fs.link(srcpath, dstpath);
445
+ }
446
+ function createLinkSync(srcpath, dstpath) {
447
+ let dstStat;
448
+ try {
449
+ dstStat = fs.lstatSync(dstpath);
450
+ } catch {}
451
+ try {
452
+ const srcStat = fs.lstatSync(srcpath);
453
+ if (dstStat && areIdentical(srcStat, dstStat)) return;
454
+ } catch (err) {
455
+ err.message = err.message.replace("lstat", "ensureLink");
456
+ throw err;
457
+ }
458
+ const dir = path.dirname(dstpath);
459
+ const dirExists = fs.existsSync(dir);
460
+ if (dirExists) return fs.linkSync(srcpath, dstpath);
461
+ mkdir.mkdirsSync(dir);
462
+ return fs.linkSync(srcpath, dstpath);
463
+ }
464
+ module1.exports = { createLink: u(createLink), createLinkSync };
1925
465
  },
1926
- set: function (val) {
1927
- FileWriteStream = val
466
+ 687: (module1, __unused_webpack_exports, __nccwpck_require__) => {
467
+ "use strict";
468
+ const path = __nccwpck_require__(17);
469
+ const fs = __nccwpck_require__(845);
470
+ const { pathExists } = __nccwpck_require__(667);
471
+ const u = __nccwpck_require__(59).fromPromise;
472
+ async function symlinkPaths(srcpath, dstpath) {
473
+ if (path.isAbsolute(srcpath)) {
474
+ try {
475
+ await fs.lstat(srcpath);
476
+ } catch (err) {
477
+ err.message = err.message.replace("lstat", "ensureSymlink");
478
+ throw err;
479
+ }
480
+ return { toCwd: srcpath, toDst: srcpath };
481
+ }
482
+ const dstdir = path.dirname(dstpath);
483
+ const relativeToDst = path.join(dstdir, srcpath);
484
+ const exists = await pathExists(relativeToDst);
485
+ if (exists) {
486
+ return { toCwd: relativeToDst, toDst: srcpath };
487
+ }
488
+ try {
489
+ await fs.lstat(srcpath);
490
+ } catch (err) {
491
+ err.message = err.message.replace("lstat", "ensureSymlink");
492
+ throw err;
493
+ }
494
+ return { toCwd: srcpath, toDst: path.relative(dstdir, srcpath) };
495
+ }
496
+ function symlinkPathsSync(srcpath, dstpath) {
497
+ if (path.isAbsolute(srcpath)) {
498
+ const exists = fs.existsSync(srcpath);
499
+ if (!exists) throw new Error("absolute srcpath does not exist");
500
+ return { toCwd: srcpath, toDst: srcpath };
501
+ }
502
+ const dstdir = path.dirname(dstpath);
503
+ const relativeToDst = path.join(dstdir, srcpath);
504
+ const exists = fs.existsSync(relativeToDst);
505
+ if (exists) {
506
+ return { toCwd: relativeToDst, toDst: srcpath };
507
+ }
508
+ const srcExists = fs.existsSync(srcpath);
509
+ if (!srcExists) throw new Error("relative srcpath does not exist");
510
+ return { toCwd: srcpath, toDst: path.relative(dstdir, srcpath) };
511
+ }
512
+ module1.exports = { symlinkPaths: u(symlinkPaths), symlinkPathsSync };
1928
513
  },
1929
- enumerable: true,
1930
- configurable: true
1931
- })
1932
-
1933
- function ReadStream (path, options) {
1934
- if (this instanceof ReadStream)
1935
- return fs$ReadStream.apply(this, arguments), this
1936
- else
1937
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
1938
- }
1939
-
1940
- function ReadStream$open () {
1941
- var that = this
1942
- open(that.path, that.flags, that.mode, function (err, fd) {
1943
- if (err) {
1944
- if (that.autoClose)
1945
- that.destroy()
1946
-
1947
- that.emit('error', err)
1948
- } else {
1949
- that.fd = fd
1950
- that.emit('open', fd)
1951
- that.read()
514
+ 725: (module1, __unused_webpack_exports, __nccwpck_require__) => {
515
+ "use strict";
516
+ const fs = __nccwpck_require__(845);
517
+ const u = __nccwpck_require__(59).fromPromise;
518
+ async function symlinkType(srcpath, type) {
519
+ if (type) return type;
520
+ let stats;
521
+ try {
522
+ stats = await fs.lstat(srcpath);
523
+ } catch {
524
+ return "file";
525
+ }
526
+ return stats && stats.isDirectory() ? "dir" : "file";
1952
527
  }
1953
- })
1954
- }
1955
-
1956
- function WriteStream (path, options) {
1957
- if (this instanceof WriteStream)
1958
- return fs$WriteStream.apply(this, arguments), this
1959
- else
1960
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
1961
- }
1962
-
1963
- function WriteStream$open () {
1964
- var that = this
1965
- open(that.path, that.flags, that.mode, function (err, fd) {
1966
- if (err) {
1967
- that.destroy()
1968
- that.emit('error', err)
1969
- } else {
1970
- that.fd = fd
1971
- that.emit('open', fd)
528
+ function symlinkTypeSync(srcpath, type) {
529
+ if (type) return type;
530
+ let stats;
531
+ try {
532
+ stats = fs.lstatSync(srcpath);
533
+ } catch {
534
+ return "file";
535
+ }
536
+ return stats && stats.isDirectory() ? "dir" : "file";
1972
537
  }
1973
- })
1974
- }
1975
-
1976
- function createReadStream (path, options) {
1977
- return new fs.ReadStream(path, options)
1978
- }
1979
-
1980
- function createWriteStream (path, options) {
1981
- return new fs.WriteStream(path, options)
1982
- }
1983
-
1984
- var fs$open = fs.open
1985
- fs.open = open
1986
- function open (path, flags, mode, cb) {
1987
- if (typeof mode === 'function')
1988
- cb = mode, mode = null
1989
-
1990
- return go$open(path, flags, mode, cb)
1991
-
1992
- function go$open (path, flags, mode, cb, startTime) {
1993
- return fs$open(path, flags, mode, function (err, fd) {
1994
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
1995
- enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])
1996
- else {
1997
- if (typeof cb === 'function')
1998
- cb.apply(this, arguments)
1999
- }
2000
- })
2001
- }
2002
- }
2003
-
2004
- return fs
2005
- }
2006
-
2007
- function enqueue (elem) {
2008
- debug('ENQUEUE', elem[0].name, elem[1])
2009
- fs[gracefulQueue].push(elem)
2010
- retry()
2011
- }
2012
-
2013
- // keep track of the timeout between retry() calls
2014
- var retryTimer
2015
-
2016
- // reset the startTime and lastTime to now
2017
- // this resets the start of the 60 second overall timeout as well as the
2018
- // delay between attempts so that we'll retry these jobs sooner
2019
- function resetQueue () {
2020
- var now = Date.now()
2021
- for (var i = 0; i < fs[gracefulQueue].length; ++i) {
2022
- // entries that are only a length of 2 are from an older version, don't
2023
- // bother modifying those since they'll be retried anyway.
2024
- if (fs[gracefulQueue][i].length > 2) {
2025
- fs[gracefulQueue][i][3] = now // startTime
2026
- fs[gracefulQueue][i][4] = now // lastTime
2027
- }
2028
- }
2029
- // call retry to make sure we're actively processing the queue
2030
- retry()
2031
- }
2032
-
2033
- function retry () {
2034
- // clear the timer and remove it to help prevent unintended concurrency
2035
- clearTimeout(retryTimer)
2036
- retryTimer = undefined
2037
-
2038
- if (fs[gracefulQueue].length === 0)
2039
- return
2040
-
2041
- var elem = fs[gracefulQueue].shift()
2042
- var fn = elem[0]
2043
- var args = elem[1]
2044
- // these items may be unset if they were added by an older graceful-fs
2045
- var err = elem[2]
2046
- var startTime = elem[3]
2047
- var lastTime = elem[4]
2048
-
2049
- // if we don't have a startTime we have no way of knowing if we've waited
2050
- // long enough, so go ahead and retry this item now
2051
- if (startTime === undefined) {
2052
- debug('RETRY', fn.name, args)
2053
- fn.apply(null, args)
2054
- } else if (Date.now() - startTime >= 60000) {
2055
- // it's been more than 60 seconds total, bail now
2056
- debug('TIMEOUT', fn.name, args)
2057
- var cb = args.pop()
2058
- if (typeof cb === 'function')
2059
- cb.call(null, err)
2060
- } else {
2061
- // the amount of time between the last attempt and right now
2062
- var sinceAttempt = Date.now() - lastTime
2063
- // the amount of time between when we first tried, and when we last tried
2064
- // rounded up to at least 1
2065
- var sinceStart = Math.max(lastTime - startTime, 1)
2066
- // backoff. wait longer than the total time we've been retrying, but only
2067
- // up to a maximum of 100ms
2068
- var desiredDelay = Math.min(sinceStart * 1.2, 100)
2069
- // it's been long enough since the last retry, do it again
2070
- if (sinceAttempt >= desiredDelay) {
2071
- debug('RETRY', fn.name, args)
2072
- fn.apply(null, args.concat([startTime]))
2073
- } else {
2074
- // if we can't do this job yet, push it to the end of the queue
2075
- // and let the next iteration check again
2076
- fs[gracefulQueue].push(elem)
2077
- }
2078
- }
2079
-
2080
- // schedule our next run if one isn't already scheduled
2081
- if (retryTimer === undefined) {
2082
- retryTimer = setTimeout(retry, 0)
2083
- }
2084
- }
2085
-
2086
-
2087
- /***/ }),
2088
-
2089
- /***/ 915:
2090
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
2091
-
2092
- var Stream = (__nccwpck_require__(781).Stream)
2093
-
2094
- module.exports = legacy
2095
-
2096
- function legacy (fs) {
2097
- return {
2098
- ReadStream: ReadStream,
2099
- WriteStream: WriteStream
2100
- }
2101
-
2102
- function ReadStream (path, options) {
2103
- if (!(this instanceof ReadStream)) return new ReadStream(path, options);
2104
-
2105
- Stream.call(this);
2106
-
2107
- var self = this;
2108
-
2109
- this.path = path;
2110
- this.fd = null;
2111
- this.readable = true;
2112
- this.paused = false;
2113
-
2114
- this.flags = 'r';
2115
- this.mode = 438; /*=0666*/
2116
- this.bufferSize = 64 * 1024;
2117
-
2118
- options = options || {};
2119
-
2120
- // Mixin options into this
2121
- var keys = Object.keys(options);
2122
- for (var index = 0, length = keys.length; index < length; index++) {
2123
- var key = keys[index];
2124
- this[key] = options[key];
2125
- }
2126
-
2127
- if (this.encoding) this.setEncoding(this.encoding);
2128
-
2129
- if (this.start !== undefined) {
2130
- if ('number' !== typeof this.start) {
2131
- throw TypeError('start must be a Number');
2132
- }
2133
- if (this.end === undefined) {
2134
- this.end = Infinity;
2135
- } else if ('number' !== typeof this.end) {
2136
- throw TypeError('end must be a Number');
2137
- }
2138
-
2139
- if (this.start > this.end) {
2140
- throw new Error('start must be <= end');
2141
- }
2142
-
2143
- this.pos = this.start;
2144
- }
2145
-
2146
- if (this.fd !== null) {
2147
- process.nextTick(function() {
2148
- self._read();
538
+ module1.exports = { symlinkType: u(symlinkType), symlinkTypeSync };
539
+ },
540
+ 425: (module1, __unused_webpack_exports, __nccwpck_require__) => {
541
+ "use strict";
542
+ const u = __nccwpck_require__(59).fromPromise;
543
+ const path = __nccwpck_require__(17);
544
+ const fs = __nccwpck_require__(845);
545
+ const { mkdirs, mkdirsSync } = __nccwpck_require__(516);
546
+ const { symlinkPaths, symlinkPathsSync } = __nccwpck_require__(687);
547
+ const { symlinkType, symlinkTypeSync } = __nccwpck_require__(725);
548
+ const { pathExists } = __nccwpck_require__(667);
549
+ const { areIdentical } = __nccwpck_require__(826);
550
+ async function createSymlink(srcpath, dstpath, type) {
551
+ let stats;
552
+ try {
553
+ stats = await fs.lstat(dstpath);
554
+ } catch {}
555
+ if (stats && stats.isSymbolicLink()) {
556
+ const [srcStat, dstStat] = await Promise.all([
557
+ fs.stat(srcpath),
558
+ fs.stat(dstpath),
559
+ ]);
560
+ if (areIdentical(srcStat, dstStat)) return;
561
+ }
562
+ const relative = await symlinkPaths(srcpath, dstpath);
563
+ srcpath = relative.toDst;
564
+ const toType = await symlinkType(relative.toCwd, type);
565
+ const dir = path.dirname(dstpath);
566
+ if (!(await pathExists(dir))) {
567
+ await mkdirs(dir);
568
+ }
569
+ return fs.symlink(srcpath, dstpath, toType);
570
+ }
571
+ function createSymlinkSync(srcpath, dstpath, type) {
572
+ let stats;
573
+ try {
574
+ stats = fs.lstatSync(dstpath);
575
+ } catch {}
576
+ if (stats && stats.isSymbolicLink()) {
577
+ const srcStat = fs.statSync(srcpath);
578
+ const dstStat = fs.statSync(dstpath);
579
+ if (areIdentical(srcStat, dstStat)) return;
580
+ }
581
+ const relative = symlinkPathsSync(srcpath, dstpath);
582
+ srcpath = relative.toDst;
583
+ type = symlinkTypeSync(relative.toCwd, type);
584
+ const dir = path.dirname(dstpath);
585
+ const exists = fs.existsSync(dir);
586
+ if (exists) return fs.symlinkSync(srcpath, dstpath, type);
587
+ mkdirsSync(dir);
588
+ return fs.symlinkSync(srcpath, dstpath, type);
589
+ }
590
+ module1.exports = { createSymlink: u(createSymlink), createSymlinkSync };
591
+ },
592
+ 845: (__unused_webpack_module, exports, __nccwpck_require__) => {
593
+ "use strict";
594
+ const u = __nccwpck_require__(59).fromCallback;
595
+ const fs = __nccwpck_require__(804);
596
+ const api = [
597
+ "access",
598
+ "appendFile",
599
+ "chmod",
600
+ "chown",
601
+ "close",
602
+ "copyFile",
603
+ "fchmod",
604
+ "fchown",
605
+ "fdatasync",
606
+ "fstat",
607
+ "fsync",
608
+ "ftruncate",
609
+ "futimes",
610
+ "lchmod",
611
+ "lchown",
612
+ "link",
613
+ "lstat",
614
+ "mkdir",
615
+ "mkdtemp",
616
+ "open",
617
+ "opendir",
618
+ "readdir",
619
+ "readFile",
620
+ "readlink",
621
+ "realpath",
622
+ "rename",
623
+ "rm",
624
+ "rmdir",
625
+ "stat",
626
+ "symlink",
627
+ "truncate",
628
+ "unlink",
629
+ "utimes",
630
+ "writeFile",
631
+ ].filter((key) => {
632
+ return typeof fs[key] === "function";
2149
633
  });
2150
- return;
2151
- }
2152
-
2153
- fs.open(this.path, this.flags, this.mode, function (err, fd) {
2154
- if (err) {
2155
- self.emit('error', err);
2156
- self.readable = false;
2157
- return;
2158
- }
2159
-
2160
- self.fd = fd;
2161
- self.emit('open', fd);
2162
- self._read();
2163
- })
2164
- }
2165
-
2166
- function WriteStream (path, options) {
2167
- if (!(this instanceof WriteStream)) return new WriteStream(path, options);
2168
-
2169
- Stream.call(this);
2170
-
2171
- this.path = path;
2172
- this.fd = null;
2173
- this.writable = true;
2174
-
2175
- this.flags = 'w';
2176
- this.encoding = 'binary';
2177
- this.mode = 438; /*=0666*/
2178
- this.bytesWritten = 0;
2179
-
2180
- options = options || {};
2181
-
2182
- // Mixin options into this
2183
- var keys = Object.keys(options);
2184
- for (var index = 0, length = keys.length; index < length; index++) {
2185
- var key = keys[index];
2186
- this[key] = options[key];
2187
- }
2188
-
2189
- if (this.start !== undefined) {
2190
- if ('number' !== typeof this.start) {
2191
- throw TypeError('start must be a Number');
634
+ Object.assign(exports, fs);
635
+ api.forEach((method) => {
636
+ exports[method] = u(fs[method]);
637
+ });
638
+ exports.exists = function (filename, callback) {
639
+ if (typeof callback === "function") {
640
+ return fs.exists(filename, callback);
641
+ }
642
+ return new Promise((resolve) => {
643
+ return fs.exists(filename, resolve);
644
+ });
645
+ };
646
+ exports.read = function (fd, buffer, offset, length, position, callback) {
647
+ if (typeof callback === "function") {
648
+ return fs.read(fd, buffer, offset, length, position, callback);
649
+ }
650
+ return new Promise((resolve, reject) => {
651
+ fs.read(
652
+ fd,
653
+ buffer,
654
+ offset,
655
+ length,
656
+ position,
657
+ (err, bytesRead, buffer) => {
658
+ if (err) return reject(err);
659
+ resolve({ bytesRead, buffer });
660
+ },
661
+ );
662
+ });
663
+ };
664
+ exports.write = function (fd, buffer, ...args) {
665
+ if (typeof args[args.length - 1] === "function") {
666
+ return fs.write(fd, buffer, ...args);
667
+ }
668
+ return new Promise((resolve, reject) => {
669
+ fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
670
+ if (err) return reject(err);
671
+ resolve({ bytesWritten, buffer });
672
+ });
673
+ });
674
+ };
675
+ exports.readv = function (fd, buffers, ...args) {
676
+ if (typeof args[args.length - 1] === "function") {
677
+ return fs.readv(fd, buffers, ...args);
678
+ }
679
+ return new Promise((resolve, reject) => {
680
+ fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
681
+ if (err) return reject(err);
682
+ resolve({ bytesRead, buffers });
683
+ });
684
+ });
685
+ };
686
+ exports.writev = function (fd, buffers, ...args) {
687
+ if (typeof args[args.length - 1] === "function") {
688
+ return fs.writev(fd, buffers, ...args);
689
+ }
690
+ return new Promise((resolve, reject) => {
691
+ fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
692
+ if (err) return reject(err);
693
+ resolve({ bytesWritten, buffers });
694
+ });
695
+ });
696
+ };
697
+ if (typeof fs.realpath.native === "function") {
698
+ exports.realpath.native = u(fs.realpath.native);
699
+ } else {
700
+ process.emitWarning(
701
+ "fs.realpath.native is not a function. Is fs being monkey-patched?",
702
+ "Warning",
703
+ "fs-extra-WARN0003",
704
+ );
2192
705
  }
2193
- if (this.start < 0) {
2194
- throw new Error('start must be >= zero');
706
+ },
707
+ 175: (module1, __unused_webpack_exports, __nccwpck_require__) => {
708
+ "use strict";
709
+ module1.exports = {
710
+ ...__nccwpck_require__(845),
711
+ ...__nccwpck_require__(852),
712
+ ...__nccwpck_require__(783),
713
+ ...__nccwpck_require__(960),
714
+ ...__nccwpck_require__(540),
715
+ ...__nccwpck_require__(516),
716
+ ...__nccwpck_require__(135),
717
+ ...__nccwpck_require__(987),
718
+ ...__nccwpck_require__(667),
719
+ ...__nccwpck_require__(58),
720
+ };
721
+ },
722
+ 540: (module1, __unused_webpack_exports, __nccwpck_require__) => {
723
+ "use strict";
724
+ const u = __nccwpck_require__(59).fromPromise;
725
+ const jsonFile = __nccwpck_require__(869);
726
+ jsonFile.outputJson = u(__nccwpck_require__(201));
727
+ jsonFile.outputJsonSync = __nccwpck_require__(709);
728
+ jsonFile.outputJSON = jsonFile.outputJson;
729
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync;
730
+ jsonFile.writeJSON = jsonFile.writeJson;
731
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync;
732
+ jsonFile.readJSON = jsonFile.readJson;
733
+ jsonFile.readJSONSync = jsonFile.readJsonSync;
734
+ module1.exports = jsonFile;
735
+ },
736
+ 869: (module1, __unused_webpack_exports, __nccwpck_require__) => {
737
+ "use strict";
738
+ const jsonFile = __nccwpck_require__(449);
739
+ module1.exports = {
740
+ readJson: jsonFile.readFile,
741
+ readJsonSync: jsonFile.readFileSync,
742
+ writeJson: jsonFile.writeFile,
743
+ writeJsonSync: jsonFile.writeFileSync,
744
+ };
745
+ },
746
+ 709: (module1, __unused_webpack_exports, __nccwpck_require__) => {
747
+ "use strict";
748
+ const { stringify } = __nccwpck_require__(213);
749
+ const { outputFileSync } = __nccwpck_require__(987);
750
+ function outputJsonSync(file, data, options) {
751
+ const str = stringify(data, options);
752
+ outputFileSync(file, str, options);
2195
753
  }
2196
-
2197
- this.pos = this.start;
2198
- }
2199
-
2200
- this.busy = false;
2201
- this._queue = [];
2202
-
2203
- if (this.fd === null) {
2204
- this._open = fs.open;
2205
- this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
2206
- this.flush();
2207
- }
2208
- }
2209
- }
2210
-
2211
-
2212
- /***/ }),
2213
-
2214
- /***/ 567:
2215
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
2216
-
2217
- var constants = __nccwpck_require__(57)
2218
-
2219
- var origCwd = process.cwd
2220
- var cwd = null
2221
-
2222
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
2223
-
2224
- process.cwd = function() {
2225
- if (!cwd)
2226
- cwd = origCwd.call(process)
2227
- return cwd
2228
- }
2229
- try {
2230
- process.cwd()
2231
- } catch (er) {}
2232
-
2233
- // This check is needed until node.js 12 is required
2234
- if (typeof process.chdir === 'function') {
2235
- var chdir = process.chdir
2236
- process.chdir = function (d) {
2237
- cwd = null
2238
- chdir.call(process, d)
2239
- }
2240
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir)
2241
- }
2242
-
2243
- module.exports = patch
2244
-
2245
- function patch (fs) {
2246
- // (re-)implement some things that are known busted or missing.
2247
-
2248
- // lchmod, broken prior to 0.6.2
2249
- // back-port the fix here.
2250
- if (constants.hasOwnProperty('O_SYMLINK') &&
2251
- process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
2252
- patchLchmod(fs)
2253
- }
2254
-
2255
- // lutimes implementation, or no-op
2256
- if (!fs.lutimes) {
2257
- patchLutimes(fs)
2258
- }
2259
-
2260
- // https://github.com/isaacs/node-graceful-fs/issues/4
2261
- // Chown should not fail on einval or eperm if non-root.
2262
- // It should not fail on enosys ever, as this just indicates
2263
- // that a fs doesn't support the intended operation.
2264
-
2265
- fs.chown = chownFix(fs.chown)
2266
- fs.fchown = chownFix(fs.fchown)
2267
- fs.lchown = chownFix(fs.lchown)
2268
-
2269
- fs.chmod = chmodFix(fs.chmod)
2270
- fs.fchmod = chmodFix(fs.fchmod)
2271
- fs.lchmod = chmodFix(fs.lchmod)
2272
-
2273
- fs.chownSync = chownFixSync(fs.chownSync)
2274
- fs.fchownSync = chownFixSync(fs.fchownSync)
2275
- fs.lchownSync = chownFixSync(fs.lchownSync)
2276
-
2277
- fs.chmodSync = chmodFixSync(fs.chmodSync)
2278
- fs.fchmodSync = chmodFixSync(fs.fchmodSync)
2279
- fs.lchmodSync = chmodFixSync(fs.lchmodSync)
2280
-
2281
- fs.stat = statFix(fs.stat)
2282
- fs.fstat = statFix(fs.fstat)
2283
- fs.lstat = statFix(fs.lstat)
2284
-
2285
- fs.statSync = statFixSync(fs.statSync)
2286
- fs.fstatSync = statFixSync(fs.fstatSync)
2287
- fs.lstatSync = statFixSync(fs.lstatSync)
2288
-
2289
- // if lchmod/lchown do not exist, then make them no-ops
2290
- if (fs.chmod && !fs.lchmod) {
2291
- fs.lchmod = function (path, mode, cb) {
2292
- if (cb) process.nextTick(cb)
2293
- }
2294
- fs.lchmodSync = function () {}
2295
- }
2296
- if (fs.chown && !fs.lchown) {
2297
- fs.lchown = function (path, uid, gid, cb) {
2298
- if (cb) process.nextTick(cb)
2299
- }
2300
- fs.lchownSync = function () {}
2301
- }
2302
-
2303
- // on Windows, A/V software can lock the directory, causing this
2304
- // to fail with an EACCES or EPERM if the directory contains newly
2305
- // created files. Try again on failure, for up to 60 seconds.
2306
-
2307
- // Set the timeout this long because some Windows Anti-Virus, such as Parity
2308
- // bit9, may lock files for up to a minute, causing npm package install
2309
- // failures. Also, take care to yield the scheduler. Windows scheduling gives
2310
- // CPU to a busy looping process, which can cause the program causing the lock
2311
- // contention to be starved of CPU by node, so the contention doesn't resolve.
2312
- if (platform === "win32") {
2313
- fs.rename = typeof fs.rename !== 'function' ? fs.rename
2314
- : (function (fs$rename) {
2315
- function rename (from, to, cb) {
2316
- var start = Date.now()
2317
- var backoff = 0;
2318
- fs$rename(from, to, function CB (er) {
2319
- if (er
2320
- && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY")
2321
- && Date.now() - start < 60000) {
2322
- setTimeout(function() {
2323
- fs.stat(to, function (stater, st) {
2324
- if (stater && stater.code === "ENOENT")
2325
- fs$rename(from, to, CB);
2326
- else
2327
- cb(er)
2328
- })
2329
- }, backoff)
2330
- if (backoff < 100)
2331
- backoff += 10;
2332
- return;
754
+ module1.exports = outputJsonSync;
755
+ },
756
+ 201: (module1, __unused_webpack_exports, __nccwpck_require__) => {
757
+ "use strict";
758
+ const { stringify } = __nccwpck_require__(213);
759
+ const { outputFile } = __nccwpck_require__(987);
760
+ async function outputJson(file, data, options = {}) {
761
+ const str = stringify(data, options);
762
+ await outputFile(file, str, options);
763
+ }
764
+ module1.exports = outputJson;
765
+ },
766
+ 516: (module1, __unused_webpack_exports, __nccwpck_require__) => {
767
+ "use strict";
768
+ const u = __nccwpck_require__(59).fromPromise;
769
+ const { makeDir: _makeDir, makeDirSync } = __nccwpck_require__(368);
770
+ const makeDir = u(_makeDir);
771
+ module1.exports = {
772
+ mkdirs: makeDir,
773
+ mkdirsSync: makeDirSync,
774
+ mkdirp: makeDir,
775
+ mkdirpSync: makeDirSync,
776
+ ensureDir: makeDir,
777
+ ensureDirSync: makeDirSync,
778
+ };
779
+ },
780
+ 368: (module1, __unused_webpack_exports, __nccwpck_require__) => {
781
+ "use strict";
782
+ const fs = __nccwpck_require__(845);
783
+ const { checkPath } = __nccwpck_require__(676);
784
+ const getMode = (options) => {
785
+ const defaults = { mode: 511 };
786
+ if (typeof options === "number") return options;
787
+ return { ...defaults, ...options }.mode;
788
+ };
789
+ module1.exports.makeDir = async (dir, options) => {
790
+ checkPath(dir);
791
+ return fs.mkdir(dir, { mode: getMode(options), recursive: true });
792
+ };
793
+ module1.exports.makeDirSync = (dir, options) => {
794
+ checkPath(dir);
795
+ return fs.mkdirSync(dir, { mode: getMode(options), recursive: true });
796
+ };
797
+ },
798
+ 676: (module1, __unused_webpack_exports, __nccwpck_require__) => {
799
+ "use strict";
800
+ const path = __nccwpck_require__(17);
801
+ module1.exports.checkPath = function checkPath(pth) {
802
+ if (process.platform === "win32") {
803
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(
804
+ pth.replace(path.parse(pth).root, ""),
805
+ );
806
+ if (pathHasInvalidWinCharacters) {
807
+ const error = new Error(`Path contains invalid characters: ${pth}`);
808
+ error.code = "EINVAL";
809
+ throw error;
2333
810
  }
2334
- if (cb) cb(er)
2335
- })
811
+ }
812
+ };
813
+ },
814
+ 135: (module1, __unused_webpack_exports, __nccwpck_require__) => {
815
+ "use strict";
816
+ const u = __nccwpck_require__(59).fromPromise;
817
+ module1.exports = {
818
+ move: u(__nccwpck_require__(497)),
819
+ moveSync: __nccwpck_require__(801),
820
+ };
821
+ },
822
+ 801: (module1, __unused_webpack_exports, __nccwpck_require__) => {
823
+ "use strict";
824
+ const fs = __nccwpck_require__(804);
825
+ const path = __nccwpck_require__(17);
826
+ const copySync = __nccwpck_require__(852).copySync;
827
+ const removeSync = __nccwpck_require__(58).removeSync;
828
+ const mkdirpSync = __nccwpck_require__(516).mkdirpSync;
829
+ const stat = __nccwpck_require__(826);
830
+ function moveSync(src, dest, opts) {
831
+ opts = opts || {};
832
+ const overwrite = opts.overwrite || opts.clobber || false;
833
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(
834
+ src,
835
+ dest,
836
+ "move",
837
+ opts,
838
+ );
839
+ stat.checkParentPathsSync(src, srcStat, dest, "move");
840
+ if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest));
841
+ return doRename(src, dest, overwrite, isChangingCase);
2336
842
  }
2337
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename)
2338
- return rename
2339
- })(fs.rename)
2340
- }
2341
-
2342
- // if read() returns EAGAIN, then just try it again.
2343
- fs.read = typeof fs.read !== 'function' ? fs.read
2344
- : (function (fs$read) {
2345
- function read (fd, buffer, offset, length, position, callback_) {
2346
- var callback
2347
- if (callback_ && typeof callback_ === 'function') {
2348
- var eagCounter = 0
2349
- callback = function (er, _, __) {
2350
- if (er && er.code === 'EAGAIN' && eagCounter < 10) {
2351
- eagCounter ++
2352
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
843
+ function isParentRoot(dest) {
844
+ const parent = path.dirname(dest);
845
+ const parsedPath = path.parse(parent);
846
+ return parsedPath.root === parent;
847
+ }
848
+ function doRename(src, dest, overwrite, isChangingCase) {
849
+ if (isChangingCase) return rename(src, dest, overwrite);
850
+ if (overwrite) {
851
+ removeSync(dest);
852
+ return rename(src, dest, overwrite);
853
+ }
854
+ if (fs.existsSync(dest)) throw new Error("dest already exists.");
855
+ return rename(src, dest, overwrite);
856
+ }
857
+ function rename(src, dest, overwrite) {
858
+ try {
859
+ fs.renameSync(src, dest);
860
+ } catch (err) {
861
+ if (err.code !== "EXDEV") throw err;
862
+ return moveAcrossDevice(src, dest, overwrite);
863
+ }
864
+ }
865
+ function moveAcrossDevice(src, dest, overwrite) {
866
+ const opts = {
867
+ overwrite,
868
+ errorOnExist: true,
869
+ preserveTimestamps: true,
870
+ };
871
+ copySync(src, dest, opts);
872
+ return removeSync(src);
873
+ }
874
+ module1.exports = moveSync;
875
+ },
876
+ 497: (module1, __unused_webpack_exports, __nccwpck_require__) => {
877
+ "use strict";
878
+ const fs = __nccwpck_require__(845);
879
+ const path = __nccwpck_require__(17);
880
+ const { copy } = __nccwpck_require__(852);
881
+ const { remove } = __nccwpck_require__(58);
882
+ const { mkdirp } = __nccwpck_require__(516);
883
+ const { pathExists } = __nccwpck_require__(667);
884
+ const stat = __nccwpck_require__(826);
885
+ async function move(src, dest, opts = {}) {
886
+ const overwrite = opts.overwrite || opts.clobber || false;
887
+ const { srcStat, isChangingCase = false } = await stat.checkPaths(
888
+ src,
889
+ dest,
890
+ "move",
891
+ opts,
892
+ );
893
+ await stat.checkParentPaths(src, srcStat, dest, "move");
894
+ const destParent = path.dirname(dest);
895
+ const parsedParentPath = path.parse(destParent);
896
+ if (parsedParentPath.root !== destParent) {
897
+ await mkdirp(destParent);
898
+ }
899
+ return doRename(src, dest, overwrite, isChangingCase);
900
+ }
901
+ async function doRename(src, dest, overwrite, isChangingCase) {
902
+ if (!isChangingCase) {
903
+ if (overwrite) {
904
+ await remove(dest);
905
+ } else if (await pathExists(dest)) {
906
+ throw new Error("dest already exists.");
2353
907
  }
2354
- callback_.apply(this, arguments)
908
+ }
909
+ try {
910
+ await fs.rename(src, dest);
911
+ } catch (err) {
912
+ if (err.code !== "EXDEV") {
913
+ throw err;
914
+ }
915
+ await moveAcrossDevice(src, dest, overwrite);
2355
916
  }
2356
917
  }
2357
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
2358
- }
2359
-
2360
- // This ensures `util.promisify` works as it does for native `fs.read`.
2361
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)
2362
- return read
2363
- })(fs.read)
2364
-
2365
- fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
2366
- : (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
2367
- var eagCounter = 0
2368
- while (true) {
2369
- try {
2370
- return fs$readSync.call(fs, fd, buffer, offset, length, position)
2371
- } catch (er) {
2372
- if (er.code === 'EAGAIN' && eagCounter < 10) {
2373
- eagCounter ++
2374
- continue
918
+ async function moveAcrossDevice(src, dest, overwrite) {
919
+ const opts = {
920
+ overwrite,
921
+ errorOnExist: true,
922
+ preserveTimestamps: true,
923
+ };
924
+ await copy(src, dest, opts);
925
+ return remove(src);
926
+ }
927
+ module1.exports = move;
928
+ },
929
+ 987: (module1, __unused_webpack_exports, __nccwpck_require__) => {
930
+ "use strict";
931
+ const u = __nccwpck_require__(59).fromPromise;
932
+ const fs = __nccwpck_require__(845);
933
+ const path = __nccwpck_require__(17);
934
+ const mkdir = __nccwpck_require__(516);
935
+ const pathExists = __nccwpck_require__(667).pathExists;
936
+ async function outputFile(file, data, encoding = "utf-8") {
937
+ const dir = path.dirname(file);
938
+ if (!(await pathExists(dir))) {
939
+ await mkdir.mkdirs(dir);
2375
940
  }
2376
- throw er
941
+ return fs.writeFile(file, data, encoding);
2377
942
  }
2378
- }
2379
- }})(fs.readSync)
2380
-
2381
- function patchLchmod (fs) {
2382
- fs.lchmod = function (path, mode, callback) {
2383
- fs.open( path
2384
- , constants.O_WRONLY | constants.O_SYMLINK
2385
- , mode
2386
- , function (err, fd) {
2387
- if (err) {
2388
- if (callback) callback(err)
2389
- return
2390
- }
2391
- // prefer to return the chmod error, if one occurs,
2392
- // but still try to close, and report closing errors if they occur.
2393
- fs.fchmod(fd, mode, function (err) {
2394
- fs.close(fd, function(err2) {
2395
- if (callback) callback(err || err2)
2396
- })
2397
- })
2398
- })
2399
- }
2400
-
2401
- fs.lchmodSync = function (path, mode) {
2402
- var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
2403
-
2404
- // prefer to return the chmod error, if one occurs,
2405
- // but still try to close, and report closing errors if they occur.
2406
- var threw = true
2407
- var ret
2408
- try {
2409
- ret = fs.fchmodSync(fd, mode)
2410
- threw = false
2411
- } finally {
2412
- if (threw) {
2413
- try {
2414
- fs.closeSync(fd)
2415
- } catch (er) {}
2416
- } else {
2417
- fs.closeSync(fd)
943
+ function outputFileSync(file, ...args) {
944
+ const dir = path.dirname(file);
945
+ if (!fs.existsSync(dir)) {
946
+ mkdir.mkdirsSync(dir);
2418
947
  }
948
+ fs.writeFileSync(file, ...args);
2419
949
  }
2420
- return ret
2421
- }
2422
- }
2423
-
2424
- function patchLutimes (fs) {
2425
- if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
2426
- fs.lutimes = function (path, at, mt, cb) {
2427
- fs.open(path, constants.O_SYMLINK, function (er, fd) {
2428
- if (er) {
2429
- if (cb) cb(er)
2430
- return
950
+ module1.exports = { outputFile: u(outputFile), outputFileSync };
951
+ },
952
+ 667: (module1, __unused_webpack_exports, __nccwpck_require__) => {
953
+ "use strict";
954
+ const u = __nccwpck_require__(59).fromPromise;
955
+ const fs = __nccwpck_require__(845);
956
+ function pathExists(path) {
957
+ return fs
958
+ .access(path)
959
+ .then(() => true)
960
+ .catch(() => false);
961
+ }
962
+ module1.exports = {
963
+ pathExists: u(pathExists),
964
+ pathExistsSync: fs.existsSync,
965
+ };
966
+ },
967
+ 58: (module1, __unused_webpack_exports, __nccwpck_require__) => {
968
+ "use strict";
969
+ const fs = __nccwpck_require__(804);
970
+ const u = __nccwpck_require__(59).fromCallback;
971
+ function remove(path, callback) {
972
+ fs.rm(path, { recursive: true, force: true }, callback);
973
+ }
974
+ function removeSync(path) {
975
+ fs.rmSync(path, { recursive: true, force: true });
976
+ }
977
+ module1.exports = { remove: u(remove), removeSync };
978
+ },
979
+ 826: (module1, __unused_webpack_exports, __nccwpck_require__) => {
980
+ "use strict";
981
+ const fs = __nccwpck_require__(845);
982
+ const path = __nccwpck_require__(17);
983
+ const u = __nccwpck_require__(59).fromPromise;
984
+ function getStats(src, dest, opts) {
985
+ const statFunc = opts.dereference
986
+ ? (file) => fs.stat(file, { bigint: true })
987
+ : (file) => fs.lstat(file, { bigint: true });
988
+ return Promise.all([
989
+ statFunc(src),
990
+ statFunc(dest).catch((err) => {
991
+ if (err.code === "ENOENT") return null;
992
+ throw err;
993
+ }),
994
+ ]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
995
+ }
996
+ function getStatsSync(src, dest, opts) {
997
+ let destStat;
998
+ const statFunc = opts.dereference
999
+ ? (file) => fs.statSync(file, { bigint: true })
1000
+ : (file) => fs.lstatSync(file, { bigint: true });
1001
+ const srcStat = statFunc(src);
1002
+ try {
1003
+ destStat = statFunc(dest);
1004
+ } catch (err) {
1005
+ if (err.code === "ENOENT") return { srcStat, destStat: null };
1006
+ throw err;
1007
+ }
1008
+ return { srcStat, destStat };
1009
+ }
1010
+ async function checkPaths(src, dest, funcName, opts) {
1011
+ const { srcStat, destStat } = await getStats(src, dest, opts);
1012
+ if (destStat) {
1013
+ if (areIdentical(srcStat, destStat)) {
1014
+ const srcBaseName = path.basename(src);
1015
+ const destBaseName = path.basename(dest);
1016
+ if (
1017
+ funcName === "move" &&
1018
+ srcBaseName !== destBaseName &&
1019
+ srcBaseName.toLowerCase() === destBaseName.toLowerCase()
1020
+ ) {
1021
+ return { srcStat, destStat, isChangingCase: true };
1022
+ }
1023
+ throw new Error("Source and destination must not be the same.");
1024
+ }
1025
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1026
+ throw new Error(
1027
+ `Cannot overwrite non-directory '${dest}' with directory '${src}'.`,
1028
+ );
1029
+ }
1030
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1031
+ throw new Error(
1032
+ `Cannot overwrite directory '${dest}' with non-directory '${src}'.`,
1033
+ );
1034
+ }
1035
+ }
1036
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1037
+ throw new Error(errMsg(src, dest, funcName));
1038
+ }
1039
+ return { srcStat, destStat };
1040
+ }
1041
+ function checkPathsSync(src, dest, funcName, opts) {
1042
+ const { srcStat, destStat } = getStatsSync(src, dest, opts);
1043
+ if (destStat) {
1044
+ if (areIdentical(srcStat, destStat)) {
1045
+ const srcBaseName = path.basename(src);
1046
+ const destBaseName = path.basename(dest);
1047
+ if (
1048
+ funcName === "move" &&
1049
+ srcBaseName !== destBaseName &&
1050
+ srcBaseName.toLowerCase() === destBaseName.toLowerCase()
1051
+ ) {
1052
+ return { srcStat, destStat, isChangingCase: true };
1053
+ }
1054
+ throw new Error("Source and destination must not be the same.");
1055
+ }
1056
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1057
+ throw new Error(
1058
+ `Cannot overwrite non-directory '${dest}' with directory '${src}'.`,
1059
+ );
1060
+ }
1061
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1062
+ throw new Error(
1063
+ `Cannot overwrite directory '${dest}' with non-directory '${src}'.`,
1064
+ );
2431
1065
  }
2432
- fs.futimes(fd, at, mt, function (er) {
2433
- fs.close(fd, function (er2) {
2434
- if (cb) cb(er || er2)
2435
- })
2436
- })
2437
- })
2438
- }
2439
-
2440
- fs.lutimesSync = function (path, at, mt) {
2441
- var fd = fs.openSync(path, constants.O_SYMLINK)
2442
- var ret
2443
- var threw = true
1066
+ }
1067
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1068
+ throw new Error(errMsg(src, dest, funcName));
1069
+ }
1070
+ return { srcStat, destStat };
1071
+ }
1072
+ async function checkParentPaths(src, srcStat, dest, funcName) {
1073
+ const srcParent = path.resolve(path.dirname(src));
1074
+ const destParent = path.resolve(path.dirname(dest));
1075
+ if (
1076
+ destParent === srcParent ||
1077
+ destParent === path.parse(destParent).root
1078
+ )
1079
+ return;
1080
+ let destStat;
2444
1081
  try {
2445
- ret = fs.futimesSync(fd, at, mt)
2446
- threw = false
1082
+ destStat = await fs.stat(destParent, { bigint: true });
1083
+ } catch (err) {
1084
+ if (err.code === "ENOENT") return;
1085
+ throw err;
1086
+ }
1087
+ if (areIdentical(srcStat, destStat)) {
1088
+ throw new Error(errMsg(src, dest, funcName));
1089
+ }
1090
+ return checkParentPaths(src, srcStat, destParent, funcName);
1091
+ }
1092
+ function checkParentPathsSync(src, srcStat, dest, funcName) {
1093
+ const srcParent = path.resolve(path.dirname(src));
1094
+ const destParent = path.resolve(path.dirname(dest));
1095
+ if (
1096
+ destParent === srcParent ||
1097
+ destParent === path.parse(destParent).root
1098
+ )
1099
+ return;
1100
+ let destStat;
1101
+ try {
1102
+ destStat = fs.statSync(destParent, { bigint: true });
1103
+ } catch (err) {
1104
+ if (err.code === "ENOENT") return;
1105
+ throw err;
1106
+ }
1107
+ if (areIdentical(srcStat, destStat)) {
1108
+ throw new Error(errMsg(src, dest, funcName));
1109
+ }
1110
+ return checkParentPathsSync(src, srcStat, destParent, funcName);
1111
+ }
1112
+ function areIdentical(srcStat, destStat) {
1113
+ return (
1114
+ destStat.ino &&
1115
+ destStat.dev &&
1116
+ destStat.ino === srcStat.ino &&
1117
+ destStat.dev === srcStat.dev
1118
+ );
1119
+ }
1120
+ function isSrcSubdir(src, dest) {
1121
+ const srcArr = path
1122
+ .resolve(src)
1123
+ .split(path.sep)
1124
+ .filter((i) => i);
1125
+ const destArr = path
1126
+ .resolve(dest)
1127
+ .split(path.sep)
1128
+ .filter((i) => i);
1129
+ return srcArr.every((cur, i) => destArr[i] === cur);
1130
+ }
1131
+ function errMsg(src, dest, funcName) {
1132
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1133
+ }
1134
+ module1.exports = {
1135
+ checkPaths: u(checkPaths),
1136
+ checkPathsSync,
1137
+ checkParentPaths: u(checkParentPaths),
1138
+ checkParentPathsSync,
1139
+ isSrcSubdir,
1140
+ areIdentical,
1141
+ };
1142
+ },
1143
+ 227: (module1, __unused_webpack_exports, __nccwpck_require__) => {
1144
+ "use strict";
1145
+ const fs = __nccwpck_require__(845);
1146
+ const u = __nccwpck_require__(59).fromPromise;
1147
+ async function utimesMillis(path, atime, mtime) {
1148
+ const fd = await fs.open(path, "r+");
1149
+ let closeErr = null;
1150
+ try {
1151
+ await fs.futimes(fd, atime, mtime);
2447
1152
  } finally {
2448
- if (threw) {
2449
- try {
2450
- fs.closeSync(fd)
2451
- } catch (er) {}
1153
+ try {
1154
+ await fs.close(fd);
1155
+ } catch (e) {
1156
+ closeErr = e;
1157
+ }
1158
+ }
1159
+ if (closeErr) {
1160
+ throw closeErr;
1161
+ }
1162
+ }
1163
+ function utimesMillisSync(path, atime, mtime) {
1164
+ const fd = fs.openSync(path, "r+");
1165
+ fs.futimesSync(fd, atime, mtime);
1166
+ return fs.closeSync(fd);
1167
+ }
1168
+ module1.exports = { utimesMillis: u(utimesMillis), utimesMillisSync };
1169
+ },
1170
+ 691: (module1) => {
1171
+ "use strict";
1172
+ module1.exports = clone;
1173
+ var getPrototypeOf =
1174
+ Object.getPrototypeOf ||
1175
+ function (obj) {
1176
+ return obj.__proto__;
1177
+ };
1178
+ function clone(obj) {
1179
+ if (obj === null || typeof obj !== "object") return obj;
1180
+ if (obj instanceof Object)
1181
+ var copy = { __proto__: getPrototypeOf(obj) };
1182
+ else var copy = Object.create(null);
1183
+ Object.getOwnPropertyNames(obj).forEach(function (key) {
1184
+ Object.defineProperty(
1185
+ copy,
1186
+ key,
1187
+ Object.getOwnPropertyDescriptor(obj, key),
1188
+ );
1189
+ });
1190
+ return copy;
1191
+ }
1192
+ },
1193
+ 804: (module1, __unused_webpack_exports, __nccwpck_require__) => {
1194
+ var fs = __nccwpck_require__(147);
1195
+ var polyfills = __nccwpck_require__(567);
1196
+ var legacy = __nccwpck_require__(915);
1197
+ var clone = __nccwpck_require__(691);
1198
+ var util = __nccwpck_require__(837);
1199
+ var gracefulQueue;
1200
+ var previousSymbol;
1201
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
1202
+ gracefulQueue = Symbol.for("graceful-fs.queue");
1203
+ previousSymbol = Symbol.for("graceful-fs.previous");
1204
+ } else {
1205
+ gracefulQueue = "___graceful-fs.queue";
1206
+ previousSymbol = "___graceful-fs.previous";
1207
+ }
1208
+ function noop() {}
1209
+ function publishQueue(context, queue) {
1210
+ Object.defineProperty(context, gracefulQueue, {
1211
+ get: function () {
1212
+ return queue;
1213
+ },
1214
+ });
1215
+ }
1216
+ var debug = noop;
1217
+ if (util.debuglog) debug = util.debuglog("gfs4");
1218
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
1219
+ debug = function () {
1220
+ var m = util.format.apply(util, arguments);
1221
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
1222
+ console.error(m);
1223
+ };
1224
+ if (!fs[gracefulQueue]) {
1225
+ var queue = global[gracefulQueue] || [];
1226
+ publishQueue(fs, queue);
1227
+ fs.close = (function (fs$close) {
1228
+ function close(fd, cb) {
1229
+ return fs$close.call(fs, fd, function (err) {
1230
+ if (!err) {
1231
+ resetQueue();
1232
+ }
1233
+ if (typeof cb === "function") cb.apply(this, arguments);
1234
+ });
1235
+ }
1236
+ Object.defineProperty(close, previousSymbol, { value: fs$close });
1237
+ return close;
1238
+ })(fs.close);
1239
+ fs.closeSync = (function (fs$closeSync) {
1240
+ function closeSync(fd) {
1241
+ fs$closeSync.apply(fs, arguments);
1242
+ resetQueue();
1243
+ }
1244
+ Object.defineProperty(closeSync, previousSymbol, {
1245
+ value: fs$closeSync,
1246
+ });
1247
+ return closeSync;
1248
+ })(fs.closeSync);
1249
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
1250
+ process.on("exit", function () {
1251
+ debug(fs[gracefulQueue]);
1252
+ __nccwpck_require__(491).equal(fs[gracefulQueue].length, 0);
1253
+ });
1254
+ }
1255
+ }
1256
+ if (!global[gracefulQueue]) {
1257
+ publishQueue(global, fs[gracefulQueue]);
1258
+ }
1259
+ module1.exports = patch(clone(fs));
1260
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
1261
+ module1.exports = patch(fs);
1262
+ fs.__patched = true;
1263
+ }
1264
+ function patch(fs) {
1265
+ polyfills(fs);
1266
+ fs.gracefulify = patch;
1267
+ fs.createReadStream = createReadStream;
1268
+ fs.createWriteStream = createWriteStream;
1269
+ var fs$readFile = fs.readFile;
1270
+ fs.readFile = readFile;
1271
+ function readFile(path, options, cb) {
1272
+ if (typeof options === "function") (cb = options), (options = null);
1273
+ return go$readFile(path, options, cb);
1274
+ function go$readFile(path, options, cb, startTime) {
1275
+ return fs$readFile(path, options, function (err) {
1276
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1277
+ enqueue([
1278
+ go$readFile,
1279
+ [path, options, cb],
1280
+ err,
1281
+ startTime || Date.now(),
1282
+ Date.now(),
1283
+ ]);
1284
+ else {
1285
+ if (typeof cb === "function") cb.apply(this, arguments);
1286
+ }
1287
+ });
1288
+ }
1289
+ }
1290
+ var fs$writeFile = fs.writeFile;
1291
+ fs.writeFile = writeFile;
1292
+ function writeFile(path, data, options, cb) {
1293
+ if (typeof options === "function") (cb = options), (options = null);
1294
+ return go$writeFile(path, data, options, cb);
1295
+ function go$writeFile(path, data, options, cb, startTime) {
1296
+ return fs$writeFile(path, data, options, function (err) {
1297
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1298
+ enqueue([
1299
+ go$writeFile,
1300
+ [path, data, options, cb],
1301
+ err,
1302
+ startTime || Date.now(),
1303
+ Date.now(),
1304
+ ]);
1305
+ else {
1306
+ if (typeof cb === "function") cb.apply(this, arguments);
1307
+ }
1308
+ });
1309
+ }
1310
+ }
1311
+ var fs$appendFile = fs.appendFile;
1312
+ if (fs$appendFile) fs.appendFile = appendFile;
1313
+ function appendFile(path, data, options, cb) {
1314
+ if (typeof options === "function") (cb = options), (options = null);
1315
+ return go$appendFile(path, data, options, cb);
1316
+ function go$appendFile(path, data, options, cb, startTime) {
1317
+ return fs$appendFile(path, data, options, function (err) {
1318
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1319
+ enqueue([
1320
+ go$appendFile,
1321
+ [path, data, options, cb],
1322
+ err,
1323
+ startTime || Date.now(),
1324
+ Date.now(),
1325
+ ]);
1326
+ else {
1327
+ if (typeof cb === "function") cb.apply(this, arguments);
1328
+ }
1329
+ });
1330
+ }
1331
+ }
1332
+ var fs$copyFile = fs.copyFile;
1333
+ if (fs$copyFile) fs.copyFile = copyFile;
1334
+ function copyFile(src, dest, flags, cb) {
1335
+ if (typeof flags === "function") {
1336
+ cb = flags;
1337
+ flags = 0;
1338
+ }
1339
+ return go$copyFile(src, dest, flags, cb);
1340
+ function go$copyFile(src, dest, flags, cb, startTime) {
1341
+ return fs$copyFile(src, dest, flags, function (err) {
1342
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1343
+ enqueue([
1344
+ go$copyFile,
1345
+ [src, dest, flags, cb],
1346
+ err,
1347
+ startTime || Date.now(),
1348
+ Date.now(),
1349
+ ]);
1350
+ else {
1351
+ if (typeof cb === "function") cb.apply(this, arguments);
1352
+ }
1353
+ });
1354
+ }
1355
+ }
1356
+ var fs$readdir = fs.readdir;
1357
+ fs.readdir = readdir;
1358
+ var noReaddirOptionVersions = /^v[0-5]\./;
1359
+ function readdir(path, options, cb) {
1360
+ if (typeof options === "function") (cb = options), (options = null);
1361
+ var go$readdir = noReaddirOptionVersions.test(process.version)
1362
+ ? function go$readdir(path, options, cb, startTime) {
1363
+ return fs$readdir(
1364
+ path,
1365
+ fs$readdirCallback(path, options, cb, startTime),
1366
+ );
1367
+ }
1368
+ : function go$readdir(path, options, cb, startTime) {
1369
+ return fs$readdir(
1370
+ path,
1371
+ options,
1372
+ fs$readdirCallback(path, options, cb, startTime),
1373
+ );
1374
+ };
1375
+ return go$readdir(path, options, cb);
1376
+ function fs$readdirCallback(path, options, cb, startTime) {
1377
+ return function (err, files) {
1378
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1379
+ enqueue([
1380
+ go$readdir,
1381
+ [path, options, cb],
1382
+ err,
1383
+ startTime || Date.now(),
1384
+ Date.now(),
1385
+ ]);
1386
+ else {
1387
+ if (files && files.sort) files.sort();
1388
+ if (typeof cb === "function") cb.call(this, err, files);
1389
+ }
1390
+ };
1391
+ }
1392
+ }
1393
+ if (process.version.substr(0, 4) === "v0.8") {
1394
+ var legStreams = legacy(fs);
1395
+ ReadStream = legStreams.ReadStream;
1396
+ WriteStream = legStreams.WriteStream;
1397
+ }
1398
+ var fs$ReadStream = fs.ReadStream;
1399
+ if (fs$ReadStream) {
1400
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
1401
+ ReadStream.prototype.open = ReadStream$open;
1402
+ }
1403
+ var fs$WriteStream = fs.WriteStream;
1404
+ if (fs$WriteStream) {
1405
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
1406
+ WriteStream.prototype.open = WriteStream$open;
1407
+ }
1408
+ Object.defineProperty(fs, "ReadStream", {
1409
+ get: function () {
1410
+ return ReadStream;
1411
+ },
1412
+ set: function (val) {
1413
+ ReadStream = val;
1414
+ },
1415
+ enumerable: true,
1416
+ configurable: true,
1417
+ });
1418
+ Object.defineProperty(fs, "WriteStream", {
1419
+ get: function () {
1420
+ return WriteStream;
1421
+ },
1422
+ set: function (val) {
1423
+ WriteStream = val;
1424
+ },
1425
+ enumerable: true,
1426
+ configurable: true,
1427
+ });
1428
+ var FileReadStream = ReadStream;
1429
+ Object.defineProperty(fs, "FileReadStream", {
1430
+ get: function () {
1431
+ return FileReadStream;
1432
+ },
1433
+ set: function (val) {
1434
+ FileReadStream = val;
1435
+ },
1436
+ enumerable: true,
1437
+ configurable: true,
1438
+ });
1439
+ var FileWriteStream = WriteStream;
1440
+ Object.defineProperty(fs, "FileWriteStream", {
1441
+ get: function () {
1442
+ return FileWriteStream;
1443
+ },
1444
+ set: function (val) {
1445
+ FileWriteStream = val;
1446
+ },
1447
+ enumerable: true,
1448
+ configurable: true,
1449
+ });
1450
+ function ReadStream(path, options) {
1451
+ if (this instanceof ReadStream)
1452
+ return fs$ReadStream.apply(this, arguments), this;
1453
+ else
1454
+ return ReadStream.apply(
1455
+ Object.create(ReadStream.prototype),
1456
+ arguments,
1457
+ );
1458
+ }
1459
+ function ReadStream$open() {
1460
+ var that = this;
1461
+ open(that.path, that.flags, that.mode, function (err, fd) {
1462
+ if (err) {
1463
+ if (that.autoClose) that.destroy();
1464
+ that.emit("error", err);
1465
+ } else {
1466
+ that.fd = fd;
1467
+ that.emit("open", fd);
1468
+ that.read();
1469
+ }
1470
+ });
1471
+ }
1472
+ function WriteStream(path, options) {
1473
+ if (this instanceof WriteStream)
1474
+ return fs$WriteStream.apply(this, arguments), this;
1475
+ else
1476
+ return WriteStream.apply(
1477
+ Object.create(WriteStream.prototype),
1478
+ arguments,
1479
+ );
1480
+ }
1481
+ function WriteStream$open() {
1482
+ var that = this;
1483
+ open(that.path, that.flags, that.mode, function (err, fd) {
1484
+ if (err) {
1485
+ that.destroy();
1486
+ that.emit("error", err);
1487
+ } else {
1488
+ that.fd = fd;
1489
+ that.emit("open", fd);
1490
+ }
1491
+ });
1492
+ }
1493
+ function createReadStream(path, options) {
1494
+ return new fs.ReadStream(path, options);
1495
+ }
1496
+ function createWriteStream(path, options) {
1497
+ return new fs.WriteStream(path, options);
1498
+ }
1499
+ var fs$open = fs.open;
1500
+ fs.open = open;
1501
+ function open(path, flags, mode, cb) {
1502
+ if (typeof mode === "function") (cb = mode), (mode = null);
1503
+ return go$open(path, flags, mode, cb);
1504
+ function go$open(path, flags, mode, cb, startTime) {
1505
+ return fs$open(path, flags, mode, function (err, fd) {
1506
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1507
+ enqueue([
1508
+ go$open,
1509
+ [path, flags, mode, cb],
1510
+ err,
1511
+ startTime || Date.now(),
1512
+ Date.now(),
1513
+ ]);
1514
+ else {
1515
+ if (typeof cb === "function") cb.apply(this, arguments);
1516
+ }
1517
+ });
1518
+ }
1519
+ }
1520
+ return fs;
1521
+ }
1522
+ function enqueue(elem) {
1523
+ debug("ENQUEUE", elem[0].name, elem[1]);
1524
+ fs[gracefulQueue].push(elem);
1525
+ retry();
1526
+ }
1527
+ var retryTimer;
1528
+ function resetQueue() {
1529
+ var now = Date.now();
1530
+ for (var i = 0; i < fs[gracefulQueue].length; ++i) {
1531
+ if (fs[gracefulQueue][i].length > 2) {
1532
+ fs[gracefulQueue][i][3] = now;
1533
+ fs[gracefulQueue][i][4] = now;
1534
+ }
1535
+ }
1536
+ retry();
1537
+ }
1538
+ function retry() {
1539
+ clearTimeout(retryTimer);
1540
+ retryTimer = undefined;
1541
+ if (fs[gracefulQueue].length === 0) return;
1542
+ var elem = fs[gracefulQueue].shift();
1543
+ var fn = elem[0];
1544
+ var args = elem[1];
1545
+ var err = elem[2];
1546
+ var startTime = elem[3];
1547
+ var lastTime = elem[4];
1548
+ if (startTime === undefined) {
1549
+ debug("RETRY", fn.name, args);
1550
+ fn.apply(null, args);
1551
+ } else if (Date.now() - startTime >= 6e4) {
1552
+ debug("TIMEOUT", fn.name, args);
1553
+ var cb = args.pop();
1554
+ if (typeof cb === "function") cb.call(null, err);
1555
+ } else {
1556
+ var sinceAttempt = Date.now() - lastTime;
1557
+ var sinceStart = Math.max(lastTime - startTime, 1);
1558
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
1559
+ if (sinceAttempt >= desiredDelay) {
1560
+ debug("RETRY", fn.name, args);
1561
+ fn.apply(null, args.concat([startTime]));
2452
1562
  } else {
2453
- fs.closeSync(fd)
1563
+ fs[gracefulQueue].push(elem);
2454
1564
  }
2455
1565
  }
2456
- return ret
1566
+ if (retryTimer === undefined) {
1567
+ retryTimer = setTimeout(retry, 0);
1568
+ }
2457
1569
  }
2458
-
2459
- } else if (fs.futimes) {
2460
- fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
2461
- fs.lutimesSync = function () {}
2462
- }
2463
- }
2464
-
2465
- function chmodFix (orig) {
2466
- if (!orig) return orig
2467
- return function (target, mode, cb) {
2468
- return orig.call(fs, target, mode, function (er) {
2469
- if (chownErOk(er)) er = null
2470
- if (cb) cb.apply(this, arguments)
2471
- })
2472
- }
2473
- }
2474
-
2475
- function chmodFixSync (orig) {
2476
- if (!orig) return orig
2477
- return function (target, mode) {
1570
+ },
1571
+ 915: (module1, __unused_webpack_exports, __nccwpck_require__) => {
1572
+ var Stream = __nccwpck_require__(781).Stream;
1573
+ module1.exports = legacy;
1574
+ function legacy(fs) {
1575
+ return { ReadStream: ReadStream, WriteStream: WriteStream };
1576
+ function ReadStream(path, options) {
1577
+ if (!(this instanceof ReadStream))
1578
+ return new ReadStream(path, options);
1579
+ Stream.call(this);
1580
+ var self = this;
1581
+ this.path = path;
1582
+ this.fd = null;
1583
+ this.readable = true;
1584
+ this.paused = false;
1585
+ this.flags = "r";
1586
+ this.mode = 438;
1587
+ this.bufferSize = 64 * 1024;
1588
+ options = options || {};
1589
+ var keys = Object.keys(options);
1590
+ for (var index = 0, length = keys.length; index < length; index++) {
1591
+ var key = keys[index];
1592
+ this[key] = options[key];
1593
+ }
1594
+ if (this.encoding) this.setEncoding(this.encoding);
1595
+ if (this.start !== undefined) {
1596
+ if ("number" !== typeof this.start) {
1597
+ throw TypeError("start must be a Number");
1598
+ }
1599
+ if (this.end === undefined) {
1600
+ this.end = Infinity;
1601
+ } else if ("number" !== typeof this.end) {
1602
+ throw TypeError("end must be a Number");
1603
+ }
1604
+ if (this.start > this.end) {
1605
+ throw new Error("start must be <= end");
1606
+ }
1607
+ this.pos = this.start;
1608
+ }
1609
+ if (this.fd !== null) {
1610
+ process.nextTick(function () {
1611
+ self._read();
1612
+ });
1613
+ return;
1614
+ }
1615
+ fs.open(this.path, this.flags, this.mode, function (err, fd) {
1616
+ if (err) {
1617
+ self.emit("error", err);
1618
+ self.readable = false;
1619
+ return;
1620
+ }
1621
+ self.fd = fd;
1622
+ self.emit("open", fd);
1623
+ self._read();
1624
+ });
1625
+ }
1626
+ function WriteStream(path, options) {
1627
+ if (!(this instanceof WriteStream))
1628
+ return new WriteStream(path, options);
1629
+ Stream.call(this);
1630
+ this.path = path;
1631
+ this.fd = null;
1632
+ this.writable = true;
1633
+ this.flags = "w";
1634
+ this.encoding = "binary";
1635
+ this.mode = 438;
1636
+ this.bytesWritten = 0;
1637
+ options = options || {};
1638
+ var keys = Object.keys(options);
1639
+ for (var index = 0, length = keys.length; index < length; index++) {
1640
+ var key = keys[index];
1641
+ this[key] = options[key];
1642
+ }
1643
+ if (this.start !== undefined) {
1644
+ if ("number" !== typeof this.start) {
1645
+ throw TypeError("start must be a Number");
1646
+ }
1647
+ if (this.start < 0) {
1648
+ throw new Error("start must be >= zero");
1649
+ }
1650
+ this.pos = this.start;
1651
+ }
1652
+ this.busy = false;
1653
+ this._queue = [];
1654
+ if (this.fd === null) {
1655
+ this._open = fs.open;
1656
+ this._queue.push([
1657
+ this._open,
1658
+ this.path,
1659
+ this.flags,
1660
+ this.mode,
1661
+ undefined,
1662
+ ]);
1663
+ this.flush();
1664
+ }
1665
+ }
1666
+ }
1667
+ },
1668
+ 567: (module1, __unused_webpack_exports, __nccwpck_require__) => {
1669
+ var constants = __nccwpck_require__(57);
1670
+ var origCwd = process.cwd;
1671
+ var cwd = null;
1672
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
1673
+ process.cwd = function () {
1674
+ if (!cwd) cwd = origCwd.call(process);
1675
+ return cwd;
1676
+ };
2478
1677
  try {
2479
- return orig.call(fs, target, mode)
2480
- } catch (er) {
2481
- if (!chownErOk(er)) throw er
1678
+ process.cwd();
1679
+ } catch (er) {}
1680
+ if (typeof process.chdir === "function") {
1681
+ var chdir = process.chdir;
1682
+ process.chdir = function (d) {
1683
+ cwd = null;
1684
+ chdir.call(process, d);
1685
+ };
1686
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
2482
1687
  }
2483
- }
2484
- }
2485
-
2486
-
2487
- function chownFix (orig) {
2488
- if (!orig) return orig
2489
- return function (target, uid, gid, cb) {
2490
- return orig.call(fs, target, uid, gid, function (er) {
2491
- if (chownErOk(er)) er = null
2492
- if (cb) cb.apply(this, arguments)
2493
- })
2494
- }
2495
- }
2496
-
2497
- function chownFixSync (orig) {
2498
- if (!orig) return orig
2499
- return function (target, uid, gid) {
1688
+ module1.exports = patch;
1689
+ function patch(fs) {
1690
+ if (
1691
+ constants.hasOwnProperty("O_SYMLINK") &&
1692
+ process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)
1693
+ ) {
1694
+ patchLchmod(fs);
1695
+ }
1696
+ if (!fs.lutimes) {
1697
+ patchLutimes(fs);
1698
+ }
1699
+ fs.chown = chownFix(fs.chown);
1700
+ fs.fchown = chownFix(fs.fchown);
1701
+ fs.lchown = chownFix(fs.lchown);
1702
+ fs.chmod = chmodFix(fs.chmod);
1703
+ fs.fchmod = chmodFix(fs.fchmod);
1704
+ fs.lchmod = chmodFix(fs.lchmod);
1705
+ fs.chownSync = chownFixSync(fs.chownSync);
1706
+ fs.fchownSync = chownFixSync(fs.fchownSync);
1707
+ fs.lchownSync = chownFixSync(fs.lchownSync);
1708
+ fs.chmodSync = chmodFixSync(fs.chmodSync);
1709
+ fs.fchmodSync = chmodFixSync(fs.fchmodSync);
1710
+ fs.lchmodSync = chmodFixSync(fs.lchmodSync);
1711
+ fs.stat = statFix(fs.stat);
1712
+ fs.fstat = statFix(fs.fstat);
1713
+ fs.lstat = statFix(fs.lstat);
1714
+ fs.statSync = statFixSync(fs.statSync);
1715
+ fs.fstatSync = statFixSync(fs.fstatSync);
1716
+ fs.lstatSync = statFixSync(fs.lstatSync);
1717
+ if (fs.chmod && !fs.lchmod) {
1718
+ fs.lchmod = function (path, mode, cb) {
1719
+ if (cb) process.nextTick(cb);
1720
+ };
1721
+ fs.lchmodSync = function () {};
1722
+ }
1723
+ if (fs.chown && !fs.lchown) {
1724
+ fs.lchown = function (path, uid, gid, cb) {
1725
+ if (cb) process.nextTick(cb);
1726
+ };
1727
+ fs.lchownSync = function () {};
1728
+ }
1729
+ if (platform === "win32") {
1730
+ fs.rename =
1731
+ typeof fs.rename !== "function"
1732
+ ? fs.rename
1733
+ : (function (fs$rename) {
1734
+ function rename(from, to, cb) {
1735
+ var start = Date.now();
1736
+ var backoff = 0;
1737
+ fs$rename(from, to, function CB(er) {
1738
+ if (
1739
+ er &&
1740
+ (er.code === "EACCES" ||
1741
+ er.code === "EPERM" ||
1742
+ er.code === "EBUSY") &&
1743
+ Date.now() - start < 6e4
1744
+ ) {
1745
+ setTimeout(function () {
1746
+ fs.stat(to, function (stater, st) {
1747
+ if (stater && stater.code === "ENOENT")
1748
+ fs$rename(from, to, CB);
1749
+ else cb(er);
1750
+ });
1751
+ }, backoff);
1752
+ if (backoff < 100) backoff += 10;
1753
+ return;
1754
+ }
1755
+ if (cb) cb(er);
1756
+ });
1757
+ }
1758
+ if (Object.setPrototypeOf)
1759
+ Object.setPrototypeOf(rename, fs$rename);
1760
+ return rename;
1761
+ })(fs.rename);
1762
+ }
1763
+ fs.read =
1764
+ typeof fs.read !== "function"
1765
+ ? fs.read
1766
+ : (function (fs$read) {
1767
+ function read(fd, buffer, offset, length, position, callback_) {
1768
+ var callback;
1769
+ if (callback_ && typeof callback_ === "function") {
1770
+ var eagCounter = 0;
1771
+ callback = function (er, _, __) {
1772
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
1773
+ eagCounter++;
1774
+ return fs$read.call(
1775
+ fs,
1776
+ fd,
1777
+ buffer,
1778
+ offset,
1779
+ length,
1780
+ position,
1781
+ callback,
1782
+ );
1783
+ }
1784
+ callback_.apply(this, arguments);
1785
+ };
1786
+ }
1787
+ return fs$read.call(
1788
+ fs,
1789
+ fd,
1790
+ buffer,
1791
+ offset,
1792
+ length,
1793
+ position,
1794
+ callback,
1795
+ );
1796
+ }
1797
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
1798
+ return read;
1799
+ })(fs.read);
1800
+ fs.readSync =
1801
+ typeof fs.readSync !== "function"
1802
+ ? fs.readSync
1803
+ : (function (fs$readSync) {
1804
+ return function (fd, buffer, offset, length, position) {
1805
+ var eagCounter = 0;
1806
+ while (true) {
1807
+ try {
1808
+ return fs$readSync.call(
1809
+ fs,
1810
+ fd,
1811
+ buffer,
1812
+ offset,
1813
+ length,
1814
+ position,
1815
+ );
1816
+ } catch (er) {
1817
+ if (er.code === "EAGAIN" && eagCounter < 10) {
1818
+ eagCounter++;
1819
+ continue;
1820
+ }
1821
+ throw er;
1822
+ }
1823
+ }
1824
+ };
1825
+ })(fs.readSync);
1826
+ function patchLchmod(fs) {
1827
+ fs.lchmod = function (path, mode, callback) {
1828
+ fs.open(
1829
+ path,
1830
+ constants.O_WRONLY | constants.O_SYMLINK,
1831
+ mode,
1832
+ function (err, fd) {
1833
+ if (err) {
1834
+ if (callback) callback(err);
1835
+ return;
1836
+ }
1837
+ fs.fchmod(fd, mode, function (err) {
1838
+ fs.close(fd, function (err2) {
1839
+ if (callback) callback(err || err2);
1840
+ });
1841
+ });
1842
+ },
1843
+ );
1844
+ };
1845
+ fs.lchmodSync = function (path, mode) {
1846
+ var fd = fs.openSync(
1847
+ path,
1848
+ constants.O_WRONLY | constants.O_SYMLINK,
1849
+ mode,
1850
+ );
1851
+ var threw = true;
1852
+ var ret;
1853
+ try {
1854
+ ret = fs.fchmodSync(fd, mode);
1855
+ threw = false;
1856
+ } finally {
1857
+ if (threw) {
1858
+ try {
1859
+ fs.closeSync(fd);
1860
+ } catch (er) {}
1861
+ } else {
1862
+ fs.closeSync(fd);
1863
+ }
1864
+ }
1865
+ return ret;
1866
+ };
1867
+ }
1868
+ function patchLutimes(fs) {
1869
+ if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
1870
+ fs.lutimes = function (path, at, mt, cb) {
1871
+ fs.open(path, constants.O_SYMLINK, function (er, fd) {
1872
+ if (er) {
1873
+ if (cb) cb(er);
1874
+ return;
1875
+ }
1876
+ fs.futimes(fd, at, mt, function (er) {
1877
+ fs.close(fd, function (er2) {
1878
+ if (cb) cb(er || er2);
1879
+ });
1880
+ });
1881
+ });
1882
+ };
1883
+ fs.lutimesSync = function (path, at, mt) {
1884
+ var fd = fs.openSync(path, constants.O_SYMLINK);
1885
+ var ret;
1886
+ var threw = true;
1887
+ try {
1888
+ ret = fs.futimesSync(fd, at, mt);
1889
+ threw = false;
1890
+ } finally {
1891
+ if (threw) {
1892
+ try {
1893
+ fs.closeSync(fd);
1894
+ } catch (er) {}
1895
+ } else {
1896
+ fs.closeSync(fd);
1897
+ }
1898
+ }
1899
+ return ret;
1900
+ };
1901
+ } else if (fs.futimes) {
1902
+ fs.lutimes = function (_a, _b, _c, cb) {
1903
+ if (cb) process.nextTick(cb);
1904
+ };
1905
+ fs.lutimesSync = function () {};
1906
+ }
1907
+ }
1908
+ function chmodFix(orig) {
1909
+ if (!orig) return orig;
1910
+ return function (target, mode, cb) {
1911
+ return orig.call(fs, target, mode, function (er) {
1912
+ if (chownErOk(er)) er = null;
1913
+ if (cb) cb.apply(this, arguments);
1914
+ });
1915
+ };
1916
+ }
1917
+ function chmodFixSync(orig) {
1918
+ if (!orig) return orig;
1919
+ return function (target, mode) {
1920
+ try {
1921
+ return orig.call(fs, target, mode);
1922
+ } catch (er) {
1923
+ if (!chownErOk(er)) throw er;
1924
+ }
1925
+ };
1926
+ }
1927
+ function chownFix(orig) {
1928
+ if (!orig) return orig;
1929
+ return function (target, uid, gid, cb) {
1930
+ return orig.call(fs, target, uid, gid, function (er) {
1931
+ if (chownErOk(er)) er = null;
1932
+ if (cb) cb.apply(this, arguments);
1933
+ });
1934
+ };
1935
+ }
1936
+ function chownFixSync(orig) {
1937
+ if (!orig) return orig;
1938
+ return function (target, uid, gid) {
1939
+ try {
1940
+ return orig.call(fs, target, uid, gid);
1941
+ } catch (er) {
1942
+ if (!chownErOk(er)) throw er;
1943
+ }
1944
+ };
1945
+ }
1946
+ function statFix(orig) {
1947
+ if (!orig) return orig;
1948
+ return function (target, options, cb) {
1949
+ if (typeof options === "function") {
1950
+ cb = options;
1951
+ options = null;
1952
+ }
1953
+ function callback(er, stats) {
1954
+ if (stats) {
1955
+ if (stats.uid < 0) stats.uid += 4294967296;
1956
+ if (stats.gid < 0) stats.gid += 4294967296;
1957
+ }
1958
+ if (cb) cb.apply(this, arguments);
1959
+ }
1960
+ return options
1961
+ ? orig.call(fs, target, options, callback)
1962
+ : orig.call(fs, target, callback);
1963
+ };
1964
+ }
1965
+ function statFixSync(orig) {
1966
+ if (!orig) return orig;
1967
+ return function (target, options) {
1968
+ var stats = options
1969
+ ? orig.call(fs, target, options)
1970
+ : orig.call(fs, target);
1971
+ if (stats) {
1972
+ if (stats.uid < 0) stats.uid += 4294967296;
1973
+ if (stats.gid < 0) stats.gid += 4294967296;
1974
+ }
1975
+ return stats;
1976
+ };
1977
+ }
1978
+ function chownErOk(er) {
1979
+ if (!er) return true;
1980
+ if (er.code === "ENOSYS") return true;
1981
+ var nonroot = !process.getuid || process.getuid() !== 0;
1982
+ if (nonroot) {
1983
+ if (er.code === "EINVAL" || er.code === "EPERM") return true;
1984
+ }
1985
+ return false;
1986
+ }
1987
+ }
1988
+ },
1989
+ 449: (module1, __unused_webpack_exports, __nccwpck_require__) => {
1990
+ let _fs;
2500
1991
  try {
2501
- return orig.call(fs, target, uid, gid)
2502
- } catch (er) {
2503
- if (!chownErOk(er)) throw er
1992
+ _fs = __nccwpck_require__(804);
1993
+ } catch (_) {
1994
+ _fs = __nccwpck_require__(147);
2504
1995
  }
1996
+ const universalify = __nccwpck_require__(59);
1997
+ const { stringify, stripBom } = __nccwpck_require__(213);
1998
+ async function _readFile(file, options = {}) {
1999
+ if (typeof options === "string") {
2000
+ options = { encoding: options };
2001
+ }
2002
+ const fs = options.fs || _fs;
2003
+ const shouldThrow = "throws" in options ? options.throws : true;
2004
+ let data = await universalify.fromCallback(fs.readFile)(file, options);
2005
+ data = stripBom(data);
2006
+ let obj;
2007
+ try {
2008
+ obj = JSON.parse(data, options ? options.reviver : null);
2009
+ } catch (err) {
2010
+ if (shouldThrow) {
2011
+ err.message = `${file}: ${err.message}`;
2012
+ throw err;
2013
+ } else {
2014
+ return null;
2015
+ }
2016
+ }
2017
+ return obj;
2018
+ }
2019
+ const readFile = universalify.fromPromise(_readFile);
2020
+ function readFileSync(file, options = {}) {
2021
+ if (typeof options === "string") {
2022
+ options = { encoding: options };
2023
+ }
2024
+ const fs = options.fs || _fs;
2025
+ const shouldThrow = "throws" in options ? options.throws : true;
2026
+ try {
2027
+ let content = fs.readFileSync(file, options);
2028
+ content = stripBom(content);
2029
+ return JSON.parse(content, options.reviver);
2030
+ } catch (err) {
2031
+ if (shouldThrow) {
2032
+ err.message = `${file}: ${err.message}`;
2033
+ throw err;
2034
+ } else {
2035
+ return null;
2036
+ }
2037
+ }
2038
+ }
2039
+ async function _writeFile(file, obj, options = {}) {
2040
+ const fs = options.fs || _fs;
2041
+ const str = stringify(obj, options);
2042
+ await universalify.fromCallback(fs.writeFile)(file, str, options);
2043
+ }
2044
+ const writeFile = universalify.fromPromise(_writeFile);
2045
+ function writeFileSync(file, obj, options = {}) {
2046
+ const fs = options.fs || _fs;
2047
+ const str = stringify(obj, options);
2048
+ return fs.writeFileSync(file, str, options);
2049
+ }
2050
+ const jsonfile = { readFile, readFileSync, writeFile, writeFileSync };
2051
+ module1.exports = jsonfile;
2052
+ },
2053
+ 213: (module1) => {
2054
+ function stringify(
2055
+ obj,
2056
+ { EOL = "\n", finalEOL = true, replacer = null, spaces } = {},
2057
+ ) {
2058
+ const EOF = finalEOL ? EOL : "";
2059
+ const str = JSON.stringify(obj, replacer, spaces);
2060
+ return str.replace(/\n/g, EOL) + EOF;
2061
+ }
2062
+ function stripBom(content) {
2063
+ if (Buffer.isBuffer(content)) content = content.toString("utf8");
2064
+ return content.replace(/^\uFEFF/, "");
2065
+ }
2066
+ module1.exports = { stringify, stripBom };
2067
+ },
2068
+ 59: (__unused_webpack_module, exports) => {
2069
+ "use strict";
2070
+ exports.fromCallback = function (fn) {
2071
+ return Object.defineProperty(
2072
+ function (...args) {
2073
+ if (typeof args[args.length - 1] === "function")
2074
+ fn.apply(this, args);
2075
+ else {
2076
+ return new Promise((resolve, reject) => {
2077
+ args.push((err, res) =>
2078
+ err != null ? reject(err) : resolve(res),
2079
+ );
2080
+ fn.apply(this, args);
2081
+ });
2082
+ }
2083
+ },
2084
+ "name",
2085
+ { value: fn.name },
2086
+ );
2087
+ };
2088
+ exports.fromPromise = function (fn) {
2089
+ return Object.defineProperty(
2090
+ function (...args) {
2091
+ const cb = args[args.length - 1];
2092
+ if (typeof cb !== "function") return fn.apply(this, args);
2093
+ else {
2094
+ args.pop();
2095
+ fn.apply(this, args).then((r) => cb(null, r), cb);
2096
+ }
2097
+ },
2098
+ "name",
2099
+ { value: fn.name },
2100
+ );
2101
+ };
2102
+ },
2103
+ 491: (module1) => {
2104
+ "use strict";
2105
+ module1.exports = require("assert");
2106
+ },
2107
+ 57: (module1) => {
2108
+ "use strict";
2109
+ module1.exports = require("constants");
2110
+ },
2111
+ 147: (module1) => {
2112
+ "use strict";
2113
+ module1.exports = require("fs");
2114
+ },
2115
+ 17: (module1) => {
2116
+ "use strict";
2117
+ module1.exports = require("path");
2118
+ },
2119
+ 781: (module1) => {
2120
+ "use strict";
2121
+ module1.exports = require("stream");
2122
+ },
2123
+ 837: (module1) => {
2124
+ "use strict";
2125
+ module1.exports = require("util");
2126
+ },
2127
+ };
2128
+ var __webpack_module_cache__ = {};
2129
+ function __nccwpck_require__(moduleId) {
2130
+ var cachedModule = __webpack_module_cache__[moduleId];
2131
+ if (cachedModule !== undefined) {
2132
+ return cachedModule.exports;
2505
2133
  }
2506
- }
2507
-
2508
- function statFix (orig) {
2509
- if (!orig) return orig
2510
- // Older versions of Node erroneously returned signed integers for
2511
- // uid + gid.
2512
- return function (target, options, cb) {
2513
- if (typeof options === 'function') {
2514
- cb = options
2515
- options = null
2516
- }
2517
- function callback (er, stats) {
2518
- if (stats) {
2519
- if (stats.uid < 0) stats.uid += 0x100000000
2520
- if (stats.gid < 0) stats.gid += 0x100000000
2521
- }
2522
- if (cb) cb.apply(this, arguments)
2523
- }
2524
- return options ? orig.call(fs, target, options, callback)
2525
- : orig.call(fs, target, callback)
2526
- }
2527
- }
2528
-
2529
- function statFixSync (orig) {
2530
- if (!orig) return orig
2531
- // Older versions of Node erroneously returned signed integers for
2532
- // uid + gid.
2533
- return function (target, options) {
2534
- var stats = options ? orig.call(fs, target, options)
2535
- : orig.call(fs, target)
2536
- if (stats) {
2537
- if (stats.uid < 0) stats.uid += 0x100000000
2538
- if (stats.gid < 0) stats.gid += 0x100000000
2539
- }
2540
- return stats;
2541
- }
2542
- }
2543
-
2544
- // ENOSYS means that the fs doesn't support the op. Just ignore
2545
- // that, because it doesn't matter.
2546
- //
2547
- // if there's no getuid, or if getuid() is something other
2548
- // than 0, and the error is EINVAL or EPERM, then just ignore
2549
- // it.
2550
- //
2551
- // This specific case is a silent failure in cp, install, tar,
2552
- // and most other unix tools that manage permissions.
2553
- //
2554
- // When running as root, or if other types of errors are
2555
- // encountered, then it's strict.
2556
- function chownErOk (er) {
2557
- if (!er)
2558
- return true
2559
-
2560
- if (er.code === "ENOSYS")
2561
- return true
2562
-
2563
- var nonroot = !process.getuid || process.getuid() !== 0
2564
- if (nonroot) {
2565
- if (er.code === "EINVAL" || er.code === "EPERM")
2566
- return true
2567
- }
2568
-
2569
- return false
2570
- }
2571
- }
2572
-
2573
-
2574
- /***/ }),
2575
-
2576
- /***/ 449:
2577
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
2578
-
2579
- let _fs
2580
- try {
2581
- _fs = __nccwpck_require__(804)
2582
- } catch (_) {
2583
- _fs = __nccwpck_require__(147)
2584
- }
2585
- const universalify = __nccwpck_require__(59)
2586
- const { stringify, stripBom } = __nccwpck_require__(213)
2587
-
2588
- async function _readFile (file, options = {}) {
2589
- if (typeof options === 'string') {
2590
- options = { encoding: options }
2591
- }
2592
-
2593
- const fs = options.fs || _fs
2594
-
2595
- const shouldThrow = 'throws' in options ? options.throws : true
2596
-
2597
- let data = await universalify.fromCallback(fs.readFile)(file, options)
2598
-
2599
- data = stripBom(data)
2600
-
2601
- let obj
2602
- try {
2603
- obj = JSON.parse(data, options ? options.reviver : null)
2604
- } catch (err) {
2605
- if (shouldThrow) {
2606
- err.message = `${file}: ${err.message}`
2607
- throw err
2608
- } else {
2609
- return null
2610
- }
2611
- }
2612
-
2613
- return obj
2614
- }
2615
-
2616
- const readFile = universalify.fromPromise(_readFile)
2617
-
2618
- function readFileSync (file, options = {}) {
2619
- if (typeof options === 'string') {
2620
- options = { encoding: options }
2621
- }
2622
-
2623
- const fs = options.fs || _fs
2624
-
2625
- const shouldThrow = 'throws' in options ? options.throws : true
2626
-
2627
- try {
2628
- let content = fs.readFileSync(file, options)
2629
- content = stripBom(content)
2630
- return JSON.parse(content, options.reviver)
2631
- } catch (err) {
2632
- if (shouldThrow) {
2633
- err.message = `${file}: ${err.message}`
2634
- throw err
2635
- } else {
2636
- return null
2134
+ var module1 = (__webpack_module_cache__[moduleId] = { exports: {} });
2135
+ var threw = true;
2136
+ try {
2137
+ __webpack_modules__[moduleId](
2138
+ module1,
2139
+ module1.exports,
2140
+ __nccwpck_require__,
2141
+ );
2142
+ threw = false;
2143
+ } finally {
2144
+ if (threw) delete __webpack_module_cache__[moduleId];
2637
2145
  }
2146
+ return module1.exports;
2638
2147
  }
2639
- }
2640
-
2641
- async function _writeFile (file, obj, options = {}) {
2642
- const fs = options.fs || _fs
2643
-
2644
- const str = stringify(obj, options)
2645
-
2646
- await universalify.fromCallback(fs.writeFile)(file, str, options)
2647
- }
2648
-
2649
- const writeFile = universalify.fromPromise(_writeFile)
2650
-
2651
- function writeFileSync (file, obj, options = {}) {
2652
- const fs = options.fs || _fs
2653
-
2654
- const str = stringify(obj, options)
2655
- // not sure if fs.writeFileSync returns anything, but just in case
2656
- return fs.writeFileSync(file, str, options)
2657
- }
2658
-
2659
- const jsonfile = {
2660
- readFile,
2661
- readFileSync,
2662
- writeFile,
2663
- writeFileSync
2664
- }
2665
-
2666
- module.exports = jsonfile
2667
-
2668
-
2669
- /***/ }),
2670
-
2671
- /***/ 213:
2672
- /***/ ((module) => {
2673
-
2674
- function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
2675
- const EOF = finalEOL ? EOL : ''
2676
- const str = JSON.stringify(obj, replacer, spaces)
2677
-
2678
- return str.replace(/\n/g, EOL) + EOF
2679
- }
2680
-
2681
- function stripBom (content) {
2682
- // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
2683
- if (Buffer.isBuffer(content)) content = content.toString('utf8')
2684
- return content.replace(/^\uFEFF/, '')
2685
- }
2686
-
2687
- module.exports = { stringify, stripBom }
2688
-
2689
-
2690
- /***/ }),
2691
-
2692
- /***/ 59:
2693
- /***/ ((__unused_webpack_module, exports) => {
2694
-
2695
- "use strict";
2696
-
2697
-
2698
- exports.fromCallback = function (fn) {
2699
- return Object.defineProperty(function (...args) {
2700
- if (typeof args[args.length - 1] === 'function') fn.apply(this, args)
2701
- else {
2702
- return new Promise((resolve, reject) => {
2703
- args.push((err, res) => (err != null) ? reject(err) : resolve(res))
2704
- fn.apply(this, args)
2705
- })
2706
- }
2707
- }, 'name', { value: fn.name })
2708
- }
2709
-
2710
- exports.fromPromise = function (fn) {
2711
- return Object.defineProperty(function (...args) {
2712
- const cb = args[args.length - 1]
2713
- if (typeof cb !== 'function') return fn.apply(this, args)
2714
- else {
2715
- args.pop()
2716
- fn.apply(this, args).then(r => cb(null, r), cb)
2717
- }
2718
- }, 'name', { value: fn.name })
2719
- }
2720
-
2721
-
2722
- /***/ }),
2723
-
2724
- /***/ 491:
2725
- /***/ ((module) => {
2726
-
2727
- "use strict";
2728
- module.exports = require("assert");
2729
-
2730
- /***/ }),
2731
-
2732
- /***/ 57:
2733
- /***/ ((module) => {
2734
-
2735
- "use strict";
2736
- module.exports = require("constants");
2737
-
2738
- /***/ }),
2739
-
2740
- /***/ 147:
2741
- /***/ ((module) => {
2742
-
2743
- "use strict";
2744
- module.exports = require("fs");
2745
-
2746
- /***/ }),
2747
-
2748
- /***/ 17:
2749
- /***/ ((module) => {
2750
-
2751
- "use strict";
2752
- module.exports = require("path");
2753
-
2754
- /***/ }),
2755
-
2756
- /***/ 781:
2757
- /***/ ((module) => {
2758
-
2759
- "use strict";
2760
- module.exports = require("stream");
2761
-
2762
- /***/ }),
2763
-
2764
- /***/ 837:
2765
- /***/ ((module) => {
2766
-
2767
- "use strict";
2768
- module.exports = require("util");
2769
-
2770
- /***/ })
2771
-
2772
- /******/ });
2773
- /************************************************************************/
2774
- /******/ // The module cache
2775
- /******/ var __webpack_module_cache__ = {};
2776
- /******/
2777
- /******/ // The require function
2778
- /******/ function __nccwpck_require__(moduleId) {
2779
- /******/ // Check if module is in cache
2780
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
2781
- /******/ if (cachedModule !== undefined) {
2782
- /******/ return cachedModule.exports;
2783
- /******/ }
2784
- /******/ // Create a new module (and put it into the cache)
2785
- /******/ var module = __webpack_module_cache__[moduleId] = {
2786
- /******/ // no module.id needed
2787
- /******/ // no module.loaded needed
2788
- /******/ exports: {}
2789
- /******/ };
2790
- /******/
2791
- /******/ // Execute the module function
2792
- /******/ var threw = true;
2793
- /******/ try {
2794
- /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
2795
- /******/ threw = false;
2796
- /******/ } finally {
2797
- /******/ if(threw) delete __webpack_module_cache__[moduleId];
2798
- /******/ }
2799
- /******/
2800
- /******/ // Return the exports of the module
2801
- /******/ return module.exports;
2802
- /******/ }
2803
- /******/
2804
- /************************************************************************/
2805
- /******/ /* webpack/runtime/compat */
2806
- /******/
2807
- /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
2808
- /******/
2809
- /************************************************************************/
2810
- /******/
2811
- /******/ // startup
2812
- /******/ // Load entry module and return exports
2813
- /******/ // This entry module is referenced by other modules so it can't be inlined
2814
- /******/ var __webpack_exports__ = __nccwpck_require__(175);
2815
- /******/ module.exports = __webpack_exports__;
2816
- /******/
2817
- /******/ })()
2818
- ;
2148
+ if (typeof __nccwpck_require__ !== "undefined")
2149
+ __nccwpck_require__.ab = __dirname + "/";
2150
+ var __webpack_exports__ = __nccwpck_require__(175);
2151
+ module.exports = __webpack_exports__;
2152
+ })();