@eclipse-glsp-examples/workflow-server-bundled 1.1.0-next.ea31916.59 → 1.1.0-next.f0fc2cf.63

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.
@@ -914,27 +914,26 @@ exports.WorkflowModelValidator = void 0;
914
914
  const server_1 = __webpack_require__(/*! @eclipse-glsp/server */ "../../packages/server/lib/node/index.js");
915
915
  const inversify_1 = __webpack_require__(/*! inversify */ "../../node_modules/inversify/es/inversify.js");
916
916
  const graph_extension_1 = __webpack_require__(/*! ../graph-extension */ "./lib/common/graph-extension.js");
917
- let WorkflowModelValidator = exports.WorkflowModelValidator = class WorkflowModelValidator {
918
- validate(elements) {
917
+ let WorkflowModelValidator = exports.WorkflowModelValidator = class WorkflowModelValidator extends server_1.AbstractModelValidator {
918
+ doLiveValidation(element) {
919
919
  const markers = [];
920
- for (const element of elements) {
921
- if (element instanceof graph_extension_1.TaskNode) {
922
- markers.push(...this.validateTaskNode(element));
923
- }
924
- else if (element instanceof graph_extension_1.ActivityNode) {
925
- if (element.nodeType === 'decisionNode') {
926
- markers.push(...this.validateDecisionNode(element));
927
- }
928
- else if (element.nodeType === 'mergeNode') {
929
- markers.push(...this.validateMergeNode(element));
930
- }
920
+ if (element instanceof graph_extension_1.ActivityNode) {
921
+ if (element.nodeType === 'decisionNode') {
922
+ markers.push(...this.validateDecisionNode(element));
931
923
  }
932
- if (element.children) {
933
- markers.push(...this.validate(element.children));
924
+ else if (element.nodeType === 'mergeNode') {
925
+ markers.push(...this.validateMergeNode(element));
934
926
  }
935
927
  }
936
928
  return markers;
937
929
  }
930
+ doBatchValidation(element) {
931
+ const markers = [];
932
+ if (element instanceof graph_extension_1.TaskNode) {
933
+ markers.push(...this.validateTaskNode(element));
934
+ }
935
+ return markers;
936
+ }
938
937
  validateTaskNode(taskNode) {
939
938
  const markers = [];
940
939
  const automated = this.validateTaskNode_isAutomated(taskNode);
@@ -8334,21 +8333,6 @@ function series(tasks, callback) {
8334
8333
  }
8335
8334
  module.exports = exports['default'];
8336
8335
 
8337
- /***/ }),
8338
-
8339
- /***/ "../../node_modules/at-least-node/index.js":
8340
- /*!*************************************************!*\
8341
- !*** ../../node_modules/at-least-node/index.js ***!
8342
- \*************************************************/
8343
- /***/ ((module) => {
8344
-
8345
- module.exports = r => {
8346
- const n = process.versions.node.split('.').map(x => parseInt(x, 10))
8347
- r = r.split('.').map(x => parseInt(x, 10))
8348
- return n[0] > r[0] || (n[0] === r[0] && (n[1] > r[1] || (n[1] === r[1] && n[2] >= r[2])))
8349
- }
8350
-
8351
-
8352
8336
  /***/ }),
8353
8337
 
8354
8338
  /***/ "../../node_modules/color-convert/conversions.js":
@@ -17160,3365 +17144,244 @@ var parseFlags = {
17160
17144
  A: amPm,
17161
17145
  ZZ: timezoneOffset,
17162
17146
  Z: timezoneOffset
17163
- };
17164
- // Some common format strings
17165
- var globalMasks = {
17166
- default: "ddd MMM DD YYYY HH:mm:ss",
17167
- shortDate: "M/D/YY",
17168
- mediumDate: "MMM D, YYYY",
17169
- longDate: "MMMM D, YYYY",
17170
- fullDate: "dddd, MMMM D, YYYY",
17171
- isoDate: "YYYY-MM-DD",
17172
- isoDateTime: "YYYY-MM-DDTHH:mm:ssZ",
17173
- shortTime: "HH:mm",
17174
- mediumTime: "HH:mm:ss",
17175
- longTime: "HH:mm:ss.SSS"
17176
- };
17177
- var setGlobalDateMasks = function (masks) { return assign(globalMasks, masks); };
17178
- /***
17179
- * Format a date
17180
- * @method format
17181
- * @param {Date|number} dateObj
17182
- * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
17183
- * @returns {string} Formatted date string
17184
- */
17185
- var format = function (dateObj, mask, i18n) {
17186
- if (mask === void 0) { mask = globalMasks["default"]; }
17187
- if (i18n === void 0) { i18n = {}; }
17188
- if (typeof dateObj === "number") {
17189
- dateObj = new Date(dateObj);
17190
- }
17191
- if (Object.prototype.toString.call(dateObj) !== "[object Date]" ||
17192
- isNaN(dateObj.getTime())) {
17193
- throw new Error("Invalid Date pass to format");
17194
- }
17195
- mask = globalMasks[mask] || mask;
17196
- var literals = [];
17197
- // Make literals inactive by replacing them with @@@
17198
- mask = mask.replace(literal, function ($0, $1) {
17199
- literals.push($1);
17200
- return "@@@";
17201
- });
17202
- var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
17203
- // Apply formatting rules
17204
- mask = mask.replace(token, function ($0) {
17205
- return formatFlags[$0](dateObj, combinedI18nSettings);
17206
- });
17207
- // Inline literal values back into the formatted value
17208
- return mask.replace(/@@@/g, function () { return literals.shift(); });
17209
- };
17210
- /**
17211
- * Parse a date string into a Javascript Date object /
17212
- * @method parse
17213
- * @param {string} dateStr Date string
17214
- * @param {string} format Date parse format
17215
- * @param {i18n} I18nSettingsOptional Full or subset of I18N settings
17216
- * @returns {Date|null} Returns Date object. Returns null what date string is invalid or doesn't match format
17217
- */
17218
- function parse(dateStr, format, i18n) {
17219
- if (i18n === void 0) { i18n = {}; }
17220
- if (typeof format !== "string") {
17221
- throw new Error("Invalid format in fecha parse");
17222
- }
17223
- // Check to see if the format is actually a mask
17224
- format = globalMasks[format] || format;
17225
- // Avoid regular expression denial of service, fail early for really long strings
17226
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
17227
- if (dateStr.length > 1000) {
17228
- return null;
17229
- }
17230
- // Default to the beginning of the year.
17231
- var today = new Date();
17232
- var dateInfo = {
17233
- year: today.getFullYear(),
17234
- month: 0,
17235
- day: 1,
17236
- hour: 0,
17237
- minute: 0,
17238
- second: 0,
17239
- millisecond: 0,
17240
- isPm: null,
17241
- timezoneOffset: null
17242
- };
17243
- var parseInfo = [];
17244
- var literals = [];
17245
- // Replace all the literals with @@@. Hopefully a string that won't exist in the format
17246
- var newFormat = format.replace(literal, function ($0, $1) {
17247
- literals.push(regexEscape($1));
17248
- return "@@@";
17249
- });
17250
- var specifiedFields = {};
17251
- var requiredFields = {};
17252
- // Change every token that we find into the correct regex
17253
- newFormat = regexEscape(newFormat).replace(token, function ($0) {
17254
- var info = parseFlags[$0];
17255
- var field = info[0], regex = info[1], requiredField = info[3];
17256
- // Check if the person has specified the same field twice. This will lead to confusing results.
17257
- if (specifiedFields[field]) {
17258
- throw new Error("Invalid format. " + field + " specified twice in format");
17259
- }
17260
- specifiedFields[field] = true;
17261
- // Check if there are any required fields. For instance, 12 hour time requires AM/PM specified
17262
- if (requiredField) {
17263
- requiredFields[requiredField] = true;
17264
- }
17265
- parseInfo.push(info);
17266
- return "(" + regex + ")";
17267
- });
17268
- // Check all the required fields are present
17269
- Object.keys(requiredFields).forEach(function (field) {
17270
- if (!specifiedFields[field]) {
17271
- throw new Error("Invalid format. " + field + " is required in specified format");
17272
- }
17273
- });
17274
- // Add back all the literals after
17275
- newFormat = newFormat.replace(/@@@/g, function () { return literals.shift(); });
17276
- // Check if the date string matches the format. If it doesn't return null
17277
- var matches = dateStr.match(new RegExp(newFormat, "i"));
17278
- if (!matches) {
17279
- return null;
17280
- }
17281
- var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
17282
- // For each match, call the parser function for that date part
17283
- for (var i = 1; i < matches.length; i++) {
17284
- var _a = parseInfo[i - 1], field = _a[0], parser = _a[2];
17285
- var value = parser
17286
- ? parser(matches[i], combinedI18nSettings)
17287
- : +matches[i];
17288
- // If the parser can't make sense of the value, return null
17289
- if (value == null) {
17290
- return null;
17291
- }
17292
- dateInfo[field] = value;
17293
- }
17294
- if (dateInfo.isPm === 1 && dateInfo.hour != null && +dateInfo.hour !== 12) {
17295
- dateInfo.hour = +dateInfo.hour + 12;
17296
- }
17297
- else if (dateInfo.isPm === 0 && +dateInfo.hour === 12) {
17298
- dateInfo.hour = 0;
17299
- }
17300
- var dateTZ;
17301
- if (dateInfo.timezoneOffset == null) {
17302
- dateTZ = new Date(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute, dateInfo.second, dateInfo.millisecond);
17303
- var validateFields = [
17304
- ["month", "getMonth"],
17305
- ["day", "getDate"],
17306
- ["hour", "getHours"],
17307
- ["minute", "getMinutes"],
17308
- ["second", "getSeconds"]
17309
- ];
17310
- for (var i = 0, len = validateFields.length; i < len; i++) {
17311
- // Check to make sure the date field is within the allowed range. Javascript dates allows values
17312
- // outside the allowed range. If the values don't match the value was invalid
17313
- if (specifiedFields[validateFields[i][0]] &&
17314
- dateInfo[validateFields[i][0]] !== dateTZ[validateFields[i][1]]()) {
17315
- return null;
17316
- }
17317
- }
17318
- }
17319
- else {
17320
- dateTZ = new Date(Date.UTC(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute - dateInfo.timezoneOffset, dateInfo.second, dateInfo.millisecond));
17321
- // We can't validate dates in another timezone unfortunately. Do a basic check instead
17322
- if (dateInfo.month > 11 ||
17323
- dateInfo.month < 0 ||
17324
- dateInfo.day > 31 ||
17325
- dateInfo.day < 1 ||
17326
- dateInfo.hour > 23 ||
17327
- dateInfo.hour < 0 ||
17328
- dateInfo.minute > 59 ||
17329
- dateInfo.minute < 0 ||
17330
- dateInfo.second > 59 ||
17331
- dateInfo.second < 0) {
17332
- return null;
17333
- }
17334
- }
17335
- // Don't allow invalid dates
17336
- return dateTZ;
17337
- }
17338
- var fecha = {
17339
- format: format,
17340
- parse: parse,
17341
- defaultI18n: defaultI18n,
17342
- setGlobalDateI18n: setGlobalDateI18n,
17343
- setGlobalDateMasks: setGlobalDateMasks
17344
- };
17345
-
17346
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fecha);
17347
-
17348
-
17349
-
17350
- /***/ }),
17351
-
17352
- /***/ "../../node_modules/fn.name/index.js":
17353
- /*!*******************************************!*\
17354
- !*** ../../node_modules/fn.name/index.js ***!
17355
- \*******************************************/
17356
- /***/ ((module) => {
17357
-
17358
- "use strict";
17359
-
17360
-
17361
- var toString = Object.prototype.toString;
17362
-
17363
- /**
17364
- * Extract names from functions.
17365
- *
17366
- * @param {Function} fn The function who's name we need to extract.
17367
- * @returns {String} The name of the function.
17368
- * @public
17369
- */
17370
- module.exports = function name(fn) {
17371
- if ('string' === typeof fn.displayName && fn.constructor.name) {
17372
- return fn.displayName;
17373
- } else if ('string' === typeof fn.name && fn.name) {
17374
- return fn.name;
17375
- }
17376
-
17377
- //
17378
- // Check to see if the constructor has a name.
17379
- //
17380
- if (
17381
- 'object' === typeof fn
17382
- && fn.constructor
17383
- && 'string' === typeof fn.constructor.name
17384
- ) return fn.constructor.name;
17385
-
17386
- //
17387
- // toString the given function and attempt to parse it out of it, or determine
17388
- // the class.
17389
- //
17390
- var named = fn.toString()
17391
- , type = toString.call(fn).slice(8, -1);
17392
-
17393
- if ('Function' === type) {
17394
- named = named.substring(named.indexOf('(') + 1, named.indexOf(')'));
17395
- } else {
17396
- named = type;
17397
- }
17398
-
17399
- return named || 'anonymous';
17400
- };
17401
-
17402
-
17403
- /***/ }),
17404
-
17405
- /***/ "../../node_modules/fs-extra/lib/copy-sync/copy-sync.js":
17406
- /*!**************************************************************!*\
17407
- !*** ../../node_modules/fs-extra/lib/copy-sync/copy-sync.js ***!
17408
- \**************************************************************/
17409
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17410
-
17411
- "use strict";
17412
-
17413
-
17414
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
17415
- const path = __webpack_require__(/*! path */ "path")
17416
- const mkdirsSync = (__webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js").mkdirsSync)
17417
- const utimesMillisSync = (__webpack_require__(/*! ../util/utimes */ "../../node_modules/fs-extra/lib/util/utimes.js").utimesMillisSync)
17418
- const stat = __webpack_require__(/*! ../util/stat */ "../../node_modules/fs-extra/lib/util/stat.js")
17419
-
17420
- function copySync (src, dest, opts) {
17421
- if (typeof opts === 'function') {
17422
- opts = { filter: opts }
17423
- }
17424
-
17425
- opts = opts || {}
17426
- opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
17427
- opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
17428
-
17429
- // Warn about using preserveTimestamps on 32-bit node
17430
- if (opts.preserveTimestamps && process.arch === 'ia32') {
17431
- console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n
17432
- see https://github.com/jprichardson/node-fs-extra/issues/269`)
17433
- }
17434
-
17435
- const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy')
17436
- stat.checkParentPathsSync(src, srcStat, dest, 'copy')
17437
- return handleFilterAndCopy(destStat, src, dest, opts)
17438
- }
17439
-
17440
- function handleFilterAndCopy (destStat, src, dest, opts) {
17441
- if (opts.filter && !opts.filter(src, dest)) return
17442
- const destParent = path.dirname(dest)
17443
- if (!fs.existsSync(destParent)) mkdirsSync(destParent)
17444
- return startCopy(destStat, src, dest, opts)
17445
- }
17446
-
17447
- function startCopy (destStat, src, dest, opts) {
17448
- if (opts.filter && !opts.filter(src, dest)) return
17449
- return getStats(destStat, src, dest, opts)
17450
- }
17451
-
17452
- function getStats (destStat, src, dest, opts) {
17453
- const statSync = opts.dereference ? fs.statSync : fs.lstatSync
17454
- const srcStat = statSync(src)
17455
-
17456
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
17457
- else if (srcStat.isFile() ||
17458
- srcStat.isCharacterDevice() ||
17459
- srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
17460
- else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
17461
- }
17462
-
17463
- function onFile (srcStat, destStat, src, dest, opts) {
17464
- if (!destStat) return copyFile(srcStat, src, dest, opts)
17465
- return mayCopyFile(srcStat, src, dest, opts)
17466
- }
17467
-
17468
- function mayCopyFile (srcStat, src, dest, opts) {
17469
- if (opts.overwrite) {
17470
- fs.unlinkSync(dest)
17471
- return copyFile(srcStat, src, dest, opts)
17472
- } else if (opts.errorOnExist) {
17473
- throw new Error(`'${dest}' already exists`)
17474
- }
17475
- }
17476
-
17477
- function copyFile (srcStat, src, dest, opts) {
17478
- fs.copyFileSync(src, dest)
17479
- if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
17480
- return setDestMode(dest, srcStat.mode)
17481
- }
17482
-
17483
- function handleTimestamps (srcMode, src, dest) {
17484
- // Make sure the file is writable before setting the timestamp
17485
- // otherwise open fails with EPERM when invoked with 'r+'
17486
- // (through utimes call)
17487
- if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
17488
- return setDestTimestamps(src, dest)
17489
- }
17490
-
17491
- function fileIsNotWritable (srcMode) {
17492
- return (srcMode & 0o200) === 0
17493
- }
17494
-
17495
- function makeFileWritable (dest, srcMode) {
17496
- return setDestMode(dest, srcMode | 0o200)
17497
- }
17498
-
17499
- function setDestMode (dest, srcMode) {
17500
- return fs.chmodSync(dest, srcMode)
17501
- }
17502
-
17503
- function setDestTimestamps (src, dest) {
17504
- // The initial srcStat.atime cannot be trusted
17505
- // because it is modified by the read(2) system call
17506
- // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
17507
- const updatedSrcStat = fs.statSync(src)
17508
- return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
17509
- }
17510
-
17511
- function onDir (srcStat, destStat, src, dest, opts) {
17512
- if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
17513
- if (destStat && !destStat.isDirectory()) {
17514
- throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
17515
- }
17516
- return copyDir(src, dest, opts)
17517
- }
17518
-
17519
- function mkDirAndCopy (srcMode, src, dest, opts) {
17520
- fs.mkdirSync(dest)
17521
- copyDir(src, dest, opts)
17522
- return setDestMode(dest, srcMode)
17523
- }
17524
-
17525
- function copyDir (src, dest, opts) {
17526
- fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))
17527
- }
17528
-
17529
- function copyDirItem (item, src, dest, opts) {
17530
- const srcItem = path.join(src, item)
17531
- const destItem = path.join(dest, item)
17532
- const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy')
17533
- return startCopy(destStat, srcItem, destItem, opts)
17534
- }
17535
-
17536
- function onLink (destStat, src, dest, opts) {
17537
- let resolvedSrc = fs.readlinkSync(src)
17538
- if (opts.dereference) {
17539
- resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
17540
- }
17541
-
17542
- if (!destStat) {
17543
- return fs.symlinkSync(resolvedSrc, dest)
17544
- } else {
17545
- let resolvedDest
17546
- try {
17547
- resolvedDest = fs.readlinkSync(dest)
17548
- } catch (err) {
17549
- // dest exists and is a regular file or directory,
17550
- // Windows may throw UNKNOWN error. If dest already exists,
17551
- // fs throws error anyway, so no need to guard against it here.
17552
- if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)
17553
- throw err
17554
- }
17555
- if (opts.dereference) {
17556
- resolvedDest = path.resolve(process.cwd(), resolvedDest)
17557
- }
17558
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
17559
- throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
17560
- }
17561
-
17562
- // prevent copy if src is a subdir of dest since unlinking
17563
- // dest in this case would result in removing src contents
17564
- // and therefore a broken symlink would be created.
17565
- if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
17566
- throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
17567
- }
17568
- return copyLink(resolvedSrc, dest)
17569
- }
17570
- }
17571
-
17572
- function copyLink (resolvedSrc, dest) {
17573
- fs.unlinkSync(dest)
17574
- return fs.symlinkSync(resolvedSrc, dest)
17575
- }
17576
-
17577
- module.exports = copySync
17578
-
17579
-
17580
- /***/ }),
17581
-
17582
- /***/ "../../node_modules/fs-extra/lib/copy-sync/index.js":
17583
- /*!**********************************************************!*\
17584
- !*** ../../node_modules/fs-extra/lib/copy-sync/index.js ***!
17585
- \**********************************************************/
17586
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17587
-
17588
- "use strict";
17589
-
17590
-
17591
- module.exports = {
17592
- copySync: __webpack_require__(/*! ./copy-sync */ "../../node_modules/fs-extra/lib/copy-sync/copy-sync.js")
17593
- }
17594
-
17595
-
17596
- /***/ }),
17597
-
17598
- /***/ "../../node_modules/fs-extra/lib/copy/copy.js":
17599
- /*!****************************************************!*\
17600
- !*** ../../node_modules/fs-extra/lib/copy/copy.js ***!
17601
- \****************************************************/
17602
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17603
-
17604
- "use strict";
17605
-
17606
-
17607
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
17608
- const path = __webpack_require__(/*! path */ "path")
17609
- const mkdirs = (__webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js").mkdirs)
17610
- const pathExists = (__webpack_require__(/*! ../path-exists */ "../../node_modules/fs-extra/lib/path-exists/index.js").pathExists)
17611
- const utimesMillis = (__webpack_require__(/*! ../util/utimes */ "../../node_modules/fs-extra/lib/util/utimes.js").utimesMillis)
17612
- const stat = __webpack_require__(/*! ../util/stat */ "../../node_modules/fs-extra/lib/util/stat.js")
17613
-
17614
- function copy (src, dest, opts, cb) {
17615
- if (typeof opts === 'function' && !cb) {
17616
- cb = opts
17617
- opts = {}
17618
- } else if (typeof opts === 'function') {
17619
- opts = { filter: opts }
17620
- }
17621
-
17622
- cb = cb || function () {}
17623
- opts = opts || {}
17624
-
17625
- opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
17626
- opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
17627
-
17628
- // Warn about using preserveTimestamps on 32-bit node
17629
- if (opts.preserveTimestamps && process.arch === 'ia32') {
17630
- console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n
17631
- see https://github.com/jprichardson/node-fs-extra/issues/269`)
17632
- }
17633
-
17634
- stat.checkPaths(src, dest, 'copy', (err, stats) => {
17635
- if (err) return cb(err)
17636
- const { srcStat, destStat } = stats
17637
- stat.checkParentPaths(src, srcStat, dest, 'copy', err => {
17638
- if (err) return cb(err)
17639
- if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb)
17640
- return checkParentDir(destStat, src, dest, opts, cb)
17641
- })
17642
- })
17643
- }
17644
-
17645
- function checkParentDir (destStat, src, dest, opts, cb) {
17646
- const destParent = path.dirname(dest)
17647
- pathExists(destParent, (err, dirExists) => {
17648
- if (err) return cb(err)
17649
- if (dirExists) return startCopy(destStat, src, dest, opts, cb)
17650
- mkdirs(destParent, err => {
17651
- if (err) return cb(err)
17652
- return startCopy(destStat, src, dest, opts, cb)
17653
- })
17654
- })
17655
- }
17656
-
17657
- function handleFilter (onInclude, destStat, src, dest, opts, cb) {
17658
- Promise.resolve(opts.filter(src, dest)).then(include => {
17659
- if (include) return onInclude(destStat, src, dest, opts, cb)
17660
- return cb()
17661
- }, error => cb(error))
17662
- }
17663
-
17664
- function startCopy (destStat, src, dest, opts, cb) {
17665
- if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb)
17666
- return getStats(destStat, src, dest, opts, cb)
17667
- }
17668
-
17669
- function getStats (destStat, src, dest, opts, cb) {
17670
- const stat = opts.dereference ? fs.stat : fs.lstat
17671
- stat(src, (err, srcStat) => {
17672
- if (err) return cb(err)
17673
-
17674
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb)
17675
- else if (srcStat.isFile() ||
17676
- srcStat.isCharacterDevice() ||
17677
- srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb)
17678
- else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb)
17679
- })
17680
- }
17681
-
17682
- function onFile (srcStat, destStat, src, dest, opts, cb) {
17683
- if (!destStat) return copyFile(srcStat, src, dest, opts, cb)
17684
- return mayCopyFile(srcStat, src, dest, opts, cb)
17685
- }
17686
-
17687
- function mayCopyFile (srcStat, src, dest, opts, cb) {
17688
- if (opts.overwrite) {
17689
- fs.unlink(dest, err => {
17690
- if (err) return cb(err)
17691
- return copyFile(srcStat, src, dest, opts, cb)
17692
- })
17693
- } else if (opts.errorOnExist) {
17694
- return cb(new Error(`'${dest}' already exists`))
17695
- } else return cb()
17696
- }
17697
-
17698
- function copyFile (srcStat, src, dest, opts, cb) {
17699
- fs.copyFile(src, dest, err => {
17700
- if (err) return cb(err)
17701
- if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb)
17702
- return setDestMode(dest, srcStat.mode, cb)
17703
- })
17704
- }
17705
-
17706
- function handleTimestampsAndMode (srcMode, src, dest, cb) {
17707
- // Make sure the file is writable before setting the timestamp
17708
- // otherwise open fails with EPERM when invoked with 'r+'
17709
- // (through utimes call)
17710
- if (fileIsNotWritable(srcMode)) {
17711
- return makeFileWritable(dest, srcMode, err => {
17712
- if (err) return cb(err)
17713
- return setDestTimestampsAndMode(srcMode, src, dest, cb)
17714
- })
17715
- }
17716
- return setDestTimestampsAndMode(srcMode, src, dest, cb)
17717
- }
17718
-
17719
- function fileIsNotWritable (srcMode) {
17720
- return (srcMode & 0o200) === 0
17721
- }
17722
-
17723
- function makeFileWritable (dest, srcMode, cb) {
17724
- return setDestMode(dest, srcMode | 0o200, cb)
17725
- }
17726
-
17727
- function setDestTimestampsAndMode (srcMode, src, dest, cb) {
17728
- setDestTimestamps(src, dest, err => {
17729
- if (err) return cb(err)
17730
- return setDestMode(dest, srcMode, cb)
17731
- })
17732
- }
17733
-
17734
- function setDestMode (dest, srcMode, cb) {
17735
- return fs.chmod(dest, srcMode, cb)
17736
- }
17737
-
17738
- function setDestTimestamps (src, dest, cb) {
17739
- // The initial srcStat.atime cannot be trusted
17740
- // because it is modified by the read(2) system call
17741
- // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
17742
- fs.stat(src, (err, updatedSrcStat) => {
17743
- if (err) return cb(err)
17744
- return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb)
17745
- })
17746
- }
17747
-
17748
- function onDir (srcStat, destStat, src, dest, opts, cb) {
17749
- if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb)
17750
- if (destStat && !destStat.isDirectory()) {
17751
- return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`))
17752
- }
17753
- return copyDir(src, dest, opts, cb)
17754
- }
17755
-
17756
- function mkDirAndCopy (srcMode, src, dest, opts, cb) {
17757
- fs.mkdir(dest, err => {
17758
- if (err) return cb(err)
17759
- copyDir(src, dest, opts, err => {
17760
- if (err) return cb(err)
17761
- return setDestMode(dest, srcMode, cb)
17762
- })
17763
- })
17764
- }
17765
-
17766
- function copyDir (src, dest, opts, cb) {
17767
- fs.readdir(src, (err, items) => {
17768
- if (err) return cb(err)
17769
- return copyDirItems(items, src, dest, opts, cb)
17770
- })
17771
- }
17772
-
17773
- function copyDirItems (items, src, dest, opts, cb) {
17774
- const item = items.pop()
17775
- if (!item) return cb()
17776
- return copyDirItem(items, item, src, dest, opts, cb)
17777
- }
17778
-
17779
- function copyDirItem (items, item, src, dest, opts, cb) {
17780
- const srcItem = path.join(src, item)
17781
- const destItem = path.join(dest, item)
17782
- stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => {
17783
- if (err) return cb(err)
17784
- const { destStat } = stats
17785
- startCopy(destStat, srcItem, destItem, opts, err => {
17786
- if (err) return cb(err)
17787
- return copyDirItems(items, src, dest, opts, cb)
17788
- })
17789
- })
17790
- }
17791
-
17792
- function onLink (destStat, src, dest, opts, cb) {
17793
- fs.readlink(src, (err, resolvedSrc) => {
17794
- if (err) return cb(err)
17795
- if (opts.dereference) {
17796
- resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
17797
- }
17798
-
17799
- if (!destStat) {
17800
- return fs.symlink(resolvedSrc, dest, cb)
17801
- } else {
17802
- fs.readlink(dest, (err, resolvedDest) => {
17803
- if (err) {
17804
- // dest exists and is a regular file or directory,
17805
- // Windows may throw UNKNOWN error. If dest already exists,
17806
- // fs throws error anyway, so no need to guard against it here.
17807
- if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb)
17808
- return cb(err)
17809
- }
17810
- if (opts.dereference) {
17811
- resolvedDest = path.resolve(process.cwd(), resolvedDest)
17812
- }
17813
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
17814
- return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))
17815
- }
17816
-
17817
- // do not copy if src is a subdir of dest since unlinking
17818
- // dest in this case would result in removing src contents
17819
- // and therefore a broken symlink would be created.
17820
- if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
17821
- return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
17822
- }
17823
- return copyLink(resolvedSrc, dest, cb)
17824
- })
17825
- }
17826
- })
17827
- }
17828
-
17829
- function copyLink (resolvedSrc, dest, cb) {
17830
- fs.unlink(dest, err => {
17831
- if (err) return cb(err)
17832
- return fs.symlink(resolvedSrc, dest, cb)
17833
- })
17834
- }
17835
-
17836
- module.exports = copy
17837
-
17838
-
17839
- /***/ }),
17840
-
17841
- /***/ "../../node_modules/fs-extra/lib/copy/index.js":
17842
- /*!*****************************************************!*\
17843
- !*** ../../node_modules/fs-extra/lib/copy/index.js ***!
17844
- \*****************************************************/
17845
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17846
-
17847
- "use strict";
17848
-
17849
-
17850
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
17851
- module.exports = {
17852
- copy: u(__webpack_require__(/*! ./copy */ "../../node_modules/fs-extra/lib/copy/copy.js"))
17853
- }
17854
-
17855
-
17856
- /***/ }),
17857
-
17858
- /***/ "../../node_modules/fs-extra/lib/empty/index.js":
17859
- /*!******************************************************!*\
17860
- !*** ../../node_modules/fs-extra/lib/empty/index.js ***!
17861
- \******************************************************/
17862
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17863
-
17864
- "use strict";
17865
-
17866
-
17867
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
17868
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
17869
- const path = __webpack_require__(/*! path */ "path")
17870
- const mkdir = __webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js")
17871
- const remove = __webpack_require__(/*! ../remove */ "../../node_modules/fs-extra/lib/remove/index.js")
17872
-
17873
- const emptyDir = u(function emptyDir (dir, callback) {
17874
- callback = callback || function () {}
17875
- fs.readdir(dir, (err, items) => {
17876
- if (err) return mkdir.mkdirs(dir, callback)
17877
-
17878
- items = items.map(item => path.join(dir, item))
17879
-
17880
- deleteItem()
17881
-
17882
- function deleteItem () {
17883
- const item = items.pop()
17884
- if (!item) return callback()
17885
- remove.remove(item, err => {
17886
- if (err) return callback(err)
17887
- deleteItem()
17888
- })
17889
- }
17890
- })
17891
- })
17892
-
17893
- function emptyDirSync (dir) {
17894
- let items
17895
- try {
17896
- items = fs.readdirSync(dir)
17897
- } catch {
17898
- return mkdir.mkdirsSync(dir)
17899
- }
17900
-
17901
- items.forEach(item => {
17902
- item = path.join(dir, item)
17903
- remove.removeSync(item)
17904
- })
17905
- }
17906
-
17907
- module.exports = {
17908
- emptyDirSync,
17909
- emptydirSync: emptyDirSync,
17910
- emptyDir,
17911
- emptydir: emptyDir
17912
- }
17913
-
17914
-
17915
- /***/ }),
17916
-
17917
- /***/ "../../node_modules/fs-extra/lib/ensure/file.js":
17918
- /*!******************************************************!*\
17919
- !*** ../../node_modules/fs-extra/lib/ensure/file.js ***!
17920
- \******************************************************/
17921
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17922
-
17923
- "use strict";
17924
-
17925
-
17926
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
17927
- const path = __webpack_require__(/*! path */ "path")
17928
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
17929
- const mkdir = __webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js")
17930
-
17931
- function createFile (file, callback) {
17932
- function makeFile () {
17933
- fs.writeFile(file, '', err => {
17934
- if (err) return callback(err)
17935
- callback()
17936
- })
17937
- }
17938
-
17939
- fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err
17940
- if (!err && stats.isFile()) return callback()
17941
- const dir = path.dirname(file)
17942
- fs.stat(dir, (err, stats) => {
17943
- if (err) {
17944
- // if the directory doesn't exist, make it
17945
- if (err.code === 'ENOENT') {
17946
- return mkdir.mkdirs(dir, err => {
17947
- if (err) return callback(err)
17948
- makeFile()
17949
- })
17950
- }
17951
- return callback(err)
17952
- }
17953
-
17954
- if (stats.isDirectory()) makeFile()
17955
- else {
17956
- // parent is not a directory
17957
- // This is just to cause an internal ENOTDIR error to be thrown
17958
- fs.readdir(dir, err => {
17959
- if (err) return callback(err)
17960
- })
17961
- }
17962
- })
17963
- })
17964
- }
17965
-
17966
- function createFileSync (file) {
17967
- let stats
17968
- try {
17969
- stats = fs.statSync(file)
17970
- } catch {}
17971
- if (stats && stats.isFile()) return
17972
-
17973
- const dir = path.dirname(file)
17974
- try {
17975
- if (!fs.statSync(dir).isDirectory()) {
17976
- // parent is not a directory
17977
- // This is just to cause an internal ENOTDIR error to be thrown
17978
- fs.readdirSync(dir)
17979
- }
17980
- } catch (err) {
17981
- // If the stat call above failed because the directory doesn't exist, create it
17982
- if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)
17983
- else throw err
17984
- }
17985
-
17986
- fs.writeFileSync(file, '')
17987
- }
17988
-
17989
- module.exports = {
17990
- createFile: u(createFile),
17991
- createFileSync
17992
- }
17993
-
17994
-
17995
- /***/ }),
17996
-
17997
- /***/ "../../node_modules/fs-extra/lib/ensure/index.js":
17998
- /*!*******************************************************!*\
17999
- !*** ../../node_modules/fs-extra/lib/ensure/index.js ***!
18000
- \*******************************************************/
18001
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18002
-
18003
- "use strict";
18004
-
18005
-
18006
- const file = __webpack_require__(/*! ./file */ "../../node_modules/fs-extra/lib/ensure/file.js")
18007
- const link = __webpack_require__(/*! ./link */ "../../node_modules/fs-extra/lib/ensure/link.js")
18008
- const symlink = __webpack_require__(/*! ./symlink */ "../../node_modules/fs-extra/lib/ensure/symlink.js")
18009
-
18010
- module.exports = {
18011
- // file
18012
- createFile: file.createFile,
18013
- createFileSync: file.createFileSync,
18014
- ensureFile: file.createFile,
18015
- ensureFileSync: file.createFileSync,
18016
- // link
18017
- createLink: link.createLink,
18018
- createLinkSync: link.createLinkSync,
18019
- ensureLink: link.createLink,
18020
- ensureLinkSync: link.createLinkSync,
18021
- // symlink
18022
- createSymlink: symlink.createSymlink,
18023
- createSymlinkSync: symlink.createSymlinkSync,
18024
- ensureSymlink: symlink.createSymlink,
18025
- ensureSymlinkSync: symlink.createSymlinkSync
18026
- }
18027
-
18028
-
18029
- /***/ }),
18030
-
18031
- /***/ "../../node_modules/fs-extra/lib/ensure/link.js":
18032
- /*!******************************************************!*\
18033
- !*** ../../node_modules/fs-extra/lib/ensure/link.js ***!
18034
- \******************************************************/
18035
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18036
-
18037
- "use strict";
18038
-
18039
-
18040
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
18041
- const path = __webpack_require__(/*! path */ "path")
18042
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18043
- const mkdir = __webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js")
18044
- const pathExists = (__webpack_require__(/*! ../path-exists */ "../../node_modules/fs-extra/lib/path-exists/index.js").pathExists)
18045
-
18046
- function createLink (srcpath, dstpath, callback) {
18047
- function makeLink (srcpath, dstpath) {
18048
- fs.link(srcpath, dstpath, err => {
18049
- if (err) return callback(err)
18050
- callback(null)
18051
- })
18052
- }
18053
-
18054
- pathExists(dstpath, (err, destinationExists) => {
18055
- if (err) return callback(err)
18056
- if (destinationExists) return callback(null)
18057
- fs.lstat(srcpath, (err) => {
18058
- if (err) {
18059
- err.message = err.message.replace('lstat', 'ensureLink')
18060
- return callback(err)
18061
- }
18062
-
18063
- const dir = path.dirname(dstpath)
18064
- pathExists(dir, (err, dirExists) => {
18065
- if (err) return callback(err)
18066
- if (dirExists) return makeLink(srcpath, dstpath)
18067
- mkdir.mkdirs(dir, err => {
18068
- if (err) return callback(err)
18069
- makeLink(srcpath, dstpath)
18070
- })
18071
- })
18072
- })
18073
- })
18074
- }
18075
-
18076
- function createLinkSync (srcpath, dstpath) {
18077
- const destinationExists = fs.existsSync(dstpath)
18078
- if (destinationExists) return undefined
18079
-
18080
- try {
18081
- fs.lstatSync(srcpath)
18082
- } catch (err) {
18083
- err.message = err.message.replace('lstat', 'ensureLink')
18084
- throw err
18085
- }
18086
-
18087
- const dir = path.dirname(dstpath)
18088
- const dirExists = fs.existsSync(dir)
18089
- if (dirExists) return fs.linkSync(srcpath, dstpath)
18090
- mkdir.mkdirsSync(dir)
18091
-
18092
- return fs.linkSync(srcpath, dstpath)
18093
- }
18094
-
18095
- module.exports = {
18096
- createLink: u(createLink),
18097
- createLinkSync
18098
- }
18099
-
18100
-
18101
- /***/ }),
18102
-
18103
- /***/ "../../node_modules/fs-extra/lib/ensure/symlink-paths.js":
18104
- /*!***************************************************************!*\
18105
- !*** ../../node_modules/fs-extra/lib/ensure/symlink-paths.js ***!
18106
- \***************************************************************/
18107
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18108
-
18109
- "use strict";
18110
-
18111
-
18112
- const path = __webpack_require__(/*! path */ "path")
18113
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18114
- const pathExists = (__webpack_require__(/*! ../path-exists */ "../../node_modules/fs-extra/lib/path-exists/index.js").pathExists)
18115
-
18116
- /**
18117
- * Function that returns two types of paths, one relative to symlink, and one
18118
- * relative to the current working directory. Checks if path is absolute or
18119
- * relative. If the path is relative, this function checks if the path is
18120
- * relative to symlink or relative to current working directory. This is an
18121
- * initiative to find a smarter `srcpath` to supply when building symlinks.
18122
- * This allows you to determine which path to use out of one of three possible
18123
- * types of source paths. The first is an absolute path. This is detected by
18124
- * `path.isAbsolute()`. When an absolute path is provided, it is checked to
18125
- * see if it exists. If it does it's used, if not an error is returned
18126
- * (callback)/ thrown (sync). The other two options for `srcpath` are a
18127
- * relative url. By default Node's `fs.symlink` works by creating a symlink
18128
- * using `dstpath` and expects the `srcpath` to be relative to the newly
18129
- * created symlink. If you provide a `srcpath` that does not exist on the file
18130
- * system it results in a broken symlink. To minimize this, the function
18131
- * checks to see if the 'relative to symlink' source file exists, and if it
18132
- * does it will use it. If it does not, it checks if there's a file that
18133
- * exists that is relative to the current working directory, if does its used.
18134
- * This preserves the expectations of the original fs.symlink spec and adds
18135
- * the ability to pass in `relative to current working direcotry` paths.
18136
- */
18137
-
18138
- function symlinkPaths (srcpath, dstpath, callback) {
18139
- if (path.isAbsolute(srcpath)) {
18140
- return fs.lstat(srcpath, (err) => {
18141
- if (err) {
18142
- err.message = err.message.replace('lstat', 'ensureSymlink')
18143
- return callback(err)
18144
- }
18145
- return callback(null, {
18146
- toCwd: srcpath,
18147
- toDst: srcpath
18148
- })
18149
- })
18150
- } else {
18151
- const dstdir = path.dirname(dstpath)
18152
- const relativeToDst = path.join(dstdir, srcpath)
18153
- return pathExists(relativeToDst, (err, exists) => {
18154
- if (err) return callback(err)
18155
- if (exists) {
18156
- return callback(null, {
18157
- toCwd: relativeToDst,
18158
- toDst: srcpath
18159
- })
18160
- } else {
18161
- return fs.lstat(srcpath, (err) => {
18162
- if (err) {
18163
- err.message = err.message.replace('lstat', 'ensureSymlink')
18164
- return callback(err)
18165
- }
18166
- return callback(null, {
18167
- toCwd: srcpath,
18168
- toDst: path.relative(dstdir, srcpath)
18169
- })
18170
- })
18171
- }
18172
- })
18173
- }
18174
- }
18175
-
18176
- function symlinkPathsSync (srcpath, dstpath) {
18177
- let exists
18178
- if (path.isAbsolute(srcpath)) {
18179
- exists = fs.existsSync(srcpath)
18180
- if (!exists) throw new Error('absolute srcpath does not exist')
18181
- return {
18182
- toCwd: srcpath,
18183
- toDst: srcpath
18184
- }
18185
- } else {
18186
- const dstdir = path.dirname(dstpath)
18187
- const relativeToDst = path.join(dstdir, srcpath)
18188
- exists = fs.existsSync(relativeToDst)
18189
- if (exists) {
18190
- return {
18191
- toCwd: relativeToDst,
18192
- toDst: srcpath
18193
- }
18194
- } else {
18195
- exists = fs.existsSync(srcpath)
18196
- if (!exists) throw new Error('relative srcpath does not exist')
18197
- return {
18198
- toCwd: srcpath,
18199
- toDst: path.relative(dstdir, srcpath)
18200
- }
18201
- }
18202
- }
18203
- }
18204
-
18205
- module.exports = {
18206
- symlinkPaths,
18207
- symlinkPathsSync
18208
- }
18209
-
18210
-
18211
- /***/ }),
18212
-
18213
- /***/ "../../node_modules/fs-extra/lib/ensure/symlink-type.js":
18214
- /*!**************************************************************!*\
18215
- !*** ../../node_modules/fs-extra/lib/ensure/symlink-type.js ***!
18216
- \**************************************************************/
18217
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18218
-
18219
- "use strict";
18220
-
18221
-
18222
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18223
-
18224
- function symlinkType (srcpath, type, callback) {
18225
- callback = (typeof type === 'function') ? type : callback
18226
- type = (typeof type === 'function') ? false : type
18227
- if (type) return callback(null, type)
18228
- fs.lstat(srcpath, (err, stats) => {
18229
- if (err) return callback(null, 'file')
18230
- type = (stats && stats.isDirectory()) ? 'dir' : 'file'
18231
- callback(null, type)
18232
- })
18233
- }
18234
-
18235
- function symlinkTypeSync (srcpath, type) {
18236
- let stats
18237
-
18238
- if (type) return type
18239
- try {
18240
- stats = fs.lstatSync(srcpath)
18241
- } catch {
18242
- return 'file'
18243
- }
18244
- return (stats && stats.isDirectory()) ? 'dir' : 'file'
18245
- }
18246
-
18247
- module.exports = {
18248
- symlinkType,
18249
- symlinkTypeSync
18250
- }
18251
-
18252
-
18253
- /***/ }),
18254
-
18255
- /***/ "../../node_modules/fs-extra/lib/ensure/symlink.js":
18256
- /*!*********************************************************!*\
18257
- !*** ../../node_modules/fs-extra/lib/ensure/symlink.js ***!
18258
- \*********************************************************/
18259
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18260
-
18261
- "use strict";
18262
-
18263
-
18264
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
18265
- const path = __webpack_require__(/*! path */ "path")
18266
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18267
- const _mkdirs = __webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js")
18268
- const mkdirs = _mkdirs.mkdirs
18269
- const mkdirsSync = _mkdirs.mkdirsSync
18270
-
18271
- const _symlinkPaths = __webpack_require__(/*! ./symlink-paths */ "../../node_modules/fs-extra/lib/ensure/symlink-paths.js")
18272
- const symlinkPaths = _symlinkPaths.symlinkPaths
18273
- const symlinkPathsSync = _symlinkPaths.symlinkPathsSync
18274
-
18275
- const _symlinkType = __webpack_require__(/*! ./symlink-type */ "../../node_modules/fs-extra/lib/ensure/symlink-type.js")
18276
- const symlinkType = _symlinkType.symlinkType
18277
- const symlinkTypeSync = _symlinkType.symlinkTypeSync
18278
-
18279
- const pathExists = (__webpack_require__(/*! ../path-exists */ "../../node_modules/fs-extra/lib/path-exists/index.js").pathExists)
18280
-
18281
- function createSymlink (srcpath, dstpath, type, callback) {
18282
- callback = (typeof type === 'function') ? type : callback
18283
- type = (typeof type === 'function') ? false : type
18284
-
18285
- pathExists(dstpath, (err, destinationExists) => {
18286
- if (err) return callback(err)
18287
- if (destinationExists) return callback(null)
18288
- symlinkPaths(srcpath, dstpath, (err, relative) => {
18289
- if (err) return callback(err)
18290
- srcpath = relative.toDst
18291
- symlinkType(relative.toCwd, type, (err, type) => {
18292
- if (err) return callback(err)
18293
- const dir = path.dirname(dstpath)
18294
- pathExists(dir, (err, dirExists) => {
18295
- if (err) return callback(err)
18296
- if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
18297
- mkdirs(dir, err => {
18298
- if (err) return callback(err)
18299
- fs.symlink(srcpath, dstpath, type, callback)
18300
- })
18301
- })
18302
- })
18303
- })
18304
- })
18305
- }
18306
-
18307
- function createSymlinkSync (srcpath, dstpath, type) {
18308
- const destinationExists = fs.existsSync(dstpath)
18309
- if (destinationExists) return undefined
18310
-
18311
- const relative = symlinkPathsSync(srcpath, dstpath)
18312
- srcpath = relative.toDst
18313
- type = symlinkTypeSync(relative.toCwd, type)
18314
- const dir = path.dirname(dstpath)
18315
- const exists = fs.existsSync(dir)
18316
- if (exists) return fs.symlinkSync(srcpath, dstpath, type)
18317
- mkdirsSync(dir)
18318
- return fs.symlinkSync(srcpath, dstpath, type)
18319
- }
18320
-
18321
- module.exports = {
18322
- createSymlink: u(createSymlink),
18323
- createSymlinkSync
18324
- }
18325
-
18326
-
18327
- /***/ }),
18328
-
18329
- /***/ "../../node_modules/fs-extra/lib/fs/index.js":
18330
- /*!***************************************************!*\
18331
- !*** ../../node_modules/fs-extra/lib/fs/index.js ***!
18332
- \***************************************************/
18333
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
18334
-
18335
- "use strict";
18336
-
18337
- // This is adapted from https://github.com/normalize/mz
18338
- // Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
18339
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
18340
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18341
-
18342
- const api = [
18343
- 'access',
18344
- 'appendFile',
18345
- 'chmod',
18346
- 'chown',
18347
- 'close',
18348
- 'copyFile',
18349
- 'fchmod',
18350
- 'fchown',
18351
- 'fdatasync',
18352
- 'fstat',
18353
- 'fsync',
18354
- 'ftruncate',
18355
- 'futimes',
18356
- 'lchmod',
18357
- 'lchown',
18358
- 'link',
18359
- 'lstat',
18360
- 'mkdir',
18361
- 'mkdtemp',
18362
- 'open',
18363
- 'opendir',
18364
- 'readdir',
18365
- 'readFile',
18366
- 'readlink',
18367
- 'realpath',
18368
- 'rename',
18369
- 'rm',
18370
- 'rmdir',
18371
- 'stat',
18372
- 'symlink',
18373
- 'truncate',
18374
- 'unlink',
18375
- 'utimes',
18376
- 'writeFile'
18377
- ].filter(key => {
18378
- // Some commands are not available on some systems. Ex:
18379
- // fs.opendir was added in Node.js v12.12.0
18380
- // fs.rm was added in Node.js v14.14.0
18381
- // fs.lchown is not available on at least some Linux
18382
- return typeof fs[key] === 'function'
18383
- })
18384
-
18385
- // Export all keys:
18386
- Object.keys(fs).forEach(key => {
18387
- if (key === 'promises') {
18388
- // fs.promises is a getter property that triggers ExperimentalWarning
18389
- // Don't re-export it here, the getter is defined in "lib/index.js"
18390
- return
18391
- }
18392
- exports[key] = fs[key]
18393
- })
18394
-
18395
- // Universalify async methods:
18396
- api.forEach(method => {
18397
- exports[method] = u(fs[method])
18398
- })
18399
-
18400
- // We differ from mz/fs in that we still ship the old, broken, fs.exists()
18401
- // since we are a drop-in replacement for the native module
18402
- exports.exists = function (filename, callback) {
18403
- if (typeof callback === 'function') {
18404
- return fs.exists(filename, callback)
18405
- }
18406
- return new Promise(resolve => {
18407
- return fs.exists(filename, resolve)
18408
- })
18409
- }
18410
-
18411
- // fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args
18412
-
18413
- exports.read = function (fd, buffer, offset, length, position, callback) {
18414
- if (typeof callback === 'function') {
18415
- return fs.read(fd, buffer, offset, length, position, callback)
18416
- }
18417
- return new Promise((resolve, reject) => {
18418
- fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
18419
- if (err) return reject(err)
18420
- resolve({ bytesRead, buffer })
18421
- })
18422
- })
18423
- }
18424
-
18425
- // Function signature can be
18426
- // fs.write(fd, buffer[, offset[, length[, position]]], callback)
18427
- // OR
18428
- // fs.write(fd, string[, position[, encoding]], callback)
18429
- // We need to handle both cases, so we use ...args
18430
- exports.write = function (fd, buffer, ...args) {
18431
- if (typeof args[args.length - 1] === 'function') {
18432
- return fs.write(fd, buffer, ...args)
18433
- }
18434
-
18435
- return new Promise((resolve, reject) => {
18436
- fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
18437
- if (err) return reject(err)
18438
- resolve({ bytesWritten, buffer })
18439
- })
18440
- })
18441
- }
18442
-
18443
- // fs.writev only available in Node v12.9.0+
18444
- if (typeof fs.writev === 'function') {
18445
- // Function signature is
18446
- // s.writev(fd, buffers[, position], callback)
18447
- // We need to handle the optional arg, so we use ...args
18448
- exports.writev = function (fd, buffers, ...args) {
18449
- if (typeof args[args.length - 1] === 'function') {
18450
- return fs.writev(fd, buffers, ...args)
18451
- }
18452
-
18453
- return new Promise((resolve, reject) => {
18454
- fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
18455
- if (err) return reject(err)
18456
- resolve({ bytesWritten, buffers })
18457
- })
18458
- })
18459
- }
18460
- }
18461
-
18462
- // fs.realpath.native only available in Node v9.2+
18463
- if (typeof fs.realpath.native === 'function') {
18464
- exports.realpath.native = u(fs.realpath.native)
18465
- }
18466
-
18467
-
18468
- /***/ }),
18469
-
18470
- /***/ "../../node_modules/fs-extra/lib/index.js":
18471
- /*!************************************************!*\
18472
- !*** ../../node_modules/fs-extra/lib/index.js ***!
18473
- \************************************************/
18474
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18475
-
18476
- "use strict";
18477
-
18478
-
18479
- module.exports = {
18480
- // Export promiseified graceful-fs:
18481
- ...__webpack_require__(/*! ./fs */ "../../node_modules/fs-extra/lib/fs/index.js"),
18482
- // Export extra methods:
18483
- ...__webpack_require__(/*! ./copy-sync */ "../../node_modules/fs-extra/lib/copy-sync/index.js"),
18484
- ...__webpack_require__(/*! ./copy */ "../../node_modules/fs-extra/lib/copy/index.js"),
18485
- ...__webpack_require__(/*! ./empty */ "../../node_modules/fs-extra/lib/empty/index.js"),
18486
- ...__webpack_require__(/*! ./ensure */ "../../node_modules/fs-extra/lib/ensure/index.js"),
18487
- ...__webpack_require__(/*! ./json */ "../../node_modules/fs-extra/lib/json/index.js"),
18488
- ...__webpack_require__(/*! ./mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js"),
18489
- ...__webpack_require__(/*! ./move-sync */ "../../node_modules/fs-extra/lib/move-sync/index.js"),
18490
- ...__webpack_require__(/*! ./move */ "../../node_modules/fs-extra/lib/move/index.js"),
18491
- ...__webpack_require__(/*! ./output */ "../../node_modules/fs-extra/lib/output/index.js"),
18492
- ...__webpack_require__(/*! ./path-exists */ "../../node_modules/fs-extra/lib/path-exists/index.js"),
18493
- ...__webpack_require__(/*! ./remove */ "../../node_modules/fs-extra/lib/remove/index.js")
18494
- }
18495
-
18496
- // Export fs.promises as a getter property so that we don't trigger
18497
- // ExperimentalWarning before fs.promises is actually accessed.
18498
- const fs = __webpack_require__(/*! fs */ "fs")
18499
- if (Object.getOwnPropertyDescriptor(fs, 'promises')) {
18500
- Object.defineProperty(module.exports, "promises", ({
18501
- get () { return fs.promises }
18502
- }))
18503
- }
18504
-
18505
-
18506
- /***/ }),
18507
-
18508
- /***/ "../../node_modules/fs-extra/lib/json/index.js":
18509
- /*!*****************************************************!*\
18510
- !*** ../../node_modules/fs-extra/lib/json/index.js ***!
18511
- \*****************************************************/
18512
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18513
-
18514
- "use strict";
18515
-
18516
-
18517
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromPromise)
18518
- const jsonFile = __webpack_require__(/*! ./jsonfile */ "../../node_modules/fs-extra/lib/json/jsonfile.js")
18519
-
18520
- jsonFile.outputJson = u(__webpack_require__(/*! ./output-json */ "../../node_modules/fs-extra/lib/json/output-json.js"))
18521
- jsonFile.outputJsonSync = __webpack_require__(/*! ./output-json-sync */ "../../node_modules/fs-extra/lib/json/output-json-sync.js")
18522
- // aliases
18523
- jsonFile.outputJSON = jsonFile.outputJson
18524
- jsonFile.outputJSONSync = jsonFile.outputJsonSync
18525
- jsonFile.writeJSON = jsonFile.writeJson
18526
- jsonFile.writeJSONSync = jsonFile.writeJsonSync
18527
- jsonFile.readJSON = jsonFile.readJson
18528
- jsonFile.readJSONSync = jsonFile.readJsonSync
18529
-
18530
- module.exports = jsonFile
18531
-
18532
-
18533
- /***/ }),
18534
-
18535
- /***/ "../../node_modules/fs-extra/lib/json/jsonfile.js":
18536
- /*!********************************************************!*\
18537
- !*** ../../node_modules/fs-extra/lib/json/jsonfile.js ***!
18538
- \********************************************************/
18539
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18540
-
18541
- "use strict";
18542
-
18543
-
18544
- const jsonFile = __webpack_require__(/*! jsonfile */ "../../node_modules/jsonfile/index.js")
18545
-
18546
- module.exports = {
18547
- // jsonfile exports
18548
- readJson: jsonFile.readFile,
18549
- readJsonSync: jsonFile.readFileSync,
18550
- writeJson: jsonFile.writeFile,
18551
- writeJsonSync: jsonFile.writeFileSync
18552
- }
18553
-
18554
-
18555
- /***/ }),
18556
-
18557
- /***/ "../../node_modules/fs-extra/lib/json/output-json-sync.js":
18558
- /*!****************************************************************!*\
18559
- !*** ../../node_modules/fs-extra/lib/json/output-json-sync.js ***!
18560
- \****************************************************************/
18561
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18562
-
18563
- "use strict";
18564
-
18565
-
18566
- const { stringify } = __webpack_require__(/*! jsonfile/utils */ "../../node_modules/jsonfile/utils.js")
18567
- const { outputFileSync } = __webpack_require__(/*! ../output */ "../../node_modules/fs-extra/lib/output/index.js")
18568
-
18569
- function outputJsonSync (file, data, options) {
18570
- const str = stringify(data, options)
18571
-
18572
- outputFileSync(file, str, options)
18573
- }
18574
-
18575
- module.exports = outputJsonSync
18576
-
18577
-
18578
- /***/ }),
18579
-
18580
- /***/ "../../node_modules/fs-extra/lib/json/output-json.js":
18581
- /*!***********************************************************!*\
18582
- !*** ../../node_modules/fs-extra/lib/json/output-json.js ***!
18583
- \***********************************************************/
18584
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18585
-
18586
- "use strict";
18587
-
18588
-
18589
- const { stringify } = __webpack_require__(/*! jsonfile/utils */ "../../node_modules/jsonfile/utils.js")
18590
- const { outputFile } = __webpack_require__(/*! ../output */ "../../node_modules/fs-extra/lib/output/index.js")
18591
-
18592
- async function outputJson (file, data, options = {}) {
18593
- const str = stringify(data, options)
18594
-
18595
- await outputFile(file, str, options)
18596
- }
18597
-
18598
- module.exports = outputJson
18599
-
18600
-
18601
- /***/ }),
18602
-
18603
- /***/ "../../node_modules/fs-extra/lib/mkdirs/index.js":
18604
- /*!*******************************************************!*\
18605
- !*** ../../node_modules/fs-extra/lib/mkdirs/index.js ***!
18606
- \*******************************************************/
18607
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18608
-
18609
- "use strict";
18610
-
18611
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromPromise)
18612
- const { makeDir: _makeDir, makeDirSync } = __webpack_require__(/*! ./make-dir */ "../../node_modules/fs-extra/lib/mkdirs/make-dir.js")
18613
- const makeDir = u(_makeDir)
18614
-
18615
- module.exports = {
18616
- mkdirs: makeDir,
18617
- mkdirsSync: makeDirSync,
18618
- // alias
18619
- mkdirp: makeDir,
18620
- mkdirpSync: makeDirSync,
18621
- ensureDir: makeDir,
18622
- ensureDirSync: makeDirSync
18623
- }
18624
-
18625
-
18626
- /***/ }),
18627
-
18628
- /***/ "../../node_modules/fs-extra/lib/mkdirs/make-dir.js":
18629
- /*!**********************************************************!*\
18630
- !*** ../../node_modules/fs-extra/lib/mkdirs/make-dir.js ***!
18631
- \**********************************************************/
18632
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18633
-
18634
- "use strict";
18635
- // Adapted from https://github.com/sindresorhus/make-dir
18636
- // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
18637
- // 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:
18638
- // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
18639
- // 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.
18640
-
18641
- const fs = __webpack_require__(/*! ../fs */ "../../node_modules/fs-extra/lib/fs/index.js")
18642
- const path = __webpack_require__(/*! path */ "path")
18643
- const atLeastNode = __webpack_require__(/*! at-least-node */ "../../node_modules/at-least-node/index.js")
18644
-
18645
- const useNativeRecursiveOption = atLeastNode('10.12.0')
18646
-
18647
- // https://github.com/nodejs/node/issues/8987
18648
- // https://github.com/libuv/libuv/pull/1088
18649
- const checkPath = pth => {
18650
- if (process.platform === 'win32') {
18651
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
18652
-
18653
- if (pathHasInvalidWinCharacters) {
18654
- const error = new Error(`Path contains invalid characters: ${pth}`)
18655
- error.code = 'EINVAL'
18656
- throw error
18657
- }
18658
- }
18659
- }
18660
-
18661
- const processOptions = options => {
18662
- const defaults = { mode: 0o777 }
18663
- if (typeof options === 'number') options = { mode: options }
18664
- return { ...defaults, ...options }
18665
- }
18666
-
18667
- const permissionError = pth => {
18668
- // This replicates the exception of `fs.mkdir` with native the
18669
- // `recusive` option when run on an invalid drive under Windows.
18670
- const error = new Error(`operation not permitted, mkdir '${pth}'`)
18671
- error.code = 'EPERM'
18672
- error.errno = -4048
18673
- error.path = pth
18674
- error.syscall = 'mkdir'
18675
- return error
18676
- }
18677
-
18678
- module.exports.makeDir = async (input, options) => {
18679
- checkPath(input)
18680
- options = processOptions(options)
18681
-
18682
- if (useNativeRecursiveOption) {
18683
- const pth = path.resolve(input)
18684
-
18685
- return fs.mkdir(pth, {
18686
- mode: options.mode,
18687
- recursive: true
18688
- })
18689
- }
18690
-
18691
- const make = async pth => {
18692
- try {
18693
- await fs.mkdir(pth, options.mode)
18694
- } catch (error) {
18695
- if (error.code === 'EPERM') {
18696
- throw error
18697
- }
18698
-
18699
- if (error.code === 'ENOENT') {
18700
- if (path.dirname(pth) === pth) {
18701
- throw permissionError(pth)
18702
- }
18703
-
18704
- if (error.message.includes('null bytes')) {
18705
- throw error
18706
- }
18707
-
18708
- await make(path.dirname(pth))
18709
- return make(pth)
18710
- }
18711
-
18712
- try {
18713
- const stats = await fs.stat(pth)
18714
- if (!stats.isDirectory()) {
18715
- // This error is never exposed to the user
18716
- // it is caught below, and the original error is thrown
18717
- throw new Error('The path is not a directory')
18718
- }
18719
- } catch {
18720
- throw error
18721
- }
18722
- }
18723
- }
18724
-
18725
- return make(path.resolve(input))
18726
- }
18727
-
18728
- module.exports.makeDirSync = (input, options) => {
18729
- checkPath(input)
18730
- options = processOptions(options)
18731
-
18732
- if (useNativeRecursiveOption) {
18733
- const pth = path.resolve(input)
18734
-
18735
- return fs.mkdirSync(pth, {
18736
- mode: options.mode,
18737
- recursive: true
18738
- })
18739
- }
18740
-
18741
- const make = pth => {
18742
- try {
18743
- fs.mkdirSync(pth, options.mode)
18744
- } catch (error) {
18745
- if (error.code === 'EPERM') {
18746
- throw error
18747
- }
18748
-
18749
- if (error.code === 'ENOENT') {
18750
- if (path.dirname(pth) === pth) {
18751
- throw permissionError(pth)
18752
- }
18753
-
18754
- if (error.message.includes('null bytes')) {
18755
- throw error
18756
- }
18757
-
18758
- make(path.dirname(pth))
18759
- return make(pth)
18760
- }
18761
-
18762
- try {
18763
- if (!fs.statSync(pth).isDirectory()) {
18764
- // This error is never exposed to the user
18765
- // it is caught below, and the original error is thrown
18766
- throw new Error('The path is not a directory')
18767
- }
18768
- } catch {
18769
- throw error
18770
- }
18771
- }
18772
- }
18773
-
18774
- return make(path.resolve(input))
18775
- }
18776
-
18777
-
18778
- /***/ }),
18779
-
18780
- /***/ "../../node_modules/fs-extra/lib/move-sync/index.js":
18781
- /*!**********************************************************!*\
18782
- !*** ../../node_modules/fs-extra/lib/move-sync/index.js ***!
18783
- \**********************************************************/
18784
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18785
-
18786
- "use strict";
18787
-
18788
-
18789
- module.exports = {
18790
- moveSync: __webpack_require__(/*! ./move-sync */ "../../node_modules/fs-extra/lib/move-sync/move-sync.js")
18791
- }
18792
-
18793
-
18794
- /***/ }),
18795
-
18796
- /***/ "../../node_modules/fs-extra/lib/move-sync/move-sync.js":
18797
- /*!**************************************************************!*\
18798
- !*** ../../node_modules/fs-extra/lib/move-sync/move-sync.js ***!
18799
- \**************************************************************/
18800
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18801
-
18802
- "use strict";
18803
-
18804
-
18805
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18806
- const path = __webpack_require__(/*! path */ "path")
18807
- const copySync = (__webpack_require__(/*! ../copy-sync */ "../../node_modules/fs-extra/lib/copy-sync/index.js").copySync)
18808
- const removeSync = (__webpack_require__(/*! ../remove */ "../../node_modules/fs-extra/lib/remove/index.js").removeSync)
18809
- const mkdirpSync = (__webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js").mkdirpSync)
18810
- const stat = __webpack_require__(/*! ../util/stat */ "../../node_modules/fs-extra/lib/util/stat.js")
18811
-
18812
- function moveSync (src, dest, opts) {
18813
- opts = opts || {}
18814
- const overwrite = opts.overwrite || opts.clobber || false
18815
-
18816
- const { srcStat } = stat.checkPathsSync(src, dest, 'move')
18817
- stat.checkParentPathsSync(src, srcStat, dest, 'move')
18818
- mkdirpSync(path.dirname(dest))
18819
- return doRename(src, dest, overwrite)
18820
- }
18821
-
18822
- function doRename (src, dest, overwrite) {
18823
- if (overwrite) {
18824
- removeSync(dest)
18825
- return rename(src, dest, overwrite)
18826
- }
18827
- if (fs.existsSync(dest)) throw new Error('dest already exists.')
18828
- return rename(src, dest, overwrite)
18829
- }
18830
-
18831
- function rename (src, dest, overwrite) {
18832
- try {
18833
- fs.renameSync(src, dest)
18834
- } catch (err) {
18835
- if (err.code !== 'EXDEV') throw err
18836
- return moveAcrossDevice(src, dest, overwrite)
18837
- }
18838
- }
18839
-
18840
- function moveAcrossDevice (src, dest, overwrite) {
18841
- const opts = {
18842
- overwrite,
18843
- errorOnExist: true
18844
- }
18845
- copySync(src, dest, opts)
18846
- return removeSync(src)
18847
- }
18848
-
18849
- module.exports = moveSync
18850
-
18851
-
18852
- /***/ }),
18853
-
18854
- /***/ "../../node_modules/fs-extra/lib/move/index.js":
18855
- /*!*****************************************************!*\
18856
- !*** ../../node_modules/fs-extra/lib/move/index.js ***!
18857
- \*****************************************************/
18858
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18859
-
18860
- "use strict";
18861
-
18862
-
18863
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
18864
- module.exports = {
18865
- move: u(__webpack_require__(/*! ./move */ "../../node_modules/fs-extra/lib/move/move.js"))
18866
- }
18867
-
18868
-
18869
- /***/ }),
18870
-
18871
- /***/ "../../node_modules/fs-extra/lib/move/move.js":
18872
- /*!****************************************************!*\
18873
- !*** ../../node_modules/fs-extra/lib/move/move.js ***!
18874
- \****************************************************/
18875
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18876
-
18877
- "use strict";
18878
-
18879
-
18880
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18881
- const path = __webpack_require__(/*! path */ "path")
18882
- const copy = (__webpack_require__(/*! ../copy */ "../../node_modules/fs-extra/lib/copy/index.js").copy)
18883
- const remove = (__webpack_require__(/*! ../remove */ "../../node_modules/fs-extra/lib/remove/index.js").remove)
18884
- const mkdirp = (__webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js").mkdirp)
18885
- const pathExists = (__webpack_require__(/*! ../path-exists */ "../../node_modules/fs-extra/lib/path-exists/index.js").pathExists)
18886
- const stat = __webpack_require__(/*! ../util/stat */ "../../node_modules/fs-extra/lib/util/stat.js")
18887
-
18888
- function move (src, dest, opts, cb) {
18889
- if (typeof opts === 'function') {
18890
- cb = opts
18891
- opts = {}
18892
- }
18893
-
18894
- const overwrite = opts.overwrite || opts.clobber || false
18895
-
18896
- stat.checkPaths(src, dest, 'move', (err, stats) => {
18897
- if (err) return cb(err)
18898
- const { srcStat } = stats
18899
- stat.checkParentPaths(src, srcStat, dest, 'move', err => {
18900
- if (err) return cb(err)
18901
- mkdirp(path.dirname(dest), err => {
18902
- if (err) return cb(err)
18903
- return doRename(src, dest, overwrite, cb)
18904
- })
18905
- })
18906
- })
18907
- }
18908
-
18909
- function doRename (src, dest, overwrite, cb) {
18910
- if (overwrite) {
18911
- return remove(dest, err => {
18912
- if (err) return cb(err)
18913
- return rename(src, dest, overwrite, cb)
18914
- })
18915
- }
18916
- pathExists(dest, (err, destExists) => {
18917
- if (err) return cb(err)
18918
- if (destExists) return cb(new Error('dest already exists.'))
18919
- return rename(src, dest, overwrite, cb)
18920
- })
18921
- }
18922
-
18923
- function rename (src, dest, overwrite, cb) {
18924
- fs.rename(src, dest, err => {
18925
- if (!err) return cb()
18926
- if (err.code !== 'EXDEV') return cb(err)
18927
- return moveAcrossDevice(src, dest, overwrite, cb)
18928
- })
18929
- }
18930
-
18931
- function moveAcrossDevice (src, dest, overwrite, cb) {
18932
- const opts = {
18933
- overwrite,
18934
- errorOnExist: true
18935
- }
18936
- copy(src, dest, opts, err => {
18937
- if (err) return cb(err)
18938
- return remove(src, cb)
18939
- })
18940
- }
18941
-
18942
- module.exports = move
18943
-
18944
-
18945
- /***/ }),
18946
-
18947
- /***/ "../../node_modules/fs-extra/lib/output/index.js":
18948
- /*!*******************************************************!*\
18949
- !*** ../../node_modules/fs-extra/lib/output/index.js ***!
18950
- \*******************************************************/
18951
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18952
-
18953
- "use strict";
18954
-
18955
-
18956
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
18957
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
18958
- const path = __webpack_require__(/*! path */ "path")
18959
- const mkdir = __webpack_require__(/*! ../mkdirs */ "../../node_modules/fs-extra/lib/mkdirs/index.js")
18960
- const pathExists = (__webpack_require__(/*! ../path-exists */ "../../node_modules/fs-extra/lib/path-exists/index.js").pathExists)
18961
-
18962
- function outputFile (file, data, encoding, callback) {
18963
- if (typeof encoding === 'function') {
18964
- callback = encoding
18965
- encoding = 'utf8'
18966
- }
18967
-
18968
- const dir = path.dirname(file)
18969
- pathExists(dir, (err, itDoes) => {
18970
- if (err) return callback(err)
18971
- if (itDoes) return fs.writeFile(file, data, encoding, callback)
18972
-
18973
- mkdir.mkdirs(dir, err => {
18974
- if (err) return callback(err)
18975
-
18976
- fs.writeFile(file, data, encoding, callback)
18977
- })
18978
- })
18979
- }
18980
-
18981
- function outputFileSync (file, ...args) {
18982
- const dir = path.dirname(file)
18983
- if (fs.existsSync(dir)) {
18984
- return fs.writeFileSync(file, ...args)
18985
- }
18986
- mkdir.mkdirsSync(dir)
18987
- fs.writeFileSync(file, ...args)
18988
- }
18989
-
18990
- module.exports = {
18991
- outputFile: u(outputFile),
18992
- outputFileSync
18993
- }
18994
-
18995
-
18996
- /***/ }),
18997
-
18998
- /***/ "../../node_modules/fs-extra/lib/path-exists/index.js":
18999
- /*!************************************************************!*\
19000
- !*** ../../node_modules/fs-extra/lib/path-exists/index.js ***!
19001
- \************************************************************/
19002
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19003
-
19004
- "use strict";
19005
-
19006
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromPromise)
19007
- const fs = __webpack_require__(/*! ../fs */ "../../node_modules/fs-extra/lib/fs/index.js")
19008
-
19009
- function pathExists (path) {
19010
- return fs.access(path).then(() => true).catch(() => false)
19011
- }
19012
-
19013
- module.exports = {
19014
- pathExists: u(pathExists),
19015
- pathExistsSync: fs.existsSync
19016
- }
19017
-
19018
-
19019
- /***/ }),
19020
-
19021
- /***/ "../../node_modules/fs-extra/lib/remove/index.js":
19022
- /*!*******************************************************!*\
19023
- !*** ../../node_modules/fs-extra/lib/remove/index.js ***!
19024
- \*******************************************************/
19025
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19026
-
19027
- "use strict";
19028
-
19029
-
19030
- const u = (__webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js").fromCallback)
19031
- const rimraf = __webpack_require__(/*! ./rimraf */ "../../node_modules/fs-extra/lib/remove/rimraf.js")
19032
-
19033
- module.exports = {
19034
- remove: u(rimraf),
19035
- removeSync: rimraf.sync
19036
- }
19037
-
19038
-
19039
- /***/ }),
19040
-
19041
- /***/ "../../node_modules/fs-extra/lib/remove/rimraf.js":
19042
- /*!********************************************************!*\
19043
- !*** ../../node_modules/fs-extra/lib/remove/rimraf.js ***!
19044
- \********************************************************/
19045
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19046
-
19047
- "use strict";
19048
-
19049
-
19050
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
19051
- const path = __webpack_require__(/*! path */ "path")
19052
- const assert = __webpack_require__(/*! assert */ "assert")
19053
-
19054
- const isWindows = (process.platform === 'win32')
19055
-
19056
- function defaults (options) {
19057
- const methods = [
19058
- 'unlink',
19059
- 'chmod',
19060
- 'stat',
19061
- 'lstat',
19062
- 'rmdir',
19063
- 'readdir'
19064
- ]
19065
- methods.forEach(m => {
19066
- options[m] = options[m] || fs[m]
19067
- m = m + 'Sync'
19068
- options[m] = options[m] || fs[m]
19069
- })
19070
-
19071
- options.maxBusyTries = options.maxBusyTries || 3
19072
- }
19073
-
19074
- function rimraf (p, options, cb) {
19075
- let busyTries = 0
19076
-
19077
- if (typeof options === 'function') {
19078
- cb = options
19079
- options = {}
19080
- }
19081
-
19082
- assert(p, 'rimraf: missing path')
19083
- assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
19084
- assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required')
19085
- assert(options, 'rimraf: invalid options argument provided')
19086
- assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
19087
-
19088
- defaults(options)
19089
-
19090
- rimraf_(p, options, function CB (er) {
19091
- if (er) {
19092
- if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
19093
- busyTries < options.maxBusyTries) {
19094
- busyTries++
19095
- const time = busyTries * 100
19096
- // try again, with the same exact callback as this one.
19097
- return setTimeout(() => rimraf_(p, options, CB), time)
19098
- }
19099
-
19100
- // already gone
19101
- if (er.code === 'ENOENT') er = null
19102
- }
19103
-
19104
- cb(er)
19105
- })
19106
- }
19107
-
19108
- // Two possible strategies.
19109
- // 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
19110
- // 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
19111
- //
19112
- // Both result in an extra syscall when you guess wrong. However, there
19113
- // are likely far more normal files in the world than directories. This
19114
- // is based on the assumption that a the average number of files per
19115
- // directory is >= 1.
19116
- //
19117
- // If anyone ever complains about this, then I guess the strategy could
19118
- // be made configurable somehow. But until then, YAGNI.
19119
- function rimraf_ (p, options, cb) {
19120
- assert(p)
19121
- assert(options)
19122
- assert(typeof cb === 'function')
19123
-
19124
- // sunos lets the root user unlink directories, which is... weird.
19125
- // so we have to lstat here and make sure it's not a dir.
19126
- options.lstat(p, (er, st) => {
19127
- if (er && er.code === 'ENOENT') {
19128
- return cb(null)
19129
- }
19130
-
19131
- // Windows can EPERM on stat. Life is suffering.
19132
- if (er && er.code === 'EPERM' && isWindows) {
19133
- return fixWinEPERM(p, options, er, cb)
19134
- }
19135
-
19136
- if (st && st.isDirectory()) {
19137
- return rmdir(p, options, er, cb)
19138
- }
19139
-
19140
- options.unlink(p, er => {
19141
- if (er) {
19142
- if (er.code === 'ENOENT') {
19143
- return cb(null)
19144
- }
19145
- if (er.code === 'EPERM') {
19146
- return (isWindows)
19147
- ? fixWinEPERM(p, options, er, cb)
19148
- : rmdir(p, options, er, cb)
19149
- }
19150
- if (er.code === 'EISDIR') {
19151
- return rmdir(p, options, er, cb)
19152
- }
19153
- }
19154
- return cb(er)
19155
- })
19156
- })
19157
- }
19158
-
19159
- function fixWinEPERM (p, options, er, cb) {
19160
- assert(p)
19161
- assert(options)
19162
- assert(typeof cb === 'function')
19163
-
19164
- options.chmod(p, 0o666, er2 => {
19165
- if (er2) {
19166
- cb(er2.code === 'ENOENT' ? null : er)
19167
- } else {
19168
- options.stat(p, (er3, stats) => {
19169
- if (er3) {
19170
- cb(er3.code === 'ENOENT' ? null : er)
19171
- } else if (stats.isDirectory()) {
19172
- rmdir(p, options, er, cb)
19173
- } else {
19174
- options.unlink(p, cb)
19175
- }
19176
- })
19177
- }
19178
- })
19179
- }
19180
-
19181
- function fixWinEPERMSync (p, options, er) {
19182
- let stats
19183
-
19184
- assert(p)
19185
- assert(options)
19186
-
19187
- try {
19188
- options.chmodSync(p, 0o666)
19189
- } catch (er2) {
19190
- if (er2.code === 'ENOENT') {
19191
- return
19192
- } else {
19193
- throw er
19194
- }
19195
- }
19196
-
19197
- try {
19198
- stats = options.statSync(p)
19199
- } catch (er3) {
19200
- if (er3.code === 'ENOENT') {
19201
- return
19202
- } else {
19203
- throw er
19204
- }
19205
- }
19206
-
19207
- if (stats.isDirectory()) {
19208
- rmdirSync(p, options, er)
19209
- } else {
19210
- options.unlinkSync(p)
19211
- }
19212
- }
19213
-
19214
- function rmdir (p, options, originalEr, cb) {
19215
- assert(p)
19216
- assert(options)
19217
- assert(typeof cb === 'function')
19218
-
19219
- // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
19220
- // if we guessed wrong, and it's not a directory, then
19221
- // raise the original error.
19222
- options.rmdir(p, er => {
19223
- if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) {
19224
- rmkids(p, options, cb)
19225
- } else if (er && er.code === 'ENOTDIR') {
19226
- cb(originalEr)
19227
- } else {
19228
- cb(er)
19229
- }
19230
- })
19231
- }
19232
-
19233
- function rmkids (p, options, cb) {
19234
- assert(p)
19235
- assert(options)
19236
- assert(typeof cb === 'function')
19237
-
19238
- options.readdir(p, (er, files) => {
19239
- if (er) return cb(er)
19240
-
19241
- let n = files.length
19242
- let errState
19243
-
19244
- if (n === 0) return options.rmdir(p, cb)
19245
-
19246
- files.forEach(f => {
19247
- rimraf(path.join(p, f), options, er => {
19248
- if (errState) {
19249
- return
19250
- }
19251
- if (er) return cb(errState = er)
19252
- if (--n === 0) {
19253
- options.rmdir(p, cb)
19254
- }
19255
- })
19256
- })
19257
- })
19258
- }
19259
-
19260
- // this looks simpler, and is strictly *faster*, but will
19261
- // tie up the JavaScript thread and fail on excessively
19262
- // deep directory trees.
19263
- function rimrafSync (p, options) {
19264
- let st
19265
-
19266
- options = options || {}
19267
- defaults(options)
19268
-
19269
- assert(p, 'rimraf: missing path')
19270
- assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
19271
- assert(options, 'rimraf: missing options')
19272
- assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
19273
-
19274
- try {
19275
- st = options.lstatSync(p)
19276
- } catch (er) {
19277
- if (er.code === 'ENOENT') {
19278
- return
19279
- }
19280
-
19281
- // Windows can EPERM on stat. Life is suffering.
19282
- if (er.code === 'EPERM' && isWindows) {
19283
- fixWinEPERMSync(p, options, er)
19284
- }
19285
- }
19286
-
19287
- try {
19288
- // sunos lets the root user unlink directories, which is... weird.
19289
- if (st && st.isDirectory()) {
19290
- rmdirSync(p, options, null)
19291
- } else {
19292
- options.unlinkSync(p)
19293
- }
19294
- } catch (er) {
19295
- if (er.code === 'ENOENT') {
19296
- return
19297
- } else if (er.code === 'EPERM') {
19298
- return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
19299
- } else if (er.code !== 'EISDIR') {
19300
- throw er
19301
- }
19302
- rmdirSync(p, options, er)
19303
- }
19304
- }
19305
-
19306
- function rmdirSync (p, options, originalEr) {
19307
- assert(p)
19308
- assert(options)
19309
-
19310
- try {
19311
- options.rmdirSync(p)
19312
- } catch (er) {
19313
- if (er.code === 'ENOTDIR') {
19314
- throw originalEr
19315
- } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') {
19316
- rmkidsSync(p, options)
19317
- } else if (er.code !== 'ENOENT') {
19318
- throw er
19319
- }
19320
- }
19321
- }
19322
-
19323
- function rmkidsSync (p, options) {
19324
- assert(p)
19325
- assert(options)
19326
- options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
19327
-
19328
- if (isWindows) {
19329
- // We only end up here once we got ENOTEMPTY at least once, and
19330
- // at this point, we are guaranteed to have removed all the kids.
19331
- // So, we know that it won't be ENOENT or ENOTDIR or anything else.
19332
- // try really hard to delete stuff on windows, because it has a
19333
- // PROFOUNDLY annoying habit of not closing handles promptly when
19334
- // files are deleted, resulting in spurious ENOTEMPTY errors.
19335
- const startTime = Date.now()
19336
- do {
19337
- try {
19338
- const ret = options.rmdirSync(p, options)
19339
- return ret
19340
- } catch {}
19341
- } while (Date.now() - startTime < 500) // give up after 500ms
19342
- } else {
19343
- const ret = options.rmdirSync(p, options)
19344
- return ret
19345
- }
19346
- }
19347
-
19348
- module.exports = rimraf
19349
- rimraf.sync = rimrafSync
19350
-
19351
-
19352
- /***/ }),
19353
-
19354
- /***/ "../../node_modules/fs-extra/lib/util/stat.js":
19355
- /*!****************************************************!*\
19356
- !*** ../../node_modules/fs-extra/lib/util/stat.js ***!
19357
- \****************************************************/
19358
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19359
-
19360
- "use strict";
19361
-
19362
-
19363
- const fs = __webpack_require__(/*! ../fs */ "../../node_modules/fs-extra/lib/fs/index.js")
19364
- const path = __webpack_require__(/*! path */ "path")
19365
- const util = __webpack_require__(/*! util */ "util")
19366
- const atLeastNode = __webpack_require__(/*! at-least-node */ "../../node_modules/at-least-node/index.js")
19367
-
19368
- const nodeSupportsBigInt = atLeastNode('10.5.0')
19369
- const stat = (file) => nodeSupportsBigInt ? fs.stat(file, { bigint: true }) : fs.stat(file)
19370
- const statSync = (file) => nodeSupportsBigInt ? fs.statSync(file, { bigint: true }) : fs.statSync(file)
19371
-
19372
- function getStats (src, dest) {
19373
- return Promise.all([
19374
- stat(src),
19375
- stat(dest).catch(err => {
19376
- if (err.code === 'ENOENT') return null
19377
- throw err
19378
- })
19379
- ]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
19380
- }
19381
-
19382
- function getStatsSync (src, dest) {
19383
- let destStat
19384
- const srcStat = statSync(src)
19385
- try {
19386
- destStat = statSync(dest)
19387
- } catch (err) {
19388
- if (err.code === 'ENOENT') return { srcStat, destStat: null }
19389
- throw err
19390
- }
19391
- return { srcStat, destStat }
19392
- }
19393
-
19394
- function checkPaths (src, dest, funcName, cb) {
19395
- util.callbackify(getStats)(src, dest, (err, stats) => {
19396
- if (err) return cb(err)
19397
- const { srcStat, destStat } = stats
19398
- if (destStat && areIdentical(srcStat, destStat)) {
19399
- return cb(new Error('Source and destination must not be the same.'))
19400
- }
19401
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
19402
- return cb(new Error(errMsg(src, dest, funcName)))
19403
- }
19404
- return cb(null, { srcStat, destStat })
19405
- })
19406
- }
19407
-
19408
- function checkPathsSync (src, dest, funcName) {
19409
- const { srcStat, destStat } = getStatsSync(src, dest)
19410
- if (destStat && areIdentical(srcStat, destStat)) {
19411
- throw new Error('Source and destination must not be the same.')
19412
- }
19413
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
19414
- throw new Error(errMsg(src, dest, funcName))
19415
- }
19416
- return { srcStat, destStat }
19417
- }
19418
-
19419
- // recursively check if dest parent is a subdirectory of src.
19420
- // It works for all file types including symlinks since it
19421
- // checks the src and dest inodes. It starts from the deepest
19422
- // parent and stops once it reaches the src parent or the root path.
19423
- function checkParentPaths (src, srcStat, dest, funcName, cb) {
19424
- const srcParent = path.resolve(path.dirname(src))
19425
- const destParent = path.resolve(path.dirname(dest))
19426
- if (destParent === srcParent || destParent === path.parse(destParent).root) return cb()
19427
- const callback = (err, destStat) => {
19428
- if (err) {
19429
- if (err.code === 'ENOENT') return cb()
19430
- return cb(err)
19431
- }
19432
- if (areIdentical(srcStat, destStat)) {
19433
- return cb(new Error(errMsg(src, dest, funcName)))
19434
- }
19435
- return checkParentPaths(src, srcStat, destParent, funcName, cb)
19436
- }
19437
- if (nodeSupportsBigInt) fs.stat(destParent, { bigint: true }, callback)
19438
- else fs.stat(destParent, callback)
19439
- }
19440
-
19441
- function checkParentPathsSync (src, srcStat, dest, funcName) {
19442
- const srcParent = path.resolve(path.dirname(src))
19443
- const destParent = path.resolve(path.dirname(dest))
19444
- if (destParent === srcParent || destParent === path.parse(destParent).root) return
19445
- let destStat
19446
- try {
19447
- destStat = statSync(destParent)
19448
- } catch (err) {
19449
- if (err.code === 'ENOENT') return
19450
- throw err
19451
- }
19452
- if (areIdentical(srcStat, destStat)) {
19453
- throw new Error(errMsg(src, dest, funcName))
19454
- }
19455
- return checkParentPathsSync(src, srcStat, destParent, funcName)
19456
- }
19457
-
19458
- function areIdentical (srcStat, destStat) {
19459
- if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) {
19460
- if (nodeSupportsBigInt || destStat.ino < Number.MAX_SAFE_INTEGER) {
19461
- // definitive answer
19462
- return true
19463
- }
19464
- // Use additional heuristics if we can't use 'bigint'.
19465
- // Different 'ino' could be represented the same if they are >= Number.MAX_SAFE_INTEGER
19466
- // See issue 657
19467
- if (destStat.size === srcStat.size &&
19468
- destStat.mode === srcStat.mode &&
19469
- destStat.nlink === srcStat.nlink &&
19470
- destStat.atimeMs === srcStat.atimeMs &&
19471
- destStat.mtimeMs === srcStat.mtimeMs &&
19472
- destStat.ctimeMs === srcStat.ctimeMs &&
19473
- destStat.birthtimeMs === srcStat.birthtimeMs) {
19474
- // heuristic answer
19475
- return true
19476
- }
19477
- }
19478
- return false
19479
- }
19480
-
19481
- // return true if dest is a subdir of src, otherwise false.
19482
- // It only checks the path strings.
19483
- function isSrcSubdir (src, dest) {
19484
- const srcArr = path.resolve(src).split(path.sep).filter(i => i)
19485
- const destArr = path.resolve(dest).split(path.sep).filter(i => i)
19486
- return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true)
19487
- }
19488
-
19489
- function errMsg (src, dest, funcName) {
19490
- return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
19491
- }
19492
-
19493
- module.exports = {
19494
- checkPaths,
19495
- checkPathsSync,
19496
- checkParentPaths,
19497
- checkParentPathsSync,
19498
- isSrcSubdir
19499
- }
19500
-
19501
-
19502
- /***/ }),
19503
-
19504
- /***/ "../../node_modules/fs-extra/lib/util/utimes.js":
19505
- /*!******************************************************!*\
19506
- !*** ../../node_modules/fs-extra/lib/util/utimes.js ***!
19507
- \******************************************************/
19508
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19509
-
19510
- "use strict";
19511
-
19512
-
19513
- const fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
19514
-
19515
- function utimesMillis (path, atime, mtime, callback) {
19516
- // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
19517
- fs.open(path, 'r+', (err, fd) => {
19518
- if (err) return callback(err)
19519
- fs.futimes(fd, atime, mtime, futimesErr => {
19520
- fs.close(fd, closeErr => {
19521
- if (callback) callback(futimesErr || closeErr)
19522
- })
19523
- })
19524
- })
19525
- }
19526
-
19527
- function utimesMillisSync (path, atime, mtime) {
19528
- const fd = fs.openSync(path, 'r+')
19529
- fs.futimesSync(fd, atime, mtime)
19530
- return fs.closeSync(fd)
19531
- }
19532
-
19533
- module.exports = {
19534
- utimesMillis,
19535
- utimesMillisSync
19536
- }
19537
-
19538
-
19539
- /***/ }),
19540
-
19541
- /***/ "../../node_modules/graceful-fs/clone.js":
19542
- /*!***********************************************!*\
19543
- !*** ../../node_modules/graceful-fs/clone.js ***!
19544
- \***********************************************/
19545
- /***/ ((module) => {
19546
-
19547
- "use strict";
19548
-
19549
-
19550
- module.exports = clone
19551
-
19552
- var getPrototypeOf = Object.getPrototypeOf || function (obj) {
19553
- return obj.__proto__
19554
- }
19555
-
19556
- function clone (obj) {
19557
- if (obj === null || typeof obj !== 'object')
19558
- return obj
19559
-
19560
- if (obj instanceof Object)
19561
- var copy = { __proto__: getPrototypeOf(obj) }
19562
- else
19563
- var copy = Object.create(null)
19564
-
19565
- Object.getOwnPropertyNames(obj).forEach(function (key) {
19566
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
19567
- })
19568
-
19569
- return copy
19570
- }
19571
-
19572
-
19573
- /***/ }),
19574
-
19575
- /***/ "../../node_modules/graceful-fs/graceful-fs.js":
19576
- /*!*****************************************************!*\
19577
- !*** ../../node_modules/graceful-fs/graceful-fs.js ***!
19578
- \*****************************************************/
19579
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19580
-
19581
- var fs = __webpack_require__(/*! fs */ "fs")
19582
- var polyfills = __webpack_require__(/*! ./polyfills.js */ "../../node_modules/graceful-fs/polyfills.js")
19583
- var legacy = __webpack_require__(/*! ./legacy-streams.js */ "../../node_modules/graceful-fs/legacy-streams.js")
19584
- var clone = __webpack_require__(/*! ./clone.js */ "../../node_modules/graceful-fs/clone.js")
19585
-
19586
- var util = __webpack_require__(/*! util */ "util")
19587
-
19588
- /* istanbul ignore next - node 0.x polyfill */
19589
- var gracefulQueue
19590
- var previousSymbol
19591
-
19592
- /* istanbul ignore else - node 0.x polyfill */
19593
- if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
19594
- gracefulQueue = Symbol.for('graceful-fs.queue')
19595
- // This is used in testing by future versions
19596
- previousSymbol = Symbol.for('graceful-fs.previous')
19597
- } else {
19598
- gracefulQueue = '___graceful-fs.queue'
19599
- previousSymbol = '___graceful-fs.previous'
19600
- }
19601
-
19602
- function noop () {}
19603
-
19604
- function publishQueue(context, queue) {
19605
- Object.defineProperty(context, gracefulQueue, {
19606
- get: function() {
19607
- return queue
19608
- }
19609
- })
19610
- }
19611
-
19612
- var debug = noop
19613
- if (util.debuglog)
19614
- debug = util.debuglog('gfs4')
19615
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
19616
- debug = function() {
19617
- var m = util.format.apply(util, arguments)
19618
- m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
19619
- console.error(m)
19620
- }
19621
-
19622
- // Once time initialization
19623
- if (!fs[gracefulQueue]) {
19624
- // This queue can be shared by multiple loaded instances
19625
- var queue = global[gracefulQueue] || []
19626
- publishQueue(fs, queue)
19627
-
19628
- // Patch fs.close/closeSync to shared queue version, because we need
19629
- // to retry() whenever a close happens *anywhere* in the program.
19630
- // This is essential when multiple graceful-fs instances are
19631
- // in play at the same time.
19632
- fs.close = (function (fs$close) {
19633
- function close (fd, cb) {
19634
- return fs$close.call(fs, fd, function (err) {
19635
- // This function uses the graceful-fs shared queue
19636
- if (!err) {
19637
- resetQueue()
19638
- }
19639
-
19640
- if (typeof cb === 'function')
19641
- cb.apply(this, arguments)
19642
- })
19643
- }
19644
-
19645
- Object.defineProperty(close, previousSymbol, {
19646
- value: fs$close
19647
- })
19648
- return close
19649
- })(fs.close)
19650
-
19651
- fs.closeSync = (function (fs$closeSync) {
19652
- function closeSync (fd) {
19653
- // This function uses the graceful-fs shared queue
19654
- fs$closeSync.apply(fs, arguments)
19655
- resetQueue()
19656
- }
19657
-
19658
- Object.defineProperty(closeSync, previousSymbol, {
19659
- value: fs$closeSync
19660
- })
19661
- return closeSync
19662
- })(fs.closeSync)
19663
-
19664
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
19665
- process.on('exit', function() {
19666
- debug(fs[gracefulQueue])
19667
- __webpack_require__(/*! assert */ "assert").equal(fs[gracefulQueue].length, 0)
19668
- })
19669
- }
19670
- }
19671
-
19672
- if (!global[gracefulQueue]) {
19673
- publishQueue(global, fs[gracefulQueue]);
19674
- }
19675
-
19676
- module.exports = patch(clone(fs))
19677
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
19678
- module.exports = patch(fs)
19679
- fs.__patched = true;
19680
- }
19681
-
19682
- function patch (fs) {
19683
- // Everything that references the open() function needs to be in here
19684
- polyfills(fs)
19685
- fs.gracefulify = patch
19686
-
19687
- fs.createReadStream = createReadStream
19688
- fs.createWriteStream = createWriteStream
19689
- var fs$readFile = fs.readFile
19690
- fs.readFile = readFile
19691
- function readFile (path, options, cb) {
19692
- if (typeof options === 'function')
19693
- cb = options, options = null
19694
-
19695
- return go$readFile(path, options, cb)
19696
-
19697
- function go$readFile (path, options, cb, startTime) {
19698
- return fs$readFile(path, options, function (err) {
19699
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
19700
- enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])
19701
- else {
19702
- if (typeof cb === 'function')
19703
- cb.apply(this, arguments)
19704
- }
19705
- })
19706
- }
19707
- }
19708
-
19709
- var fs$writeFile = fs.writeFile
19710
- fs.writeFile = writeFile
19711
- function writeFile (path, data, options, cb) {
19712
- if (typeof options === 'function')
19713
- cb = options, options = null
19714
-
19715
- return go$writeFile(path, data, options, cb)
19716
-
19717
- function go$writeFile (path, data, options, cb, startTime) {
19718
- return fs$writeFile(path, data, options, function (err) {
19719
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
19720
- enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
19721
- else {
19722
- if (typeof cb === 'function')
19723
- cb.apply(this, arguments)
19724
- }
19725
- })
19726
- }
19727
- }
19728
-
19729
- var fs$appendFile = fs.appendFile
19730
- if (fs$appendFile)
19731
- fs.appendFile = appendFile
19732
- function appendFile (path, data, options, cb) {
19733
- if (typeof options === 'function')
19734
- cb = options, options = null
19735
-
19736
- return go$appendFile(path, data, options, cb)
19737
-
19738
- function go$appendFile (path, data, options, cb, startTime) {
19739
- return fs$appendFile(path, data, options, function (err) {
19740
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
19741
- enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
19742
- else {
19743
- if (typeof cb === 'function')
19744
- cb.apply(this, arguments)
19745
- }
19746
- })
19747
- }
19748
- }
19749
-
19750
- var fs$copyFile = fs.copyFile
19751
- if (fs$copyFile)
19752
- fs.copyFile = copyFile
19753
- function copyFile (src, dest, flags, cb) {
19754
- if (typeof flags === 'function') {
19755
- cb = flags
19756
- flags = 0
19757
- }
19758
- return go$copyFile(src, dest, flags, cb)
19759
-
19760
- function go$copyFile (src, dest, flags, cb, startTime) {
19761
- return fs$copyFile(src, dest, flags, function (err) {
19762
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
19763
- enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])
19764
- else {
19765
- if (typeof cb === 'function')
19766
- cb.apply(this, arguments)
19767
- }
19768
- })
19769
- }
19770
- }
19771
-
19772
- var fs$readdir = fs.readdir
19773
- fs.readdir = readdir
19774
- var noReaddirOptionVersions = /^v[0-5]\./
19775
- function readdir (path, options, cb) {
19776
- if (typeof options === 'function')
19777
- cb = options, options = null
19778
-
19779
- var go$readdir = noReaddirOptionVersions.test(process.version)
19780
- ? function go$readdir (path, options, cb, startTime) {
19781
- return fs$readdir(path, fs$readdirCallback(
19782
- path, options, cb, startTime
19783
- ))
19784
- }
19785
- : function go$readdir (path, options, cb, startTime) {
19786
- return fs$readdir(path, options, fs$readdirCallback(
19787
- path, options, cb, startTime
19788
- ))
19789
- }
19790
-
19791
- return go$readdir(path, options, cb)
19792
-
19793
- function fs$readdirCallback (path, options, cb, startTime) {
19794
- return function (err, files) {
19795
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
19796
- enqueue([
19797
- go$readdir,
19798
- [path, options, cb],
19799
- err,
19800
- startTime || Date.now(),
19801
- Date.now()
19802
- ])
19803
- else {
19804
- if (files && files.sort)
19805
- files.sort()
19806
-
19807
- if (typeof cb === 'function')
19808
- cb.call(this, err, files)
19809
- }
19810
- }
19811
- }
19812
- }
19813
-
19814
- if (process.version.substr(0, 4) === 'v0.8') {
19815
- var legStreams = legacy(fs)
19816
- ReadStream = legStreams.ReadStream
19817
- WriteStream = legStreams.WriteStream
19818
- }
19819
-
19820
- var fs$ReadStream = fs.ReadStream
19821
- if (fs$ReadStream) {
19822
- ReadStream.prototype = Object.create(fs$ReadStream.prototype)
19823
- ReadStream.prototype.open = ReadStream$open
19824
- }
19825
-
19826
- var fs$WriteStream = fs.WriteStream
19827
- if (fs$WriteStream) {
19828
- WriteStream.prototype = Object.create(fs$WriteStream.prototype)
19829
- WriteStream.prototype.open = WriteStream$open
19830
- }
19831
-
19832
- Object.defineProperty(fs, 'ReadStream', {
19833
- get: function () {
19834
- return ReadStream
19835
- },
19836
- set: function (val) {
19837
- ReadStream = val
19838
- },
19839
- enumerable: true,
19840
- configurable: true
19841
- })
19842
- Object.defineProperty(fs, 'WriteStream', {
19843
- get: function () {
19844
- return WriteStream
19845
- },
19846
- set: function (val) {
19847
- WriteStream = val
19848
- },
19849
- enumerable: true,
19850
- configurable: true
19851
- })
19852
-
19853
- // legacy names
19854
- var FileReadStream = ReadStream
19855
- Object.defineProperty(fs, 'FileReadStream', {
19856
- get: function () {
19857
- return FileReadStream
19858
- },
19859
- set: function (val) {
19860
- FileReadStream = val
19861
- },
19862
- enumerable: true,
19863
- configurable: true
19864
- })
19865
- var FileWriteStream = WriteStream
19866
- Object.defineProperty(fs, 'FileWriteStream', {
19867
- get: function () {
19868
- return FileWriteStream
19869
- },
19870
- set: function (val) {
19871
- FileWriteStream = val
19872
- },
19873
- enumerable: true,
19874
- configurable: true
19875
- })
19876
-
19877
- function ReadStream (path, options) {
19878
- if (this instanceof ReadStream)
19879
- return fs$ReadStream.apply(this, arguments), this
19880
- else
19881
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
19882
- }
19883
-
19884
- function ReadStream$open () {
19885
- var that = this
19886
- open(that.path, that.flags, that.mode, function (err, fd) {
19887
- if (err) {
19888
- if (that.autoClose)
19889
- that.destroy()
19890
-
19891
- that.emit('error', err)
19892
- } else {
19893
- that.fd = fd
19894
- that.emit('open', fd)
19895
- that.read()
19896
- }
19897
- })
19898
- }
19899
-
19900
- function WriteStream (path, options) {
19901
- if (this instanceof WriteStream)
19902
- return fs$WriteStream.apply(this, arguments), this
19903
- else
19904
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
19905
- }
19906
-
19907
- function WriteStream$open () {
19908
- var that = this
19909
- open(that.path, that.flags, that.mode, function (err, fd) {
19910
- if (err) {
19911
- that.destroy()
19912
- that.emit('error', err)
19913
- } else {
19914
- that.fd = fd
19915
- that.emit('open', fd)
19916
- }
19917
- })
19918
- }
19919
-
19920
- function createReadStream (path, options) {
19921
- return new fs.ReadStream(path, options)
19922
- }
19923
-
19924
- function createWriteStream (path, options) {
19925
- return new fs.WriteStream(path, options)
19926
- }
19927
-
19928
- var fs$open = fs.open
19929
- fs.open = open
19930
- function open (path, flags, mode, cb) {
19931
- if (typeof mode === 'function')
19932
- cb = mode, mode = null
19933
-
19934
- return go$open(path, flags, mode, cb)
19935
-
19936
- function go$open (path, flags, mode, cb, startTime) {
19937
- return fs$open(path, flags, mode, function (err, fd) {
19938
- if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
19939
- enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])
19940
- else {
19941
- if (typeof cb === 'function')
19942
- cb.apply(this, arguments)
19943
- }
19944
- })
19945
- }
19946
- }
19947
-
19948
- return fs
19949
- }
19950
-
19951
- function enqueue (elem) {
19952
- debug('ENQUEUE', elem[0].name, elem[1])
19953
- fs[gracefulQueue].push(elem)
19954
- retry()
19955
- }
19956
-
19957
- // keep track of the timeout between retry() calls
19958
- var retryTimer
19959
-
19960
- // reset the startTime and lastTime to now
19961
- // this resets the start of the 60 second overall timeout as well as the
19962
- // delay between attempts so that we'll retry these jobs sooner
19963
- function resetQueue () {
19964
- var now = Date.now()
19965
- for (var i = 0; i < fs[gracefulQueue].length; ++i) {
19966
- // entries that are only a length of 2 are from an older version, don't
19967
- // bother modifying those since they'll be retried anyway.
19968
- if (fs[gracefulQueue][i].length > 2) {
19969
- fs[gracefulQueue][i][3] = now // startTime
19970
- fs[gracefulQueue][i][4] = now // lastTime
19971
- }
19972
- }
19973
- // call retry to make sure we're actively processing the queue
19974
- retry()
19975
- }
19976
-
19977
- function retry () {
19978
- // clear the timer and remove it to help prevent unintended concurrency
19979
- clearTimeout(retryTimer)
19980
- retryTimer = undefined
19981
-
19982
- if (fs[gracefulQueue].length === 0)
19983
- return
19984
-
19985
- var elem = fs[gracefulQueue].shift()
19986
- var fn = elem[0]
19987
- var args = elem[1]
19988
- // these items may be unset if they were added by an older graceful-fs
19989
- var err = elem[2]
19990
- var startTime = elem[3]
19991
- var lastTime = elem[4]
19992
-
19993
- // if we don't have a startTime we have no way of knowing if we've waited
19994
- // long enough, so go ahead and retry this item now
19995
- if (startTime === undefined) {
19996
- debug('RETRY', fn.name, args)
19997
- fn.apply(null, args)
19998
- } else if (Date.now() - startTime >= 60000) {
19999
- // it's been more than 60 seconds total, bail now
20000
- debug('TIMEOUT', fn.name, args)
20001
- var cb = args.pop()
20002
- if (typeof cb === 'function')
20003
- cb.call(null, err)
20004
- } else {
20005
- // the amount of time between the last attempt and right now
20006
- var sinceAttempt = Date.now() - lastTime
20007
- // the amount of time between when we first tried, and when we last tried
20008
- // rounded up to at least 1
20009
- var sinceStart = Math.max(lastTime - startTime, 1)
20010
- // backoff. wait longer than the total time we've been retrying, but only
20011
- // up to a maximum of 100ms
20012
- var desiredDelay = Math.min(sinceStart * 1.2, 100)
20013
- // it's been long enough since the last retry, do it again
20014
- if (sinceAttempt >= desiredDelay) {
20015
- debug('RETRY', fn.name, args)
20016
- fn.apply(null, args.concat([startTime]))
20017
- } else {
20018
- // if we can't do this job yet, push it to the end of the queue
20019
- // and let the next iteration check again
20020
- fs[gracefulQueue].push(elem)
17147
+ };
17148
+ // Some common format strings
17149
+ var globalMasks = {
17150
+ default: "ddd MMM DD YYYY HH:mm:ss",
17151
+ shortDate: "M/D/YY",
17152
+ mediumDate: "MMM D, YYYY",
17153
+ longDate: "MMMM D, YYYY",
17154
+ fullDate: "dddd, MMMM D, YYYY",
17155
+ isoDate: "YYYY-MM-DD",
17156
+ isoDateTime: "YYYY-MM-DDTHH:mm:ssZ",
17157
+ shortTime: "HH:mm",
17158
+ mediumTime: "HH:mm:ss",
17159
+ longTime: "HH:mm:ss.SSS"
17160
+ };
17161
+ var setGlobalDateMasks = function (masks) { return assign(globalMasks, masks); };
17162
+ /***
17163
+ * Format a date
17164
+ * @method format
17165
+ * @param {Date|number} dateObj
17166
+ * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
17167
+ * @returns {string} Formatted date string
17168
+ */
17169
+ var format = function (dateObj, mask, i18n) {
17170
+ if (mask === void 0) { mask = globalMasks["default"]; }
17171
+ if (i18n === void 0) { i18n = {}; }
17172
+ if (typeof dateObj === "number") {
17173
+ dateObj = new Date(dateObj);
20021
17174
  }
20022
- }
20023
-
20024
- // schedule our next run if one isn't already scheduled
20025
- if (retryTimer === undefined) {
20026
- retryTimer = setTimeout(retry, 0)
20027
- }
20028
- }
20029
-
20030
-
20031
- /***/ }),
20032
-
20033
- /***/ "../../node_modules/graceful-fs/legacy-streams.js":
20034
- /*!********************************************************!*\
20035
- !*** ../../node_modules/graceful-fs/legacy-streams.js ***!
20036
- \********************************************************/
20037
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20038
-
20039
- var Stream = (__webpack_require__(/*! stream */ "stream").Stream)
20040
-
20041
- module.exports = legacy
20042
-
20043
- function legacy (fs) {
20044
- return {
20045
- ReadStream: ReadStream,
20046
- WriteStream: WriteStream
20047
- }
20048
-
20049
- function ReadStream (path, options) {
20050
- if (!(this instanceof ReadStream)) return new ReadStream(path, options);
20051
-
20052
- Stream.call(this);
20053
-
20054
- var self = this;
20055
-
20056
- this.path = path;
20057
- this.fd = null;
20058
- this.readable = true;
20059
- this.paused = false;
20060
-
20061
- this.flags = 'r';
20062
- this.mode = 438; /*=0666*/
20063
- this.bufferSize = 64 * 1024;
20064
-
20065
- options = options || {};
20066
-
20067
- // Mixin options into this
20068
- var keys = Object.keys(options);
20069
- for (var index = 0, length = keys.length; index < length; index++) {
20070
- var key = keys[index];
20071
- this[key] = options[key];
17175
+ if (Object.prototype.toString.call(dateObj) !== "[object Date]" ||
17176
+ isNaN(dateObj.getTime())) {
17177
+ throw new Error("Invalid Date pass to format");
20072
17178
  }
20073
-
20074
- if (this.encoding) this.setEncoding(this.encoding);
20075
-
20076
- if (this.start !== undefined) {
20077
- if ('number' !== typeof this.start) {
20078
- throw TypeError('start must be a Number');
20079
- }
20080
- if (this.end === undefined) {
20081
- this.end = Infinity;
20082
- } else if ('number' !== typeof this.end) {
20083
- throw TypeError('end must be a Number');
20084
- }
20085
-
20086
- if (this.start > this.end) {
20087
- throw new Error('start must be <= end');
20088
- }
20089
-
20090
- this.pos = this.start;
17179
+ mask = globalMasks[mask] || mask;
17180
+ var literals = [];
17181
+ // Make literals inactive by replacing them with @@@
17182
+ mask = mask.replace(literal, function ($0, $1) {
17183
+ literals.push($1);
17184
+ return "@@@";
17185
+ });
17186
+ var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
17187
+ // Apply formatting rules
17188
+ mask = mask.replace(token, function ($0) {
17189
+ return formatFlags[$0](dateObj, combinedI18nSettings);
17190
+ });
17191
+ // Inline literal values back into the formatted value
17192
+ return mask.replace(/@@@/g, function () { return literals.shift(); });
17193
+ };
17194
+ /**
17195
+ * Parse a date string into a Javascript Date object /
17196
+ * @method parse
17197
+ * @param {string} dateStr Date string
17198
+ * @param {string} format Date parse format
17199
+ * @param {i18n} I18nSettingsOptional Full or subset of I18N settings
17200
+ * @returns {Date|null} Returns Date object. Returns null what date string is invalid or doesn't match format
17201
+ */
17202
+ function parse(dateStr, format, i18n) {
17203
+ if (i18n === void 0) { i18n = {}; }
17204
+ if (typeof format !== "string") {
17205
+ throw new Error("Invalid format in fecha parse");
20091
17206
  }
20092
-
20093
- if (this.fd !== null) {
20094
- process.nextTick(function() {
20095
- self._read();
20096
- });
20097
- return;
17207
+ // Check to see if the format is actually a mask
17208
+ format = globalMasks[format] || format;
17209
+ // Avoid regular expression denial of service, fail early for really long strings
17210
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
17211
+ if (dateStr.length > 1000) {
17212
+ return null;
20098
17213
  }
20099
-
20100
- fs.open(this.path, this.flags, this.mode, function (err, fd) {
20101
- if (err) {
20102
- self.emit('error', err);
20103
- self.readable = false;
20104
- return;
20105
- }
20106
-
20107
- self.fd = fd;
20108
- self.emit('open', fd);
20109
- self._read();
20110
- })
20111
- }
20112
-
20113
- function WriteStream (path, options) {
20114
- if (!(this instanceof WriteStream)) return new WriteStream(path, options);
20115
-
20116
- Stream.call(this);
20117
-
20118
- this.path = path;
20119
- this.fd = null;
20120
- this.writable = true;
20121
-
20122
- this.flags = 'w';
20123
- this.encoding = 'binary';
20124
- this.mode = 438; /*=0666*/
20125
- this.bytesWritten = 0;
20126
-
20127
- options = options || {};
20128
-
20129
- // Mixin options into this
20130
- var keys = Object.keys(options);
20131
- for (var index = 0, length = keys.length; index < length; index++) {
20132
- var key = keys[index];
20133
- this[key] = options[key];
17214
+ // Default to the beginning of the year.
17215
+ var today = new Date();
17216
+ var dateInfo = {
17217
+ year: today.getFullYear(),
17218
+ month: 0,
17219
+ day: 1,
17220
+ hour: 0,
17221
+ minute: 0,
17222
+ second: 0,
17223
+ millisecond: 0,
17224
+ isPm: null,
17225
+ timezoneOffset: null
17226
+ };
17227
+ var parseInfo = [];
17228
+ var literals = [];
17229
+ // Replace all the literals with @@@. Hopefully a string that won't exist in the format
17230
+ var newFormat = format.replace(literal, function ($0, $1) {
17231
+ literals.push(regexEscape($1));
17232
+ return "@@@";
17233
+ });
17234
+ var specifiedFields = {};
17235
+ var requiredFields = {};
17236
+ // Change every token that we find into the correct regex
17237
+ newFormat = regexEscape(newFormat).replace(token, function ($0) {
17238
+ var info = parseFlags[$0];
17239
+ var field = info[0], regex = info[1], requiredField = info[3];
17240
+ // Check if the person has specified the same field twice. This will lead to confusing results.
17241
+ if (specifiedFields[field]) {
17242
+ throw new Error("Invalid format. " + field + " specified twice in format");
17243
+ }
17244
+ specifiedFields[field] = true;
17245
+ // Check if there are any required fields. For instance, 12 hour time requires AM/PM specified
17246
+ if (requiredField) {
17247
+ requiredFields[requiredField] = true;
17248
+ }
17249
+ parseInfo.push(info);
17250
+ return "(" + regex + ")";
17251
+ });
17252
+ // Check all the required fields are present
17253
+ Object.keys(requiredFields).forEach(function (field) {
17254
+ if (!specifiedFields[field]) {
17255
+ throw new Error("Invalid format. " + field + " is required in specified format");
17256
+ }
17257
+ });
17258
+ // Add back all the literals after
17259
+ newFormat = newFormat.replace(/@@@/g, function () { return literals.shift(); });
17260
+ // Check if the date string matches the format. If it doesn't return null
17261
+ var matches = dateStr.match(new RegExp(newFormat, "i"));
17262
+ if (!matches) {
17263
+ return null;
20134
17264
  }
20135
-
20136
- if (this.start !== undefined) {
20137
- if ('number' !== typeof this.start) {
20138
- throw TypeError('start must be a Number');
20139
- }
20140
- if (this.start < 0) {
20141
- throw new Error('start must be >= zero');
20142
- }
20143
-
20144
- this.pos = this.start;
17265
+ var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
17266
+ // For each match, call the parser function for that date part
17267
+ for (var i = 1; i < matches.length; i++) {
17268
+ var _a = parseInfo[i - 1], field = _a[0], parser = _a[2];
17269
+ var value = parser
17270
+ ? parser(matches[i], combinedI18nSettings)
17271
+ : +matches[i];
17272
+ // If the parser can't make sense of the value, return null
17273
+ if (value == null) {
17274
+ return null;
17275
+ }
17276
+ dateInfo[field] = value;
20145
17277
  }
20146
-
20147
- this.busy = false;
20148
- this._queue = [];
20149
-
20150
- if (this.fd === null) {
20151
- this._open = fs.open;
20152
- this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
20153
- this.flush();
17278
+ if (dateInfo.isPm === 1 && dateInfo.hour != null && +dateInfo.hour !== 12) {
17279
+ dateInfo.hour = +dateInfo.hour + 12;
20154
17280
  }
20155
- }
20156
- }
20157
-
20158
-
20159
- /***/ }),
20160
-
20161
- /***/ "../../node_modules/graceful-fs/polyfills.js":
20162
- /*!***************************************************!*\
20163
- !*** ../../node_modules/graceful-fs/polyfills.js ***!
20164
- \***************************************************/
20165
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20166
-
20167
- var constants = __webpack_require__(/*! constants */ "constants")
20168
-
20169
- var origCwd = process.cwd
20170
- var cwd = null
20171
-
20172
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
20173
-
20174
- process.cwd = function() {
20175
- if (!cwd)
20176
- cwd = origCwd.call(process)
20177
- return cwd
20178
- }
20179
- try {
20180
- process.cwd()
20181
- } catch (er) {}
20182
-
20183
- // This check is needed until node.js 12 is required
20184
- if (typeof process.chdir === 'function') {
20185
- var chdir = process.chdir
20186
- process.chdir = function (d) {
20187
- cwd = null
20188
- chdir.call(process, d)
20189
- }
20190
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir)
20191
- }
20192
-
20193
- module.exports = patch
20194
-
20195
- function patch (fs) {
20196
- // (re-)implement some things that are known busted or missing.
20197
-
20198
- // lchmod, broken prior to 0.6.2
20199
- // back-port the fix here.
20200
- if (constants.hasOwnProperty('O_SYMLINK') &&
20201
- process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
20202
- patchLchmod(fs)
20203
- }
20204
-
20205
- // lutimes implementation, or no-op
20206
- if (!fs.lutimes) {
20207
- patchLutimes(fs)
20208
- }
20209
-
20210
- // https://github.com/isaacs/node-graceful-fs/issues/4
20211
- // Chown should not fail on einval or eperm if non-root.
20212
- // It should not fail on enosys ever, as this just indicates
20213
- // that a fs doesn't support the intended operation.
20214
-
20215
- fs.chown = chownFix(fs.chown)
20216
- fs.fchown = chownFix(fs.fchown)
20217
- fs.lchown = chownFix(fs.lchown)
20218
-
20219
- fs.chmod = chmodFix(fs.chmod)
20220
- fs.fchmod = chmodFix(fs.fchmod)
20221
- fs.lchmod = chmodFix(fs.lchmod)
20222
-
20223
- fs.chownSync = chownFixSync(fs.chownSync)
20224
- fs.fchownSync = chownFixSync(fs.fchownSync)
20225
- fs.lchownSync = chownFixSync(fs.lchownSync)
20226
-
20227
- fs.chmodSync = chmodFixSync(fs.chmodSync)
20228
- fs.fchmodSync = chmodFixSync(fs.fchmodSync)
20229
- fs.lchmodSync = chmodFixSync(fs.lchmodSync)
20230
-
20231
- fs.stat = statFix(fs.stat)
20232
- fs.fstat = statFix(fs.fstat)
20233
- fs.lstat = statFix(fs.lstat)
20234
-
20235
- fs.statSync = statFixSync(fs.statSync)
20236
- fs.fstatSync = statFixSync(fs.fstatSync)
20237
- fs.lstatSync = statFixSync(fs.lstatSync)
20238
-
20239
- // if lchmod/lchown do not exist, then make them no-ops
20240
- if (fs.chmod && !fs.lchmod) {
20241
- fs.lchmod = function (path, mode, cb) {
20242
- if (cb) process.nextTick(cb)
20243
- }
20244
- fs.lchmodSync = function () {}
20245
- }
20246
- if (fs.chown && !fs.lchown) {
20247
- fs.lchown = function (path, uid, gid, cb) {
20248
- if (cb) process.nextTick(cb)
20249
- }
20250
- fs.lchownSync = function () {}
20251
- }
20252
-
20253
- // on Windows, A/V software can lock the directory, causing this
20254
- // to fail with an EACCES or EPERM if the directory contains newly
20255
- // created files. Try again on failure, for up to 60 seconds.
20256
-
20257
- // Set the timeout this long because some Windows Anti-Virus, such as Parity
20258
- // bit9, may lock files for up to a minute, causing npm package install
20259
- // failures. Also, take care to yield the scheduler. Windows scheduling gives
20260
- // CPU to a busy looping process, which can cause the program causing the lock
20261
- // contention to be starved of CPU by node, so the contention doesn't resolve.
20262
- if (platform === "win32") {
20263
- fs.rename = typeof fs.rename !== 'function' ? fs.rename
20264
- : (function (fs$rename) {
20265
- function rename (from, to, cb) {
20266
- var start = Date.now()
20267
- var backoff = 0;
20268
- fs$rename(from, to, function CB (er) {
20269
- if (er
20270
- && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY")
20271
- && Date.now() - start < 60000) {
20272
- setTimeout(function() {
20273
- fs.stat(to, function (stater, st) {
20274
- if (stater && stater.code === "ENOENT")
20275
- fs$rename(from, to, CB);
20276
- else
20277
- cb(er)
20278
- })
20279
- }, backoff)
20280
- if (backoff < 100)
20281
- backoff += 10;
20282
- return;
20283
- }
20284
- if (cb) cb(er)
20285
- })
20286
- }
20287
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename)
20288
- return rename
20289
- })(fs.rename)
20290
- }
20291
-
20292
- // if read() returns EAGAIN, then just try it again.
20293
- fs.read = typeof fs.read !== 'function' ? fs.read
20294
- : (function (fs$read) {
20295
- function read (fd, buffer, offset, length, position, callback_) {
20296
- var callback
20297
- if (callback_ && typeof callback_ === 'function') {
20298
- var eagCounter = 0
20299
- callback = function (er, _, __) {
20300
- if (er && er.code === 'EAGAIN' && eagCounter < 10) {
20301
- eagCounter ++
20302
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
20303
- }
20304
- callback_.apply(this, arguments)
20305
- }
20306
- }
20307
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
17281
+ else if (dateInfo.isPm === 0 && +dateInfo.hour === 12) {
17282
+ dateInfo.hour = 0;
20308
17283
  }
20309
-
20310
- // This ensures `util.promisify` works as it does for native `fs.read`.
20311
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)
20312
- return read
20313
- })(fs.read)
20314
-
20315
- fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
20316
- : (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
20317
- var eagCounter = 0
20318
- while (true) {
20319
- try {
20320
- return fs$readSync.call(fs, fd, buffer, offset, length, position)
20321
- } catch (er) {
20322
- if (er.code === 'EAGAIN' && eagCounter < 10) {
20323
- eagCounter ++
20324
- continue
17284
+ var dateTZ;
17285
+ if (dateInfo.timezoneOffset == null) {
17286
+ dateTZ = new Date(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute, dateInfo.second, dateInfo.millisecond);
17287
+ var validateFields = [
17288
+ ["month", "getMonth"],
17289
+ ["day", "getDate"],
17290
+ ["hour", "getHours"],
17291
+ ["minute", "getMinutes"],
17292
+ ["second", "getSeconds"]
17293
+ ];
17294
+ for (var i = 0, len = validateFields.length; i < len; i++) {
17295
+ // Check to make sure the date field is within the allowed range. Javascript dates allows values
17296
+ // outside the allowed range. If the values don't match the value was invalid
17297
+ if (specifiedFields[validateFields[i][0]] &&
17298
+ dateInfo[validateFields[i][0]] !== dateTZ[validateFields[i][1]]()) {
17299
+ return null;
17300
+ }
20325
17301
  }
20326
- throw er
20327
- }
20328
- }
20329
- }})(fs.readSync)
20330
-
20331
- function patchLchmod (fs) {
20332
- fs.lchmod = function (path, mode, callback) {
20333
- fs.open( path
20334
- , constants.O_WRONLY | constants.O_SYMLINK
20335
- , mode
20336
- , function (err, fd) {
20337
- if (err) {
20338
- if (callback) callback(err)
20339
- return
20340
- }
20341
- // prefer to return the chmod error, if one occurs,
20342
- // but still try to close, and report closing errors if they occur.
20343
- fs.fchmod(fd, mode, function (err) {
20344
- fs.close(fd, function(err2) {
20345
- if (callback) callback(err || err2)
20346
- })
20347
- })
20348
- })
20349
17302
  }
20350
-
20351
- fs.lchmodSync = function (path, mode) {
20352
- var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
20353
-
20354
- // prefer to return the chmod error, if one occurs,
20355
- // but still try to close, and report closing errors if they occur.
20356
- var threw = true
20357
- var ret
20358
- try {
20359
- ret = fs.fchmodSync(fd, mode)
20360
- threw = false
20361
- } finally {
20362
- if (threw) {
20363
- try {
20364
- fs.closeSync(fd)
20365
- } catch (er) {}
20366
- } else {
20367
- fs.closeSync(fd)
17303
+ else {
17304
+ dateTZ = new Date(Date.UTC(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute - dateInfo.timezoneOffset, dateInfo.second, dateInfo.millisecond));
17305
+ // We can't validate dates in another timezone unfortunately. Do a basic check instead
17306
+ if (dateInfo.month > 11 ||
17307
+ dateInfo.month < 0 ||
17308
+ dateInfo.day > 31 ||
17309
+ dateInfo.day < 1 ||
17310
+ dateInfo.hour > 23 ||
17311
+ dateInfo.hour < 0 ||
17312
+ dateInfo.minute > 59 ||
17313
+ dateInfo.minute < 0 ||
17314
+ dateInfo.second > 59 ||
17315
+ dateInfo.second < 0) {
17316
+ return null;
20368
17317
  }
20369
- }
20370
- return ret
20371
17318
  }
20372
- }
20373
-
20374
- function patchLutimes (fs) {
20375
- if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
20376
- fs.lutimes = function (path, at, mt, cb) {
20377
- fs.open(path, constants.O_SYMLINK, function (er, fd) {
20378
- if (er) {
20379
- if (cb) cb(er)
20380
- return
20381
- }
20382
- fs.futimes(fd, at, mt, function (er) {
20383
- fs.close(fd, function (er2) {
20384
- if (cb) cb(er || er2)
20385
- })
20386
- })
20387
- })
20388
- }
17319
+ // Don't allow invalid dates
17320
+ return dateTZ;
17321
+ }
17322
+ var fecha = {
17323
+ format: format,
17324
+ parse: parse,
17325
+ defaultI18n: defaultI18n,
17326
+ setGlobalDateI18n: setGlobalDateI18n,
17327
+ setGlobalDateMasks: setGlobalDateMasks
17328
+ };
20389
17329
 
20390
- fs.lutimesSync = function (path, at, mt) {
20391
- var fd = fs.openSync(path, constants.O_SYMLINK)
20392
- var ret
20393
- var threw = true
20394
- try {
20395
- ret = fs.futimesSync(fd, at, mt)
20396
- threw = false
20397
- } finally {
20398
- if (threw) {
20399
- try {
20400
- fs.closeSync(fd)
20401
- } catch (er) {}
20402
- } else {
20403
- fs.closeSync(fd)
20404
- }
20405
- }
20406
- return ret
20407
- }
17330
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fecha);
20408
17331
 
20409
- } else if (fs.futimes) {
20410
- fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
20411
- fs.lutimesSync = function () {}
20412
- }
20413
- }
20414
17332
 
20415
- function chmodFix (orig) {
20416
- if (!orig) return orig
20417
- return function (target, mode, cb) {
20418
- return orig.call(fs, target, mode, function (er) {
20419
- if (chownErOk(er)) er = null
20420
- if (cb) cb.apply(this, arguments)
20421
- })
20422
- }
20423
- }
20424
17333
 
20425
- function chmodFixSync (orig) {
20426
- if (!orig) return orig
20427
- return function (target, mode) {
20428
- try {
20429
- return orig.call(fs, target, mode)
20430
- } catch (er) {
20431
- if (!chownErOk(er)) throw er
20432
- }
20433
- }
20434
- }
17334
+ /***/ }),
20435
17335
 
17336
+ /***/ "../../node_modules/fn.name/index.js":
17337
+ /*!*******************************************!*\
17338
+ !*** ../../node_modules/fn.name/index.js ***!
17339
+ \*******************************************/
17340
+ /***/ ((module) => {
20436
17341
 
20437
- function chownFix (orig) {
20438
- if (!orig) return orig
20439
- return function (target, uid, gid, cb) {
20440
- return orig.call(fs, target, uid, gid, function (er) {
20441
- if (chownErOk(er)) er = null
20442
- if (cb) cb.apply(this, arguments)
20443
- })
20444
- }
20445
- }
17342
+ "use strict";
20446
17343
 
20447
- function chownFixSync (orig) {
20448
- if (!orig) return orig
20449
- return function (target, uid, gid) {
20450
- try {
20451
- return orig.call(fs, target, uid, gid)
20452
- } catch (er) {
20453
- if (!chownErOk(er)) throw er
20454
- }
20455
- }
20456
- }
20457
17344
 
20458
- function statFix (orig) {
20459
- if (!orig) return orig
20460
- // Older versions of Node erroneously returned signed integers for
20461
- // uid + gid.
20462
- return function (target, options, cb) {
20463
- if (typeof options === 'function') {
20464
- cb = options
20465
- options = null
20466
- }
20467
- function callback (er, stats) {
20468
- if (stats) {
20469
- if (stats.uid < 0) stats.uid += 0x100000000
20470
- if (stats.gid < 0) stats.gid += 0x100000000
20471
- }
20472
- if (cb) cb.apply(this, arguments)
20473
- }
20474
- return options ? orig.call(fs, target, options, callback)
20475
- : orig.call(fs, target, callback)
20476
- }
20477
- }
17345
+ var toString = Object.prototype.toString;
20478
17346
 
20479
- function statFixSync (orig) {
20480
- if (!orig) return orig
20481
- // Older versions of Node erroneously returned signed integers for
20482
- // uid + gid.
20483
- return function (target, options) {
20484
- var stats = options ? orig.call(fs, target, options)
20485
- : orig.call(fs, target)
20486
- if (stats) {
20487
- if (stats.uid < 0) stats.uid += 0x100000000
20488
- if (stats.gid < 0) stats.gid += 0x100000000
20489
- }
20490
- return stats;
20491
- }
17347
+ /**
17348
+ * Extract names from functions.
17349
+ *
17350
+ * @param {Function} fn The function who's name we need to extract.
17351
+ * @returns {String} The name of the function.
17352
+ * @public
17353
+ */
17354
+ module.exports = function name(fn) {
17355
+ if ('string' === typeof fn.displayName && fn.constructor.name) {
17356
+ return fn.displayName;
17357
+ } else if ('string' === typeof fn.name && fn.name) {
17358
+ return fn.name;
20492
17359
  }
20493
17360
 
20494
- // ENOSYS means that the fs doesn't support the op. Just ignore
20495
- // that, because it doesn't matter.
20496
17361
  //
20497
- // if there's no getuid, or if getuid() is something other
20498
- // than 0, and the error is EINVAL or EPERM, then just ignore
20499
- // it.
20500
- //
20501
- // This specific case is a silent failure in cp, install, tar,
20502
- // and most other unix tools that manage permissions.
17362
+ // Check to see if the constructor has a name.
20503
17363
  //
20504
- // When running as root, or if other types of errors are
20505
- // encountered, then it's strict.
20506
- function chownErOk (er) {
20507
- if (!er)
20508
- return true
20509
-
20510
- if (er.code === "ENOSYS")
20511
- return true
17364
+ if (
17365
+ 'object' === typeof fn
17366
+ && fn.constructor
17367
+ && 'string' === typeof fn.constructor.name
17368
+ ) return fn.constructor.name;
20512
17369
 
20513
- var nonroot = !process.getuid || process.getuid() !== 0
20514
- if (nonroot) {
20515
- if (er.code === "EINVAL" || er.code === "EPERM")
20516
- return true
20517
- }
17370
+ //
17371
+ // toString the given function and attempt to parse it out of it, or determine
17372
+ // the class.
17373
+ //
17374
+ var named = fn.toString()
17375
+ , type = toString.call(fn).slice(8, -1);
20518
17376
 
20519
- return false
17377
+ if ('Function' === type) {
17378
+ named = named.substring(named.indexOf('(') + 1, named.indexOf(')'));
17379
+ } else {
17380
+ named = type;
20520
17381
  }
20521
- }
17382
+
17383
+ return named || 'anonymous';
17384
+ };
20522
17385
 
20523
17386
 
20524
17387
  /***/ }),
@@ -24819,128 +21682,6 @@ isStream.transform = stream =>
24819
21682
  module.exports = isStream;
24820
21683
 
24821
21684
 
24822
- /***/ }),
24823
-
24824
- /***/ "../../node_modules/jsonfile/index.js":
24825
- /*!********************************************!*\
24826
- !*** ../../node_modules/jsonfile/index.js ***!
24827
- \********************************************/
24828
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24829
-
24830
- let _fs
24831
- try {
24832
- _fs = __webpack_require__(/*! graceful-fs */ "../../node_modules/graceful-fs/graceful-fs.js")
24833
- } catch (_) {
24834
- _fs = __webpack_require__(/*! fs */ "fs")
24835
- }
24836
- const universalify = __webpack_require__(/*! universalify */ "../../node_modules/universalify/index.js")
24837
- const { stringify, stripBom } = __webpack_require__(/*! ./utils */ "../../node_modules/jsonfile/utils.js")
24838
-
24839
- async function _readFile (file, options = {}) {
24840
- if (typeof options === 'string') {
24841
- options = { encoding: options }
24842
- }
24843
-
24844
- const fs = options.fs || _fs
24845
-
24846
- const shouldThrow = 'throws' in options ? options.throws : true
24847
-
24848
- let data = await universalify.fromCallback(fs.readFile)(file, options)
24849
-
24850
- data = stripBom(data)
24851
-
24852
- let obj
24853
- try {
24854
- obj = JSON.parse(data, options ? options.reviver : null)
24855
- } catch (err) {
24856
- if (shouldThrow) {
24857
- err.message = `${file}: ${err.message}`
24858
- throw err
24859
- } else {
24860
- return null
24861
- }
24862
- }
24863
-
24864
- return obj
24865
- }
24866
-
24867
- const readFile = universalify.fromPromise(_readFile)
24868
-
24869
- function readFileSync (file, options = {}) {
24870
- if (typeof options === 'string') {
24871
- options = { encoding: options }
24872
- }
24873
-
24874
- const fs = options.fs || _fs
24875
-
24876
- const shouldThrow = 'throws' in options ? options.throws : true
24877
-
24878
- try {
24879
- let content = fs.readFileSync(file, options)
24880
- content = stripBom(content)
24881
- return JSON.parse(content, options.reviver)
24882
- } catch (err) {
24883
- if (shouldThrow) {
24884
- err.message = `${file}: ${err.message}`
24885
- throw err
24886
- } else {
24887
- return null
24888
- }
24889
- }
24890
- }
24891
-
24892
- async function _writeFile (file, obj, options = {}) {
24893
- const fs = options.fs || _fs
24894
-
24895
- const str = stringify(obj, options)
24896
-
24897
- await universalify.fromCallback(fs.writeFile)(file, str, options)
24898
- }
24899
-
24900
- const writeFile = universalify.fromPromise(_writeFile)
24901
-
24902
- function writeFileSync (file, obj, options = {}) {
24903
- const fs = options.fs || _fs
24904
-
24905
- const str = stringify(obj, options)
24906
- // not sure if fs.writeFileSync returns anything, but just in case
24907
- return fs.writeFileSync(file, str, options)
24908
- }
24909
-
24910
- const jsonfile = {
24911
- readFile,
24912
- readFileSync,
24913
- writeFile,
24914
- writeFileSync
24915
- }
24916
-
24917
- module.exports = jsonfile
24918
-
24919
-
24920
- /***/ }),
24921
-
24922
- /***/ "../../node_modules/jsonfile/utils.js":
24923
- /*!********************************************!*\
24924
- !*** ../../node_modules/jsonfile/utils.js ***!
24925
- \********************************************/
24926
- /***/ ((module) => {
24927
-
24928
- function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
24929
- const EOF = finalEOL ? EOL : ''
24930
- const str = JSON.stringify(obj, replacer, spaces)
24931
-
24932
- return str.replace(/\n/g, EOL) + EOF
24933
- }
24934
-
24935
- function stripBom (content) {
24936
- // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
24937
- if (Buffer.isBuffer(content)) content = content.toString('utf8')
24938
- return content.replace(/^\uFEFF/, '')
24939
- }
24940
-
24941
- module.exports = { stringify, stripBom }
24942
-
24943
-
24944
21685
  /***/ }),
24945
21686
 
24946
21687
  /***/ "../../node_modules/kuler/index.js":
@@ -33629,41 +30370,6 @@ Object.defineProperty(exports, "configs", ({
33629
30370
  }));
33630
30371
 
33631
30372
 
33632
- /***/ }),
33633
-
33634
- /***/ "../../node_modules/universalify/index.js":
33635
- /*!************************************************!*\
33636
- !*** ../../node_modules/universalify/index.js ***!
33637
- \************************************************/
33638
- /***/ ((__unused_webpack_module, exports) => {
33639
-
33640
- "use strict";
33641
-
33642
-
33643
- exports.fromCallback = function (fn) {
33644
- return Object.defineProperty(function (...args) {
33645
- if (typeof args[args.length - 1] === 'function') fn.apply(this, args)
33646
- else {
33647
- return new Promise((resolve, reject) => {
33648
- fn.call(
33649
- this,
33650
- ...args,
33651
- (err, res) => (err != null) ? reject(err) : resolve(res)
33652
- )
33653
- })
33654
- }
33655
- }, 'name', { value: fn.name })
33656
- }
33657
-
33658
- exports.fromPromise = function (fn) {
33659
- return Object.defineProperty(function (...args) {
33660
- const cb = args[args.length - 1]
33661
- if (typeof cb !== 'function') return fn.apply(this, args)
33662
- else fn.apply(this, args.slice(0, -1)).then(r => cb(null, r), cb)
33663
- }, 'name', { value: fn.name })
33664
- }
33665
-
33666
-
33667
30373
  /***/ }),
33668
30374
 
33669
30375
  /***/ "../../node_modules/util-deprecate/node.js":
@@ -50987,6 +47693,7 @@ const inversify_1 = __webpack_require__(/*! inversify */ "../../node_modules/inv
50987
47693
  const command_stack_1 = __webpack_require__(/*! ../../command/command-stack */ "../../packages/server/lib/common/command/command-stack.js");
50988
47694
  const diagram_configuration_1 = __webpack_require__(/*! ../../diagram/diagram-configuration */ "../../packages/server/lib/common/diagram/diagram-configuration.js");
50989
47695
  const layout_engine_1 = __webpack_require__(/*! ../layout/layout-engine */ "../../packages/server/lib/common/features/layout/layout-engine.js");
47696
+ const model_validator_1 = __webpack_require__(/*! ../validation/model-validator */ "../../packages/server/lib/common/features/validation/model-validator.js");
50990
47697
  const gmodel_factory_1 = __webpack_require__(/*! ./gmodel-factory */ "../../packages/server/lib/common/features/model/gmodel-factory.js");
50991
47698
  const gmodel_serializer_1 = __webpack_require__(/*! ./gmodel-serializer */ "../../packages/server/lib/common/features/model/gmodel-serializer.js");
50992
47699
  const model_state_1 = __webpack_require__(/*! ./model-state */ "../../packages/server/lib/common/features/model/model-state.js");
@@ -51036,6 +47743,10 @@ let ModelSubmissionHandler = exports.ModelSubmissionHandler = class ModelSubmiss
51036
47743
  if (!this.diagramConfiguration.needsClientLayout) {
51037
47744
  result.push(protocol_1.SetDirtyStateAction.create(this.commandStack.isDirty, { reason }));
51038
47745
  }
47746
+ if (this.validator) {
47747
+ const markers = await this.validator.validate([this.modelState.root], protocol_1.MarkersReason.LIVE);
47748
+ result.push(protocol_1.SetMarkersAction.create(markers, { reason: protocol_1.MarkersReason.LIVE }));
47749
+ }
51039
47750
  return result;
51040
47751
  }
51041
47752
  serializeGModel() {
@@ -51067,6 +47778,11 @@ __decorate([
51067
47778
  (0, inversify_1.inject)(command_stack_1.CommandStack),
51068
47779
  __metadata("design:type", Object)
51069
47780
  ], ModelSubmissionHandler.prototype, "commandStack", void 0);
47781
+ __decorate([
47782
+ (0, inversify_1.inject)(model_validator_1.ModelValidator),
47783
+ (0, inversify_1.optional)(),
47784
+ __metadata("design:type", Object)
47785
+ ], ModelSubmissionHandler.prototype, "validator", void 0);
51070
47786
  exports.ModelSubmissionHandler = ModelSubmissionHandler = __decorate([
51071
47787
  (0, inversify_1.injectable)()
51072
47788
  ], ModelSubmissionHandler);
@@ -51111,6 +47827,7 @@ exports.RequestModelActionHandler = void 0;
51111
47827
  const protocol_1 = __webpack_require__(/*! @eclipse-glsp/protocol */ "../../node_modules/@eclipse-glsp/protocol/lib/index.js");
51112
47828
  const inversify_1 = __webpack_require__(/*! inversify */ "../../node_modules/inversify/es/inversify.js");
51113
47829
  const action_dispatcher_1 = __webpack_require__(/*! ../../actions/action-dispatcher */ "../../packages/server/lib/common/actions/action-dispatcher.js");
47830
+ const client_options_util_1 = __webpack_require__(/*! ../../utils/client-options-util */ "../../packages/server/lib/common/utils/client-options-util.js");
51114
47831
  const logger_1 = __webpack_require__(/*! ../../utils/logger */ "../../packages/server/lib/common/utils/logger.js");
51115
47832
  const progress_service_1 = __webpack_require__(/*! ../progress/progress-service */ "../../packages/server/lib/common/features/progress/progress-service.js");
51116
47833
  const model_state_1 = __webpack_require__(/*! ./model-state */ "../../packages/server/lib/common/features/model/model-state.js");
@@ -51124,11 +47841,29 @@ let RequestModelActionHandler = exports.RequestModelActionHandler = class Reques
51124
47841
  var _a;
51125
47842
  this.logger.debug('Execute RequestModelAction:', action);
51126
47843
  this.modelState.setAll((_a = action.options) !== null && _a !== void 0 ? _a : {});
47844
+ const isReconnecting = client_options_util_1.ClientOptionsUtil.isReconnecting(action.options);
51127
47845
  const progress = this.reportModelLoading('Model loading in progress');
51128
- await this.sourceModelStorage.loadSourceModel(action);
47846
+ if (isReconnecting) {
47847
+ await this.handleReconnect(action);
47848
+ }
47849
+ else {
47850
+ await this.sourceModelStorage.loadSourceModel(action);
47851
+ }
51129
47852
  this.reportModelLoadingFinished(progress);
51130
47853
  return this.submissionHandler.submitModel();
51131
47854
  }
47855
+ async handleReconnect(action) {
47856
+ var _a;
47857
+ const oldModelRoot = this.modelState.root;
47858
+ if (oldModelRoot) {
47859
+ // decrease revision by one, as each submit will increase it by one;
47860
+ // the next save would produce warning that source model was changed otherwise
47861
+ this.modelState.root.revision = ((_a = this.modelState.root.revision) !== null && _a !== void 0 ? _a : 0) - 1;
47862
+ }
47863
+ else {
47864
+ await this.sourceModelStorage.loadSourceModel(action);
47865
+ }
47866
+ }
51132
47867
  reportModelLoading(message) {
51133
47868
  this.actionDispatcher.dispatch(protocol_1.ServerStatusAction.create(message, { severity: 'INFO' }));
51134
47869
  return this.progressService.start(message);
@@ -51780,13 +48515,91 @@ exports.DefaultProgressService = DefaultProgressService = __decorate([
51780
48515
  /*!*******************************************************************************!*\
51781
48516
  !*** ../../packages/server/lib/common/features/validation/model-validator.js ***!
51782
48517
  \*******************************************************************************/
51783
- /***/ ((__unused_webpack_module, exports) => {
48518
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
51784
48519
 
51785
48520
  "use strict";
51786
48521
 
48522
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
48523
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
48524
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
48525
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
48526
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
48527
+ };
51787
48528
  Object.defineProperty(exports, "__esModule", ({ value: true }));
51788
- exports.ModelValidator = void 0;
48529
+ exports.AbstractModelValidator = exports.ModelValidator = void 0;
48530
+ const protocol_1 = __webpack_require__(/*! @eclipse-glsp/protocol */ "../../node_modules/@eclipse-glsp/protocol/lib/index.js");
48531
+ const inversify_1 = __webpack_require__(/*! inversify */ "../../node_modules/inversify/es/inversify.js");
51789
48532
  exports.ModelValidator = Symbol('ModelValidator');
48533
+ let AbstractModelValidator = exports.AbstractModelValidator = class AbstractModelValidator {
48534
+ validate(elements, reason) {
48535
+ const markers = [];
48536
+ for (const element of elements) {
48537
+ if (protocol_1.MarkersReason.LIVE === reason) {
48538
+ markers.push(...this.doLiveValidation(element));
48539
+ }
48540
+ else if (protocol_1.MarkersReason.BATCH === reason) {
48541
+ markers.push(...this.doBatchValidation(element));
48542
+ }
48543
+ else {
48544
+ markers.push(...this.doValidationForCustomReason(element));
48545
+ }
48546
+ if (element.children) {
48547
+ markers.push(...this.validate(element.children, reason));
48548
+ }
48549
+ }
48550
+ return markers;
48551
+ }
48552
+ /**
48553
+ * Perform the live validation rules for the given <code>element</code>.
48554
+ *
48555
+ * This will be invoked on start and after each operation for all elements.
48556
+ * Thus, the validation should be rather inexpensive.
48557
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
48558
+ * this method for all children anyway.
48559
+ *
48560
+ * @param element The element to validate.
48561
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
48562
+ */
48563
+ doLiveValidation(element) {
48564
+ return [];
48565
+ }
48566
+ /**
48567
+ * Perform the batch validation rules for the given <code>element</code>.
48568
+ *
48569
+ * <p>
48570
+ * This will be invoked on demand by the client.
48571
+ * Thus, the validation can include more expensive validation rules.
48572
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
48573
+ * this method for all children anyway.
48574
+ * </p>
48575
+ *
48576
+ * @param element The element to validate.
48577
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
48578
+ */
48579
+ doBatchValidation(element) {
48580
+ return [];
48581
+ }
48582
+ /**
48583
+ * Perform a validation for a custom <code>reason</code> with the given <code>element</code>.
48584
+ *
48585
+ * <p>
48586
+ * GLSP editors may add custom reasons for triggering a validation, other than <code>live</code> and
48587
+ * <code>batch</code>.
48588
+ * Validation requests that are not live or batch validations will be handled by this method.
48589
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
48590
+ * this method for all children anyway.
48591
+ * </p>
48592
+ *
48593
+ * @param element The element to validate.
48594
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
48595
+ */
48596
+ doValidationForCustomReason(element) {
48597
+ return [];
48598
+ }
48599
+ };
48600
+ exports.AbstractModelValidator = AbstractModelValidator = __decorate([
48601
+ (0, inversify_1.injectable)()
48602
+ ], AbstractModelValidator);
51790
48603
 
51791
48604
 
51792
48605
  /***/ }),
@@ -51825,7 +48638,6 @@ exports.RequestMarkersHandler = void 0;
51825
48638
  *
51826
48639
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
51827
48640
  ********************************************************************************/
51828
- const graph_1 = __webpack_require__(/*! @eclipse-glsp/graph */ "../../packages/graph/lib/index.js");
51829
48641
  const protocol_1 = __webpack_require__(/*! @eclipse-glsp/protocol */ "../../node_modules/@eclipse-glsp/protocol/lib/index.js");
51830
48642
  const inversify_1 = __webpack_require__(/*! inversify */ "../../node_modules/inversify/es/inversify.js");
51831
48643
  const glsp_server_error_1 = __webpack_require__(/*! ../../utils/glsp-server-error */ "../../packages/server/lib/common/utils/glsp-server-error.js");
@@ -51836,6 +48648,7 @@ let RequestMarkersHandler = exports.RequestMarkersHandler = class RequestMarkers
51836
48648
  this.actionKinds = [protocol_1.RequestMarkersAction.KIND];
51837
48649
  }
51838
48650
  async execute(action) {
48651
+ var _a;
51839
48652
  let elementIDs = action.elementsIDs;
51840
48653
  if (!this.validator) {
51841
48654
  throw new glsp_server_error_1.GLSPServerError('Cannot compute markers! No implementation for ModelValidator has been bound');
@@ -51843,14 +48656,8 @@ let RequestMarkersHandler = exports.RequestMarkersHandler = class RequestMarkers
51843
48656
  if (!elementIDs || elementIDs.length === 0 || (elementIDs.length === 1 && elementIDs[0] === 'EMPTY')) {
51844
48657
  elementIDs = [this.modelState.root.id];
51845
48658
  }
51846
- let markers = [];
51847
- const currentModelIndex = this.modelState.index;
51848
- for (const elementID of elementIDs) {
51849
- const modelElement = currentModelIndex.findByClass(elementID, graph_1.GGraph);
51850
- if (modelElement) {
51851
- markers = markers.concat(await this.validator.validate([modelElement]));
51852
- }
51853
- }
48659
+ const modelElements = this.modelState.index.getAll(elementIDs);
48660
+ const markers = await this.validator.validate(modelElements, (_a = action.reason) !== null && _a !== void 0 ? _a : protocol_1.MarkersReason.BATCH);
51854
48661
  return [protocol_1.SetMarkersAction.create(markers)];
51855
48662
  }
51856
48663
  };
@@ -54121,34 +50928,24 @@ var ArgsUtil;
54121
50928
  /*!*********************************************************************!*\
54122
50929
  !*** ../../packages/server/lib/common/utils/client-options-util.js ***!
54123
50930
  \*********************************************************************/
54124
- /***/ ((__unused_webpack_module, exports) => {
50931
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
54125
50932
 
54126
50933
  "use strict";
54127
50934
 
54128
50935
  Object.defineProperty(exports, "__esModule", ({ value: true }));
54129
50936
  exports.ClientOptionsUtil = void 0;
54130
- /********************************************************************************
54131
- * Copyright (c) 2022-2023 STMicroelectronics and others.
54132
- *
54133
- * This program and the accompanying materials are made available under the
54134
- * terms of the Eclipse Public License v. 2.0 which is available at
54135
- * http://www.eclipse.org/legal/epl-2.0.
54136
- *
54137
- * This Source Code may also be made available under the following Secondary
54138
- * Licenses when the conditions for such availability set forth in the Eclipse
54139
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
54140
- * with the GNU Classpath Exception which is available at
54141
- * https://www.gnu.org/software/classpath/license.html.
54142
- *
54143
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
54144
- ********************************************************************************/
50937
+ const args_util_1 = __webpack_require__(/*! ./args-util */ "../../packages/server/lib/common/utils/args-util.js");
54145
50938
  class ClientOptionsUtil {
54146
50939
  static adaptUri(uri) {
54147
50940
  return uri.replace(this.FILE_PREFIX, '');
54148
50941
  }
50942
+ static isReconnecting(options) {
50943
+ return args_util_1.ArgsUtil.getBoolean(options, ClientOptionsUtil.IS_RECONNECTING);
50944
+ }
54149
50945
  }
54150
50946
  exports.ClientOptionsUtil = ClientOptionsUtil;
54151
50947
  ClientOptionsUtil.FILE_PREFIX = 'file://';
50948
+ ClientOptionsUtil.IS_RECONNECTING = 'isReconnecting';
54152
50949
 
54153
50950
 
54154
50951
  /***/ }),
@@ -54858,8 +51655,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
54858
51655
  };
54859
51656
  Object.defineProperty(exports, "__esModule", ({ value: true }));
54860
51657
  exports.AbstractJsonModelStorage = void 0;
54861
- const fs = __webpack_require__(/*! fs-extra */ "../../node_modules/fs-extra/lib/index.js");
51658
+ const fs = __webpack_require__(/*! fs */ "fs");
54862
51659
  const inversify_1 = __webpack_require__(/*! inversify */ "../../node_modules/inversify/es/inversify.js");
51660
+ const os = __webpack_require__(/*! os */ "os");
54863
51661
  const url_1 = __webpack_require__(/*! url */ "url");
54864
51662
  const model_state_1 = __webpack_require__(/*! ../common/features/model/model-state */ "../../packages/server/lib/common/features/model/model-state.js");
54865
51663
  const glsp_server_error_1 = __webpack_require__(/*! ../common/utils/glsp-server-error */ "../../packages/server/lib/common/utils/glsp-server-error.js");
@@ -54921,7 +51719,12 @@ let AbstractJsonModelStorage = exports.AbstractJsonModelStorage = class Abstract
54921
51719
  return JSON.parse(fileContent);
54922
51720
  }
54923
51721
  toPath(sourceUri) {
54924
- return sourceUri.startsWith('file://') ? (0, url_1.fileURLToPath)(sourceUri) : sourceUri;
51722
+ let path = sourceUri.startsWith('file://') ? (0, url_1.fileURLToPath)(sourceUri) : sourceUri;
51723
+ if (os.platform() === 'win32') {
51724
+ // Remove the leading slash if it exists (Windows paths don't have it)
51725
+ path = path.replace(/^\//, '');
51726
+ }
51727
+ return path;
54925
51728
  }
54926
51729
  getFileUri(action) {
54927
51730
  var _a;
@@ -55248,7 +52051,7 @@ exports.isDirectory = exports.processLogDir = exports.processLogLevel = exports.
55248
52051
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
55249
52052
  ********************************************************************************/
55250
52053
  const cmd = __webpack_require__(/*! commander */ "../../packages/server/node_modules/commander/index.js");
55251
- const fs = __webpack_require__(/*! fs-extra */ "../../node_modules/fs-extra/lib/index.js");
52054
+ const fs = __webpack_require__(/*! fs */ "fs");
55252
52055
  const path = __webpack_require__(/*! path */ "path");
55253
52056
  const logger_1 = __webpack_require__(/*! ../../common/utils/logger */ "../../packages/server/lib/common/utils/logger.js");
55254
52057
  exports.defaultLaunchOptions = {
@@ -55607,17 +52410,6 @@ exports.wrapWebSocket = wrapWebSocket;
55607
52410
  module.exports = __webpack_require__(/*! ./lib/node/index */ "../../packages/server/lib/node/index.js");
55608
52411
 
55609
52412
 
55610
- /***/ }),
55611
-
55612
- /***/ "assert":
55613
- /*!*************************!*\
55614
- !*** external "assert" ***!
55615
- \*************************/
55616
- /***/ ((module) => {
55617
-
55618
- "use strict";
55619
- module.exports = require("assert");
55620
-
55621
52413
  /***/ }),
55622
52414
 
55623
52415
  /***/ "buffer":
@@ -55642,17 +52434,6 @@ module.exports = require("child_process");
55642
52434
 
55643
52435
  /***/ }),
55644
52436
 
55645
- /***/ "constants":
55646
- /*!****************************!*\
55647
- !*** external "constants" ***!
55648
- \****************************/
55649
- /***/ ((module) => {
55650
-
55651
- "use strict";
55652
- module.exports = require("constants");
55653
-
55654
- /***/ }),
55655
-
55656
52437
  /***/ "crypto":
55657
52438
  /*!*************************!*\
55658
52439
  !*** external "crypto" ***!