@squidcloud/cli 1.0.484 → 1.0.486
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1925 -597
- package/dist/resources/claude/skills/squid-development/SKILL.md +11 -0
- package/dist/resources/claude/skills/squid-development/reference/openai.md +2 -1
- package/dist/resources/claude/skills/squid-integrations/SKILL.md +7 -0
- package/dist/resources/claude/skills/squid-react-development/SKILL.md +2 -0
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -208,6 +208,7 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
208
208
|
* Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory
|
|
209
209
|
*
|
|
210
210
|
* @param {ZipEntry|string} entry
|
|
211
|
+
* @param {boolean} withsubfolders
|
|
211
212
|
* @returns {void}
|
|
212
213
|
*/
|
|
213
214
|
deleteFile: function (entry, withsubfolders = true) {
|
|
@@ -492,7 +493,7 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
492
493
|
addLocalFolderAsync2: function (options, callback) {
|
|
493
494
|
const self = this;
|
|
494
495
|
options = typeof options === "object" ? options : { localPath: options };
|
|
495
|
-
localPath = pth.resolve(fixPath(options.localPath));
|
|
496
|
+
const localPath = pth.resolve(fixPath(options.localPath));
|
|
496
497
|
let { zipPath, filter, namefix } = options;
|
|
497
498
|
|
|
498
499
|
if (filter instanceof RegExp) {
|
|
@@ -511,7 +512,7 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
511
512
|
zipPath = zipPath ? fixPath(zipPath) : "";
|
|
512
513
|
|
|
513
514
|
// Check Namefix function
|
|
514
|
-
if (namefix
|
|
515
|
+
if (namefix === "latin1") {
|
|
515
516
|
namefix = (str) =>
|
|
516
517
|
str
|
|
517
518
|
.normalize("NFD")
|
|
@@ -687,7 +688,7 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
687
688
|
|
|
688
689
|
var entryName = canonical(item.entryName);
|
|
689
690
|
|
|
690
|
-
var target = sanitize(targetPath, outFileName && !item.isDirectory ? outFileName : maintainEntryPath ? entryName : pth.basename(entryName));
|
|
691
|
+
var target = sanitize(targetPath, outFileName && !item.isDirectory ? canonical(outFileName) : maintainEntryPath ? entryName : pth.basename(entryName));
|
|
691
692
|
|
|
692
693
|
if (item.isDirectory) {
|
|
693
694
|
var children = _zip.getEntryChildren(item);
|
|
@@ -728,7 +729,7 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
728
729
|
return false;
|
|
729
730
|
}
|
|
730
731
|
|
|
731
|
-
for (var entry
|
|
732
|
+
for (var entry of _zip.entries) {
|
|
732
733
|
try {
|
|
733
734
|
if (entry.isDirectory) {
|
|
734
735
|
continue;
|
|
@@ -1050,6 +1051,7 @@ module.exports = function () {
|
|
|
1050
1051
|
switch (val) {
|
|
1051
1052
|
case Constants.STORED:
|
|
1052
1053
|
this.version = 10;
|
|
1054
|
+
break;
|
|
1053
1055
|
case Constants.DEFLATED:
|
|
1054
1056
|
default:
|
|
1055
1057
|
this.version = 20;
|
|
@@ -1252,7 +1254,11 @@ module.exports = function () {
|
|
|
1252
1254
|
// version needed to extract
|
|
1253
1255
|
data.writeUInt16LE(_version, Constants.LOCVER);
|
|
1254
1256
|
// general purpose bit flag
|
|
1255
|
-
data
|
|
1257
|
+
// clear bit 3 (data descriptor): we always write the real crc-32
|
|
1258
|
+
// and sizes into this local header, so no trailing descriptor is
|
|
1259
|
+
// emitted. Leaving the flag set would make the output unreadable
|
|
1260
|
+
// (see issue #555).
|
|
1261
|
+
data.writeUInt16LE(_flags & ~Constants.FLG_DESC, Constants.LOCFLG);
|
|
1256
1262
|
// compression method
|
|
1257
1263
|
data.writeUInt16LE(_method, Constants.LOCHOW);
|
|
1258
1264
|
// modification time (2 bytes time, 2 bytes date)
|
|
@@ -1280,7 +1286,9 @@ module.exports = function () {
|
|
|
1280
1286
|
// version needed to extract
|
|
1281
1287
|
data.writeUInt16LE(_version, Constants.CENVER);
|
|
1282
1288
|
// encrypt, decrypt flags
|
|
1283
|
-
data
|
|
1289
|
+
// clear bit 3 (data descriptor) to match the local header we emit
|
|
1290
|
+
// (real crc/sizes are written, no descriptor follows the data) — issue #555
|
|
1291
|
+
data.writeUInt16LE(_flags & ~Constants.FLG_DESC, Constants.CENFLG);
|
|
1284
1292
|
// compression method
|
|
1285
1293
|
data.writeUInt16LE(_method, Constants.CENHOW);
|
|
1286
1294
|
// modification time (2 bytes time, 2 bytes date)
|
|
@@ -1365,6 +1373,8 @@ module.exports = function () {
|
|
|
1365
1373
|
_offset = 0,
|
|
1366
1374
|
_commentLength = 0;
|
|
1367
1375
|
|
|
1376
|
+
const needsZip64 = () => _volumeEntries > Constants.EF_ZIP64_OR_16 || _totalEntries > Constants.EF_ZIP64_OR_16 || _size > Constants.EF_ZIP64_OR_32 || _offset > Constants.EF_ZIP64_OR_32;
|
|
1377
|
+
|
|
1368
1378
|
return {
|
|
1369
1379
|
get diskEntries() {
|
|
1370
1380
|
return _volumeEntries;
|
|
@@ -1402,7 +1412,7 @@ module.exports = function () {
|
|
|
1402
1412
|
},
|
|
1403
1413
|
|
|
1404
1414
|
get mainHeaderSize() {
|
|
1405
|
-
return Constants.ENDHDR + _commentLength;
|
|
1415
|
+
return (needsZip64() ? Constants.ZIP64HDR + Constants.END64HDR : 0) + Constants.ENDHDR + _commentLength;
|
|
1406
1416
|
},
|
|
1407
1417
|
|
|
1408
1418
|
loadFromBinary: function (/*Buffer*/ data) {
|
|
@@ -1432,7 +1442,7 @@ module.exports = function () {
|
|
|
1432
1442
|
// total number of entries
|
|
1433
1443
|
_totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT);
|
|
1434
1444
|
// central directory size in bytes
|
|
1435
|
-
_size = Utils.readBigUInt64LE(data, Constants.
|
|
1445
|
+
_size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZB);
|
|
1436
1446
|
// offset of first CEN header
|
|
1437
1447
|
_offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF);
|
|
1438
1448
|
|
|
@@ -1441,22 +1451,67 @@ module.exports = function () {
|
|
|
1441
1451
|
},
|
|
1442
1452
|
|
|
1443
1453
|
toBinary: function () {
|
|
1444
|
-
|
|
1454
|
+
if (!needsZip64()) {
|
|
1455
|
+
var b = Buffer.alloc(Constants.ENDHDR + _commentLength);
|
|
1456
|
+
// "PK 05 06" signature
|
|
1457
|
+
b.writeUInt32LE(Constants.ENDSIG, 0);
|
|
1458
|
+
b.writeUInt32LE(0, 4);
|
|
1459
|
+
// number of entries on this volume
|
|
1460
|
+
b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
|
|
1461
|
+
// total number of entries
|
|
1462
|
+
b.writeUInt16LE(_totalEntries, Constants.ENDTOT);
|
|
1463
|
+
// central directory size in bytes
|
|
1464
|
+
b.writeUInt32LE(_size, Constants.ENDSIZ);
|
|
1465
|
+
// offset of first CEN header
|
|
1466
|
+
b.writeUInt32LE(_offset, Constants.ENDOFF);
|
|
1467
|
+
// zip file comment length
|
|
1468
|
+
b.writeUInt16LE(_commentLength, Constants.ENDCOM);
|
|
1469
|
+
// fill comment memory with spaces so no garbage is left there
|
|
1470
|
+
b.fill(" ", Constants.ENDHDR);
|
|
1471
|
+
|
|
1472
|
+
return b;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
var b = Buffer.alloc(this.mainHeaderSize);
|
|
1476
|
+
let offset = 0;
|
|
1477
|
+
|
|
1478
|
+
// Zip64 end of central directory record.
|
|
1479
|
+
b.writeUInt32LE(Constants.ZIP64SIG, offset);
|
|
1480
|
+
Utils.writeBigUInt64LE(b, Constants.ZIP64HDR - Constants.ZIP64LEAD, offset + Constants.ZIP64SIZE);
|
|
1481
|
+
b.writeUInt16LE(45, offset + Constants.ZIP64VEM);
|
|
1482
|
+
b.writeUInt16LE(45, offset + Constants.ZIP64VER);
|
|
1483
|
+
b.writeUInt32LE(0, offset + Constants.ZIP64DSK);
|
|
1484
|
+
b.writeUInt32LE(0, offset + Constants.ZIP64DSKDIR);
|
|
1485
|
+
Utils.writeBigUInt64LE(b, _volumeEntries, offset + Constants.ZIP64SUB);
|
|
1486
|
+
Utils.writeBigUInt64LE(b, _totalEntries, offset + Constants.ZIP64TOT);
|
|
1487
|
+
Utils.writeBigUInt64LE(b, _size, offset + Constants.ZIP64SIZB);
|
|
1488
|
+
Utils.writeBigUInt64LE(b, _offset, offset + Constants.ZIP64OFF);
|
|
1489
|
+
|
|
1490
|
+
const zip64EndOffset = _offset + _size;
|
|
1491
|
+
offset += Constants.ZIP64HDR;
|
|
1492
|
+
|
|
1493
|
+
// Zip64 end of central directory locator.
|
|
1494
|
+
b.writeUInt32LE(Constants.END64SIG, offset);
|
|
1495
|
+
b.writeUInt32LE(0, offset + Constants.END64START);
|
|
1496
|
+
Utils.writeBigUInt64LE(b, zip64EndOffset, offset + Constants.END64OFF);
|
|
1497
|
+
b.writeUInt32LE(1, offset + Constants.END64NUMDISKS);
|
|
1498
|
+
offset += Constants.END64HDR;
|
|
1499
|
+
|
|
1445
1500
|
// "PK 05 06" signature
|
|
1446
|
-
b.writeUInt32LE(Constants.ENDSIG,
|
|
1447
|
-
b.writeUInt32LE(0, 4);
|
|
1501
|
+
b.writeUInt32LE(Constants.ENDSIG, offset);
|
|
1502
|
+
b.writeUInt32LE(0, offset + 4);
|
|
1448
1503
|
// number of entries on this volume
|
|
1449
|
-
b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
|
|
1504
|
+
b.writeUInt16LE(Math.min(_volumeEntries, Constants.EF_ZIP64_OR_16), offset + Constants.ENDSUB);
|
|
1450
1505
|
// total number of entries
|
|
1451
|
-
b.writeUInt16LE(_totalEntries, Constants.ENDTOT);
|
|
1506
|
+
b.writeUInt16LE(Math.min(_totalEntries, Constants.EF_ZIP64_OR_16), offset + Constants.ENDTOT);
|
|
1452
1507
|
// central directory size in bytes
|
|
1453
|
-
b.writeUInt32LE(_size, Constants.ENDSIZ);
|
|
1508
|
+
b.writeUInt32LE(Math.min(_size, Constants.EF_ZIP64_OR_32), offset + Constants.ENDSIZ);
|
|
1454
1509
|
// offset of first CEN header
|
|
1455
|
-
b.writeUInt32LE(_offset, Constants.ENDOFF);
|
|
1510
|
+
b.writeUInt32LE(Math.min(_offset, Constants.EF_ZIP64_OR_32), offset + Constants.ENDOFF);
|
|
1456
1511
|
// zip file comment length
|
|
1457
|
-
b.writeUInt16LE(_commentLength, Constants.ENDCOM);
|
|
1512
|
+
b.writeUInt16LE(_commentLength, offset + Constants.ENDCOM);
|
|
1458
1513
|
// fill comment memory with spaces so no garbage is left there
|
|
1459
|
-
b.fill(" ", Constants.ENDHDR);
|
|
1514
|
+
b.fill(" ", offset + Constants.ENDHDR);
|
|
1460
1515
|
|
|
1461
1516
|
return b;
|
|
1462
1517
|
},
|
|
@@ -1541,7 +1596,7 @@ exports.ZipCrypto = __webpack_require__(7186);
|
|
|
1541
1596
|
/***/ 1297
|
|
1542
1597
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
1543
1598
|
|
|
1544
|
-
const version = +(process
|
|
1599
|
+
const version = +(process?.versions?.node ?? "").split(".")[0] || 0;
|
|
1545
1600
|
|
|
1546
1601
|
module.exports = function (/*Buffer*/ inbuf, /*number*/ expectedLength) {
|
|
1547
1602
|
var zlib = __webpack_require__(3106);
|
|
@@ -2383,13 +2438,13 @@ Utils.findLast = function (arr, callback) {
|
|
|
2383
2438
|
return void 0;
|
|
2384
2439
|
};
|
|
2385
2440
|
|
|
2386
|
-
// make
|
|
2441
|
+
// make absolute paths taking prefix as root folder
|
|
2387
2442
|
Utils.sanitize = function (/*string*/ prefix, /*string*/ name) {
|
|
2388
2443
|
prefix = pth.resolve(pth.normalize(prefix));
|
|
2389
2444
|
var parts = name.split("/");
|
|
2390
2445
|
for (var i = 0, l = parts.length; i < l; i++) {
|
|
2391
2446
|
var path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
|
|
2392
|
-
if (path.
|
|
2447
|
+
if (path === prefix || path.startsWith(prefix + pth.sep)) {
|
|
2393
2448
|
return path;
|
|
2394
2449
|
}
|
|
2395
2450
|
}
|
|
@@ -2414,6 +2469,13 @@ Utils.readBigUInt64LE = function (/*Buffer*/ buffer, /*int*/ index) {
|
|
|
2414
2469
|
return hi * 0x100000000 + lo;
|
|
2415
2470
|
};
|
|
2416
2471
|
|
|
2472
|
+
Utils.writeBigUInt64LE = function (/*Buffer*/ buffer, /*Number*/ value, /*int*/ index) {
|
|
2473
|
+
const lo = value >>> 0;
|
|
2474
|
+
const hi = Math.floor(value / 0x100000000) >>> 0;
|
|
2475
|
+
buffer.writeUInt32LE(lo, index);
|
|
2476
|
+
buffer.writeUInt32LE(hi, index + 4);
|
|
2477
|
+
};
|
|
2478
|
+
|
|
2417
2479
|
Utils.fromDOS2Date = function (val) {
|
|
2418
2480
|
return new Date(((val >> 25) & 0x7f) + 1980, Math.max(((val >> 21) & 0x0f) - 1, 0), Math.max((val >> 16) & 0x1f, 1), (val >> 11) & 0x1f, (val >> 5) & 0x3f, (val & 0x1f) << 1);
|
|
2419
2481
|
};
|
|
@@ -3194,7 +3256,7 @@ module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {
|
|
|
3194
3256
|
// write main header
|
|
3195
3257
|
const mh = mainHeader.toBinary();
|
|
3196
3258
|
if (_comment) {
|
|
3197
|
-
_comment.copy(mh,
|
|
3259
|
+
_comment.copy(mh, mh.length - _comment.length); // add zip file comment
|
|
3198
3260
|
}
|
|
3199
3261
|
mh.copy(outBuffer, dindex);
|
|
3200
3262
|
|
|
@@ -3272,7 +3334,7 @@ module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {
|
|
|
3272
3334
|
|
|
3273
3335
|
const mh = mainHeader.toBinary();
|
|
3274
3336
|
if (_comment) {
|
|
3275
|
-
_comment.copy(mh,
|
|
3337
|
+
_comment.copy(mh, mh.length - _comment.length); // add zip file comment
|
|
3276
3338
|
}
|
|
3277
3339
|
|
|
3278
3340
|
mh.copy(outBuffer, dindex); // write main header
|
|
@@ -3321,56 +3383,21 @@ module.exports = ({onlyFirst = false} = {}) => {
|
|
|
3321
3383
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3322
3384
|
|
|
3323
3385
|
"use strict";
|
|
3324
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3325
3386
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3326
|
-
/* harmony export */ $a: () => (/* binding */ W),
|
|
3327
|
-
/* harmony export */ $u: () => (/* binding */ G),
|
|
3328
3387
|
/* harmony export */ arrayAssertion: () => (/* binding */ S),
|
|
3329
|
-
/* harmony export */ assertArray: () => (/* binding */ E),
|
|
3330
|
-
/* harmony export */ assertBoolean: () => (/* binding */ Z),
|
|
3331
|
-
/* harmony export */ assertDate: () => (/* binding */ O),
|
|
3332
|
-
/* harmony export */ assertEmail: () => (/* binding */ q),
|
|
3333
|
-
/* harmony export */ assertHexString: () => (/* binding */ N),
|
|
3334
|
-
/* harmony export */ assertNonNullable: () => (/* binding */ V),
|
|
3335
|
-
/* harmony export */ assertNumber: () => (/* binding */ z),
|
|
3336
|
-
/* harmony export */ assertObject: () => (/* binding */ b),
|
|
3337
|
-
/* harmony export */ assertRecord: () => (/* binding */ B),
|
|
3338
|
-
/* harmony export */ assertString: () => (/* binding */ k),
|
|
3339
3388
|
/* harmony export */ assertTruthy: () => (/* binding */ g),
|
|
3340
|
-
/* harmony export */ assertUuid: () => (/* binding */ I),
|
|
3341
|
-
/* harmony export */ callValueAssertion: () => (/* binding */ j),
|
|
3342
|
-
/* harmony export */ checkArrayHasUniqueElements: () => (/* binding */ e),
|
|
3343
|
-
/* harmony export */ checkArraysHasEqualElementsByComparator: () => (/* binding */ r),
|
|
3344
|
-
/* harmony export */ checkArraysHaveEqualElements: () => (/* binding */ o),
|
|
3345
|
-
/* harmony export */ fail: () => (/* binding */ v),
|
|
3346
3389
|
/* harmony export */ formatError: () => (/* binding */ x),
|
|
3347
|
-
/* harmony export */ formatValue: () => (/* binding */ $),
|
|
3348
|
-
/* harmony export */ getAssertionErrorFromProvider: () => (/* binding */ m),
|
|
3349
|
-
/* harmony export */ getErrorMessage: () => (/* binding */ p),
|
|
3350
3390
|
/* harmony export */ getMessageFromError: () => (/* binding */ X),
|
|
3351
|
-
/* harmony export */ isBoolean: () => (/* binding */ u),
|
|
3352
|
-
/* harmony export */ isDate: () => (/* binding */ t),
|
|
3353
|
-
/* harmony export */ isEmail: () => (/* binding */ s),
|
|
3354
|
-
/* harmony export */ isHexString: () => (/* binding */ A),
|
|
3355
|
-
/* harmony export */ isNonNullable: () => (/* binding */ D),
|
|
3356
|
-
/* harmony export */ isNumber: () => (/* binding */ n),
|
|
3357
|
-
/* harmony export */ isString: () => (/* binding */ F),
|
|
3358
|
-
/* harmony export */ isUuid: () => (/* binding */ l),
|
|
3359
|
-
/* harmony export */ nullOr: () => (/* binding */ K),
|
|
3360
|
-
/* harmony export */ objectAssertion: () => (/* binding */ _),
|
|
3361
3391
|
/* harmony export */ recordAssertion: () => (/* binding */ U),
|
|
3362
|
-
/* harmony export */
|
|
3363
|
-
/* harmony export */ stringAssertion: () => (/* binding */ M),
|
|
3364
|
-
/* harmony export */ truthy: () => (/* binding */ C),
|
|
3365
|
-
/* harmony export */ tryCatch: () => (/* binding */ P),
|
|
3366
|
-
/* harmony export */ undefinedOr: () => (/* binding */ J),
|
|
3367
|
-
/* harmony export */ validateArray: () => (/* binding */ R),
|
|
3368
|
-
/* harmony export */ validateObject: () => (/* binding */ Q),
|
|
3369
|
-
/* harmony export */ validateRecord: () => (/* binding */ T),
|
|
3370
|
-
/* harmony export */ valueOr: () => (/* binding */ H)
|
|
3392
|
+
/* harmony export */ truthy: () => (/* binding */ C)
|
|
3371
3393
|
/* harmony export */ });
|
|
3394
|
+
/* unused harmony exports $a, $u, assertArray, assertBoolean, assertDate, assertEmail, assertHexString, assertNonNullable, assertNumber, assertObject, assertRecord, assertUuid, callValueAssertion, checkArrayHasUniqueElements, checkArraysHasEqualElementsByComparator, checkArraysHaveEqualElements, fail, formatValue, getAssertionErrorFromProvider, getErrorMessage, isBoolean, isDate, isEmail, isHexString, isNonNullable, isNumber, isString, isUuid, nullOr, objectAssertion, setDefaultAssertionErrorFactory, stringAssertion, tryCatch, undefinedOr, validateArray, validateObject, validateRecord, valueOr */
|
|
3372
3395
|
function u(u){return"boolean"==typeof u}function F(u){return"string"==typeof u}function n(u){return"number"==typeof u}function t(u){return u instanceof Date}function e(u,F){if(u.length<=1)return!0;const n=new Set;for(const t of u){const u=F(t);if(n.has(u))return!1;n.add(u)}return!0}function o(u,F){return r(u,F,((u,F)=>u===F))}function r(u,F,n){if(u===F)return!0;if(!u||!F)return!1;if(u.length!==F.length)return!1;for(let t=0;t<u.length;t++)if(!n(u[t],F[t]))return!1;return!0}const i=/^[-!#$%&'*+/\d=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/\d=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z\d])*\.[a-zA-Z](-?[a-zA-Z\d])+$/,a=/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF.!#$%&'*+-/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF\-.\d]+)((\.([a-zA-Z\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF]){2,63})+)$/i;function s(u,n={allowInternationalDomains:!1}){if(!F(u)||0===u.length||u.length>254)return!1;if(!(n.allowInternationalDomains?a:i).test(u))return!1;const t=u.split("@");return!(t[0].length>64)&&!t[1].split(".").some((u=>u.length>63))}const c=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function l(u){return F(u)&&c.test(u)}const f=/^[0-9a-fA-F]*$/;function A(u){return F(u)&&f.test(u)}function D(u){return null!=u}function $(u){return void 0===u?"<undefined>":"symbol"==typeof u?u.toString():null===u?"<null>":`<${typeof u}:${u}>`}const d=u=>new Error(u);let h=d;function y(u){h=u||d}function g(u,F,...n){u||v(F,...n)}function C(u,F,...n){return g(u,F,...n),u}function v(u,...F){const n=m(u);if("object"==typeof n)throw n;throw h(n||"Assertion error",...F)}function m(u){return void 0===u?"":"string"==typeof u?u:u()}function p(u){const F=m(u);return"string"==typeof F?F:F.message||"<no error message>"}function b(u,F,n=void 0,t={}){const e=()=>p(n),o=u=>{const F=e();return 0===F.length?u:`${F} ${u}`};g("object"==typeof u,(()=>o("is not an object: "+typeof u))),g(void 0!==u,(()=>o("is not defined"))),g(null!==u,(()=>o("is null"))),g(!Array.isArray(u),(()=>o("is an array.")));const r=Object.entries(F);if(t.failOnUnknownFields){const F=t.allowedUnknownFieldNames||[];for(const n in u)g(F.includes(n)||r.some((([u])=>n===u)),o(`property can't be checked: ${n}`))}let i;for(const[F,n]of r){g("function"==typeof n||"object"==typeof n&&null!==n,(()=>`${e()}.${F} assertion is not an object or a function: ${typeof n}`));const t=u[F],o=()=>`${e()}.${F}`;if("object"==typeof n)g(!Array.isArray(t),(()=>`${e()}.${o()} use arrayAssertion() to create a ValueAssertion for an array`)),b(t,n,o);else if(g("function"==typeof n,(()=>`${e()}.${o()} assertion is not a function`)),"$o"===F)i=n;else{const u=n(t,o);g(void 0===u,`Assertion function must assert (void) but it returns a value: ${u}. Wrap with $u()?`)}}i&&i(u,n)}function E(u,F,n={},t=void 0){var o,r;const i=L(t);g(Array.isArray(u),(()=>`${i()}value is not an array: ${u}`));const a=null!==(o=n.minLength)&&void 0!==o?o:0,s=null!==(r=n.maxLength)&&void 0!==r?r:1/0;g(u.length>=a,(()=>`${i()}array length < minLength. Array length: ${u.length}, minLength: ${a}`)),g(u.length<=s,(()=>`${i()}array length > maxLength. Array length: ${u.length}, maxLength: ${s}`)),n.uniqueByIdentity&&g(e(u,n.uniqueByIdentity),(()=>`${i()}array contains non-unique elements`));let c=0;const l=()=>`${i("no-space-separator")}[${c}]`;for(;c<u.length;c++)w(u[c],F,l)}function B(u,F,n={},t=void 0){const e=L(t);g("object"==typeof u,(()=>`${e()}value is not an object: ${$(u)}`)),g(null!==u,(()=>`${e()}value is null`)),g(!Array.isArray(u),(()=>`${e()}the value is not a record, but is an array`));for(const[t,o]of Object.entries(u)){const u=()=>`${e("no-space-separator")}['${t}']`;n.keyAssertion&&w(t,n.keyAssertion,(()=>`${u()}, key assertion failed:`)),w(o,F,u);const{keyField:r}=n;if(r){g("object"==typeof o&&null!==o,(()=>`${u()} is not an object: ${$(o)}`));const F=o[r];g(F===t,(()=>`${u()} key value does not match object field '${r}' value: ${$(F)}`))}}n.$o&&n.$o(u,t)}function j(u,F,n){F(u,n)}function L(u){return(F="with-space-separator")=>{const n=p(u);return n?`${n}${"with-space-separator"===F?" ":""}`:""}}function w(u,F,n){"object"==typeof F?(g(!Array.isArray(u),(()=>`${n}: use arrayAssertion() to create a ValueAssertion for an array`)),b(u,F,n)):j(u,F,n)}function x(u,F,n){const t=m(u);if("object"==typeof t)throw t;return`${t?`${t}: `:""}${F} ${$(n)}`}const k=(u,n=void 0)=>{g(F(u),(()=>x(n,"Not a string",u)))},z=(u,F=void 0)=>{g(n(u),(()=>x(F,"Not a number",u)))},Z=(F,n=void 0)=>{g(u(F),(()=>x(n,"Not a boolean",F)))},I=(u,F=void 0)=>{g(l(u),(()=>x(F,"Invalid uuid",u)))},N=(u,F=void 0)=>{g(A(u),(()=>x(F,"Invalid hex string",u)))},q=(u,F=void 0)=>{g(s(u),(()=>x(F,"Invalid email",u)))},O=(u,F=void 0)=>{g(u instanceof Date,(()=>x(F,"Invalid Date",u)))};function V(u,F){g(D(u),(()=>x(F,"Value is "+(void 0===u?"undefined":"null"),u)))}function _(u,F=void 0){return n=>b(n,u,F)}function S(u,F={}){const{minLength:n,maxLength:t}=F;return g((null!=n?n:0)<=(null!=t?t:1/0),`minLength must be < maxLength! minLength ${n}, maxLength: ${t}`),g((null!=n?n:0)>=0,`minLength must be a positive number: ${n}`),g((null!=t?t:0)>=0,`maxLength must be a positive number: ${t}`),(n,t=void 0)=>{E(n,u,F,t)}}function U(u,F={}){return(n,t=void 0)=>{B(n,u,F,t)}}function W(u,F){return g("function"==typeof u,`"check" is not a function: ${u}`),(n,t=void 0)=>g(u(n),(()=>{let u=p(t)||"Check is failed";return u.endsWith(":")||(u+=":"),`${u} ${p(F)||("object"==typeof n?"[object]":`'${n}'`)}`}))}function G(u,F){return W(u,F)}function H(u,F){return(n,t=void 0)=>{n!==u&&("object"==typeof F?b(n,F,t):j(n,F,t))}}function J(u){return H(void 0,u)}function K(u){return H(null,u)}const M=u=>(F,n=void 0)=>{var t,e;k(F,n),g(F.length>=(null!==(t=u.minLength)&&void 0!==t?t:0),`${p(n)} length is too small: ${F.length} < ${u.minLength}`),g(F.length<=(null!==(e=u.maxLength)&&void 0!==e?e:1/0),`${p(n)} length is too large ${F.length} > ${u.maxLength}`)};function P(u){try{u()}catch(u){return u instanceof Error&&u.message||`${u}`}}function Q(u,F,n=void 0,t={}){return P((()=>b(u,F,n,t)))}function R(u,F,n={},t=void 0){return P((()=>E(u,F,n,t)))}function T(u,F,n={},t=void 0){return P((()=>B(u,F,n,t)))}function X(u,F){return u instanceof Error?u.message:null!=F?F:`${u}`}
|
|
3373
3396
|
//# sourceMappingURL=index.esm.js.map
|
|
3397
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
3398
|
+
/* harmony export */ "assertString", 0, /* binding */ k
|
|
3399
|
+
/* harmony export */ ]);
|
|
3400
|
+
|
|
3374
3401
|
|
|
3375
3402
|
/***/ },
|
|
3376
3403
|
|
|
@@ -8454,7 +8481,7 @@ module.exports = (string, columns, options) => {
|
|
|
8454
8481
|
/***/ },
|
|
8455
8482
|
|
|
8456
8483
|
/***/ 1218
|
|
8457
|
-
(__unused_webpack_module, exports) {
|
|
8484
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
8458
8485
|
|
|
8459
8486
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
8460
8487
|
//
|
|
@@ -8558,7 +8585,7 @@ function isPrimitive(arg) {
|
|
|
8558
8585
|
}
|
|
8559
8586
|
exports.isPrimitive = isPrimitive;
|
|
8560
8587
|
|
|
8561
|
-
exports.isBuffer = Buffer.isBuffer;
|
|
8588
|
+
exports.isBuffer = __webpack_require__(181).Buffer.isBuffer;
|
|
8562
8589
|
|
|
8563
8590
|
function objectToString(o) {
|
|
8564
8591
|
return Object.prototype.toString.call(o);
|
|
@@ -12471,6 +12498,114 @@ const runCallbacks = (callbacks, err, result) => {
|
|
|
12471
12498
|
// eslint-disable-next-line jsdoc/reject-any-type
|
|
12472
12499
|
/** @typedef {any} EXPECTED_ANY */
|
|
12473
12500
|
|
|
12501
|
+
/**
|
|
12502
|
+
* The first pending cache hit is held in these slots (a scheduled tick is
|
|
12503
|
+
* pending iff `firstCallback` is set); later hits from the same synchronous
|
|
12504
|
+
* burst spill into `dispatchQueue` as flat [callback, err, result] triples
|
|
12505
|
+
* and are drained by the same tick. This keeps the common single-hit case
|
|
12506
|
+
* as cheap as a plain `nextTick` while bursts share one tick.
|
|
12507
|
+
* @type {FileSystemCallback<EXPECTED_ANY> | undefined}
|
|
12508
|
+
*/
|
|
12509
|
+
let firstCallback;
|
|
12510
|
+
/** @type {Error | null} */
|
|
12511
|
+
let firstErr = null;
|
|
12512
|
+
/** @type {EXPECTED_ANY} */
|
|
12513
|
+
let firstResult;
|
|
12514
|
+
/** @type {EXPECTED_ANY[]} */
|
|
12515
|
+
let dispatchQueue = [];
|
|
12516
|
+
let dispatchQueueLength = 0;
|
|
12517
|
+
/** @type {EXPECTED_ANY[]} */
|
|
12518
|
+
let spareQueue = [];
|
|
12519
|
+
// upper bound on the spill-array capacity kept alive between bursts
|
|
12520
|
+
const MAX_RETAINED_QUEUE_LENGTH = 1024;
|
|
12521
|
+
|
|
12522
|
+
const runDispatch = () => {
|
|
12523
|
+
const callback = /** @type {FileSystemCallback<EXPECTED_ANY>} */ (
|
|
12524
|
+
firstCallback
|
|
12525
|
+
);
|
|
12526
|
+
const err = firstErr;
|
|
12527
|
+
const result = firstResult;
|
|
12528
|
+
// clear before calling: hits made from inside a callback start a new tick
|
|
12529
|
+
firstCallback = undefined;
|
|
12530
|
+
firstErr = null;
|
|
12531
|
+
firstResult = undefined;
|
|
12532
|
+
if (dispatchQueueLength === 0) {
|
|
12533
|
+
// single hit: no queue bookkeeping, a throw affects nobody else
|
|
12534
|
+
callback(err, result);
|
|
12535
|
+
return;
|
|
12536
|
+
}
|
|
12537
|
+
const queue = dispatchQueue;
|
|
12538
|
+
const length = dispatchQueueLength;
|
|
12539
|
+
// ping-pong the two arrays so draining never allocates
|
|
12540
|
+
dispatchQueue = spareQueue;
|
|
12541
|
+
dispatchQueueLength = 0;
|
|
12542
|
+
let i = -3;
|
|
12543
|
+
try {
|
|
12544
|
+
callback(err, result);
|
|
12545
|
+
for (i = 0; i < length; i += 3) {
|
|
12546
|
+
queue[i](queue[i + 1], queue[i + 2]);
|
|
12547
|
+
}
|
|
12548
|
+
} finally {
|
|
12549
|
+
// a throwing callback must not starve the rest: re-schedule the
|
|
12550
|
+
// remainder ahead of anything scheduled during this drain (matching
|
|
12551
|
+
// the old per-tick FIFO order) and rethrow
|
|
12552
|
+
i += 3;
|
|
12553
|
+
if (i < length) {
|
|
12554
|
+
if (firstCallback === undefined) {
|
|
12555
|
+
// no reentrant hit took the slot, so `dispatchQueue` is empty
|
|
12556
|
+
firstCallback = queue[i];
|
|
12557
|
+
firstErr = queue[i + 1];
|
|
12558
|
+
firstResult = queue[i + 2];
|
|
12559
|
+
nextTick(runDispatch);
|
|
12560
|
+
for (let j = i + 3; j < length; j++) {
|
|
12561
|
+
dispatchQueue[dispatchQueueLength++] = queue[j];
|
|
12562
|
+
}
|
|
12563
|
+
} else {
|
|
12564
|
+
// a reentrant hit claimed the slot (and scheduled the tick);
|
|
12565
|
+
// displace it behind the remainder to keep FIFO order
|
|
12566
|
+
const rest = queue.slice(i, length);
|
|
12567
|
+
rest.push(firstCallback, firstErr, firstResult);
|
|
12568
|
+
for (let j = 0; j < dispatchQueueLength; j++) {
|
|
12569
|
+
rest.push(dispatchQueue[j]);
|
|
12570
|
+
}
|
|
12571
|
+
[firstCallback, firstErr, firstResult] = rest;
|
|
12572
|
+
dispatchQueue = rest.slice(3);
|
|
12573
|
+
dispatchQueueLength = dispatchQueue.length;
|
|
12574
|
+
}
|
|
12575
|
+
}
|
|
12576
|
+
// release references but keep the backing store, so the next burst
|
|
12577
|
+
// does not have to re-grow the array from scratch
|
|
12578
|
+
for (let j = 0; j < length; j++) queue[j] = undefined;
|
|
12579
|
+
// bound the permanently retained capacity after a rare giant burst
|
|
12580
|
+
if (queue.length > MAX_RETAINED_QUEUE_LENGTH) {
|
|
12581
|
+
queue.length = MAX_RETAINED_QUEUE_LENGTH;
|
|
12582
|
+
}
|
|
12583
|
+
spareQueue = queue;
|
|
12584
|
+
}
|
|
12585
|
+
};
|
|
12586
|
+
|
|
12587
|
+
/**
|
|
12588
|
+
* Cache hits stay asynchronous, but all hits from the same synchronous
|
|
12589
|
+
* execution share a single `nextTick` instead of scheduling one each.
|
|
12590
|
+
* @param {FileSystemCallback<EXPECTED_ANY>} callback callback
|
|
12591
|
+
* @param {Error | null} err error
|
|
12592
|
+
* @param {EXPECTED_ANY} result result
|
|
12593
|
+
*/
|
|
12594
|
+
const scheduleDispatch = (callback, err, result) => {
|
|
12595
|
+
if (firstCallback === undefined) {
|
|
12596
|
+
firstCallback = callback;
|
|
12597
|
+
firstErr = err;
|
|
12598
|
+
firstResult = result;
|
|
12599
|
+
nextTick(runDispatch);
|
|
12600
|
+
} else {
|
|
12601
|
+
const queue = dispatchQueue;
|
|
12602
|
+
queue[dispatchQueueLength] = callback;
|
|
12603
|
+
queue[dispatchQueueLength + 1] = err;
|
|
12604
|
+
queue[dispatchQueueLength + 2] = result;
|
|
12605
|
+
dispatchQueueLength += 3;
|
|
12606
|
+
}
|
|
12607
|
+
};
|
|
12608
|
+
|
|
12474
12609
|
class OperationMergerBackend {
|
|
12475
12610
|
/**
|
|
12476
12611
|
* @param {EXPECTED_FUNCTION | undefined} provider async method in filesystem
|
|
@@ -12671,8 +12806,10 @@ class CacheBackend {
|
|
|
12671
12806
|
// Check in cache
|
|
12672
12807
|
const cacheEntry = this._data.get(strPath);
|
|
12673
12808
|
if (cacheEntry !== undefined) {
|
|
12674
|
-
if (cacheEntry.err)
|
|
12675
|
-
|
|
12809
|
+
if (cacheEntry.err) {
|
|
12810
|
+
return scheduleDispatch(callback, cacheEntry.err, undefined);
|
|
12811
|
+
}
|
|
12812
|
+
return scheduleDispatch(callback, null, cacheEntry.result);
|
|
12676
12813
|
}
|
|
12677
12814
|
|
|
12678
12815
|
// Check if there is already the same operation running
|
|
@@ -12774,9 +12911,10 @@ class CacheBackend {
|
|
|
12774
12911
|
|
|
12775
12912
|
/**
|
|
12776
12913
|
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
|
|
12914
|
+
* @param {{ exact?: boolean }=} options options; `exact: true` removes only entries whose key matches `what` exactly instead of any entry whose key starts with `what`
|
|
12777
12915
|
*/
|
|
12778
|
-
purge(what) {
|
|
12779
|
-
if (
|
|
12916
|
+
purge(what, options) {
|
|
12917
|
+
if (what === undefined || what === null) {
|
|
12780
12918
|
if (this._mode !== STORAGE_MODE_IDLE) {
|
|
12781
12919
|
this._data.clear();
|
|
12782
12920
|
for (const level of this._levels) {
|
|
@@ -12784,13 +12922,56 @@ class CacheBackend {
|
|
|
12784
12922
|
}
|
|
12785
12923
|
this._enterIdleMode();
|
|
12786
12924
|
}
|
|
12787
|
-
|
|
12925
|
+
return;
|
|
12926
|
+
}
|
|
12927
|
+
const exact =
|
|
12928
|
+
options !== undefined && options !== null && options.exact === true;
|
|
12929
|
+
if (exact) {
|
|
12930
|
+
if (
|
|
12931
|
+
typeof what === "string" ||
|
|
12932
|
+
Buffer.isBuffer(what) ||
|
|
12933
|
+
what instanceof URL ||
|
|
12934
|
+
typeof what === "number"
|
|
12935
|
+
) {
|
|
12936
|
+
const strWhat = typeof what !== "string" ? what.toString() : what;
|
|
12937
|
+
const data = this._data.get(strWhat);
|
|
12938
|
+
if (data !== undefined) {
|
|
12939
|
+
this._data.delete(strWhat);
|
|
12940
|
+
data.level.delete(strWhat);
|
|
12941
|
+
}
|
|
12942
|
+
} else {
|
|
12943
|
+
for (const item of what) {
|
|
12944
|
+
const strItem = typeof item !== "string" ? item.toString() : item;
|
|
12945
|
+
const data = this._data.get(strItem);
|
|
12946
|
+
if (data !== undefined) {
|
|
12947
|
+
this._data.delete(strItem);
|
|
12948
|
+
data.level.delete(strItem);
|
|
12949
|
+
}
|
|
12950
|
+
}
|
|
12951
|
+
}
|
|
12952
|
+
if (this._data.size === 0) {
|
|
12953
|
+
this._enterIdleMode();
|
|
12954
|
+
}
|
|
12955
|
+
return;
|
|
12956
|
+
}
|
|
12957
|
+
if (
|
|
12788
12958
|
typeof what === "string" ||
|
|
12789
12959
|
Buffer.isBuffer(what) ||
|
|
12790
12960
|
what instanceof URL ||
|
|
12791
12961
|
typeof what === "number"
|
|
12792
12962
|
) {
|
|
12793
12963
|
const strWhat = typeof what !== "string" ? what.toString() : what;
|
|
12964
|
+
if (strWhat === "") {
|
|
12965
|
+
// empty string is a prefix of every key — short-circuit the O(n) scan
|
|
12966
|
+
if (this._mode !== STORAGE_MODE_IDLE) {
|
|
12967
|
+
this._data.clear();
|
|
12968
|
+
for (const level of this._levels) {
|
|
12969
|
+
level.clear();
|
|
12970
|
+
}
|
|
12971
|
+
this._enterIdleMode();
|
|
12972
|
+
}
|
|
12973
|
+
return;
|
|
12974
|
+
}
|
|
12794
12975
|
for (const [key, data] of this._data) {
|
|
12795
12976
|
if (key.startsWith(strWhat)) {
|
|
12796
12977
|
this._data.delete(key);
|
|
@@ -12821,7 +13002,7 @@ class CacheBackend {
|
|
|
12821
13002
|
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
|
|
12822
13003
|
*/
|
|
12823
13004
|
purgeParent(what) {
|
|
12824
|
-
if (
|
|
13005
|
+
if (what === undefined || what === null) {
|
|
12825
13006
|
this.purge();
|
|
12826
13007
|
} else if (
|
|
12827
13008
|
typeof what === "string" ||
|
|
@@ -13080,15 +13261,20 @@ module.exports = class CachedInputFileSystem {
|
|
|
13080
13261
|
|
|
13081
13262
|
/**
|
|
13082
13263
|
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
|
|
13264
|
+
* @param {{ exact?: boolean }=} options options; `exact: true` removes only cache entries whose key matches `what` exactly instead of any entry whose key starts with `what`
|
|
13083
13265
|
*/
|
|
13084
|
-
purge(what) {
|
|
13085
|
-
this._statBackend.purge(what);
|
|
13086
|
-
this._lstatBackend.purge(what);
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13266
|
+
purge(what, options) {
|
|
13267
|
+
this._statBackend.purge(what, options);
|
|
13268
|
+
this._lstatBackend.purge(what, options);
|
|
13269
|
+
if (options !== undefined && options !== null && options.exact === true) {
|
|
13270
|
+
this._readdirBackend.purge(what, options);
|
|
13271
|
+
} else {
|
|
13272
|
+
this._readdirBackend.purgeParent(what);
|
|
13273
|
+
}
|
|
13274
|
+
this._readFileBackend.purge(what, options);
|
|
13275
|
+
this._readlinkBackend.purge(what, options);
|
|
13276
|
+
this._readJsonBackend.purge(what, options);
|
|
13277
|
+
this._realpathBackend.purge(what, options);
|
|
13092
13278
|
}
|
|
13093
13279
|
};
|
|
13094
13280
|
|
|
@@ -13344,6 +13530,7 @@ module.exports = class DescriptionFilePlugin {
|
|
|
13344
13530
|
|
|
13345
13531
|
|
|
13346
13532
|
const forEachBail = __webpack_require__(8048);
|
|
13533
|
+
const { decodeText } = __webpack_require__(1912);
|
|
13347
13534
|
|
|
13348
13535
|
/** @typedef {import("./Resolver")} Resolver */
|
|
13349
13536
|
/** @typedef {import("./Resolver").JsonObject} JsonObject */
|
|
@@ -13498,7 +13685,7 @@ function loadDescriptionFile(
|
|
|
13498
13685
|
|
|
13499
13686
|
if (content) {
|
|
13500
13687
|
try {
|
|
13501
|
-
json = JSON.parse(content
|
|
13688
|
+
json = JSON.parse(decodeText(content));
|
|
13502
13689
|
} catch (/** @type {unknown} */ err_) {
|
|
13503
13690
|
return onJson(/** @type {Error} */ (err_));
|
|
13504
13691
|
}
|
|
@@ -13680,12 +13867,14 @@ module.exports = class ExportsFieldPlugin {
|
|
|
13680
13867
|
* @param {Set<string>} conditionNames condition names
|
|
13681
13868
|
* @param {string | string[]} fieldNamePath name path
|
|
13682
13869
|
* @param {string | ResolveStepHook} target target
|
|
13870
|
+
* @param {boolean=} restrictions whether `restrictions` are configured (enables exports-target fallback when a target is filtered out)
|
|
13683
13871
|
*/
|
|
13684
|
-
constructor(source, conditionNames, fieldNamePath, target) {
|
|
13872
|
+
constructor(source, conditionNames, fieldNamePath, target, restrictions) {
|
|
13685
13873
|
this.source = source;
|
|
13686
13874
|
this.target = target;
|
|
13687
13875
|
this.conditionNames = conditionNames;
|
|
13688
13876
|
this.fieldName = fieldNamePath;
|
|
13877
|
+
this.restrictions = Boolean(restrictions);
|
|
13689
13878
|
// `null` is cached for description files that have no exports field,
|
|
13690
13879
|
// so subsequent resolves against the same package.json skip the
|
|
13691
13880
|
// `DescriptionFileUtils.getField` walk entirely.
|
|
@@ -13789,6 +13978,13 @@ module.exports = class ExportsFieldPlugin {
|
|
|
13789
13978
|
);
|
|
13790
13979
|
}
|
|
13791
13980
|
|
|
13981
|
+
// When `restrictions` are configured, share a marker down the
|
|
13982
|
+
// chain so RestrictionsPlugin can tell us it filtered out an
|
|
13983
|
+
// otherwise-valid target — then we fall back instead of erroring.
|
|
13984
|
+
const restrictionsMarker = this.restrictions
|
|
13985
|
+
? { blocked: false }
|
|
13986
|
+
: undefined;
|
|
13987
|
+
|
|
13792
13988
|
forEachBail(
|
|
13793
13989
|
paths,
|
|
13794
13990
|
/**
|
|
@@ -13844,6 +14040,12 @@ module.exports = class ExportsFieldPlugin {
|
|
|
13844
14040
|
query,
|
|
13845
14041
|
fragment,
|
|
13846
14042
|
};
|
|
14043
|
+
// Attach the marker only when restrictions are configured, so
|
|
14044
|
+
// resolves without restrictions keep their request shape and
|
|
14045
|
+
// never leak the property onto the result.
|
|
14046
|
+
if (restrictionsMarker) {
|
|
14047
|
+
obj.__restrictionsMarker = restrictionsMarker;
|
|
14048
|
+
}
|
|
13847
14049
|
|
|
13848
14050
|
resolver.doResolve(
|
|
13849
14051
|
target,
|
|
@@ -13871,12 +14073,19 @@ module.exports = class ExportsFieldPlugin {
|
|
|
13871
14073
|
// is a hard error, not a signal to continue searching up the directory tree.
|
|
13872
14074
|
// See: https://github.com/webpack/enhanced-resolve/issues/399
|
|
13873
14075
|
if (!result) {
|
|
14076
|
+
// Exception: the target existed but `restrictions` filtered it
|
|
14077
|
+
// out — return no result so the next `modules` entry is tried.
|
|
14078
|
+
if (restrictionsMarker && restrictionsMarker.blocked) {
|
|
14079
|
+
return callback(null, null);
|
|
14080
|
+
}
|
|
13874
14081
|
return callback(
|
|
13875
14082
|
new Error(
|
|
13876
14083
|
`Package path ${remainingRequest} is exported from package ${request.descriptionFileRoot}, but no valid target file was found (see exports field in ${request.descriptionFilePath})`,
|
|
13877
14084
|
),
|
|
13878
14085
|
);
|
|
13879
14086
|
}
|
|
14087
|
+
// Drop the internal marker before it reaches the result.
|
|
14088
|
+
if (restrictionsMarker) delete result.__restrictionsMarker;
|
|
13880
14089
|
callback(null, result);
|
|
13881
14090
|
},
|
|
13882
14091
|
);
|
|
@@ -14007,6 +14216,14 @@ module.exports = class ExtensionAliasPlugin {
|
|
|
14007
14216
|
const stoppingCallback = (err, result) => {
|
|
14008
14217
|
if (err) return callback(err);
|
|
14009
14218
|
if (result) return callback(null, result);
|
|
14219
|
+
// Listing the source extension among its own aliases keeps the
|
|
14220
|
+
// original request valid, so it must still be resolvable in its
|
|
14221
|
+
// normal (not fully specified) form: as a directory, or with
|
|
14222
|
+
// extensions appended. Only a mapping that drops the source
|
|
14223
|
+
// extension is strict.
|
|
14224
|
+
if (isAliasString ? alias === extension : alias.includes(extension)) {
|
|
14225
|
+
return callback();
|
|
14226
|
+
}
|
|
14010
14227
|
// Don't allow other aliasing or raw request
|
|
14011
14228
|
return callback(null, null);
|
|
14012
14229
|
};
|
|
@@ -14971,18 +15188,25 @@ module.exports = class ParsePlugin {
|
|
|
14971
15188
|
*/
|
|
14972
15189
|
apply(resolver) {
|
|
14973
15190
|
const target = resolver.ensureHook(this.target);
|
|
15191
|
+
const { requestOptions } = this;
|
|
14974
15192
|
resolver
|
|
14975
15193
|
.getHook(this.source)
|
|
14976
15194
|
.tapAsync("ParsePlugin", (request, resolveContext, callback) => {
|
|
14977
15195
|
const parsed = resolver.parse(/** @type {string} */ (request.request));
|
|
14978
15196
|
/** @type {ResolveRequest} */
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
15197
|
+
// Single spread + direct field assignment instead of
|
|
15198
|
+
// `{ ...request, ...parsed, ...requestOptions }` — avoids
|
|
15199
|
+
// two extra property enumerations on every resolve.
|
|
15200
|
+
// Keep in sync with Resolver.parse() output shape.
|
|
15201
|
+
const obj = { ...request };
|
|
15202
|
+
obj.request = parsed.request;
|
|
15203
|
+
obj.query = parsed.query || request.query || "";
|
|
15204
|
+
obj.fragment = parsed.fragment || request.fragment || "";
|
|
15205
|
+
obj.module = parsed.module;
|
|
15206
|
+
obj.directory = parsed.directory;
|
|
15207
|
+
obj.file = parsed.file;
|
|
15208
|
+
obj.internal = parsed.internal;
|
|
15209
|
+
Object.assign(obj, requestOptions);
|
|
14986
15210
|
if (parsed && resolveContext.log) {
|
|
14987
15211
|
if (parsed.module) resolveContext.log("Parsed request is a module");
|
|
14988
15212
|
if (parsed.directory) {
|
|
@@ -15186,6 +15410,7 @@ const {
|
|
|
15186
15410
|
createCachedJoin,
|
|
15187
15411
|
getType,
|
|
15188
15412
|
normalize,
|
|
15413
|
+
toPath,
|
|
15189
15414
|
} = __webpack_require__(6932);
|
|
15190
15415
|
|
|
15191
15416
|
/* eslint-disable jsdoc/check-alignment */
|
|
@@ -15196,8 +15421,8 @@ const _withResolvers =
|
|
|
15196
15421
|
? /**
|
|
15197
15422
|
* @param {Resolver} self resolver
|
|
15198
15423
|
* @param {Context} context context information object
|
|
15199
|
-
* @param {string} path context path
|
|
15200
|
-
* @param {string} request request string
|
|
15424
|
+
* @param {string | URL} path context path or a `file:` URL instance
|
|
15425
|
+
* @param {string | URL} request request string or a `file:` URL instance
|
|
15201
15426
|
* @param {ResolveContext} resolveContext resolve context
|
|
15202
15427
|
* @returns {Promise<string | false>} result
|
|
15203
15428
|
*/
|
|
@@ -15213,8 +15438,8 @@ const _withResolvers =
|
|
|
15213
15438
|
: /**
|
|
15214
15439
|
* @param {Resolver} self resolver
|
|
15215
15440
|
* @param {Context} context context information object
|
|
15216
|
-
* @param {string} path context path
|
|
15217
|
-
* @param {string} request request string
|
|
15441
|
+
* @param {string | URL} path context path or a `file:` URL instance
|
|
15442
|
+
* @param {string | URL} request request string or a `file:` URL instance
|
|
15218
15443
|
* @param {ResolveContext} resolveContext resolve context
|
|
15219
15444
|
* @returns {Promise<string | false>} result
|
|
15220
15445
|
*/
|
|
@@ -15574,6 +15799,7 @@ const HASH_ESCAPE_RE = /#/g;
|
|
|
15574
15799
|
* @property {string=} __innerRequest inner request for internal usage
|
|
15575
15800
|
* @property {string=} __innerRequest_request inner request for internal usage
|
|
15576
15801
|
* @property {string=} __innerRequest_relativePath inner relative path for internal usage
|
|
15802
|
+
* @property {{ blocked: boolean }=} __restrictionsMarker internal: shared marker `RestrictionsPlugin` flips when it filters out an existing target, letting `ExportsFieldPlugin` fall back instead of erroring
|
|
15577
15803
|
*/
|
|
15578
15804
|
|
|
15579
15805
|
/** @typedef {BaseResolveRequest & Partial<ParsedIdentifier>} ResolveRequest */
|
|
@@ -15862,27 +16088,27 @@ class Resolver {
|
|
|
15862
16088
|
|
|
15863
16089
|
/**
|
|
15864
16090
|
* @overload
|
|
15865
|
-
* @param {string}
|
|
15866
|
-
* @param {string}
|
|
16091
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16092
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15867
16093
|
* @param {ResolveContext=} resolveContext resolve context
|
|
15868
16094
|
* @returns {string | false} result
|
|
15869
16095
|
*/
|
|
15870
16096
|
/**
|
|
15871
16097
|
* @overload
|
|
15872
16098
|
* @param {Context} context context information object
|
|
15873
|
-
* @param {string}
|
|
15874
|
-
* @param {string}
|
|
16099
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16100
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15875
16101
|
* @param {ResolveContext=} resolveContext resolve context
|
|
15876
16102
|
* @returns {string | false} result
|
|
15877
16103
|
*/
|
|
15878
16104
|
/**
|
|
15879
|
-
* @param {Context | string} context context information object or context path when no context is provided
|
|
15880
|
-
* @param {string | ResolveContext=}
|
|
15881
|
-
* @param {string | ResolveContext=}
|
|
16105
|
+
* @param {Context | string | URL} context context information object, or the context path (string or `file:` URL instance) when no context is provided
|
|
16106
|
+
* @param {string | URL | ResolveContext=} parent context path (string or `file:` URL instance) or resolve context when no context is provided
|
|
16107
|
+
* @param {string | URL | ResolveContext=} specifier request string (or `file:` URL instance) or resolve context when no context is provided
|
|
15882
16108
|
* @param {ResolveContext=} resolveContext resolve context
|
|
15883
16109
|
* @returns {string | false} result
|
|
15884
16110
|
*/
|
|
15885
|
-
resolveSync(context,
|
|
16111
|
+
resolveSync(context, parent, specifier, resolveContext) {
|
|
15886
16112
|
/** @type {Error | null | undefined} */
|
|
15887
16113
|
let err;
|
|
15888
16114
|
/** @type {string | false | undefined} */
|
|
@@ -15893,8 +16119,8 @@ class Resolver {
|
|
|
15893
16119
|
// caller supplied a resolveContext.
|
|
15894
16120
|
this.resolve(
|
|
15895
16121
|
/** @type {Context} */ (context),
|
|
15896
|
-
/** @type {string} */ (
|
|
15897
|
-
/** @type {string} */ (
|
|
16122
|
+
/** @type {string} */ (parent),
|
|
16123
|
+
/** @type {string} */ (specifier),
|
|
15898
16124
|
/** @type {ResolveContext} */ (resolveContext) || {},
|
|
15899
16125
|
(_err, r) => {
|
|
15900
16126
|
err = _err;
|
|
@@ -15914,49 +16140,49 @@ class Resolver {
|
|
|
15914
16140
|
|
|
15915
16141
|
/**
|
|
15916
16142
|
* @overload
|
|
15917
|
-
* @param {string}
|
|
15918
|
-
* @param {string}
|
|
16143
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16144
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15919
16145
|
* @param {ResolveContext=} resolveContext resolve context
|
|
15920
16146
|
* @returns {Promise<string | false>} result
|
|
15921
16147
|
*/
|
|
15922
16148
|
/**
|
|
15923
16149
|
* @overload
|
|
15924
16150
|
* @param {Context} context context information object
|
|
15925
|
-
* @param {string}
|
|
15926
|
-
* @param {string}
|
|
16151
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16152
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15927
16153
|
* @param {ResolveContext=} resolveContext resolve context
|
|
15928
16154
|
* @returns {Promise<string | false>} result
|
|
15929
16155
|
*/
|
|
15930
16156
|
/**
|
|
15931
|
-
* @param {Context | string} context context information object or context path when no context is provided
|
|
15932
|
-
* @param {string | ResolveContext=}
|
|
15933
|
-
* @param {string | ResolveContext=}
|
|
16157
|
+
* @param {Context | string | URL} context context information object, or the context path (string or `file:` URL instance) when no context is provided
|
|
16158
|
+
* @param {string | URL | ResolveContext=} parent context path (string or `file:` URL instance) or resolve context when no context is provided
|
|
16159
|
+
* @param {string | URL | ResolveContext=} specifier request string (or `file:` URL instance) or resolve context when no context is provided
|
|
15934
16160
|
* @param {ResolveContext=} resolveContext resolve context
|
|
15935
16161
|
* @returns {Promise<string | false>} result
|
|
15936
16162
|
*/
|
|
15937
|
-
resolvePromise(context,
|
|
16163
|
+
resolvePromise(context, parent, specifier, resolveContext) {
|
|
15938
16164
|
// `|| {}` ensures the 5-arg fast path inside `resolve()` is reached
|
|
15939
16165
|
// even when the caller doesn't pass a resolveContext.
|
|
15940
16166
|
return _withResolvers(
|
|
15941
16167
|
this,
|
|
15942
16168
|
/** @type {Context} */ (context),
|
|
15943
|
-
/** @type {string} */ (
|
|
15944
|
-
/** @type {string} */ (
|
|
16169
|
+
/** @type {string} */ (parent),
|
|
16170
|
+
/** @type {string} */ (specifier),
|
|
15945
16171
|
/** @type {ResolveContext} */ (resolveContext) || {},
|
|
15946
16172
|
);
|
|
15947
16173
|
}
|
|
15948
16174
|
|
|
15949
16175
|
/**
|
|
15950
16176
|
* @overload
|
|
15951
|
-
* @param {string}
|
|
15952
|
-
* @param {string}
|
|
16177
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16178
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15953
16179
|
* @param {ResolveCallback} callback callback function
|
|
15954
16180
|
* @returns {void}
|
|
15955
16181
|
*/
|
|
15956
16182
|
/**
|
|
15957
16183
|
* @overload
|
|
15958
|
-
* @param {string}
|
|
15959
|
-
* @param {string}
|
|
16184
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16185
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15960
16186
|
* @param {ResolveContext} resolveContext resolve context
|
|
15961
16187
|
* @param {ResolveCallback} callback callback function
|
|
15962
16188
|
* @returns {void}
|
|
@@ -15964,29 +16190,29 @@ class Resolver {
|
|
|
15964
16190
|
/**
|
|
15965
16191
|
* @overload
|
|
15966
16192
|
* @param {Context} context context information object
|
|
15967
|
-
* @param {string}
|
|
15968
|
-
* @param {string}
|
|
16193
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16194
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15969
16195
|
* @param {ResolveCallback} callback callback function
|
|
15970
16196
|
* @returns {void}
|
|
15971
16197
|
*/
|
|
15972
16198
|
/**
|
|
15973
16199
|
* @overload
|
|
15974
16200
|
* @param {Context} context context information object
|
|
15975
|
-
* @param {string}
|
|
15976
|
-
* @param {string}
|
|
16201
|
+
* @param {string | URL} parent context path or a `file:` URL instance
|
|
16202
|
+
* @param {string | URL} specifier request string or a `file:` URL instance
|
|
15977
16203
|
* @param {ResolveContext} resolveContext resolve context
|
|
15978
16204
|
* @param {ResolveCallback} callback callback function
|
|
15979
16205
|
* @returns {void}
|
|
15980
16206
|
*/
|
|
15981
16207
|
/**
|
|
15982
|
-
* @param {Context | string} context context information object or context path when no context is provided
|
|
15983
|
-
* @param {string | ResolveContext | ResolveCallback=}
|
|
15984
|
-
* @param {string | ResolveContext | ResolveCallback=}
|
|
16208
|
+
* @param {Context | string | URL} context context information object, or the context path (string or `file:` URL instance) when no context is provided
|
|
16209
|
+
* @param {string | URL | ResolveContext | ResolveCallback=} parent context path (string or `file:` URL instance) or (when no context) resolve context or callback
|
|
16210
|
+
* @param {string | URL | ResolveContext | ResolveCallback=} specifier request string (or `file:` URL instance) or (when no context) resolve context or callback
|
|
15985
16211
|
* @param {ResolveContext | ResolveCallback=} resolveContext resolve context or callback when no resolve context is provided
|
|
15986
16212
|
* @param {ResolveCallback=} callback callback function
|
|
15987
16213
|
* @returns {void}
|
|
15988
16214
|
*/
|
|
15989
|
-
resolve(context,
|
|
16215
|
+
resolve(context, parent, specifier, resolveContext, callback) {
|
|
15990
16216
|
// Fast path for the common 5-arg call (`resolver.resolve(ctx, from,
|
|
15991
16217
|
// req, resolveCtx, cb)`) — every call from `resolveSync` /
|
|
15992
16218
|
// `resolvePromise` plus the vast majority of direct API callers.
|
|
@@ -16005,8 +16231,9 @@ class Resolver {
|
|
|
16005
16231
|
// proceed straight to per-arg validation below
|
|
16006
16232
|
} else {
|
|
16007
16233
|
// Slow path: shift positional args based on what was supplied.
|
|
16008
|
-
// Shift when context is omitted (first positional arg is the
|
|
16009
|
-
|
|
16234
|
+
// Shift when context is omitted (first positional arg is the parent,
|
|
16235
|
+
// either a string or a `file:` URL instance).
|
|
16236
|
+
if (typeof context === "string" || context instanceof URL) {
|
|
16010
16237
|
// Keep an already-supplied callback (resolveSync / resolvePromise
|
|
16011
16238
|
// always pass one in the 5th position).
|
|
16012
16239
|
if (typeof callback !== "function") {
|
|
@@ -16015,9 +16242,11 @@ class Resolver {
|
|
|
16015
16242
|
);
|
|
16016
16243
|
}
|
|
16017
16244
|
resolveContext =
|
|
16018
|
-
/** @type {ResolveContext | ResolveCallback | undefined} */ (
|
|
16019
|
-
|
|
16020
|
-
|
|
16245
|
+
/** @type {ResolveContext | ResolveCallback | undefined} */ (
|
|
16246
|
+
specifier
|
|
16247
|
+
);
|
|
16248
|
+
specifier = /** @type {string} */ (parent);
|
|
16249
|
+
parent = context;
|
|
16021
16250
|
context = {};
|
|
16022
16251
|
}
|
|
16023
16252
|
// 4-arg form: the resolveContext slot holds the callback.
|
|
@@ -16034,18 +16263,24 @@ class Resolver {
|
|
|
16034
16263
|
context = {};
|
|
16035
16264
|
}
|
|
16036
16265
|
}
|
|
16037
|
-
|
|
16038
|
-
|
|
16266
|
+
// Accept `file:` URL instances for parent/specifier, converting to a
|
|
16267
|
+
// filesystem path (mirrors the URL support in resolve options). The
|
|
16268
|
+
// `instanceof` check sits on the error branch, so the common string
|
|
16269
|
+
// case keeps its single `typeof` check on this hot path.
|
|
16270
|
+
if (typeof parent !== "string") {
|
|
16271
|
+
if (parent instanceof URL) parent = toPath(parent);
|
|
16272
|
+
else return callback(new Error("path argument is not a string"));
|
|
16039
16273
|
}
|
|
16040
|
-
if (typeof
|
|
16041
|
-
|
|
16274
|
+
if (typeof specifier !== "string") {
|
|
16275
|
+
if (specifier instanceof URL) specifier = toPath(specifier);
|
|
16276
|
+
else return callback(new Error("request argument is not a string"));
|
|
16042
16277
|
}
|
|
16043
16278
|
|
|
16044
16279
|
/** @type {ResolveRequest} */
|
|
16045
16280
|
const obj = {
|
|
16046
16281
|
context,
|
|
16047
|
-
path,
|
|
16048
|
-
request,
|
|
16282
|
+
path: parent,
|
|
16283
|
+
request: specifier,
|
|
16049
16284
|
};
|
|
16050
16285
|
|
|
16051
16286
|
/** @type {ResolveContextYield | undefined} */
|
|
@@ -16074,8 +16309,6 @@ class Resolver {
|
|
|
16074
16309
|
};
|
|
16075
16310
|
}
|
|
16076
16311
|
|
|
16077
|
-
const message = `resolve '${request}' in '${path}'`;
|
|
16078
|
-
|
|
16079
16312
|
/**
|
|
16080
16313
|
* @param {ResolveRequest} result result
|
|
16081
16314
|
* @returns {void}
|
|
@@ -16103,10 +16336,11 @@ class Resolver {
|
|
|
16103
16336
|
};
|
|
16104
16337
|
|
|
16105
16338
|
/**
|
|
16339
|
+
* @param {string} message resolve message
|
|
16106
16340
|
* @param {string[]} log logs
|
|
16107
16341
|
* @returns {void}
|
|
16108
16342
|
*/
|
|
16109
|
-
const finishWithoutResolve = (log) => {
|
|
16343
|
+
const finishWithoutResolve = (message, log) => {
|
|
16110
16344
|
/**
|
|
16111
16345
|
* @type {ErrorWithDetail}
|
|
16112
16346
|
*/
|
|
@@ -16117,6 +16351,7 @@ class Resolver {
|
|
|
16117
16351
|
};
|
|
16118
16352
|
|
|
16119
16353
|
if (resolveContext.log) {
|
|
16354
|
+
const message = `resolve '${specifier}' in '${parent}'`;
|
|
16120
16355
|
// We need log anyway to capture it in case of an error
|
|
16121
16356
|
const parentLog = resolveContext.log;
|
|
16122
16357
|
/** @type {string[]} */
|
|
@@ -16147,66 +16382,68 @@ class Resolver {
|
|
|
16147
16382
|
|
|
16148
16383
|
if (result) return finishResolved(result);
|
|
16149
16384
|
|
|
16150
|
-
return finishWithoutResolve(log);
|
|
16385
|
+
return finishWithoutResolve(message, log);
|
|
16151
16386
|
},
|
|
16152
16387
|
);
|
|
16153
16388
|
}
|
|
16154
16389
|
// Try to resolve assuming there is no error
|
|
16155
16390
|
// We don't log stuff in this case
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
(err, result) => {
|
|
16169
|
-
if (err) return callback(err);
|
|
16170
|
-
|
|
16171
|
-
if (yieldCalled || (result && yield_)) {
|
|
16172
|
-
return /** @type {ResolveContextYield} */ (finishYield)(
|
|
16173
|
-
/** @type {ResolveRequest} */ (result),
|
|
16174
|
-
);
|
|
16391
|
+
// When there is no yield wrapper, the caller's resolveContext can
|
|
16392
|
+
// be passed directly — its `log` is already falsy (we are in the
|
|
16393
|
+
// !log branch) and `yield` is undefined, so a fresh wrapper would
|
|
16394
|
+
// be an identical copy.
|
|
16395
|
+
const rc = yield_
|
|
16396
|
+
? {
|
|
16397
|
+
log: undefined,
|
|
16398
|
+
yield: yield_,
|
|
16399
|
+
fileDependencies: resolveContext.fileDependencies,
|
|
16400
|
+
contextDependencies: resolveContext.contextDependencies,
|
|
16401
|
+
missingDependencies: resolveContext.missingDependencies,
|
|
16402
|
+
stack: resolveContext.stack,
|
|
16175
16403
|
}
|
|
16404
|
+
: resolveContext;
|
|
16405
|
+
return this.doResolve(this.hooks.resolve, obj, null, rc, (err, result) => {
|
|
16406
|
+
if (err) return callback(err);
|
|
16176
16407
|
|
|
16177
|
-
|
|
16408
|
+
if (yieldCalled || (result && yield_)) {
|
|
16409
|
+
return /** @type {ResolveContextYield} */ (finishYield)(
|
|
16410
|
+
/** @type {ResolveRequest} */ (result),
|
|
16411
|
+
);
|
|
16412
|
+
}
|
|
16178
16413
|
|
|
16179
|
-
|
|
16180
|
-
// so we redo the resolving for the log info
|
|
16181
|
-
// this is more expensive to the success case
|
|
16182
|
-
// is assumed by default
|
|
16183
|
-
/** @type {string[]} */
|
|
16184
|
-
const log = [];
|
|
16414
|
+
if (result) return finishResolved(result);
|
|
16185
16415
|
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
stack: resolveContext.stack,
|
|
16194
|
-
},
|
|
16195
|
-
(err, result) => {
|
|
16196
|
-
if (err) return callback(err);
|
|
16416
|
+
// log is missing for the error details
|
|
16417
|
+
// so we redo the resolving for the log info
|
|
16418
|
+
// this is more expensive to the success case
|
|
16419
|
+
// is assumed by default
|
|
16420
|
+
const message = `resolve '${specifier}' in '${parent}'`;
|
|
16421
|
+
/** @type {string[]} */
|
|
16422
|
+
const log = [];
|
|
16197
16423
|
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16424
|
+
return this.doResolve(
|
|
16425
|
+
this.hooks.resolve,
|
|
16426
|
+
obj,
|
|
16427
|
+
message,
|
|
16428
|
+
{
|
|
16429
|
+
log: (msg) => log.push(msg),
|
|
16430
|
+
yield: yield_,
|
|
16431
|
+
stack: resolveContext.stack,
|
|
16432
|
+
},
|
|
16433
|
+
(err, result) => {
|
|
16434
|
+
if (err) return callback(err);
|
|
16204
16435
|
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16436
|
+
// In a case that there is a race condition and yield will be called
|
|
16437
|
+
if (yieldCalled || (result && yield_)) {
|
|
16438
|
+
return /** @type {ResolveContextYield} */ (finishYield)(
|
|
16439
|
+
/** @type {ResolveRequest} */ (result),
|
|
16440
|
+
);
|
|
16441
|
+
}
|
|
16442
|
+
|
|
16443
|
+
return finishWithoutResolve(message, log);
|
|
16444
|
+
},
|
|
16445
|
+
);
|
|
16446
|
+
});
|
|
16210
16447
|
}
|
|
16211
16448
|
|
|
16212
16449
|
/**
|
|
@@ -16266,11 +16503,19 @@ class Resolver {
|
|
|
16266
16503
|
this.hooks.resolveStep.call(hook, request);
|
|
16267
16504
|
|
|
16268
16505
|
if (hook.isUsed()) {
|
|
16269
|
-
//
|
|
16270
|
-
//
|
|
16271
|
-
//
|
|
16272
|
-
//
|
|
16273
|
-
|
|
16506
|
+
// No-log fast path: when the context was created internally
|
|
16507
|
+
// (stack is already a StackEntry from a prior doResolve), we
|
|
16508
|
+
// can mutate stack in-place and restore it in the callback,
|
|
16509
|
+
// avoiding the createInnerContext allocation entirely.
|
|
16510
|
+
if (!resolveContext.log && rawStack instanceof StackEntry) {
|
|
16511
|
+
resolveContext.stack = stackEntry;
|
|
16512
|
+
return hook.callAsync(request, resolveContext, (err, result) => {
|
|
16513
|
+
resolveContext.stack = rawStack;
|
|
16514
|
+
if (err) return callback(err);
|
|
16515
|
+
if (result) return callback(null, result);
|
|
16516
|
+
callback();
|
|
16517
|
+
});
|
|
16518
|
+
}
|
|
16274
16519
|
const innerContext = createInnerContext(
|
|
16275
16520
|
resolveContext,
|
|
16276
16521
|
stackEntry,
|
|
@@ -16442,7 +16687,7 @@ const TryNextPlugin = __webpack_require__(9413);
|
|
|
16442
16687
|
const TsconfigPathsPlugin = __webpack_require__(528);
|
|
16443
16688
|
const UnsafeCachePlugin = __webpack_require__(3177);
|
|
16444
16689
|
const UseFilePlugin = __webpack_require__(492);
|
|
16445
|
-
const { PathType, getType } = __webpack_require__(6932);
|
|
16690
|
+
const { PathType, getType, toPath } = __webpack_require__(6932);
|
|
16446
16691
|
|
|
16447
16692
|
/** @typedef {import("./AliasPlugin").AliasOption} AliasOptionEntry */
|
|
16448
16693
|
/** @typedef {import("./ExtensionAliasPlugin").ExtensionAliasOption} ExtensionAliasOption */
|
|
@@ -16456,6 +16701,9 @@ const { PathType, getType } = __webpack_require__(6932);
|
|
|
16456
16701
|
|
|
16457
16702
|
/** @typedef {string | string[] | false} AliasOptionNewRequest */
|
|
16458
16703
|
/** @typedef {{ [k: string]: AliasOptionNewRequest }} AliasOptions */
|
|
16704
|
+
/** @typedef {string | URL | (string | URL)[] | false} UserAliasOptionNewRequest */
|
|
16705
|
+
/** @typedef {{ [k: string]: UserAliasOptionNewRequest }} UserAliasOptions */
|
|
16706
|
+
/** @typedef {{ alias: UserAliasOptionNewRequest, name: string, onlyModule?: boolean }} UserAliasOptionEntry */
|
|
16459
16707
|
/** @typedef {{ [k: string]: string | string[] }} ExtensionAliasOptions */
|
|
16460
16708
|
/** @typedef {false | 0 | "" | null | undefined} Falsy */
|
|
16461
16709
|
/** @typedef {{ apply: (resolver: Resolver) => void } | ((this: Resolver, resolver: Resolver) => void) | Falsy} Plugin */
|
|
@@ -16467,10 +16715,17 @@ const { PathType, getType } = __webpack_require__(6932);
|
|
|
16467
16715
|
* @property {string=} baseUrl Override baseUrl from tsconfig.json. If provided, this value will be used instead of the baseUrl in the tsconfig file
|
|
16468
16716
|
*/
|
|
16469
16717
|
|
|
16718
|
+
/**
|
|
16719
|
+
* @typedef {object} UserTsconfigOptions
|
|
16720
|
+
* @property {(string | URL)=} configFile A path, or `file:` `URL` instance, pointing at the tsconfig file
|
|
16721
|
+
* @property {((string | URL)[] | "auto")=} references References to other tsconfig files. 'auto' inherits from TypeScript config, or an array of relative/absolute paths or `file:` `URL` instances
|
|
16722
|
+
* @property {(string | URL)=} baseUrl Override baseUrl from tsconfig.json with a path or `file:` `URL` instance
|
|
16723
|
+
*/
|
|
16724
|
+
|
|
16470
16725
|
/**
|
|
16471
16726
|
* @typedef {object} UserResolveOptions
|
|
16472
|
-
* @property {(
|
|
16473
|
-
* @property {(
|
|
16727
|
+
* @property {(UserAliasOptions | UserAliasOptionEntry[])=} alias A list of module alias configurations or an object which maps key to value
|
|
16728
|
+
* @property {(UserAliasOptions | UserAliasOptionEntry[])=} fallback A list of module alias configurations or an object which maps key to value, applied only after modules option
|
|
16474
16729
|
* @property {ExtensionAliasOptions=} extensionAlias An object which maps extension to extension aliases
|
|
16475
16730
|
* @property {boolean=} extensionAliasForExports Also apply `extensionAlias` to paths resolved through the package.json `exports` field. Off by default (Node.js-aligned); when enabled, matches TypeScript's behavior for packages that ship TS sources alongside compiled JS.
|
|
16476
16731
|
* @property {(string | string[])[]=} aliasFields A list of alias fields in description files
|
|
@@ -16486,19 +16741,19 @@ const { PathType, getType } = __webpack_require__(6932);
|
|
|
16486
16741
|
* @property {(Cache | boolean)=} unsafeCache Use this cache object to unsafely cache the successful requests
|
|
16487
16742
|
* @property {boolean=} symlinks Resolve symlinks to their symlinked location
|
|
16488
16743
|
* @property {Resolver=} resolver A prepared Resolver to which the plugins are attached
|
|
16489
|
-
* @property {string[] | string=} modules A list of directories to resolve modules from, can be absolute path or
|
|
16744
|
+
* @property {(string | URL)[] | string | URL=} modules A list of directories to resolve modules from, can be absolute path, folder name, or a `file:` `URL` instance
|
|
16490
16745
|
* @property {(string | string[] | { name: string | string[], forceRelative: boolean })[]=} mainFields A list of main fields in description files
|
|
16491
16746
|
* @property {string[]=} mainFiles A list of main files in directories
|
|
16492
16747
|
* @property {Plugin[]=} plugins A list of additional resolve plugins which should be applied
|
|
16493
16748
|
* @property {PnpApi | null=} pnpApi A PnP API that should be used - null is "never", undefined is "auto"
|
|
16494
|
-
* @property {string[]=} roots A list of root paths
|
|
16749
|
+
* @property {(string | URL)[]=} roots A list of root paths, each an absolute path or a `file:` `URL` instance
|
|
16495
16750
|
* @property {boolean=} fullySpecified The request is already fully specified and no extensions or directories are resolved for it
|
|
16496
16751
|
* @property {boolean=} resolveToContext Resolve to a context instead of a file
|
|
16497
|
-
* @property {(string | RegExp)[]=} restrictions A list of resolve restrictions
|
|
16752
|
+
* @property {(string | URL | RegExp)[]=} restrictions A list of resolve restrictions, each an absolute path, a `file:` `URL` instance, or a RegExp
|
|
16498
16753
|
* @property {boolean=} useSyncFileSystemCalls Use only the sync constraints of the file system calls
|
|
16499
16754
|
* @property {boolean=} preferRelative Prefer to resolve module requests as relative requests before falling back to modules
|
|
16500
16755
|
* @property {boolean=} preferAbsolute Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots
|
|
16501
|
-
* @property {string | boolean |
|
|
16756
|
+
* @property {string | URL | boolean | UserTsconfigOptions=} tsconfig TypeScript config file path (or `file:` `URL` instance) or config object with configFile and references
|
|
16502
16757
|
*/
|
|
16503
16758
|
|
|
16504
16759
|
/**
|
|
@@ -16570,23 +16825,69 @@ function processPnpApiOption(option) {
|
|
|
16570
16825
|
}
|
|
16571
16826
|
|
|
16572
16827
|
/**
|
|
16573
|
-
* @param {
|
|
16828
|
+
* @param {UserAliasOptionNewRequest} alias alias target(s)
|
|
16829
|
+
* @returns {AliasOptionNewRequest} target(s) with file `URL` instances converted to paths
|
|
16830
|
+
*/
|
|
16831
|
+
function toPathAlias(alias) {
|
|
16832
|
+
if (alias === false) return false;
|
|
16833
|
+
return Array.isArray(alias) ? alias.map(toPath) : toPath(alias);
|
|
16834
|
+
}
|
|
16835
|
+
|
|
16836
|
+
/**
|
|
16837
|
+
* @param {UserAliasOptions | UserAliasOptionEntry[] | undefined} alias alias
|
|
16574
16838
|
* @returns {AliasOptionEntry[]} normalized aliases
|
|
16575
16839
|
*/
|
|
16576
16840
|
function normalizeAlias(alias) {
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
}
|
|
16841
|
+
if (typeof alias === "object" && !Array.isArray(alias) && alias !== null) {
|
|
16842
|
+
return Object.keys(alias).map((key) => {
|
|
16843
|
+
/** @type {AliasOptionEntry} */
|
|
16844
|
+
const obj = {
|
|
16845
|
+
name: key,
|
|
16846
|
+
onlyModule: false,
|
|
16847
|
+
alias: toPathAlias(alias[key]),
|
|
16848
|
+
};
|
|
16586
16849
|
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16850
|
+
if (/\$$/.test(key)) {
|
|
16851
|
+
obj.onlyModule = true;
|
|
16852
|
+
obj.name = key.slice(0, -1);
|
|
16853
|
+
}
|
|
16854
|
+
|
|
16855
|
+
return obj;
|
|
16856
|
+
});
|
|
16857
|
+
}
|
|
16858
|
+
|
|
16859
|
+
return alias
|
|
16860
|
+
? alias.map((item) => ({ ...item, alias: toPathAlias(item.alias) }))
|
|
16861
|
+
: [];
|
|
16862
|
+
}
|
|
16863
|
+
|
|
16864
|
+
/**
|
|
16865
|
+
* @param {string | URL | boolean | UserTsconfigOptions | undefined} tsconfig tsconfig option
|
|
16866
|
+
* @returns {string | boolean | TsconfigOptions} normalized tsconfig with file `URL` instances converted to paths
|
|
16867
|
+
*/
|
|
16868
|
+
function normalizeTsconfig(tsconfig) {
|
|
16869
|
+
if (tsconfig === undefined) return false;
|
|
16870
|
+
if (typeof tsconfig === "boolean") return tsconfig;
|
|
16871
|
+
if (typeof tsconfig === "string" || tsconfig instanceof URL) {
|
|
16872
|
+
return toPath(tsconfig);
|
|
16873
|
+
}
|
|
16874
|
+
|
|
16875
|
+
/** @type {TsconfigOptions} */
|
|
16876
|
+
const result = {};
|
|
16877
|
+
|
|
16878
|
+
if (tsconfig.configFile !== undefined) {
|
|
16879
|
+
result.configFile = toPath(tsconfig.configFile);
|
|
16880
|
+
}
|
|
16881
|
+
if (tsconfig.baseUrl !== undefined) {
|
|
16882
|
+
result.baseUrl = toPath(tsconfig.baseUrl);
|
|
16883
|
+
}
|
|
16884
|
+
if (tsconfig.references !== undefined) {
|
|
16885
|
+
result.references = Array.isArray(tsconfig.references)
|
|
16886
|
+
? tsconfig.references.map(toPath)
|
|
16887
|
+
: tsconfig.references;
|
|
16888
|
+
}
|
|
16889
|
+
|
|
16890
|
+
return result;
|
|
16590
16891
|
}
|
|
16591
16892
|
|
|
16592
16893
|
/**
|
|
@@ -16693,9 +16994,9 @@ function createOptions(options) {
|
|
|
16693
16994
|
resolver: options.resolver,
|
|
16694
16995
|
modules: mergeFilteredToArray(
|
|
16695
16996
|
Array.isArray(options.modules)
|
|
16696
|
-
? options.modules
|
|
16997
|
+
? options.modules.map(toPath)
|
|
16697
16998
|
: options.modules
|
|
16698
|
-
? [options.modules]
|
|
16999
|
+
? [toPath(options.modules)]
|
|
16699
17000
|
: ["node_modules"],
|
|
16700
17001
|
(item) => {
|
|
16701
17002
|
const type = getType(item);
|
|
@@ -16706,14 +17007,16 @@ function createOptions(options) {
|
|
|
16706
17007
|
mainFiles: new Set(options.mainFiles || ["index"]),
|
|
16707
17008
|
plugins: options.plugins || [],
|
|
16708
17009
|
pnpApi: processPnpApiOption(options.pnpApi),
|
|
16709
|
-
roots: new Set(options.roots
|
|
17010
|
+
roots: new Set(options.roots ? options.roots.map(toPath) : undefined),
|
|
16710
17011
|
fullySpecified: options.fullySpecified || false,
|
|
16711
17012
|
resolveToContext: options.resolveToContext || false,
|
|
16712
17013
|
preferRelative: options.preferRelative || false,
|
|
16713
17014
|
preferAbsolute: options.preferAbsolute || false,
|
|
16714
|
-
restrictions: new Set(
|
|
16715
|
-
|
|
16716
|
-
|
|
17015
|
+
restrictions: new Set(
|
|
17016
|
+
options.restrictions &&
|
|
17017
|
+
options.restrictions.map((r) => (r instanceof RegExp ? r : toPath(r))),
|
|
17018
|
+
),
|
|
17019
|
+
tsconfig: normalizeTsconfig(options.tsconfig),
|
|
16717
17020
|
};
|
|
16718
17021
|
}
|
|
16719
17022
|
|
|
@@ -17017,6 +17320,7 @@ module.exports.createResolver = function createResolver(options) {
|
|
|
17017
17320
|
conditionNames,
|
|
17018
17321
|
exportsField,
|
|
17019
17322
|
exportsFieldTarget,
|
|
17323
|
+
restrictions.size > 0,
|
|
17020
17324
|
),
|
|
17021
17325
|
);
|
|
17022
17326
|
}
|
|
@@ -17198,7 +17502,7 @@ module.exports.createResolver = function createResolver(options) {
|
|
|
17198
17502
|
/***/ },
|
|
17199
17503
|
|
|
17200
17504
|
/***/ 2620
|
|
17201
|
-
(module) {
|
|
17505
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
17202
17506
|
|
|
17203
17507
|
"use strict";
|
|
17204
17508
|
/*
|
|
@@ -17208,23 +17512,24 @@ module.exports.createResolver = function createResolver(options) {
|
|
|
17208
17512
|
|
|
17209
17513
|
|
|
17210
17514
|
|
|
17515
|
+
const { isInside, normalize } = __webpack_require__(6932);
|
|
17516
|
+
|
|
17211
17517
|
/** @typedef {import("./Resolver")} Resolver */
|
|
17212
17518
|
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
|
|
17213
17519
|
|
|
17214
|
-
|
|
17215
|
-
|
|
17520
|
+
/**
|
|
17521
|
+
* @typedef {object} PathRestriction
|
|
17522
|
+
* @property {"path"} type type of the restriction
|
|
17523
|
+
* @property {string} rule normalized path the request has to be inside of
|
|
17524
|
+
*/
|
|
17216
17525
|
|
|
17217
17526
|
/**
|
|
17218
|
-
* @
|
|
17219
|
-
* @
|
|
17220
|
-
* @
|
|
17527
|
+
* @typedef {object} RegExpRestriction
|
|
17528
|
+
* @property {"regexp"} type type of the restriction
|
|
17529
|
+
* @property {RegExp} rule pattern the request has to match
|
|
17221
17530
|
*/
|
|
17222
|
-
|
|
17223
|
-
|
|
17224
|
-
if (path.length === parent.length) return true;
|
|
17225
|
-
const charCode = path.charCodeAt(parent.length);
|
|
17226
|
-
return charCode === slashCode || charCode === backslashCode;
|
|
17227
|
-
};
|
|
17531
|
+
|
|
17532
|
+
/** @typedef {PathRestriction | RegExpRestriction} Restriction */
|
|
17228
17533
|
|
|
17229
17534
|
module.exports = class RestrictionsPlugin {
|
|
17230
17535
|
/**
|
|
@@ -17234,6 +17539,17 @@ module.exports = class RestrictionsPlugin {
|
|
|
17234
17539
|
constructor(source, restrictions) {
|
|
17235
17540
|
this.source = source;
|
|
17236
17541
|
this.restrictions = restrictions;
|
|
17542
|
+
// Restrictions never change, so bringing them into the shape requests
|
|
17543
|
+
// arrive in is done once here instead of on every request.
|
|
17544
|
+
/** @type {Restriction[]} */
|
|
17545
|
+
this._restrictions = [];
|
|
17546
|
+
for (const rule of restrictions) {
|
|
17547
|
+
this._restrictions.push(
|
|
17548
|
+
typeof rule === "string"
|
|
17549
|
+
? { type: "path", rule: normalize(rule) }
|
|
17550
|
+
: { type: "regexp", rule },
|
|
17551
|
+
);
|
|
17552
|
+
}
|
|
17237
17553
|
}
|
|
17238
17554
|
|
|
17239
17555
|
/**
|
|
@@ -17246,24 +17562,28 @@ module.exports = class RestrictionsPlugin {
|
|
|
17246
17562
|
.tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => {
|
|
17247
17563
|
if (typeof request.path === "string") {
|
|
17248
17564
|
const { path } = request;
|
|
17249
|
-
for (const
|
|
17250
|
-
if (
|
|
17251
|
-
if (
|
|
17252
|
-
|
|
17253
|
-
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
}
|
|
17257
|
-
return callback(null, null);
|
|
17565
|
+
for (const restriction of this._restrictions) {
|
|
17566
|
+
if (restriction.type === "path") {
|
|
17567
|
+
if (isInside(restriction.rule, path)) continue;
|
|
17568
|
+
if (resolveContext.log) {
|
|
17569
|
+
resolveContext.log(
|
|
17570
|
+
`${path} is not inside of the restriction ${restriction.rule}`,
|
|
17571
|
+
);
|
|
17258
17572
|
}
|
|
17259
|
-
} else
|
|
17573
|
+
} else {
|
|
17574
|
+
if (restriction.rule.test(path)) continue;
|
|
17260
17575
|
if (resolveContext.log) {
|
|
17261
17576
|
resolveContext.log(
|
|
17262
|
-
`${path} doesn't match the restriction ${rule}`,
|
|
17577
|
+
`${path} doesn't match the restriction ${restriction.rule}`,
|
|
17263
17578
|
);
|
|
17264
17579
|
}
|
|
17265
|
-
return callback(null, null);
|
|
17266
17580
|
}
|
|
17581
|
+
// Target existed (FileExistsPlugin already passed) but is
|
|
17582
|
+
// outside the jail; signal ExportsFieldPlugin to fall back.
|
|
17583
|
+
if (request.__restrictionsMarker) {
|
|
17584
|
+
request.__restrictionsMarker.blocked = true;
|
|
17585
|
+
}
|
|
17586
|
+
return callback(null, null);
|
|
17267
17587
|
}
|
|
17268
17588
|
}
|
|
17269
17589
|
|
|
@@ -17635,7 +17955,18 @@ module.exports = class SymlinkPlugin {
|
|
|
17635
17955
|
obj,
|
|
17636
17956
|
`resolved symlink to ${result}`,
|
|
17637
17957
|
resolveContext,
|
|
17638
|
-
|
|
17958
|
+
(err, innerResult) => {
|
|
17959
|
+
if (err) return callback(err);
|
|
17960
|
+
// The symlink-resolved (real) path is authoritative. If
|
|
17961
|
+
// resolving it produced a result, use it. If it did not —
|
|
17962
|
+
// e.g. a `restrictions` rule rejected the real target —
|
|
17963
|
+
// stop here with no result instead of letting the next
|
|
17964
|
+
// plugin report the original in-root symlink path, which
|
|
17965
|
+
// would leave the symlink unresolved and bypass
|
|
17966
|
+
// `restrictions`.
|
|
17967
|
+
if (innerResult) return callback(null, innerResult);
|
|
17968
|
+
return callback(null, null);
|
|
17969
|
+
},
|
|
17639
17970
|
);
|
|
17640
17971
|
},
|
|
17641
17972
|
);
|
|
@@ -18390,6 +18721,7 @@ module.exports = class TsconfigPathsPlugin {
|
|
|
18390
18721
|
|
|
18391
18722
|
/**
|
|
18392
18723
|
* @param {string} dir current directory
|
|
18724
|
+
* @returns {void}
|
|
18393
18725
|
*/
|
|
18394
18726
|
const check = (dir) => {
|
|
18395
18727
|
const candidate = resolver.join(dir, configFileName);
|
|
@@ -18397,7 +18729,10 @@ module.exports = class TsconfigPathsPlugin {
|
|
|
18397
18729
|
if (!statErr) {
|
|
18398
18730
|
// Found — load it
|
|
18399
18731
|
this._loadTsconfigPathsMap(resolver, candidate, (loadErr, result) => {
|
|
18400
|
-
if (loadErr)
|
|
18732
|
+
if (loadErr) {
|
|
18733
|
+
// Auto mode: soft-fail silently.
|
|
18734
|
+
return callback(null, null);
|
|
18735
|
+
}
|
|
18401
18736
|
callback(null, result);
|
|
18402
18737
|
});
|
|
18403
18738
|
return;
|
|
@@ -18591,47 +18926,10 @@ module.exports = class TsconfigPathsPlugin {
|
|
|
18591
18926
|
extendedConfigValue,
|
|
18592
18927
|
);
|
|
18593
18928
|
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
// "@scope/name" should resolve to node_modules/@scope/name/tsconfig.json,
|
|
18599
|
-
// not node_modules/@scope/name.json
|
|
18600
|
-
// See: test/fixtures/tsconfig-paths/extends-pkg-entry/
|
|
18601
|
-
if (
|
|
18602
|
-
typeof originalExtendedConfigValue === "string" &&
|
|
18603
|
-
originalExtendedConfigValue.startsWith("@") &&
|
|
18604
|
-
originalExtendedConfigValue.split("/").length === 2
|
|
18605
|
-
) {
|
|
18606
|
-
extendedConfigPath = resolver.join(
|
|
18607
|
-
currentDir,
|
|
18608
|
-
normalize(
|
|
18609
|
-
`node_modules/${originalExtendedConfigValue}/${DEFAULT_CONFIG_FILE}`,
|
|
18610
|
-
),
|
|
18611
|
-
);
|
|
18612
|
-
} else if (extendedConfigValue.includes("/")) {
|
|
18613
|
-
// Handle package sub-path extends like "react/tsconfig":
|
|
18614
|
-
// "react/tsconfig" resolves to node_modules/react/tsconfig.json
|
|
18615
|
-
// See: test/fixtures/tsconfig-paths/extends-npm/
|
|
18616
|
-
extendedConfigPath = resolver.join(
|
|
18617
|
-
currentDir,
|
|
18618
|
-
normalize(`node_modules/${extendedConfigValue}`),
|
|
18619
|
-
);
|
|
18620
|
-
} else if (
|
|
18621
|
-
!originalExtendedConfigValue.startsWith(".") &&
|
|
18622
|
-
!originalExtendedConfigValue.startsWith("/")
|
|
18623
|
-
) {
|
|
18624
|
-
// Handle unscoped package extends like "my-base-config" (no sub-path):
|
|
18625
|
-
// "my-base-config" should resolve to node_modules/my-base-config/tsconfig.json
|
|
18626
|
-
extendedConfigPath = resolver.join(
|
|
18627
|
-
currentDir,
|
|
18628
|
-
normalize(
|
|
18629
|
-
`node_modules/${originalExtendedConfigValue}/${DEFAULT_CONFIG_FILE}`,
|
|
18630
|
-
),
|
|
18631
|
-
);
|
|
18632
|
-
}
|
|
18633
|
-
}
|
|
18634
|
-
|
|
18929
|
+
/**
|
|
18930
|
+
* @param {string} extendedConfigPath resolved config path to load
|
|
18931
|
+
*/
|
|
18932
|
+
const loadExtended = (extendedConfigPath) => {
|
|
18635
18933
|
this._loadTsconfig(
|
|
18636
18934
|
resolver,
|
|
18637
18935
|
extendedConfigPath,
|
|
@@ -18659,9 +18957,85 @@ module.exports = class TsconfigPathsPlugin {
|
|
|
18659
18957
|
callback(null, cfg);
|
|
18660
18958
|
},
|
|
18661
18959
|
);
|
|
18960
|
+
};
|
|
18961
|
+
|
|
18962
|
+
fileSystem.stat(initialExtendedConfigPath, (existsErr) => {
|
|
18963
|
+
if (!existsErr) return loadExtended(initialExtendedConfigPath);
|
|
18964
|
+
|
|
18965
|
+
// The relative form does not exist — treat the value as a package
|
|
18966
|
+
// specifier and compute its `node_modules/<...>` sub-path.
|
|
18967
|
+
let nodeModulesSubPath = null;
|
|
18968
|
+
if (
|
|
18969
|
+
typeof originalExtendedConfigValue === "string" &&
|
|
18970
|
+
originalExtendedConfigValue.startsWith("@") &&
|
|
18971
|
+
originalExtendedConfigValue.split("/").length === 2
|
|
18972
|
+
) {
|
|
18973
|
+
// Scoped package, no sub-path ("@scope/name") →
|
|
18974
|
+
// node_modules/@scope/name/tsconfig.json (not @scope/name.json).
|
|
18975
|
+
// See: test/fixtures/tsconfig-paths/extends-pkg-entry/
|
|
18976
|
+
nodeModulesSubPath = `${originalExtendedConfigValue}/${DEFAULT_CONFIG_FILE}`;
|
|
18977
|
+
} else if (
|
|
18978
|
+
extendedConfigValue.includes("/") &&
|
|
18979
|
+
!originalExtendedConfigValue.startsWith(".") &&
|
|
18980
|
+
!originalExtendedConfigValue.startsWith("/")
|
|
18981
|
+
) {
|
|
18982
|
+
// Package sub-path ("react/tsconfig", "@scope/name/tsconfig") →
|
|
18983
|
+
// node_modules/react/tsconfig.json.
|
|
18984
|
+
// See: test/fixtures/tsconfig-paths/extends-npm/
|
|
18985
|
+
nodeModulesSubPath = extendedConfigValue;
|
|
18986
|
+
} else if (
|
|
18987
|
+
!originalExtendedConfigValue.startsWith(".") &&
|
|
18988
|
+
!originalExtendedConfigValue.startsWith("/")
|
|
18989
|
+
) {
|
|
18990
|
+
// Unscoped package, no sub-path ("my-base-config") →
|
|
18991
|
+
// node_modules/my-base-config/tsconfig.json.
|
|
18992
|
+
nodeModulesSubPath = `${originalExtendedConfigValue}/${DEFAULT_CONFIG_FILE}`;
|
|
18993
|
+
}
|
|
18994
|
+
|
|
18995
|
+
// Not a package specifier (relative/absolute) — load the missing
|
|
18996
|
+
// path anyway so the read surfaces its own ENOENT.
|
|
18997
|
+
if (nodeModulesSubPath === null) {
|
|
18998
|
+
return loadExtended(initialExtendedConfigPath);
|
|
18999
|
+
}
|
|
19000
|
+
|
|
19001
|
+
// Walk ancestor node_modules like Node.js/TypeScript so a package
|
|
19002
|
+
// hoisted to a parent workspace directory is found. #21457
|
|
19003
|
+
const subPath = normalize(`node_modules/${nodeModulesSubPath}`);
|
|
19004
|
+
this._findExtendsInNodeModules(resolver, currentDir, subPath, (found) => {
|
|
19005
|
+
loadExtended(found || resolver.join(currentDir, subPath));
|
|
19006
|
+
});
|
|
18662
19007
|
});
|
|
18663
19008
|
}
|
|
18664
19009
|
|
|
19010
|
+
/**
|
|
19011
|
+
* Walk up from startDir looking for `<dir>/<subPath>` (a
|
|
19012
|
+
* `node_modules/...` sub-path), matching Node.js module resolution so a
|
|
19013
|
+
* package hoisted to a parent workspace's node_modules is found.
|
|
19014
|
+
* @param {Resolver} resolver the resolver
|
|
19015
|
+
* @param {string} startDir directory to start searching from
|
|
19016
|
+
* @param {string} subPath node_modules-relative sub-path to look for
|
|
19017
|
+
* @param {(found: string | null) => void} callback receives the found path or null
|
|
19018
|
+
* @returns {void}
|
|
19019
|
+
*/
|
|
19020
|
+
_findExtendsInNodeModules(resolver, startDir, subPath, callback) {
|
|
19021
|
+
const { fileSystem } = resolver;
|
|
19022
|
+
|
|
19023
|
+
/**
|
|
19024
|
+
* @param {string} dir current directory
|
|
19025
|
+
*/
|
|
19026
|
+
const check = (dir) => {
|
|
19027
|
+
const candidate = resolver.join(dir, subPath);
|
|
19028
|
+
fileSystem.stat(candidate, (statErr) => {
|
|
19029
|
+
if (!statErr) return callback(candidate);
|
|
19030
|
+
const parentDir = resolver.dirname(dir);
|
|
19031
|
+
if (parentDir === dir) return callback(null);
|
|
19032
|
+
check(parentDir);
|
|
19033
|
+
});
|
|
19034
|
+
};
|
|
19035
|
+
|
|
19036
|
+
check(startDir);
|
|
19037
|
+
}
|
|
19038
|
+
|
|
18665
19039
|
/**
|
|
18666
19040
|
* Load referenced tsconfig projects and store in referenceMatchMap
|
|
18667
19041
|
* Simple implementation matching tsconfig-paths-webpack-plugin:
|
|
@@ -19393,24 +19767,24 @@ const memoize = __webpack_require__(7043);
|
|
|
19393
19767
|
|
|
19394
19768
|
/**
|
|
19395
19769
|
* @typedef {{
|
|
19396
|
-
* (context: Context,
|
|
19397
|
-
* (context: Context,
|
|
19398
|
-
* (
|
|
19399
|
-
* (
|
|
19770
|
+
* (context: Context, parent: string | URL, specifier: string | URL, resolveContext: ResolveContext, callback: ResolveCallback): void,
|
|
19771
|
+
* (context: Context, parent: string | URL, specifier: string | URL, callback: ResolveCallback): void,
|
|
19772
|
+
* (parent: string | URL, specifier: string | URL, resolveContext: ResolveContext, callback: ResolveCallback): void,
|
|
19773
|
+
* (parent: string | URL, specifier: string | URL, callback: ResolveCallback): void,
|
|
19400
19774
|
* }} ResolveFunctionAsync
|
|
19401
19775
|
*/
|
|
19402
19776
|
|
|
19403
19777
|
/**
|
|
19404
19778
|
* @typedef {{
|
|
19405
|
-
* (context: Context,
|
|
19406
|
-
* (
|
|
19779
|
+
* (context: Context, parent: string | URL, specifier: string | URL, resolveContext?: ResolveContext): string | false,
|
|
19780
|
+
* (parent: string | URL, specifier: string | URL, resolveContext?: ResolveContext): string | false,
|
|
19407
19781
|
* }} ResolveFunction
|
|
19408
19782
|
*/
|
|
19409
19783
|
|
|
19410
19784
|
/**
|
|
19411
19785
|
* @typedef {{
|
|
19412
|
-
* (context: Context,
|
|
19413
|
-
* (
|
|
19786
|
+
* (context: Context, parent: string | URL, specifier: string | URL, resolveContext?: ResolveContext): Promise<string | false>,
|
|
19787
|
+
* (parent: string | URL, specifier: string | URL, resolveContext?: ResolveContext): Promise<string | false>,
|
|
19414
19788
|
* }} ResolveFunctionPromise
|
|
19415
19789
|
*/
|
|
19416
19790
|
|
|
@@ -19442,18 +19816,18 @@ const getAsyncResolver = memoize(() =>
|
|
|
19442
19816
|
*/
|
|
19443
19817
|
const resolve =
|
|
19444
19818
|
/**
|
|
19445
|
-
* @param {object | string} context context
|
|
19446
|
-
* @param {string}
|
|
19447
|
-
* @param {string | ResolveContext | ResolveCallback}
|
|
19819
|
+
* @param {object | string | URL} context context
|
|
19820
|
+
* @param {string | URL} parent parent path
|
|
19821
|
+
* @param {string | URL | ResolveContext | ResolveCallback} specifier specifier to resolve
|
|
19448
19822
|
* @param {ResolveContext | ResolveCallback=} resolveContext resolve context
|
|
19449
19823
|
* @param {ResolveCallback=} callback callback
|
|
19450
19824
|
*/
|
|
19451
|
-
(context,
|
|
19452
|
-
if (typeof context === "string") {
|
|
19825
|
+
(context, parent, specifier, resolveContext, callback) => {
|
|
19826
|
+
if (typeof context === "string" || context instanceof URL) {
|
|
19453
19827
|
callback = /** @type {ResolveCallback} */ (resolveContext);
|
|
19454
|
-
resolveContext = /** @type {ResolveContext} */ (
|
|
19455
|
-
|
|
19456
|
-
|
|
19828
|
+
resolveContext = /** @type {ResolveContext} */ (specifier);
|
|
19829
|
+
specifier = parent;
|
|
19830
|
+
parent = context;
|
|
19457
19831
|
context = getNodeContext();
|
|
19458
19832
|
}
|
|
19459
19833
|
if (typeof callback !== "function") {
|
|
@@ -19461,8 +19835,8 @@ const resolve =
|
|
|
19461
19835
|
}
|
|
19462
19836
|
getAsyncResolver().resolve(
|
|
19463
19837
|
context,
|
|
19464
|
-
|
|
19465
|
-
/** @type {string} */ (
|
|
19838
|
+
parent,
|
|
19839
|
+
/** @type {string} */ (specifier),
|
|
19466
19840
|
/** @type {ResolveContext} */ (resolveContext),
|
|
19467
19841
|
/** @type {ResolveCallback} */ (callback),
|
|
19468
19842
|
);
|
|
@@ -19482,23 +19856,23 @@ const getSyncResolver = memoize(() =>
|
|
|
19482
19856
|
*/
|
|
19483
19857
|
const resolveSync =
|
|
19484
19858
|
/**
|
|
19485
|
-
* @param {object | string} context context
|
|
19486
|
-
* @param {string}
|
|
19487
|
-
* @param {string | ResolveContext | undefined}
|
|
19859
|
+
* @param {object | string | URL} context context
|
|
19860
|
+
* @param {string | URL} parent parent path
|
|
19861
|
+
* @param {string | URL | ResolveContext | undefined} specifier specifier to resolve
|
|
19488
19862
|
* @param {ResolveContext=} resolveContext resolve context
|
|
19489
19863
|
* @returns {string | false} resolved path
|
|
19490
19864
|
*/
|
|
19491
|
-
(context,
|
|
19492
|
-
if (typeof context === "string") {
|
|
19493
|
-
resolveContext = /** @type {ResolveContext} */ (
|
|
19494
|
-
|
|
19495
|
-
|
|
19865
|
+
(context, parent, specifier, resolveContext) => {
|
|
19866
|
+
if (typeof context === "string" || context instanceof URL) {
|
|
19867
|
+
resolveContext = /** @type {ResolveContext} */ (specifier);
|
|
19868
|
+
specifier = parent;
|
|
19869
|
+
parent = context;
|
|
19496
19870
|
context = getNodeContext();
|
|
19497
19871
|
}
|
|
19498
19872
|
return getSyncResolver().resolveSync(
|
|
19499
19873
|
context,
|
|
19500
|
-
|
|
19501
|
-
/** @type {string} */ (
|
|
19874
|
+
parent,
|
|
19875
|
+
/** @type {string} */ (specifier),
|
|
19502
19876
|
/** @type {ResolveContext} */ (resolveContext),
|
|
19503
19877
|
);
|
|
19504
19878
|
};
|
|
@@ -19508,23 +19882,23 @@ const resolveSync =
|
|
|
19508
19882
|
*/
|
|
19509
19883
|
const resolvePromise =
|
|
19510
19884
|
/**
|
|
19511
|
-
* @param {object | string} context context
|
|
19512
|
-
* @param {string}
|
|
19513
|
-
* @param {string | ResolveContext | undefined}
|
|
19885
|
+
* @param {object | string | URL} context context
|
|
19886
|
+
* @param {string | URL} parent parent path
|
|
19887
|
+
* @param {string | URL | ResolveContext | undefined} specifier specifier to resolve
|
|
19514
19888
|
* @param {ResolveContext=} resolveContext resolve context
|
|
19515
19889
|
* @returns {Promise<string | false>} resolved path
|
|
19516
19890
|
*/
|
|
19517
|
-
(context,
|
|
19518
|
-
if (typeof context === "string") {
|
|
19519
|
-
resolveContext = /** @type {ResolveContext} */ (
|
|
19520
|
-
|
|
19521
|
-
|
|
19891
|
+
(context, parent, specifier, resolveContext) => {
|
|
19892
|
+
if (typeof context === "string" || context instanceof URL) {
|
|
19893
|
+
resolveContext = /** @type {ResolveContext} */ (specifier);
|
|
19894
|
+
specifier = parent;
|
|
19895
|
+
parent = context;
|
|
19522
19896
|
context = getNodeContext();
|
|
19523
19897
|
}
|
|
19524
19898
|
return getAsyncResolver().resolvePromise(
|
|
19525
19899
|
context,
|
|
19526
|
-
|
|
19527
|
-
/** @type {string} */ (
|
|
19900
|
+
parent,
|
|
19901
|
+
/** @type {string} */ (specifier),
|
|
19528
19902
|
/** @type {ResolveContext} */ (resolveContext),
|
|
19529
19903
|
);
|
|
19530
19904
|
};
|
|
@@ -19537,22 +19911,22 @@ const resolvePromise =
|
|
|
19537
19911
|
*/
|
|
19538
19912
|
function create(options) {
|
|
19539
19913
|
const resolver = getResolverFactory().createResolver({
|
|
19540
|
-
fileSystem: getNodeFileSystem(),
|
|
19541
19914
|
...options,
|
|
19915
|
+
fileSystem: options.fileSystem || getNodeFileSystem(),
|
|
19542
19916
|
});
|
|
19543
19917
|
/**
|
|
19544
|
-
* @param {object | string} context Custom context
|
|
19545
|
-
* @param {string}
|
|
19546
|
-
* @param {string | ResolveContext | ResolveCallback}
|
|
19918
|
+
* @param {object | string | URL} context Custom context
|
|
19919
|
+
* @param {string | URL} parent Base/parent path
|
|
19920
|
+
* @param {string | URL | ResolveContext | ResolveCallback} specifier Specifier to resolve
|
|
19547
19921
|
* @param {ResolveContext | ResolveCallback=} resolveContext Resolve context
|
|
19548
19922
|
* @param {ResolveCallback=} callback Result callback
|
|
19549
19923
|
*/
|
|
19550
|
-
return function create(context,
|
|
19551
|
-
if (typeof context === "string") {
|
|
19924
|
+
return function create(context, parent, specifier, resolveContext, callback) {
|
|
19925
|
+
if (typeof context === "string" || context instanceof URL) {
|
|
19552
19926
|
callback = /** @type {ResolveCallback} */ (resolveContext);
|
|
19553
|
-
resolveContext = /** @type {ResolveContext} */ (
|
|
19554
|
-
|
|
19555
|
-
|
|
19927
|
+
resolveContext = /** @type {ResolveContext} */ (specifier);
|
|
19928
|
+
specifier = parent;
|
|
19929
|
+
parent = context;
|
|
19556
19930
|
context = getNodeContext();
|
|
19557
19931
|
}
|
|
19558
19932
|
if (typeof callback !== "function") {
|
|
@@ -19560,8 +19934,8 @@ function create(options) {
|
|
|
19560
19934
|
}
|
|
19561
19935
|
resolver.resolve(
|
|
19562
19936
|
context,
|
|
19563
|
-
|
|
19564
|
-
/** @type {string} */ (
|
|
19937
|
+
parent,
|
|
19938
|
+
/** @type {string} */ (specifier),
|
|
19565
19939
|
/** @type {ResolveContext} */ (resolveContext),
|
|
19566
19940
|
callback,
|
|
19567
19941
|
);
|
|
@@ -19575,27 +19949,27 @@ function create(options) {
|
|
|
19575
19949
|
function createSync(options) {
|
|
19576
19950
|
const resolver = getResolverFactory().createResolver({
|
|
19577
19951
|
useSyncFileSystemCalls: true,
|
|
19578
|
-
fileSystem: getNodeFileSystem(),
|
|
19579
19952
|
...options,
|
|
19953
|
+
fileSystem: options.fileSystem || getNodeFileSystem(),
|
|
19580
19954
|
});
|
|
19581
19955
|
/**
|
|
19582
|
-
* @param {object | string} context custom context
|
|
19583
|
-
* @param {string}
|
|
19584
|
-
* @param {string | ResolveContext | undefined}
|
|
19956
|
+
* @param {object | string | URL} context custom context
|
|
19957
|
+
* @param {string | URL} parent base/parent path
|
|
19958
|
+
* @param {string | URL | ResolveContext | undefined} specifier specifier to resolve
|
|
19585
19959
|
* @param {ResolveContext=} resolveContext Resolve context
|
|
19586
19960
|
* @returns {string | false} Resolved path or false
|
|
19587
19961
|
*/
|
|
19588
|
-
return function createSync(context,
|
|
19589
|
-
if (typeof context === "string") {
|
|
19590
|
-
resolveContext = /** @type {ResolveContext} */ (
|
|
19591
|
-
|
|
19592
|
-
|
|
19962
|
+
return function createSync(context, parent, specifier, resolveContext) {
|
|
19963
|
+
if (typeof context === "string" || context instanceof URL) {
|
|
19964
|
+
resolveContext = /** @type {ResolveContext} */ (specifier);
|
|
19965
|
+
specifier = parent;
|
|
19966
|
+
parent = context;
|
|
19593
19967
|
context = getNodeContext();
|
|
19594
19968
|
}
|
|
19595
19969
|
return resolver.resolveSync(
|
|
19596
19970
|
context,
|
|
19597
|
-
|
|
19598
|
-
/** @type {string} */ (
|
|
19971
|
+
parent,
|
|
19972
|
+
/** @type {string} */ (specifier),
|
|
19599
19973
|
/** @type {ResolveContext} */ (resolveContext),
|
|
19600
19974
|
);
|
|
19601
19975
|
};
|
|
@@ -19607,27 +19981,27 @@ function createSync(options) {
|
|
|
19607
19981
|
*/
|
|
19608
19982
|
function createPromise(options) {
|
|
19609
19983
|
const resolver = getResolverFactory().createResolver({
|
|
19610
|
-
fileSystem: getNodeFileSystem(),
|
|
19611
19984
|
...options,
|
|
19985
|
+
fileSystem: options.fileSystem || getNodeFileSystem(),
|
|
19612
19986
|
});
|
|
19613
19987
|
/**
|
|
19614
|
-
* @param {object | string} context Custom context
|
|
19615
|
-
* @param {string}
|
|
19616
|
-
* @param {string | ResolveContext | undefined}
|
|
19988
|
+
* @param {object | string | URL} context Custom context
|
|
19989
|
+
* @param {string | URL} parent Base/parent path
|
|
19990
|
+
* @param {string | URL | ResolveContext | undefined} specifier Specifier to resolve
|
|
19617
19991
|
* @param {ResolveContext=} resolveContext Resolve context
|
|
19618
19992
|
* @returns {Promise<string | false>} resolved path
|
|
19619
19993
|
*/
|
|
19620
|
-
return function createPromise(context,
|
|
19621
|
-
if (typeof context === "string") {
|
|
19622
|
-
resolveContext = /** @type {ResolveContext} */ (
|
|
19623
|
-
|
|
19624
|
-
|
|
19994
|
+
return function createPromise(context, parent, specifier, resolveContext) {
|
|
19995
|
+
if (typeof context === "string" || context instanceof URL) {
|
|
19996
|
+
resolveContext = /** @type {ResolveContext} */ (specifier);
|
|
19997
|
+
specifier = parent;
|
|
19998
|
+
parent = context;
|
|
19625
19999
|
context = getNodeContext();
|
|
19626
20000
|
}
|
|
19627
20001
|
return resolver.resolvePromise(
|
|
19628
20002
|
context,
|
|
19629
|
-
|
|
19630
|
-
/** @type {string} */ (
|
|
20003
|
+
parent,
|
|
20004
|
+
/** @type {string} */ (specifier),
|
|
19631
20005
|
/** @type {ResolveContext} */ (resolveContext),
|
|
19632
20006
|
);
|
|
19633
20007
|
};
|
|
@@ -20448,6 +20822,7 @@ module.exports.processImportsField = function processImportsField(
|
|
|
20448
20822
|
|
|
20449
20823
|
|
|
20450
20824
|
|
|
20825
|
+
const memoize = __webpack_require__(7043);
|
|
20451
20826
|
const stripJsonComments = __webpack_require__(959);
|
|
20452
20827
|
|
|
20453
20828
|
/** @typedef {import("../Resolver").FileSystem} FileSystem */
|
|
@@ -20458,9 +20833,33 @@ const stripJsonComments = __webpack_require__(959);
|
|
|
20458
20833
|
* @property {boolean=} stripComments Whether to strip JSONC comments
|
|
20459
20834
|
*/
|
|
20460
20835
|
|
|
20461
|
-
/** @type {WeakMap<Buffer, JsonObject>} */
|
|
20836
|
+
/** @type {WeakMap<Buffer | Uint8Array, JsonObject>} */
|
|
20462
20837
|
const _stripCommentsCache = new WeakMap();
|
|
20463
20838
|
|
|
20839
|
+
// Only constructed for non-Buffer input: on Node the `Buffer.isBuffer` branch
|
|
20840
|
+
// in `decodeText` handles decoding, so the global `TextDecoder` (Node 11+,
|
|
20841
|
+
// always present in browsers/Deno/Bun) is only reached off the Buffer path.
|
|
20842
|
+
// `ignoreBOM: true` keeps a leading BOM in the output, matching
|
|
20843
|
+
// `Buffer.toString("utf8")` so both decode paths behave identically.
|
|
20844
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
20845
|
+
const getDecoder = memoize(() => new TextDecoder("utf-8", { ignoreBOM: true }));
|
|
20846
|
+
|
|
20847
|
+
/**
|
|
20848
|
+
* Decode a file's raw contents to text without assuming a Node runtime. A
|
|
20849
|
+
* `Buffer` (Node) uses its fast native `toString`; any other binary input
|
|
20850
|
+
* (`Uint8Array` from a browser/Deno/Bun file system) goes through
|
|
20851
|
+
* `TextDecoder`, and strings are returned as-is.
|
|
20852
|
+
* @param {string | Buffer | Uint8Array} data raw file contents
|
|
20853
|
+
* @returns {string} decoded text
|
|
20854
|
+
*/
|
|
20855
|
+
const decodeText = (data) => {
|
|
20856
|
+
if (typeof data === "string") return data;
|
|
20857
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) {
|
|
20858
|
+
return data.toString("utf8");
|
|
20859
|
+
}
|
|
20860
|
+
return getDecoder().decode(data);
|
|
20861
|
+
};
|
|
20862
|
+
|
|
20464
20863
|
/**
|
|
20465
20864
|
* Read and parse JSON file (supports JSONC with comments).
|
|
20466
20865
|
* Callback-based so a synchronous `fileSystem` stays synchronous all the
|
|
@@ -20486,16 +20885,21 @@ function readJson(fileSystem, jsonFilePath, options, callback) {
|
|
|
20486
20885
|
|
|
20487
20886
|
fileSystem.readFile(jsonFilePath, (err, data) => {
|
|
20488
20887
|
if (err) return callback(err);
|
|
20489
|
-
const buf = /** @type {Buffer} */ (data);
|
|
20888
|
+
const buf = /** @type {Buffer | Uint8Array | string} */ (data);
|
|
20889
|
+
|
|
20890
|
+
// The strip-comments cache is keyed by the file-contents object; a file
|
|
20891
|
+
// system may hand back a plain string, which cannot be a WeakMap key, so
|
|
20892
|
+
// only cache when the contents are an object.
|
|
20893
|
+
const cacheable = stripComments && typeof buf === "object";
|
|
20490
20894
|
|
|
20491
|
-
if (
|
|
20895
|
+
if (cacheable) {
|
|
20492
20896
|
const cached = _stripCommentsCache.get(buf);
|
|
20493
20897
|
if (cached !== undefined) return callback(null, cached);
|
|
20494
20898
|
}
|
|
20495
20899
|
|
|
20496
20900
|
let result;
|
|
20497
20901
|
try {
|
|
20498
|
-
const jsonText = buf
|
|
20902
|
+
const jsonText = decodeText(buf);
|
|
20499
20903
|
const jsonWithoutComments = stripComments
|
|
20500
20904
|
? stripJsonComments(jsonText, {
|
|
20501
20905
|
trailingCommas: true,
|
|
@@ -20507,7 +20911,7 @@ function readJson(fileSystem, jsonFilePath, options, callback) {
|
|
|
20507
20911
|
return callback(/** @type {Error} */ (parseErr));
|
|
20508
20912
|
}
|
|
20509
20913
|
|
|
20510
|
-
if (
|
|
20914
|
+
if (cacheable) {
|
|
20511
20915
|
_stripCommentsCache.set(buf, result);
|
|
20512
20916
|
}
|
|
20513
20917
|
|
|
@@ -20515,6 +20919,7 @@ function readJson(fileSystem, jsonFilePath, options, callback) {
|
|
|
20515
20919
|
});
|
|
20516
20920
|
}
|
|
20517
20921
|
|
|
20922
|
+
module.exports.decodeText = decodeText;
|
|
20518
20923
|
module.exports.readJson = readJson;
|
|
20519
20924
|
|
|
20520
20925
|
|
|
@@ -20531,9 +20936,7 @@ module.exports.readJson = readJson;
|
|
|
20531
20936
|
|
|
20532
20937
|
|
|
20533
20938
|
|
|
20534
|
-
const
|
|
20535
|
-
|
|
20536
|
-
const getUrl = memorize(() => __webpack_require__(7016));
|
|
20939
|
+
const { fileURLToPath } = __webpack_require__(7016);
|
|
20537
20940
|
|
|
20538
20941
|
const PATH_QUERY_FRAGMENT_REGEXP =
|
|
20539
20942
|
/^(#?(?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
|
|
@@ -20570,7 +20973,7 @@ function parseIdentifier(identifier) {
|
|
|
20570
20973
|
}
|
|
20571
20974
|
|
|
20572
20975
|
if (FILE_REG_EXP.test(identifier)) {
|
|
20573
|
-
identifier =
|
|
20976
|
+
identifier = fileURLToPath(identifier);
|
|
20574
20977
|
}
|
|
20575
20978
|
|
|
20576
20979
|
const firstEscape = identifier.indexOf("\0");
|
|
@@ -20689,6 +21092,7 @@ var __webpack_unused_export__;
|
|
|
20689
21092
|
|
|
20690
21093
|
|
|
20691
21094
|
const path = __webpack_require__(6928);
|
|
21095
|
+
const { fileURLToPath } = __webpack_require__(7016);
|
|
20692
21096
|
|
|
20693
21097
|
const CHAR_HASH = "#".charCodeAt(0);
|
|
20694
21098
|
const CHAR_SLASH = "/".charCodeAt(0);
|
|
@@ -20699,7 +21103,6 @@ const CHAR_LOWER_A = "a".charCodeAt(0);
|
|
|
20699
21103
|
const CHAR_LOWER_Z = "z".charCodeAt(0);
|
|
20700
21104
|
const CHAR_DOT = ".".charCodeAt(0);
|
|
20701
21105
|
const CHAR_COLON = ":".charCodeAt(0);
|
|
20702
|
-
const CHAR_QUESTION = "?".charCodeAt(0);
|
|
20703
21106
|
|
|
20704
21107
|
const posixNormalize = path.posix.normalize;
|
|
20705
21108
|
const winNormalize = path.win32.normalize;
|
|
@@ -20722,20 +21125,6 @@ const deprecatedInvalidSegmentRegEx =
|
|
|
20722
21125
|
const invalidSegmentRegEx =
|
|
20723
21126
|
/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i;
|
|
20724
21127
|
|
|
20725
|
-
/**
|
|
20726
|
-
* @param {string} maybePath a path known to start with `\\`
|
|
20727
|
-
* @returns {PathType} AbsoluteWin for `\\?\…` / `\\.\…`, otherwise Normal
|
|
20728
|
-
*/
|
|
20729
|
-
const getDosDeviceType = (maybePath) => {
|
|
20730
|
-
if (maybePath.length >= 4 && maybePath.charCodeAt(3) === CHAR_BACKSLASH) {
|
|
20731
|
-
const c2 = maybePath.charCodeAt(2);
|
|
20732
|
-
if (c2 === CHAR_QUESTION || c2 === CHAR_DOT) {
|
|
20733
|
-
return PathType.AbsoluteWin;
|
|
20734
|
-
}
|
|
20735
|
-
}
|
|
20736
|
-
return PathType.Normal;
|
|
20737
|
-
};
|
|
20738
|
-
|
|
20739
21128
|
/**
|
|
20740
21129
|
* @param {string} maybePath a path
|
|
20741
21130
|
* @returns {PathType} type of path
|
|
@@ -20781,6 +21170,9 @@ const getType = (maybePath) => {
|
|
|
20781
21170
|
) {
|
|
20782
21171
|
return PathType.AbsoluteWin;
|
|
20783
21172
|
}
|
|
21173
|
+
if (c0 === CHAR_BACKSLASH && c1 === CHAR_BACKSLASH) {
|
|
21174
|
+
return PathType.AbsoluteWin;
|
|
21175
|
+
}
|
|
20784
21176
|
return PathType.Normal;
|
|
20785
21177
|
}
|
|
20786
21178
|
}
|
|
@@ -20815,12 +21207,11 @@ const getType = (maybePath) => {
|
|
|
20815
21207
|
return PathType.AbsoluteWin;
|
|
20816
21208
|
}
|
|
20817
21209
|
}
|
|
20818
|
-
//
|
|
20819
|
-
//
|
|
20820
|
-
// `
|
|
20821
|
-
// only pay the two-byte gate for non-DOS inputs.
|
|
21210
|
+
// Two leading backslashes root a UNC share (`\\server\share`) or a DOS
|
|
21211
|
+
// device path (`\\?\…`, `\\.\…`); `path.win32` reads either as absolute,
|
|
21212
|
+
// so both belong on `path.win32` and not on posix.
|
|
20822
21213
|
if (c0 === CHAR_BACKSLASH && c1 === CHAR_BACKSLASH) {
|
|
20823
|
-
return
|
|
21214
|
+
return PathType.AbsoluteWin;
|
|
20824
21215
|
}
|
|
20825
21216
|
return PathType.Normal;
|
|
20826
21217
|
};
|
|
@@ -20980,39 +21371,154 @@ const isRelativeRequest = (request) => {
|
|
|
20980
21371
|
};
|
|
20981
21372
|
|
|
20982
21373
|
/**
|
|
20983
|
-
*
|
|
21374
|
+
* Whether this is a Windows path, in which `/` and `\` are interchangeable and
|
|
21375
|
+
* paths compare case-insensitively, as opposed to a posix path, in which `\` is
|
|
21376
|
+
* an ordinary filename character. Decided by the root — a drive letter or a
|
|
21377
|
+
* leading `\` — which is where `path.win32` and `path.posix` disagree about
|
|
21378
|
+
* `parse(maybePath).root`, and never by the host platform, since Windows paths
|
|
21379
|
+
* are resolved on posix hosts and in browsers too. A path starting with `//`
|
|
21380
|
+
* stays posix: `path.win32` reads it as a UNC root, but here it cannot be told
|
|
21381
|
+
* apart from a posix path, where `\` has to keep being a filename character.
|
|
21382
|
+
* @param {string} maybePath a path
|
|
21383
|
+
* @returns {boolean} true, when the path is a Windows path
|
|
21384
|
+
*/
|
|
21385
|
+
const isWindowsPath = (maybePath) => {
|
|
21386
|
+
const c0 = maybePath.charCodeAt(0);
|
|
21387
|
+
if (c0 === CHAR_BACKSLASH) return true;
|
|
21388
|
+
if (maybePath.charCodeAt(1) !== CHAR_COLON) return false;
|
|
21389
|
+
return (
|
|
21390
|
+
(c0 >= CHAR_A && c0 <= CHAR_Z) || (c0 >= CHAR_LOWER_A && c0 <= CHAR_LOWER_Z)
|
|
21391
|
+
);
|
|
21392
|
+
};
|
|
21393
|
+
|
|
21394
|
+
/**
|
|
21395
|
+
* @param {number} charCode a char code
|
|
21396
|
+
* @param {boolean} windowsPath whether `\` separates segments
|
|
21397
|
+
* @returns {boolean} true, when the char code separates path segments
|
|
21398
|
+
*/
|
|
21399
|
+
const isSeparator = (charCode, windowsPath) =>
|
|
21400
|
+
charCode === CHAR_SLASH || (windowsPath && charCode === CHAR_BACKSLASH);
|
|
21401
|
+
|
|
21402
|
+
/**
|
|
21403
|
+
* @param {string} parentPath parent directory path
|
|
21404
|
+
* @param {boolean} windowsPath whether `parentPath` is a Windows path
|
|
21405
|
+
* @returns {number} length of `parentPath` without its trailing separators
|
|
21406
|
+
*/
|
|
21407
|
+
const parentPathLength = (parentPath, windowsPath) => {
|
|
21408
|
+
let end = parentPath.length;
|
|
21409
|
+
while (end > 0 && isSeparator(parentPath.charCodeAt(end - 1), windowsPath)) {
|
|
21410
|
+
end--;
|
|
21411
|
+
}
|
|
21412
|
+
return end;
|
|
21413
|
+
};
|
|
21414
|
+
|
|
21415
|
+
/**
|
|
21416
|
+
* Cold path of `startsWithPath`: Node lowercases whole paths rather than single
|
|
21417
|
+
* characters, which only makes a difference outside of ASCII.
|
|
21418
|
+
* @param {string} parentPath parent directory path
|
|
21419
|
+
* @param {number} length number of characters to compare
|
|
21420
|
+
* @param {string} childPath child path to check
|
|
21421
|
+
* @returns {boolean} true, when both prefixes name the same Windows path
|
|
21422
|
+
*/
|
|
21423
|
+
const equalsWindowsPrefix = (parentPath, length, childPath) =>
|
|
21424
|
+
childPath.slice(0, length).replace(/\//g, "\\").toLowerCase() ===
|
|
21425
|
+
parentPath.slice(0, length).replace(/\//g, "\\").toLowerCase();
|
|
21426
|
+
|
|
21427
|
+
/**
|
|
21428
|
+
* @param {string} parentPath parent directory path
|
|
21429
|
+
* @param {number} length number of characters of `parentPath` to compare
|
|
21430
|
+
* @param {string} childPath child path to check
|
|
21431
|
+
* @param {boolean} windowsPath whether `parentPath` is a Windows path
|
|
21432
|
+
* @returns {boolean} true, when `childPath` starts with that prefix
|
|
21433
|
+
*/
|
|
21434
|
+
const startsWithPath = (parentPath, length, childPath, windowsPath) => {
|
|
21435
|
+
if (childPath.length < length) return false;
|
|
21436
|
+
// The common case is an exact prefix of a parent without trailing
|
|
21437
|
+
// separators, which `startsWith` answers natively and without a slice. For
|
|
21438
|
+
// a posix parent that is the whole answer, only a Windows one has more
|
|
21439
|
+
// spellings of the same path to try.
|
|
21440
|
+
if (length === parentPath.length) {
|
|
21441
|
+
if (childPath.startsWith(parentPath)) return true;
|
|
21442
|
+
if (!windowsPath) return false;
|
|
21443
|
+
}
|
|
21444
|
+
for (let i = 0; i < length; i++) {
|
|
21445
|
+
const childCharCode = childPath.charCodeAt(i);
|
|
21446
|
+
const parentCharCode = parentPath.charCodeAt(i);
|
|
21447
|
+
if (childCharCode === parentCharCode) continue;
|
|
21448
|
+
if (!windowsPath) return false;
|
|
21449
|
+
// Windows mixes `/` and `\` freely and compares case-insensitively.
|
|
21450
|
+
if (isSeparator(childCharCode, true) && isSeparator(parentCharCode, true)) {
|
|
21451
|
+
continue;
|
|
21452
|
+
}
|
|
21453
|
+
if (childCharCode > 127 || parentCharCode > 127) {
|
|
21454
|
+
return equalsWindowsPrefix(parentPath, length, childPath);
|
|
21455
|
+
}
|
|
21456
|
+
const childLower =
|
|
21457
|
+
childCharCode >= CHAR_A && childCharCode <= CHAR_Z
|
|
21458
|
+
? childCharCode + 32
|
|
21459
|
+
: childCharCode;
|
|
21460
|
+
const parentLower =
|
|
21461
|
+
parentCharCode >= CHAR_A && parentCharCode <= CHAR_Z
|
|
21462
|
+
? parentCharCode + 32
|
|
21463
|
+
: parentCharCode;
|
|
21464
|
+
if (childLower !== parentLower) return false;
|
|
21465
|
+
}
|
|
21466
|
+
return true;
|
|
21467
|
+
};
|
|
21468
|
+
|
|
21469
|
+
/**
|
|
21470
|
+
* Whether childPath is parentPath itself or a path under it, the answer node's
|
|
21471
|
+
* `relative(parentPath, childPath)` gives: not escaping upward and not
|
|
21472
|
+
* absolute. A trailing separator on the parent is not part of the boundary, so
|
|
21473
|
+
* `/a/b/` contains exactly what `/a/b` contains.
|
|
21474
|
+
* @param {string} parentPath parent directory path
|
|
21475
|
+
* @param {string} childPath child path to check
|
|
21476
|
+
* @returns {boolean} true if childPath is parentPath or is under it
|
|
21477
|
+
*/
|
|
21478
|
+
const isInside = (parentPath, childPath) => {
|
|
21479
|
+
const windowsPath = isWindowsPath(parentPath);
|
|
21480
|
+
const length = parentPathLength(parentPath, windowsPath);
|
|
21481
|
+
if (!startsWithPath(parentPath, length, childPath, windowsPath)) return false;
|
|
21482
|
+
// The parent itself, or a segment boundary right after it so that `/a/b`
|
|
21483
|
+
// does not contain the sibling `/a/b-other`.
|
|
21484
|
+
return (
|
|
21485
|
+
childPath.length === length ||
|
|
21486
|
+
isSeparator(childPath.charCodeAt(length), windowsPath)
|
|
21487
|
+
);
|
|
21488
|
+
};
|
|
21489
|
+
|
|
21490
|
+
/**
|
|
21491
|
+
* Check if childPath is a subdirectory of parentPath. Compares like `isInside`,
|
|
21492
|
+
* except that a path is not a subpath of itself.
|
|
20984
21493
|
*
|
|
20985
21494
|
* Called from `TsconfigPathsPlugin._selectPathsDataForContext` inside a loop
|
|
20986
21495
|
* over every tsconfig-paths context on every resolve, so it's worth keeping
|
|
20987
|
-
* cheap
|
|
20988
|
-
*
|
|
20989
|
-
* `endsWith` calls; and skips `normalize()` entirely in the common case
|
|
20990
|
-
* (parent has no trailing separator), since all we really need is the same
|
|
20991
|
-
* anchoring effect — a cheap `startsWith` plus a separator char check on the
|
|
20992
|
-
* byte immediately after `parentPath.length`.
|
|
21496
|
+
* cheap: a native `startsWith` plus a separator char check answers it, and the
|
|
21497
|
+
* character loop only runs for a Windows path that the prefix test missed.
|
|
20993
21498
|
* @param {string} parentPath parent directory path
|
|
20994
21499
|
* @param {string} childPath child path to check
|
|
20995
21500
|
* @returns {boolean} true if childPath is under parentPath
|
|
20996
21501
|
*/
|
|
20997
21502
|
const isSubPath = (parentPath, childPath) => {
|
|
20998
|
-
const
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
}
|
|
21004
|
-
const lastChar = parentPath.charCodeAt(parentLen - 1);
|
|
21005
|
-
if (lastChar === CHAR_SLASH || lastChar === CHAR_BACKSLASH) {
|
|
21006
|
-
// Parent already ends with a separator — a plain prefix test is enough.
|
|
21007
|
-
return childPath.startsWith(parentPath);
|
|
21008
|
-
}
|
|
21009
|
-
if (childPath.length <= parentLen) return false;
|
|
21010
|
-
if (!childPath.startsWith(parentPath)) return false;
|
|
21011
|
-
// Must be followed by a separator so "/app" doesn't match "/app-other".
|
|
21012
|
-
const nextChar = childPath.charCodeAt(parentLen);
|
|
21013
|
-
return nextChar === CHAR_SLASH || nextChar === CHAR_BACKSLASH;
|
|
21503
|
+
const windowsPath = isWindowsPath(parentPath);
|
|
21504
|
+
const length = parentPathLength(parentPath, windowsPath);
|
|
21505
|
+
if (childPath.length <= length) return false;
|
|
21506
|
+
if (!startsWithPath(parentPath, length, childPath, windowsPath)) return false;
|
|
21507
|
+
return isSeparator(childPath.charCodeAt(length), windowsPath);
|
|
21014
21508
|
};
|
|
21015
21509
|
|
|
21510
|
+
/**
|
|
21511
|
+
* Convert a `file:` `URL` instance to a filesystem path; any other input
|
|
21512
|
+
* (including plain strings) is returned unchanged. Mirrors Node's `fs`, which
|
|
21513
|
+
* treats strings as literal paths and only `URL` objects as URLs (see
|
|
21514
|
+
* nodejs/node#17658) — so a directory literally named `file:` is never
|
|
21515
|
+
* mistaken for a URL.
|
|
21516
|
+
* @param {string | URL} maybeURL a path string or a `file:` `URL` instance
|
|
21517
|
+
* @returns {string} a filesystem path
|
|
21518
|
+
*/
|
|
21519
|
+
const toPath = (maybeURL) =>
|
|
21520
|
+
maybeURL instanceof URL ? fileURLToPath(maybeURL) : maybeURL;
|
|
21521
|
+
|
|
21016
21522
|
module.exports.PathType = PathType;
|
|
21017
21523
|
module.exports.createCachedBasename = createCachedBasename;
|
|
21018
21524
|
module.exports.createCachedDirname = createCachedDirname;
|
|
@@ -21021,10 +21527,13 @@ module.exports.deprecatedInvalidSegmentRegEx = deprecatedInvalidSegmentRegEx;
|
|
|
21021
21527
|
__webpack_unused_export__ = dirname;
|
|
21022
21528
|
module.exports.getType = getType;
|
|
21023
21529
|
module.exports.invalidSegmentRegEx = invalidSegmentRegEx;
|
|
21530
|
+
module.exports.isInside = isInside;
|
|
21024
21531
|
module.exports.isRelativeRequest = isRelativeRequest;
|
|
21025
21532
|
module.exports.isSubPath = isSubPath;
|
|
21533
|
+
__webpack_unused_export__ = isWindowsPath;
|
|
21026
21534
|
__webpack_unused_export__ = join;
|
|
21027
21535
|
module.exports.normalize = normalize;
|
|
21536
|
+
module.exports.toPath = toPath;
|
|
21028
21537
|
|
|
21029
21538
|
|
|
21030
21539
|
/***/ },
|
|
@@ -23858,35 +24367,12 @@ module.exports = Array.isArray || function (arr) {
|
|
|
23858
24367
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
23859
24368
|
|
|
23860
24369
|
"use strict";
|
|
23861
|
-
__webpack_require__.r(__webpack_exports__);
|
|
23862
24370
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23863
|
-
/* harmony export */ LOG_LEVELS: () => (/* binding */ e),
|
|
23864
|
-
/* harmony export */ createDateTimePipe: () => (/* binding */ g),
|
|
23865
|
-
/* harmony export */ createJsonPipe: () => (/* binding */ x),
|
|
23866
|
-
/* harmony export */ createJsonStringifyPipe: () => (/* binding */ P),
|
|
23867
|
-
/* harmony export */ createLogCachePipe: () => (/* binding */ O),
|
|
23868
24371
|
/* harmony export */ createLogLevelFilterPipe: () => (/* binding */ V),
|
|
23869
|
-
/* harmony export */
|
|
23870
|
-
/* harmony export */ createNoopPipe: () => (/* binding */ M),
|
|
23871
|
-
/* harmony export */ estimateArgsSizeByStringify: () => (/* binding */ L),
|
|
23872
|
-
/* harmony export */ generateUuidSimple: () => (/* binding */ v),
|
|
23873
|
-
/* harmony export */ getConsoleOverrides: () => (/* binding */ l),
|
|
23874
|
-
/* harmony export */ getDefaultDateTimePipeOptions: () => (/* binding */ f),
|
|
23875
|
-
/* harmony export */ getDefaultJsonPipeOptions: () => (/* binding */ h),
|
|
23876
|
-
/* harmony export */ getDefaultJsonSimplifierOptions: () => (/* binding */ y),
|
|
23877
|
-
/* harmony export */ getDefaultJsonStringifyPipeOptions: () => (/* binding */ S),
|
|
23878
|
-
/* harmony export */ getDefaultLogCachePipeOptions: () => (/* binding */ j),
|
|
23879
|
-
/* harmony export */ getLogMessageFilterPipeOptions: () => (/* binding */ I),
|
|
23880
|
-
/* harmony export */ getOriginalConsoleMethods: () => (/* binding */ u),
|
|
23881
|
-
/* harmony export */ installConsoleOverride: () => (/* binding */ o),
|
|
23882
|
-
/* harmony export */ installConsoleOverrides: () => (/* binding */ i),
|
|
23883
|
-
/* harmony export */ simplifyJson: () => (/* binding */ d),
|
|
23884
|
-
/* harmony export */ simplifyValue: () => (/* binding */ b),
|
|
23885
|
-
/* harmony export */ uninstallAllConsoleOverrides: () => (/* binding */ c),
|
|
23886
|
-
/* harmony export */ uninstallConsoleOverride: () => (/* binding */ s),
|
|
23887
|
-
/* harmony export */ uninstallConsoleOverrides: () => (/* binding */ a)
|
|
24372
|
+
/* harmony export */ installConsoleOverrides: () => (/* binding */ i)
|
|
23888
24373
|
/* harmony export */ });
|
|
23889
|
-
|
|
24374
|
+
/* unused harmony exports LOG_LEVELS, createDateTimePipe, createJsonPipe, createJsonStringifyPipe, createLogCachePipe, createLogMessageFilterPipe, createNoopPipe, estimateArgsSizeByStringify, generateUuidSimple, getConsoleOverrides, getDefaultDateTimePipeOptions, getDefaultJsonPipeOptions, getDefaultJsonSimplifierOptions, getDefaultJsonStringifyPipeOptions, getDefaultLogCachePipeOptions, getLogMessageFilterPipeOptions, getOriginalConsoleMethods, installConsoleOverride, simplifyJson, simplifyValue, uninstallAllConsoleOverrides, uninstallConsoleOverride, uninstallConsoleOverrides */
|
|
24375
|
+
const e=["debug","error","info","log","trace","warn"],t=[],r=()=>{},n={debug:r,error:r,info:r,log:r,trace:r,warn:r};function o(e){i(...Array.isArray(e)?e:[e])}function i(...o){!function(){if(n.debug===r)for(const r of e)n[r]=console[r],console[r]=(...e)=>{var o,i,s;let a=r,c=e;for(const e of t){const t=e(a,...c);if(!t||(Array.isArray(t)?0===(null!==(o=null==t?void 0:t.length)&&void 0!==o?o:0):0===(null!==(s=null===(i=t.args)||void 0===i?void 0:i.length)&&void 0!==s?s:0)))return;Array.isArray(t)?c=t:(a=t.level,c=t.args)}n[a](...c)}}();for(const e of o)!t.includes(e)&&e.onInstall&&e.onInstall(),t.push(e)}function s(e){a(...Array.isArray(e)?e:[e])}function a(...o){for(const e of o)for(let r=t.indexOf(e);r>=0;r=t.indexOf(e)){const e=t.splice(r,1)[0];!t.includes(e)&&e.onUninstall&&e.onUninstall()}!function(){if(!(t.length>0)&&n.debug!==r)for(const t of e)console[t]=n[t],n[t]=r}()}function c(){for(const e of[...t])s(e)}function l(){return[...t]}function u(){if(n.debug!==r)return Object.assign({},n);const t={};for(const r of e)t[r]=console[r];return t}function f(){return{dateFormatter:e=>new Date(e).toISOString()}}function g({dateFormatter:e}=f()){return(t,...r)=>[e(Date.now()),...r]}function y(){return{maxDepthLimit:10,maxArrayLength:100,maxObjectPropertyCount:100,isIgnoredProperty:()=>!1,replacePropertyValue:(e,t)=>t,depthLimitValue:"[Depth limit ~]",arrayLengthLimitValue:"[Array, length: $length ~]",objectPropertyCountLimitValue:"[Object, properties: $count ~]",circularReferenceValue:"[Circular ~]",functionValue:"[Function ~]",symbolValue:"[Symbol ~]"}}const p=(/* unused pure expression or super */ null && ({maxDepthLimit:10,maxArrayLength:100,maxObjectPropertyCount:100,isIgnoredProperty:()=>!1,replacePropertyValue:(e,t)=>t,depthLimitValue:"[Depth limit ~]",arrayLengthLimitValue:"[Array, length: $length ~]",objectPropertyCountLimitValue:"[Object, properties: $count ~]",circularReferenceValue:"[Circular ~]",functionValue:"[Function ~]",symbolValue:"[Symbol ~]"})),m=(/* unused pure expression or super */ null && (["cause","message","name","stack"]));function d(e,t={},r=0,n=new Set){const o=Object.assign(Object.assign({},p),t);if(r>o.maxDepthLimit)return o.depthLimitValue;if("string"==typeof(e=b(e))||"boolean"==typeof e||"number"==typeof e||null==e)return e;if(n.has(e))return o.circularReferenceValue;if(n.add(e),Array.isArray(e))return e.length>o.maxArrayLength?o.arrayLengthLimitValue.replace("$length",`${e.length}`):e.map((e=>d(e,o,r+1,n)));const i=Object.entries(e);if(i.length>o.maxObjectPropertyCount)return o.objectPropertyCountLimitValue.replace("$count",`${i.length}`);const s={};for(const[e,t]of i)0===r&&o.isIgnoredProperty(e)||(s[e]=d(t,o,r+1,n));for(const t of m)if(!s[t]&&!o.isIgnoredProperty(t)){const i=e[t];void 0!==i&&(s[t]=d(i,o,r+1,n))}if(o.replacePropertyValue!==p.replacePropertyValue)for(const[e,t]of Object.entries(s))s[e]=o.replacePropertyValue(e,t);return s}function b(e,t={}){if(null==e)return e;switch(typeof e){case"undefined":case"boolean":case"string":return e;case"bigint":return`BigInt(${e.toString()})`;case"number":return isNaN(e)?"NaN":e===1/0?"Infinity":e===-1/0?"-Infinity":e;case"function":return t.functionValue||p.functionValue;case"symbol":return t.symbolValue||p.symbolValue;case"object":if(e instanceof Set)return[...e.keys()];if(e instanceof Map)return Object.fromEntries([...e.entries()]);if(e instanceof String||e instanceof Number||e instanceof Boolean)return e.valueOf();if(e instanceof Date)return e.toISOString()}return e}function h(){return Object.assign(Object.assign({},{maxDepthLimit:10,maxArrayLength:100,maxObjectPropertyCount:100,isIgnoredProperty:()=>!1,replacePropertyValue:(e,t)=>t,depthLimitValue:"[Depth limit ~]",arrayLengthLimitValue:"[Array, length: $length ~]",objectPropertyCountLimitValue:"[Object, properties: $count ~]",circularReferenceValue:"[Circular ~]",functionValue:"[Function ~]",symbolValue:"[Symbol ~]"}),{messagePropertyName:"message",levelPropertyName:"level",levelPropertyFormatter:e=>e,timestampPropertyName:"timestamp",timestampPropertyFormatter:e=>new Date(e).toISOString(),messageIdPropertyName:"message_id",messageIdPropertyProvider:v,isIgnoredProperty:()=>!1,getObjectMessageToken:e=>`$${e+1}`,pickFieldNameAsObjectMessageTokenForSingleFieldObjects:!1,undefinedMessageValue:void 0})}function x(e={}){const t=h(),r=Object.assign(Object.assign({},t),e);let n,o="";const i=(e,...i)=>{const s={};let a;s[r.messagePropertyName]=void 0;let c=0;for(let e=0;e<i.length;e++){const t=b(i[e]);let n=t;if("object"==typeof t&&null!==t){let o=d(t,r);if(r.pickFieldNameAsObjectMessageTokenForSingleFieldObjects&&"object"==typeof o&&null!==o){const e=Object.entries(o);if(1===e.length){const[t,r]=e[0],i=`$${t}`;if(void 0===s[i])if(n=i,null===(l=r)||"string"==typeof l||void 0===l||"number"==typeof l||"boolean"==typeof l){const e="string"==typeof r?"'":"";n+=`:[${e}${r}${e}]`,o=void 0}else o=r}}"string"!=typeof n&&(n=r.getObjectMessageToken(c,t,e),c++),s[n]=o}else void 0===t?void 0!==r.undefinedMessageValue&&(n+=r.undefinedMessageValue):n=t;a=void 0===a?`${n}`:`${a} ${n}`}var l;if(a&&(s[r.messagePropertyName]=a),r.levelPropertyName&&(s[r.levelPropertyName]=r.levelPropertyFormatter(e)),r.timestampPropertyName&&(s[r.timestampPropertyName]=r.timestampPropertyFormatter(Date.now())),r.messageIdPropertyName){let a=n||r.messageIdPropertyProvider(e,...i);void 0===a&&(a=t.messageIdPropertyProvider()),o=a,s[r.messageIdPropertyName]=o,n=void 0}return[s]};return i.getLastMessageId=()=>o,i.setNextMessageId=e=>{n=e},i}function v(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(e+Math.floor(16*Math.random()))%16;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}function S(){return Object.assign(Object.assign({},h()),{preStringifyCallback:()=>{}})}function P(e={}){const t=Object.assign(Object.assign({},S()),e),r=x(t),n=(e,...n)=>{const o=r(e,...n);if(0===o.length)return[];const i=o[0];return t.preStringifyCallback(i),[JSON.stringify(i)]};return n.getLastMessageId=r.getLastMessageId,n.setNextMessageId=r.setNextMessageId,n}function j(){return{cacheSize:1e3,cacheSizeByStringify:-1}}function O(e={}){const t=Object.assign(Object.assign({},{cacheSize:1e3,cacheSizeByStringify:-1}),e);if(t.cacheSize<0||isNaN(t.cacheSize))throw new Error(`Invalid cache size: ${t.cacheSize}`);const r={size:0};let n=!1,o=0;function i(){r.first&&(o>0&&(o-=L(...r.first.value.args)),r.first=r.first.next,r.size--)}const s=(e,...a)=>{if(0===t.cacheSize||n)return a;var c;c={value:{level:e,args:a,timestamp:Date.now()}},void 0===r.last?r.first=c:r.last.next=c,r.last=c,r.size++,t.cacheSizeByStringify>=0&&(o+=L(...c.value.args));const l=r.size>t.cacheSize,u=t.cacheSizeByStringify>=0&&o>t.cacheSizeByStringify;if((l||u)&&t.onCacheSizeReached){n=!0;try{t.onCacheSizeReached(s)}finally{n=!1}}if(u){for(;o>t.cacheSizeByStringify&&void 0!==r.first;)i();o=Math.max(o,0),void 0===r.first&&(o=0)}else l&&i();return a};return s.getMessages=()=>{const e=[];let t=r.first;for(;void 0!==t;)e.push(t.value),t=t.next;return e},s.clearMessages=()=>{r.first=void 0,r.last=void 0,r.size=0,o=0},s.onInstall=()=>s.clearMessages(),s}function L(...e){let t=0;for(const r of e)void 0!==r&&(t+=JSON.stringify(d(r)).length);return t}function V(e={}){const t=Object.assign({excludedLogLevels:[]},e);return(e,...r)=>{const n="function"==typeof t.excludedLogLevels?t.excludedLogLevels(e):t.excludedLogLevels;return("boolean"==typeof n?n:n.includes(e))?[]:r}}function I(){return{isCaseSensitive:!1,excludedMessageTokens:[]}}function N(e){const{excludedMessageTokens:t,isCaseSensitive:r}=Object.assign(Object.assign({},{isCaseSensitive:!1,excludedMessageTokens:[]}),e),n=t.filter((e=>"string"==typeof e)).map((e=>r?e:e.toLowerCase())),o=t.filter((e=>"object"==typeof e));return t.sort(((e,t)=>typeof e==typeof t?0:"string"==typeof e?-1:1)),(e,...i)=>{if(0===t.length)return i;if(r){for(const e of i)if("string"==typeof e){if(n.some((t=>e.includes(t))))return[];if(o.some((t=>t.test(e))))return[]}}else for(const e of i)if("string"==typeof e){const t=e.toLowerCase();if(n.some((e=>t.includes(e))))return[];if(o.some((t=>t.test(e))))return[]}return i}}function M(){return(e,...t)=>t}
|
|
23890
24376
|
//# sourceMappingURL=index.esm.js.map
|
|
23891
24377
|
|
|
23892
24378
|
/***/ },
|
|
@@ -28457,7 +28943,7 @@ exports.decode = function (buf, filenameEncoding) {
|
|
|
28457
28943
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
28458
28944
|
|
|
28459
28945
|
exports.extract = __webpack_require__(7810)
|
|
28460
|
-
|
|
28946
|
+
/* unused reexport */ __webpack_require__(642)
|
|
28461
28947
|
|
|
28462
28948
|
|
|
28463
28949
|
/***/ },
|
|
@@ -31685,17 +32171,18 @@ module.exports = function toBuffer(data, encoding) {
|
|
|
31685
32171
|
(__unused_webpack_module, exports) {
|
|
31686
32172
|
|
|
31687
32173
|
"use strict";
|
|
32174
|
+
var __webpack_unused_export__;
|
|
31688
32175
|
|
|
31689
|
-
|
|
31690
|
-
|
|
31691
|
-
|
|
31692
|
-
|
|
31693
|
-
|
|
31694
|
-
|
|
32176
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32177
|
+
__webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.h3 = exports.VF = __webpack_unused_export__ = exports.F3 = exports.eS = exports.Eh = exports.dH = exports.mz = exports.Pq = exports.lZ = exports.I1 = exports.xV = exports.Kq = exports.oL = exports.hp = exports.AI_PROVIDER_TYPES = __webpack_unused_export__ = void 0;
|
|
32178
|
+
__webpack_unused_export__ = isVendorAiChatModelName;
|
|
32179
|
+
__webpack_unused_export__ = isAiEmbeddingsModelName;
|
|
32180
|
+
__webpack_unused_export__ = isIntegrationEmbeddingModelSpec;
|
|
32181
|
+
__webpack_unused_export__ = isIntegrationModelSpec;
|
|
31695
32182
|
/**
|
|
31696
32183
|
* @category AI
|
|
31697
32184
|
*/
|
|
31698
|
-
|
|
32185
|
+
__webpack_unused_export__ = ['cohere', 'none'];
|
|
31699
32186
|
/** List of available AI provider types. See AiProviderType. */
|
|
31700
32187
|
exports.AI_PROVIDER_TYPES = [
|
|
31701
32188
|
'anthropic',
|
|
@@ -31713,6 +32200,7 @@ exports.AI_PROVIDER_TYPES = [
|
|
|
31713
32200
|
'voyage',
|
|
31714
32201
|
'mistral',
|
|
31715
32202
|
'textract',
|
|
32203
|
+
'azure_document_intelligence',
|
|
31716
32204
|
'vertex',
|
|
31717
32205
|
'external', // This is a technicality, referring to user-defined providers.
|
|
31718
32206
|
];
|
|
@@ -31720,7 +32208,7 @@ exports.AI_PROVIDER_TYPES = [
|
|
|
31720
32208
|
* Public OpenAI chat model names (active models only).
|
|
31721
32209
|
* @category AI
|
|
31722
32210
|
*/
|
|
31723
|
-
exports.
|
|
32211
|
+
exports.hp = [
|
|
31724
32212
|
'gpt-5.4-mini',
|
|
31725
32213
|
'gpt-5.4-nano',
|
|
31726
32214
|
'gpt-5.5',
|
|
@@ -31733,57 +32221,62 @@ exports.OPENAI_CHAT_MODEL_NAMES = [
|
|
|
31733
32221
|
* Public Gemini chat model names (active models only).
|
|
31734
32222
|
* @category AI
|
|
31735
32223
|
*/
|
|
31736
|
-
exports.
|
|
32224
|
+
exports.oL = ['gemini-3.1-pro', 'gemini-3.6-flash', 'gemini-3.5-flash-lite'];
|
|
31737
32225
|
/**
|
|
31738
32226
|
* Public Grok chat model names (active models only).
|
|
31739
32227
|
* @category AI
|
|
31740
32228
|
*/
|
|
31741
|
-
exports.
|
|
32229
|
+
exports.Kq = ['grok-4.5', 'grok-4-1-fast-reasoning', 'grok-4-1-fast-non-reasoning'];
|
|
31742
32230
|
/**
|
|
31743
32231
|
* Public Anthropic chat model names (active models only).
|
|
31744
32232
|
* @category AI
|
|
31745
32233
|
*/
|
|
31746
|
-
exports.
|
|
32234
|
+
exports.xV = [
|
|
32235
|
+
'claude-fable-5',
|
|
32236
|
+
'claude-haiku-4-5-20251001',
|
|
32237
|
+
'claude-opus-5',
|
|
32238
|
+
'claude-sonnet-5',
|
|
32239
|
+
];
|
|
31747
32240
|
/**
|
|
31748
32241
|
* The supported AI model names.
|
|
31749
32242
|
* @category AI
|
|
31750
32243
|
*/
|
|
31751
|
-
exports.
|
|
31752
|
-
...exports.
|
|
31753
|
-
...exports.
|
|
31754
|
-
...exports.
|
|
31755
|
-
...exports.
|
|
32244
|
+
exports.I1 = [
|
|
32245
|
+
...exports.hp,
|
|
32246
|
+
...exports.xV,
|
|
32247
|
+
...exports.oL,
|
|
32248
|
+
...exports.Kq,
|
|
31756
32249
|
];
|
|
31757
32250
|
/** Checks if the given model name is a global AI chat model name. */
|
|
31758
32251
|
function isVendorAiChatModelName(modelName) {
|
|
31759
|
-
return exports.
|
|
32252
|
+
return exports.I1.includes(modelName);
|
|
31760
32253
|
}
|
|
31761
32254
|
/**
|
|
31762
32255
|
* @category AI
|
|
31763
32256
|
*/
|
|
31764
|
-
exports.
|
|
32257
|
+
exports.lZ = ['text-embedding-3-small'];
|
|
31765
32258
|
/**
|
|
31766
32259
|
* @category AI
|
|
31767
32260
|
*/
|
|
31768
|
-
exports.
|
|
32261
|
+
exports.Pq = ['voyage-3-large'];
|
|
31769
32262
|
/**
|
|
31770
32263
|
* @category AI
|
|
31771
32264
|
*/
|
|
31772
|
-
exports.
|
|
32265
|
+
exports.mz = ['titan-embed-text-v2'];
|
|
31773
32266
|
/**
|
|
31774
32267
|
* @category AI
|
|
31775
32268
|
*/
|
|
31776
|
-
exports.
|
|
31777
|
-
...exports.
|
|
31778
|
-
...exports.
|
|
31779
|
-
...exports.
|
|
32269
|
+
exports.dH = [
|
|
32270
|
+
...exports.lZ,
|
|
32271
|
+
...exports.Pq,
|
|
32272
|
+
...exports.mz,
|
|
31780
32273
|
];
|
|
31781
32274
|
/**
|
|
31782
32275
|
* Checks if the given model name is a valid AI embeddings model name.
|
|
31783
32276
|
* @category AI
|
|
31784
32277
|
*/
|
|
31785
32278
|
function isAiEmbeddingsModelName(modelName) {
|
|
31786
|
-
return exports.
|
|
32279
|
+
return exports.dH.includes(modelName);
|
|
31787
32280
|
}
|
|
31788
32281
|
/**
|
|
31789
32282
|
* Type guard for `IntegrationEmbeddingModelSpec`.
|
|
@@ -31796,7 +32289,7 @@ function isIntegrationEmbeddingModelSpec(model) {
|
|
|
31796
32289
|
* The supported AI image generation model names.
|
|
31797
32290
|
* @category AI
|
|
31798
32291
|
*/
|
|
31799
|
-
exports.
|
|
32292
|
+
exports.Eh = [
|
|
31800
32293
|
'gpt-image-1',
|
|
31801
32294
|
'gpt-image-1-mini',
|
|
31802
32295
|
'gpt-image-1.5',
|
|
@@ -31807,7 +32300,7 @@ exports.OPENAI_IMAGE_MODEL_NAMES = [
|
|
|
31807
32300
|
/**
|
|
31808
32301
|
* @category AI
|
|
31809
32302
|
*/
|
|
31810
|
-
exports.
|
|
32303
|
+
exports.eS = [
|
|
31811
32304
|
'whisper-1',
|
|
31812
32305
|
'gpt-4o-transcribe',
|
|
31813
32306
|
'gpt-4o-mini-transcribe',
|
|
@@ -31815,47 +32308,47 @@ exports.OPENAI_AUDIO_TRANSCRIPTION_MODEL_NAMES = [
|
|
|
31815
32308
|
/**
|
|
31816
32309
|
* @category AI
|
|
31817
32310
|
*/
|
|
31818
|
-
exports.
|
|
32311
|
+
exports.F3 = ['tts-1', 'tts-1-hd', 'gpt-4o-mini-tts'];
|
|
31819
32312
|
/**
|
|
31820
32313
|
* @category AI
|
|
31821
32314
|
*/
|
|
31822
|
-
|
|
31823
|
-
...exports.
|
|
31824
|
-
...exports.
|
|
32315
|
+
__webpack_unused_export__ = [
|
|
32316
|
+
...exports.eS,
|
|
32317
|
+
...exports.F3,
|
|
31825
32318
|
];
|
|
31826
32319
|
/**
|
|
31827
32320
|
* @category AI
|
|
31828
32321
|
*/
|
|
31829
|
-
exports.
|
|
32322
|
+
exports.VF = ['stable-diffusion-core'];
|
|
31830
32323
|
/**
|
|
31831
32324
|
* @category AI
|
|
31832
32325
|
*/
|
|
31833
|
-
exports.
|
|
32326
|
+
exports.h3 = ['flux-pro-1.1', 'flux-kontext-pro'];
|
|
31834
32327
|
/**
|
|
31835
32328
|
* @category AI
|
|
31836
32329
|
*/
|
|
31837
|
-
|
|
31838
|
-
...exports.
|
|
31839
|
-
...exports.
|
|
31840
|
-
...exports.
|
|
32330
|
+
__webpack_unused_export__ = [
|
|
32331
|
+
...exports.Eh,
|
|
32332
|
+
...exports.VF,
|
|
32333
|
+
...exports.h3,
|
|
31841
32334
|
];
|
|
31842
32335
|
/**
|
|
31843
32336
|
* @category AI
|
|
31844
32337
|
*/
|
|
31845
|
-
|
|
32338
|
+
__webpack_unused_export__ = [...exports.eS];
|
|
31846
32339
|
/**
|
|
31847
32340
|
* @category AI
|
|
31848
32341
|
*/
|
|
31849
|
-
|
|
32342
|
+
__webpack_unused_export__ = [...exports.F3];
|
|
31850
32343
|
/**
|
|
31851
32344
|
* @category AI
|
|
31852
32345
|
*/
|
|
31853
|
-
|
|
32346
|
+
__webpack_unused_export__ = ['mp3', 'opus', 'aac', 'flac', 'wav', 'pcm'];
|
|
31854
32347
|
/**
|
|
31855
32348
|
* Where a chat model offered to an app comes from. See {@link ModelIdSpec.source}.
|
|
31856
32349
|
* @category AI
|
|
31857
32350
|
*/
|
|
31858
|
-
|
|
32351
|
+
__webpack_unused_export__ = ['vendor', 'connector', 'custom'];
|
|
31859
32352
|
/**
|
|
31860
32353
|
* Type guard to check if a model selection is integration-based.
|
|
31861
32354
|
* @category AI
|
|
@@ -31871,8 +32364,9 @@ function isIntegrationModelSpec(model) {
|
|
|
31871
32364
|
(__unused_webpack_module, exports) {
|
|
31872
32365
|
|
|
31873
32366
|
"use strict";
|
|
32367
|
+
var __webpack_unused_export__;
|
|
31874
32368
|
|
|
31875
|
-
|
|
32369
|
+
__webpack_unused_export__ = ({ value: true });
|
|
31876
32370
|
exports.CONNECTOR_IDS = void 0;
|
|
31877
32371
|
/**
|
|
31878
32372
|
* List of all connector package names.
|
|
@@ -31912,12 +32406,13 @@ exports.CONNECTOR_IDS = [
|
|
|
31912
32406
|
(__unused_webpack_module, exports) {
|
|
31913
32407
|
|
|
31914
32408
|
"use strict";
|
|
32409
|
+
var __webpack_unused_export__;
|
|
31915
32410
|
|
|
31916
|
-
|
|
31917
|
-
exports.
|
|
31918
|
-
|
|
32411
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32412
|
+
exports.EL = exports.y4 = exports.q7 = exports.lO = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.INTEGRATION_TYPES = __webpack_unused_export__ = void 0;
|
|
32413
|
+
__webpack_unused_export__ = isBuiltInIntegrationId;
|
|
31919
32414
|
/** @internal */
|
|
31920
|
-
|
|
32415
|
+
__webpack_unused_export__ = 'ai_agents';
|
|
31921
32416
|
/** List of all integration types supported by Squid. */
|
|
31922
32417
|
exports.INTEGRATION_TYPES = [
|
|
31923
32418
|
'active_directory',
|
|
@@ -32008,7 +32503,7 @@ exports.INTEGRATION_TYPES = [
|
|
|
32008
32503
|
/**
|
|
32009
32504
|
* @category Database
|
|
32010
32505
|
*/
|
|
32011
|
-
|
|
32506
|
+
__webpack_unused_export__ = [
|
|
32012
32507
|
'bigquery',
|
|
32013
32508
|
'built_in_db',
|
|
32014
32509
|
'clickhouse',
|
|
@@ -32027,7 +32522,7 @@ exports.DATA_INTEGRATION_TYPES = [
|
|
|
32027
32522
|
/**
|
|
32028
32523
|
* @category Auth
|
|
32029
32524
|
*/
|
|
32030
|
-
|
|
32525
|
+
__webpack_unused_export__ = [
|
|
32031
32526
|
'auth0',
|
|
32032
32527
|
'jwt_rsa',
|
|
32033
32528
|
'jwt_hmac',
|
|
@@ -32038,34 +32533,40 @@ exports.AUTH_INTEGRATION_TYPES = [
|
|
|
32038
32533
|
'firebase_auth',
|
|
32039
32534
|
'azure-entra-external-id',
|
|
32040
32535
|
];
|
|
32536
|
+
/**
|
|
32537
|
+
* Auth integration types that can OAuth-protect an MCP server (see `McpOAuthOptions` and
|
|
32538
|
+
* `AiAgentMcpServerConfig.oauthIntegrationId`). Kept in sync with the providers supported by the
|
|
32539
|
+
* MCP OAuth validation in core.
|
|
32540
|
+
*/
|
|
32541
|
+
__webpack_unused_export__ = ['auth0'];
|
|
32041
32542
|
/** Supported integration types for GraphQL-based services. */
|
|
32042
|
-
|
|
32543
|
+
__webpack_unused_export__ = ['graphql'];
|
|
32043
32544
|
/** Supported integration types for HTTP-based services. */
|
|
32044
|
-
|
|
32545
|
+
__webpack_unused_export__ = ['api'];
|
|
32045
32546
|
/** Supported schema types for integrations */
|
|
32046
|
-
|
|
32547
|
+
__webpack_unused_export__ = ['data', 'api', 'graphql'];
|
|
32047
32548
|
/**
|
|
32048
32549
|
* @category Database
|
|
32049
32550
|
*/
|
|
32050
|
-
exports.
|
|
32551
|
+
exports.lO = 'built_in_db';
|
|
32051
32552
|
/**
|
|
32052
32553
|
* @category Queue
|
|
32053
32554
|
*/
|
|
32054
|
-
exports.
|
|
32555
|
+
exports.q7 = 'built_in_queue';
|
|
32055
32556
|
/**
|
|
32056
32557
|
* ID for the cloud specific storage integration: s3 (built_in_s3) or gcs (built_in_gcs).
|
|
32057
32558
|
* @category
|
|
32058
32559
|
*/
|
|
32059
|
-
exports.
|
|
32560
|
+
exports.y4 = 'built_in_storage';
|
|
32060
32561
|
/** Integration IDs used for built-in integrations by Squid. */
|
|
32061
|
-
exports.
|
|
32062
|
-
exports.
|
|
32063
|
-
exports.
|
|
32064
|
-
exports.
|
|
32562
|
+
exports.EL = [
|
|
32563
|
+
exports.lO,
|
|
32564
|
+
exports.q7,
|
|
32565
|
+
exports.y4,
|
|
32065
32566
|
];
|
|
32066
32567
|
/** Returns true if ID is a built-in integration ID in Squid. */
|
|
32067
32568
|
function isBuiltInIntegrationId(id) {
|
|
32068
|
-
return exports.
|
|
32569
|
+
return exports.EL.includes(id);
|
|
32069
32570
|
}
|
|
32070
32571
|
|
|
32071
32572
|
|
|
@@ -32075,25 +32576,89 @@ function isBuiltInIntegrationId(id) {
|
|
|
32075
32576
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32076
32577
|
|
|
32077
32578
|
"use strict";
|
|
32579
|
+
var __webpack_unused_export__;
|
|
32078
32580
|
|
|
32079
|
-
|
|
32080
|
-
exports.
|
|
32581
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32582
|
+
exports.SH = exports.a7 = exports.AR = void 0;
|
|
32583
|
+
__webpack_unused_export__ = validateAppIdFormat;
|
|
32584
|
+
__webpack_unused_export__ = assertAppIdFormat;
|
|
32585
|
+
__webpack_unused_export__ = appIdFromHost;
|
|
32586
|
+
__webpack_unused_export__ = parseAppId;
|
|
32081
32587
|
exports.appIdWithEnvironmentId = appIdWithEnvironmentId;
|
|
32082
32588
|
exports.appIdWithEnvironmentIdAndDevId = appIdWithEnvironmentIdAndDevId;
|
|
32083
|
-
|
|
32084
|
-
|
|
32085
|
-
|
|
32589
|
+
__webpack_unused_export__ = validateEnvironment;
|
|
32590
|
+
__webpack_unused_export__ = verifyWithSquidDevId;
|
|
32591
|
+
__webpack_unused_export__ = omitSquidDevId;
|
|
32086
32592
|
/**
|
|
32087
32593
|
* The appId is the unique identifier of an application.
|
|
32088
32594
|
* It is the combination of the application id (as shown in the console), environment id (dev, prod) and the
|
|
32089
32595
|
* developer id (if exists). For example - "fdgfd90ds-dev-1234567890abcdef"
|
|
32090
32596
|
*/
|
|
32091
32597
|
const assertic_1 = __webpack_require__(3205);
|
|
32598
|
+
/**
|
|
32599
|
+
* A DNS label may not exceed 63 bytes, and the appId is one — see [appIdFromHost].
|
|
32600
|
+
*
|
|
32601
|
+
* @internal
|
|
32602
|
+
*/
|
|
32603
|
+
exports.AR = 63;
|
|
32604
|
+
/**
|
|
32605
|
+
* Shortest appId the platform has ever accepted. Not a DNS constraint — a long-standing sanity
|
|
32606
|
+
* guard, kept so consolidating the checks does not quietly widen what is allowed.
|
|
32607
|
+
*
|
|
32608
|
+
* @internal
|
|
32609
|
+
*/
|
|
32610
|
+
exports.a7 = 3;
|
|
32611
|
+
/** @internal */
|
|
32612
|
+
exports.SH = `<appId>[-<environmentId>[-<squidDeveloperId>]], non-empty segments of [A-Za-z0-9], ${exports.a7}-${exports.AR} chars`;
|
|
32613
|
+
/**
|
|
32614
|
+
* Checks the appId format every parser in the stack depends on.
|
|
32615
|
+
*
|
|
32616
|
+
* Two independent reasons, and the appId is terminal inside its own format but inside neither:
|
|
32617
|
+
* - It is a DNS label. `getApplicationUrl` builds `<appId>.<environmentPrefix>.<baseDomain>` and
|
|
32618
|
+
* servers recover it with [appIdFromHost], so a `.` is truncated away before anything validates
|
|
32619
|
+
* it — `app-dev-john.doe` arrives as `app-dev-john`, silently resolving to a different app — while
|
|
32620
|
+
* `/`, `?`, `#`, `:` break URL construction outright, and 63 bytes is the label limit.
|
|
32621
|
+
* - It is the first half of the Redis identifier `<prefix>_<appId>_<clientId>`. clientIds may
|
|
32622
|
+
* contain `_`, so that split is only unambiguous while appIds do not.
|
|
32623
|
+
*
|
|
32624
|
+
* @internal
|
|
32625
|
+
*/
|
|
32626
|
+
function validateAppIdFormat(appId) {
|
|
32627
|
+
const segments = appId.split('-');
|
|
32628
|
+
const isValid = appId.length >= exports.a7 &&
|
|
32629
|
+
appId.length <= exports.AR &&
|
|
32630
|
+
segments.length <= 3 &&
|
|
32631
|
+
segments.every(segment => /^[A-Za-z0-9]+$/.test(segment));
|
|
32632
|
+
return isValid ? null : 'INVALID_FORMAT';
|
|
32633
|
+
}
|
|
32634
|
+
/**
|
|
32635
|
+
* [validateAppIdFormat] for callers that treat a malformed appId as a bug rather than as input.
|
|
32636
|
+
*
|
|
32637
|
+
* @internal
|
|
32638
|
+
*/
|
|
32639
|
+
function assertAppIdFormat(appId) {
|
|
32640
|
+
(0, assertic_1.assertTruthy)(!validateAppIdFormat(appId), `Invalid appId '${appId}'. Format: ${exports.SH}`);
|
|
32641
|
+
}
|
|
32642
|
+
/**
|
|
32643
|
+
* Recovers the appId from an application host such as `<appId>.<environmentPrefix>.<baseDomain>`.
|
|
32644
|
+
*
|
|
32645
|
+
* The one place that knows the appId is the first DNS label, so the assumption is stated once
|
|
32646
|
+
* rather than re-derived at every ingress. Returns the label as-is without validating it: callers
|
|
32647
|
+
* decide whether an unusable value is a rejected request or a thrown error.
|
|
32648
|
+
*
|
|
32649
|
+
* @internal
|
|
32650
|
+
*/
|
|
32651
|
+
function appIdFromHost(host) {
|
|
32652
|
+
return host.split('.')[0];
|
|
32653
|
+
}
|
|
32092
32654
|
/** @internal */
|
|
32093
32655
|
function parseAppId(appId) {
|
|
32094
32656
|
(0, assertic_1.assertString)(appId, 'Invalid application ID');
|
|
32095
|
-
const
|
|
32096
|
-
|
|
32657
|
+
const segments = appId.split('-');
|
|
32658
|
+
// Counted, not tested for a truthy fourth element: `app-dev-alice-` splits into four parts whose
|
|
32659
|
+
// last is '', which a truthiness check would accept.
|
|
32660
|
+
(0, assertic_1.assertTruthy)(segments.length < 4, `Invalid application ID: ${appId}`);
|
|
32661
|
+
const [appIdWithoutEnv, environmentId, squidDeveloperId] = segments;
|
|
32097
32662
|
return {
|
|
32098
32663
|
appId: appIdWithoutEnv,
|
|
32099
32664
|
environmentId: (environmentId ?? 'prod'),
|
|
@@ -32133,8 +32698,9 @@ function omitSquidDevId(appId) {
|
|
|
32133
32698
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32134
32699
|
|
|
32135
32700
|
"use strict";
|
|
32701
|
+
var __webpack_unused_export__;
|
|
32136
32702
|
|
|
32137
|
-
|
|
32703
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32138
32704
|
exports.CONNECTOR_METADATA_JSON_FILE = exports.CONNECTOR_IDS = void 0;
|
|
32139
32705
|
const connector_public_types_1 = __webpack_require__(3046);
|
|
32140
32706
|
Object.defineProperty(exports, "CONNECTOR_IDS", ({ enumerable: true, get: function () { return connector_public_types_1.CONNECTOR_IDS; } }));
|
|
@@ -32148,8 +32714,9 @@ exports.CONNECTOR_METADATA_JSON_FILE = 'connector-metadata.json';
|
|
|
32148
32714
|
(__unused_webpack_module, exports) {
|
|
32149
32715
|
|
|
32150
32716
|
"use strict";
|
|
32717
|
+
var __webpack_unused_export__;
|
|
32151
32718
|
|
|
32152
|
-
|
|
32719
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32153
32720
|
exports.getConsoleAppRegionByStage = getConsoleAppRegionByStage;
|
|
32154
32721
|
/**
|
|
32155
32722
|
* Returns Console application Squid region for the given stage. */
|
|
@@ -32173,31 +32740,32 @@ function getConsoleAppRegionByStage(stage) {
|
|
|
32173
32740
|
(__unused_webpack_module, exports) {
|
|
32174
32741
|
|
|
32175
32742
|
"use strict";
|
|
32743
|
+
var __webpack_unused_export__;
|
|
32176
32744
|
|
|
32177
|
-
|
|
32178
|
-
|
|
32745
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32746
|
+
__webpack_unused_export__ = __webpack_unused_export__ = exports.MILLIS_PER_DAY = __webpack_unused_export__ = exports.MILLIS_PER_MINUTE = exports.MILLIS_PER_SECOND = exports.LW = exports.FN = exports.xz = exports.NG = exports.fA = void 0;
|
|
32179
32747
|
/** @internal */
|
|
32180
|
-
exports.
|
|
32748
|
+
exports.fA = 60;
|
|
32181
32749
|
/** @internal */
|
|
32182
|
-
exports.
|
|
32750
|
+
exports.NG = 60 * exports.fA;
|
|
32183
32751
|
/** @internal */
|
|
32184
|
-
exports.
|
|
32752
|
+
exports.xz = 24 * exports.NG;
|
|
32185
32753
|
/** @internal */
|
|
32186
|
-
exports.
|
|
32754
|
+
exports.FN = 7 * exports.xz;
|
|
32187
32755
|
/** @internal */
|
|
32188
|
-
exports.
|
|
32756
|
+
exports.LW = 30 * exports.xz;
|
|
32189
32757
|
/** @internal */
|
|
32190
32758
|
exports.MILLIS_PER_SECOND = 1000;
|
|
32191
32759
|
/** @internal */
|
|
32192
|
-
exports.MILLIS_PER_MINUTE = exports.
|
|
32760
|
+
exports.MILLIS_PER_MINUTE = exports.fA * exports.MILLIS_PER_SECOND;
|
|
32193
32761
|
/** @internal */
|
|
32194
|
-
|
|
32762
|
+
__webpack_unused_export__ = exports.NG * exports.MILLIS_PER_SECOND;
|
|
32195
32763
|
/** @internal */
|
|
32196
|
-
exports.MILLIS_PER_DAY = exports.
|
|
32764
|
+
exports.MILLIS_PER_DAY = exports.xz * exports.MILLIS_PER_SECOND;
|
|
32197
32765
|
/** @internal */
|
|
32198
|
-
|
|
32766
|
+
__webpack_unused_export__ = exports.FN * exports.MILLIS_PER_SECOND;
|
|
32199
32767
|
/** @internal */
|
|
32200
|
-
|
|
32768
|
+
__webpack_unused_export__ = exports.LW * exports.MILLIS_PER_SECOND;
|
|
32201
32769
|
|
|
32202
32770
|
|
|
32203
32771
|
/***/ },
|
|
@@ -32284,9 +32852,10 @@ function getRuntimeVmLabel() {
|
|
|
32284
32852
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32285
32853
|
|
|
32286
32854
|
"use strict";
|
|
32855
|
+
var __webpack_unused_export__;
|
|
32287
32856
|
|
|
32288
|
-
|
|
32289
|
-
|
|
32857
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32858
|
+
__webpack_unused_export__ = __webpack_unused_export__ = exports.UD = __webpack_unused_export__ = exports.assertConnectorId = __webpack_unused_export__ = void 0;
|
|
32290
32859
|
const assertic_1 = __webpack_require__(3205);
|
|
32291
32860
|
const ai_common_public_types_1 = __webpack_require__(6587);
|
|
32292
32861
|
const integration_public_types_1 = __webpack_require__(6205);
|
|
@@ -32295,7 +32864,7 @@ const connector_types_1 = __webpack_require__(3420);
|
|
|
32295
32864
|
const assertIntegrationType = (value, context = undefined) => {
|
|
32296
32865
|
(0, assertic_1.assertTruthy)(integration_public_types_1.INTEGRATION_TYPES.includes(value), () => (0, assertic_1.formatError)(context, `Not a valid integration type`, value));
|
|
32297
32866
|
};
|
|
32298
|
-
|
|
32867
|
+
__webpack_unused_export__ = assertIntegrationType;
|
|
32299
32868
|
const assertConnectorId = (value, context = undefined) => {
|
|
32300
32869
|
(0, assertic_1.assertTruthy)(connector_types_1.CONNECTOR_IDS.includes(value), () => (0, assertic_1.formatError)(context, `Not a valid connector id`, value));
|
|
32301
32870
|
};
|
|
@@ -32305,15 +32874,15 @@ const assertNotBuiltInIntegrationType = (value, context = undefined) => {
|
|
|
32305
32874
|
(0, assertic_1.assertString)(value, context);
|
|
32306
32875
|
(0, assertic_1.assertTruthy)(!['built_in_db', 'built_in_queue', 'built_in_s3'].includes(value), () => (0, assertic_1.formatError)(context, `The value can't be a built-in integration type`, value));
|
|
32307
32876
|
};
|
|
32308
|
-
|
|
32877
|
+
__webpack_unused_export__ = assertNotBuiltInIntegrationType;
|
|
32309
32878
|
const assertAiProviderType = (value, context = undefined) => {
|
|
32310
32879
|
(0, assertic_1.assertTruthy)(ai_common_public_types_1.AI_PROVIDER_TYPES.includes(value), () => (0, assertic_1.formatError)(context, 'Invalid AI provider type', value));
|
|
32311
32880
|
};
|
|
32312
|
-
exports.
|
|
32313
|
-
|
|
32314
|
-
apiKeys: (0, assertic_1.recordAssertion)(assertic_1.assertString, { keyAssertion: exports.
|
|
32881
|
+
exports.UD = assertAiProviderType;
|
|
32882
|
+
__webpack_unused_export__ = {
|
|
32883
|
+
apiKeys: (0, assertic_1.recordAssertion)(assertic_1.assertString, { keyAssertion: exports.UD }),
|
|
32315
32884
|
};
|
|
32316
|
-
|
|
32885
|
+
__webpack_unused_export__ = {
|
|
32317
32886
|
appConnectors: (0, assertic_1.arrayAssertion)(exports.assertConnectorId, { uniqueByIdentity: (v) => v }),
|
|
32318
32887
|
};
|
|
32319
32888
|
|
|
@@ -32324,8 +32893,9 @@ exports.applicationAppConnectorsAssertion = {
|
|
|
32324
32893
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32325
32894
|
|
|
32326
32895
|
"use strict";
|
|
32896
|
+
var __webpack_unused_export__;
|
|
32327
32897
|
|
|
32328
|
-
|
|
32898
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32329
32899
|
exports.debugLogFilterPipe = void 0;
|
|
32330
32900
|
const logpipes_1 = __webpack_require__(6102);
|
|
32331
32901
|
const enable_debug_logs_decorator_1 = __webpack_require__(5692);
|
|
@@ -32347,9 +32917,10 @@ exports.debugLogFilterPipe = (0, logpipes_1.createLogLevelFilterPipe)({
|
|
|
32347
32917
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32348
32918
|
|
|
32349
32919
|
"use strict";
|
|
32920
|
+
var __webpack_unused_export__;
|
|
32350
32921
|
|
|
32351
|
-
|
|
32352
|
-
|
|
32922
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32923
|
+
__webpack_unused_export__ = EnableDebugLogs;
|
|
32353
32924
|
exports.isInDebugDecoratorContext = isInDebugDecoratorContext;
|
|
32354
32925
|
const async_hooks_1 = __webpack_require__(290);
|
|
32355
32926
|
const store = new async_hooks_1.AsyncLocalStorage();
|
|
@@ -32382,13 +32953,14 @@ function isInDebugDecoratorContext() {
|
|
|
32382
32953
|
(__unused_webpack_module, exports) {
|
|
32383
32954
|
|
|
32384
32955
|
"use strict";
|
|
32956
|
+
var __webpack_unused_export__;
|
|
32385
32957
|
|
|
32386
|
-
|
|
32387
|
-
|
|
32388
|
-
|
|
32958
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32959
|
+
__webpack_unused_export__ = void 0;
|
|
32960
|
+
__webpack_unused_export__ = getGlobal;
|
|
32389
32961
|
exports.isDebugEnabled = isDebugEnabled;
|
|
32390
32962
|
exports.enableDebugLogs = enableDebugLogs;
|
|
32391
|
-
|
|
32963
|
+
__webpack_unused_export__ = disableTimestampsInLog;
|
|
32392
32964
|
/** @internal */
|
|
32393
32965
|
function getGlobal() {
|
|
32394
32966
|
if (typeof window !== 'undefined') {
|
|
@@ -32452,7 +33024,7 @@ class DebugLogger {
|
|
|
32452
33024
|
console.debug(`${getLogPrefixString()} DEBUG`, ...args);
|
|
32453
33025
|
}
|
|
32454
33026
|
}
|
|
32455
|
-
|
|
33027
|
+
__webpack_unused_export__ = DebugLogger;
|
|
32456
33028
|
function getLogPrefixString() {
|
|
32457
33029
|
if (isTimestampsEnabled()) {
|
|
32458
33030
|
const date = new Date();
|
|
@@ -32470,20 +33042,19 @@ function getLogPrefixString() {
|
|
|
32470
33042
|
(__unused_webpack_module, exports) {
|
|
32471
33043
|
|
|
32472
33044
|
"use strict";
|
|
33045
|
+
var __webpack_unused_export__;
|
|
32473
33046
|
|
|
32474
|
-
|
|
32475
|
-
exports.
|
|
32476
|
-
|
|
32477
|
-
|
|
33047
|
+
__webpack_unused_export__ = ({ value: true });
|
|
33048
|
+
exports.sQ = void 0;
|
|
33049
|
+
__webpack_unused_export__ = isKotlinPath;
|
|
33050
|
+
__webpack_unused_export__ = getEnvironmentPrefix;
|
|
32478
33051
|
exports.getApplicationUrl = getApplicationUrl;
|
|
32479
|
-
exports.
|
|
33052
|
+
exports.sQ = [
|
|
32480
33053
|
'application',
|
|
32481
33054
|
'auth',
|
|
32482
33055
|
'mutation',
|
|
32483
33056
|
'native-query',
|
|
32484
33057
|
'query',
|
|
32485
|
-
'queue',
|
|
32486
|
-
'notification',
|
|
32487
33058
|
// Note: every `/ws/*` WebSocket path is served by the TypeScript core (port 8000), never Kotlin.
|
|
32488
33059
|
];
|
|
32489
33060
|
/**
|
|
@@ -32493,7 +33064,7 @@ exports.KOTLIN_CONTROLLERS = [
|
|
|
32493
33064
|
function isKotlinPath(path) {
|
|
32494
33065
|
const cleaned = path.replace(/^\/+/, '');
|
|
32495
33066
|
const first = cleaned.split('/')[0] || '';
|
|
32496
|
-
return exports.
|
|
33067
|
+
return exports.sQ.includes(first);
|
|
32497
33068
|
}
|
|
32498
33069
|
function getEnvironmentPrefix(shard, region, cloudId, stage) {
|
|
32499
33070
|
if (region === 'local') {
|
|
@@ -32547,10 +33118,11 @@ function isIOS(regionPrefix) {
|
|
|
32547
33118
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32548
33119
|
|
|
32549
33120
|
"use strict";
|
|
33121
|
+
var __webpack_unused_export__;
|
|
32550
33122
|
|
|
32551
|
-
|
|
33123
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32552
33124
|
exports.timeSince = timeSince;
|
|
32553
|
-
|
|
33125
|
+
__webpack_unused_export__ = timePeriod;
|
|
32554
33126
|
/*** The file contains logging helper methods. Used to reduce boilerplate code in logging functions. */
|
|
32555
33127
|
const time_units_1 = __webpack_require__(1929);
|
|
32556
33128
|
/**
|
|
@@ -32673,9 +33245,10 @@ async function populateOpenApiControllersMap(bundleData, codeDir, codeType) {
|
|
|
32673
33245
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32674
33246
|
|
|
32675
33247
|
"use strict";
|
|
33248
|
+
var __webpack_unused_export__;
|
|
32676
33249
|
|
|
32677
|
-
|
|
32678
|
-
|
|
33250
|
+
__webpack_unused_export__ = ({ value: true });
|
|
33251
|
+
__webpack_unused_export__ = getProcessEnv;
|
|
32679
33252
|
exports.isEnvVarTruthy = isEnvVarTruthy;
|
|
32680
33253
|
const assertic_1 = __webpack_require__(3205);
|
|
32681
33254
|
function getProcessEnv(key) {
|
|
@@ -32699,11 +33272,12 @@ function isEnvVarTruthy(variableName) {
|
|
|
32699
33272
|
(__unused_webpack_module, exports) {
|
|
32700
33273
|
|
|
32701
33274
|
"use strict";
|
|
33275
|
+
var __webpack_unused_export__;
|
|
32702
33276
|
|
|
32703
|
-
|
|
33277
|
+
__webpack_unused_export__ = ({ value: true });
|
|
32704
33278
|
exports.parseSquidRegion = parseSquidRegion;
|
|
32705
|
-
|
|
32706
|
-
|
|
33279
|
+
__webpack_unused_export__ = isDefaultOrLocalRegion;
|
|
33280
|
+
__webpack_unused_export__ = getCloudId;
|
|
32707
33281
|
/**
|
|
32708
33282
|
* Checks if a string is a valid stage name.
|
|
32709
33283
|
*
|
|
@@ -33657,8 +34231,9 @@ async function deploy(consoleRegion, appId, bundlePath, apiKey, verbose, direct,
|
|
|
33657
34231
|
(__unused_webpack_module, exports) {
|
|
33658
34232
|
|
|
33659
34233
|
"use strict";
|
|
34234
|
+
var __webpack_unused_export__;
|
|
33660
34235
|
|
|
33661
|
-
|
|
34236
|
+
__webpack_unused_export__ = ({ value: true });
|
|
33662
34237
|
exports.environment = void 0;
|
|
33663
34238
|
exports.environment = {
|
|
33664
34239
|
consoleAppId: 'console',
|
|
@@ -33797,6 +34372,726 @@ async function initWebpack() {
|
|
|
33797
34372
|
}
|
|
33798
34373
|
|
|
33799
34374
|
|
|
34375
|
+
/***/ },
|
|
34376
|
+
|
|
34377
|
+
/***/ 2713
|
|
34378
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
34379
|
+
|
|
34380
|
+
"use strict";
|
|
34381
|
+
|
|
34382
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
34383
|
+
if (k2 === undefined) k2 = k;
|
|
34384
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
34385
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
34386
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
34387
|
+
}
|
|
34388
|
+
Object.defineProperty(o, k2, desc);
|
|
34389
|
+
}) : (function(o, m, k, k2) {
|
|
34390
|
+
if (k2 === undefined) k2 = k;
|
|
34391
|
+
o[k2] = m[k];
|
|
34392
|
+
}));
|
|
34393
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34394
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34395
|
+
}) : function(o, v) {
|
|
34396
|
+
o["default"] = v;
|
|
34397
|
+
});
|
|
34398
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34399
|
+
var ownKeys = function(o) {
|
|
34400
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34401
|
+
var ar = [];
|
|
34402
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34403
|
+
return ar;
|
|
34404
|
+
};
|
|
34405
|
+
return ownKeys(o);
|
|
34406
|
+
};
|
|
34407
|
+
return function (mod) {
|
|
34408
|
+
if (mod && mod.__esModule) return mod;
|
|
34409
|
+
var result = {};
|
|
34410
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34411
|
+
__setModuleDefault(result, mod);
|
|
34412
|
+
return result;
|
|
34413
|
+
};
|
|
34414
|
+
})();
|
|
34415
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
34416
|
+
exports.setupKbUploadCommand = setupKbUploadCommand;
|
|
34417
|
+
const assertic_1 = __webpack_require__(3205);
|
|
34418
|
+
const dotenv = __importStar(__webpack_require__(9650));
|
|
34419
|
+
const fs_1 = __webpack_require__(9896);
|
|
34420
|
+
const fs = __importStar(__webpack_require__(1943));
|
|
34421
|
+
const path = __importStar(__webpack_require__(6928));
|
|
34422
|
+
const stream_1 = __webpack_require__(2203);
|
|
34423
|
+
const communication_types_1 = __webpack_require__(3443);
|
|
34424
|
+
const time_units_1 = __webpack_require__(1929);
|
|
34425
|
+
const http_1 = __webpack_require__(866);
|
|
34426
|
+
const process_utils_1 = __webpack_require__(8251);
|
|
34427
|
+
/** CLI-side pacing default: files staged per bulk-ingestion job (not a server-enforced cap). */
|
|
34428
|
+
const DEFAULT_BATCH_SIZE = 200;
|
|
34429
|
+
/** Upper bound accepted for `--batchSize`; keeps a single job's blast radius reasonable. */
|
|
34430
|
+
const MAX_BATCH_SIZE = 1000;
|
|
34431
|
+
/**
|
|
34432
|
+
* Byte budget for one batch's files on disk. Mirrors the server's `BULK_INGESTION_MAX_STAGED_BYTES`
|
|
34433
|
+
* (256 MiB, ai-knowledge-base-management.service.ts) with headroom, since that ceiling applies to
|
|
34434
|
+
* EXTRACTED content and extraction can produce more text than the source file holds. Deliberately a
|
|
34435
|
+
* separate constant rather than an import: the CLI does not depend on core.
|
|
34436
|
+
*/
|
|
34437
|
+
const MAX_BATCH_BYTES = 192 * 1024 * 1024;
|
|
34438
|
+
/** Server-enforced cap on `bulk/createUploadUrls`'s `files` array (`BULK_INGESTION_MAX_UPLOAD_URLS_PER_CALL`). */
|
|
34439
|
+
const MAX_UPLOAD_URLS_PER_CALL = 500;
|
|
34440
|
+
/** Number of concurrent presigned-URL PUTs. */
|
|
34441
|
+
const PUT_CONCURRENCY = 8;
|
|
34442
|
+
/**
|
|
34443
|
+
* Files whose upload URLs are minted together. Kept a small multiple of {@link PUT_CONCURRENCY} so a wave's
|
|
34444
|
+
* URLs are always used well inside their 15-minute lifetime, while still amortizing the mint round-trip.
|
|
34445
|
+
*/
|
|
34446
|
+
const UPLOAD_WAVE_SIZE = 40;
|
|
34447
|
+
/**
|
|
34448
|
+
* How long a SIGINT waits for an in-flight `upsertContexts` to yield its job id before cancelling without it.
|
|
34449
|
+
* Bounded because that call has no request timeout of its own: an unbounded wait would leave the first Ctrl-C
|
|
34450
|
+
* hanging behind a wedged server, and a job whose id never arrives is better left to the 7-day deadline than
|
|
34451
|
+
* a CLI that will not quit.
|
|
34452
|
+
*/
|
|
34453
|
+
const SIGINT_STAGING_WAIT_MILLIS = 10 * time_units_1.MILLIS_PER_SECOND;
|
|
34454
|
+
/** Default per-job wait budget before falling back to "still running server-side" and moving on. */
|
|
34455
|
+
const DEFAULT_TIMEOUT_MINUTES = 120;
|
|
34456
|
+
/** Interval between `bulk/getJob` polls while waiting for a job to reach a terminal state. */
|
|
34457
|
+
const POLL_INTERVAL_MILLIS = 10 * time_units_1.MILLIS_PER_SECOND;
|
|
34458
|
+
/** Extensions ingested by default when `--extensions` is not provided. */
|
|
34459
|
+
const DEFAULT_EXTENSIONS = ['pdf', 'docx', 'txt', 'md', 'html', 'csv', 'xlsx', 'xls', 'xlsm', 'xlsb', 'pptx'];
|
|
34460
|
+
/** Job states that end a bulk-ingestion job's lifecycle (`BulkIngestionJobState` in core). */
|
|
34461
|
+
const TERMINAL_JOB_STATES = new Set(['completed', 'failed', 'cancelled']);
|
|
34462
|
+
const DEFAULT_MIME_TYPE = 'application/octet-stream';
|
|
34463
|
+
/** Placeholder status when a job's real status could never be retrieved before the timeout. */
|
|
34464
|
+
const UNKNOWN_JOB_STATUS = {
|
|
34465
|
+
state: 'unknown',
|
|
34466
|
+
counts: { files: 0, finalized: 0, failed: 0, requestsPending: 0, requestsSubmitted: 0 },
|
|
34467
|
+
providerBatchIds: [],
|
|
34468
|
+
files: [],
|
|
34469
|
+
};
|
|
34470
|
+
/**
|
|
34471
|
+
* Fixed line width the progress line pads to, so a shorter update fully overwrites a longer one. 140 because
|
|
34472
|
+
* at Pritzker scale a real line (`batch N/M job <uuid>: X/Y finalized, Z failed, state=...`) exceeds 100 chars.
|
|
34473
|
+
*/
|
|
34474
|
+
const PROGRESS_LINE_WIDTH = 140;
|
|
34475
|
+
/** Small extension → MIME map so the presigned PUT always carries an explicit Content-Type. */
|
|
34476
|
+
const EXTENSION_MIME_TYPES = {
|
|
34477
|
+
pdf: 'application/pdf',
|
|
34478
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
34479
|
+
doc: 'application/msword',
|
|
34480
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
34481
|
+
ppt: 'application/vnd.ms-powerpoint',
|
|
34482
|
+
txt: 'text/plain',
|
|
34483
|
+
md: 'text/markdown',
|
|
34484
|
+
html: 'text/html',
|
|
34485
|
+
htm: 'text/html',
|
|
34486
|
+
csv: 'text/csv',
|
|
34487
|
+
tsv: 'text/tab-separated-values',
|
|
34488
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
34489
|
+
xls: 'application/vnd.ms-excel',
|
|
34490
|
+
xlsm: 'application/vnd.ms-excel.sheet.macroEnabled.12',
|
|
34491
|
+
xlsb: 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
|
34492
|
+
eml: 'message/rfc822',
|
|
34493
|
+
msg: 'application/vnd.ms-outlook',
|
|
34494
|
+
json: 'application/json',
|
|
34495
|
+
};
|
|
34496
|
+
/** Registers the `kb-upload` command: bulk-ingests a local directory tree into a knowledge base. */
|
|
34497
|
+
function setupKbUploadCommand(yargs) {
|
|
34498
|
+
yargs.command('kb-upload', 'Bulk-ingests a local directory tree into a knowledge base via the direct-to-storage bulk-ingestion API', yargs => {
|
|
34499
|
+
yargs.option('dir', {
|
|
34500
|
+
type: 'string',
|
|
34501
|
+
demandOption: true,
|
|
34502
|
+
describe: 'The local directory to walk recursively for files to ingest',
|
|
34503
|
+
});
|
|
34504
|
+
yargs.option('knowledgeBase', {
|
|
34505
|
+
type: 'string',
|
|
34506
|
+
demandOption: true,
|
|
34507
|
+
describe: 'The id of the knowledge base to ingest into',
|
|
34508
|
+
});
|
|
34509
|
+
yargs.option('appId', {
|
|
34510
|
+
type: 'string',
|
|
34511
|
+
describe: 'The application ID (Can be retrieved from the Squid Console). Falls back to SQUID_APP_ID',
|
|
34512
|
+
});
|
|
34513
|
+
yargs.option('apiKey', {
|
|
34514
|
+
type: 'string',
|
|
34515
|
+
describe: 'The application API key (Can be retrieved from the Squid Console). Falls back to SQUID_API_KEY',
|
|
34516
|
+
});
|
|
34517
|
+
yargs.option('internalApiKey', {
|
|
34518
|
+
type: 'string',
|
|
34519
|
+
describe: 'Internal API key for local/on-prem use instead of --apiKey. Falls back to SQUID_INTERNAL_API_KEY',
|
|
34520
|
+
});
|
|
34521
|
+
yargs.option('region', {
|
|
34522
|
+
type: 'string',
|
|
34523
|
+
describe: 'The Squid region the application lives in. Falls back to SQUID_REGION',
|
|
34524
|
+
});
|
|
34525
|
+
yargs.option('environmentId', {
|
|
34526
|
+
type: 'string',
|
|
34527
|
+
describe: "The environment to ingest into ('dev' or 'prod'). Falls back to SQUID_ENVIRONMENT_ID",
|
|
34528
|
+
});
|
|
34529
|
+
yargs.option('batchSize', {
|
|
34530
|
+
type: 'number',
|
|
34531
|
+
default: DEFAULT_BATCH_SIZE,
|
|
34532
|
+
describe: `Files staged per bulk-ingestion job (max ${MAX_BATCH_SIZE})`,
|
|
34533
|
+
});
|
|
34534
|
+
yargs.option('extensions', {
|
|
34535
|
+
type: 'string',
|
|
34536
|
+
default: DEFAULT_EXTENSIONS.join(','),
|
|
34537
|
+
describe: 'Comma-separated allow-list of file extensions to ingest',
|
|
34538
|
+
});
|
|
34539
|
+
yargs.option('dryRun', {
|
|
34540
|
+
type: 'boolean',
|
|
34541
|
+
default: false,
|
|
34542
|
+
describe: 'List the files that would be uploaded and exit without contacting the server',
|
|
34543
|
+
});
|
|
34544
|
+
yargs.option('timeoutMinutes', {
|
|
34545
|
+
type: 'number',
|
|
34546
|
+
default: DEFAULT_TIMEOUT_MINUTES,
|
|
34547
|
+
describe: 'Minutes to wait for each job to finish before moving on and reporting it as still running',
|
|
34548
|
+
});
|
|
34549
|
+
}, async (argv) => {
|
|
34550
|
+
// Mirrors what `deploy`/`undeploy` do in main.ts: an initialized project keeps its appId, region,
|
|
34551
|
+
// environment and developer id in a local `.env`, and nothing else loads it for this command — so
|
|
34552
|
+
// without this every normal project fails on "Missing application ID" until the user exports the
|
|
34553
|
+
// variables by hand.
|
|
34554
|
+
dotenv.config({ path: path.resolve('./', '.env') });
|
|
34555
|
+
await kbUpload(argv);
|
|
34556
|
+
});
|
|
34557
|
+
}
|
|
34558
|
+
/** Drives the full walk → stage → wait → summarize flow and sets `process.exitCode` accordingly. */
|
|
34559
|
+
async function kbUpload(argv) {
|
|
34560
|
+
const extensions = parseExtensions(argv.extensions);
|
|
34561
|
+
const batchSize = validateBatchSize(argv.batchSize);
|
|
34562
|
+
const files = await collectFiles(argv.dir, extensions);
|
|
34563
|
+
if (argv.dryRun) {
|
|
34564
|
+
await printDryRun(argv.dir, files, batchSize);
|
|
34565
|
+
return;
|
|
34566
|
+
}
|
|
34567
|
+
if (files.length === 0) {
|
|
34568
|
+
console.log(`No files with extensions [${Array.from(extensions).join(', ')}] found under ${argv.dir}`);
|
|
34569
|
+
return;
|
|
34570
|
+
}
|
|
34571
|
+
const appId = getDataPlaneAppId(argv);
|
|
34572
|
+
const region = getRegion(argv);
|
|
34573
|
+
const { apiKey, internalApiKey } = getAuth(argv);
|
|
34574
|
+
const timeoutMillis = argv.timeoutMinutes * time_units_1.MILLIS_PER_MINUTE;
|
|
34575
|
+
const client = new BulkIngestionClient(region, appId, apiKey, internalApiKey);
|
|
34576
|
+
const batches = await groupFilesIntoBatches(files, batchSize);
|
|
34577
|
+
console.log(`Found ${files.length} file(s) under ${argv.dir}; staging in ${batches.length} batch(es) of up to ${batchSize}.`);
|
|
34578
|
+
const activeJobIds = new Set();
|
|
34579
|
+
// The job id of a batch whose `upsertContexts` call is CURRENTLY in flight. That call runs extraction
|
|
34580
|
+
// inline server-side for a whole batch, so it is a long window in which a job exists on the server but has
|
|
34581
|
+
// no id here yet — and a SIGINT landing in it would otherwise snapshot an empty `activeJobIds`, exit, and
|
|
34582
|
+
// leave that job running and billing. The handler waits on this before cancelling.
|
|
34583
|
+
let pendingStaging;
|
|
34584
|
+
let interrupted = false;
|
|
34585
|
+
const onSigint = () => {
|
|
34586
|
+
if (interrupted) {
|
|
34587
|
+
process.exit(130);
|
|
34588
|
+
}
|
|
34589
|
+
interrupted = true;
|
|
34590
|
+
process.stdout.write('\n');
|
|
34591
|
+
console.log('Received interrupt; cancelling in-flight bulk-ingestion job(s)... (press Ctrl-C again to exit immediately)');
|
|
34592
|
+
// Resolve any in-flight staging FIRST so its job id can be cancelled too; a staging that itself fails
|
|
34593
|
+
// created no job, so an undefined result simply adds nothing. Never rejects — a staging error is already
|
|
34594
|
+
// reported by runBatch — so cancellation always runs.
|
|
34595
|
+
//
|
|
34596
|
+
// Raced against a deadline: `upsertContexts` runs extraction inline server-side for a whole batch and
|
|
34597
|
+
// carries no request timeout, so waiting on it unconditionally would hang the FIRST Ctrl-C behind a slow
|
|
34598
|
+
// or wedged server. On timeout we fall back to cancelling what we already know about, which is strictly
|
|
34599
|
+
// better than not exiting.
|
|
34600
|
+
const stagingOrTimeout = Promise.race([
|
|
34601
|
+
// Belt and braces: the published promise is already non-rejecting (see onStagingStarted).
|
|
34602
|
+
Promise.resolve(pendingStaging).catch(() => undefined),
|
|
34603
|
+
new Promise(resolve => setTimeout(() => resolve(undefined), SIGINT_STAGING_WAIT_MILLIS)),
|
|
34604
|
+
]);
|
|
34605
|
+
void stagingOrTimeout
|
|
34606
|
+
.then(stagingJobId => cancelActiveJobs(client, stagingJobId ? new Set([...activeJobIds, stagingJobId]) : activeJobIds))
|
|
34607
|
+
.finally(() => process.exit(130));
|
|
34608
|
+
};
|
|
34609
|
+
process.on('SIGINT', onSigint);
|
|
34610
|
+
const results = [];
|
|
34611
|
+
for (let batchIndex = 0; batchIndex < batches.length && !interrupted; batchIndex++) {
|
|
34612
|
+
// runBatch handles the expected failure modes internally (upload failures, and a staging/job-creation
|
|
34613
|
+
// failure that happens after uploads already succeeded) and always returns a BatchResult for those. This
|
|
34614
|
+
// catch is a last resort for something genuinely unexpected happening before any of that is known (e.g.
|
|
34615
|
+
// createUploadUrls itself throwing), so one batch's crash doesn't abort the whole run.
|
|
34616
|
+
try {
|
|
34617
|
+
const result = await runBatch(client, argv.knowledgeBase, batches[batchIndex], batchIndex, batches.length, timeoutMillis, activeJobIds, () => interrupted, staging => {
|
|
34618
|
+
pendingStaging = staging;
|
|
34619
|
+
});
|
|
34620
|
+
results.push(result);
|
|
34621
|
+
// Cleared once the batch is done: its job id is in `activeJobIds` now (or the job was never created),
|
|
34622
|
+
// so a later SIGINT must not re-resolve this settled promise and issue a pointless cancel.
|
|
34623
|
+
pendingStaging = undefined;
|
|
34624
|
+
}
|
|
34625
|
+
catch (error) {
|
|
34626
|
+
const message = (0, assertic_1.getMessageFromError)(error);
|
|
34627
|
+
console.error(`batch ${batchIndex + 1}/${batches.length}: unexpected error before staging: ${message}`);
|
|
34628
|
+
results.push({
|
|
34629
|
+
batchIndex,
|
|
34630
|
+
batchCount: batches.length,
|
|
34631
|
+
uploadFailures: [],
|
|
34632
|
+
duplicates: [],
|
|
34633
|
+
timedOut: false,
|
|
34634
|
+
batchError: message,
|
|
34635
|
+
});
|
|
34636
|
+
}
|
|
34637
|
+
}
|
|
34638
|
+
process.off('SIGINT', onSigint);
|
|
34639
|
+
printSummary(files.length, results);
|
|
34640
|
+
process.exitCode = interrupted || results.some(hasBatchFailed) ? 1 : 0;
|
|
34641
|
+
}
|
|
34642
|
+
/** Stages one batch (upload + upsertContexts) and waits for its job to finish or time out. */
|
|
34643
|
+
async function runBatch(client, knowledgeBaseId, filePaths, batchIndex, batchCount, timeoutMillis, activeJobIds, isInterrupted,
|
|
34644
|
+
/** Publishes this batch's in-flight `upsertContexts` promise so a SIGINT can cancel the job it creates. */
|
|
34645
|
+
onStagingStarted) {
|
|
34646
|
+
const batchLabel = `batch ${batchIndex + 1}/${batchCount}`;
|
|
34647
|
+
// Minted wave by wave, immediately before the PUTs that use them, rather than all at once up front. The
|
|
34648
|
+
// server gives a presigned URL BULK_INGESTION_UPLOAD_URL_EXPIRATION_SECONDS (15 min) of life, and a large
|
|
34649
|
+
// batch on a slow link uploads at only PUT_CONCURRENCY at a time — so URLs minted for the tail of the
|
|
34650
|
+
// batch could expire before their turn arrived, and the single retry would reuse the same dead URL.
|
|
34651
|
+
const uploadResults = [];
|
|
34652
|
+
for (const wave of chunk(filePaths, UPLOAD_WAVE_SIZE)) {
|
|
34653
|
+
// SIGINT is observed between waves, not only after the whole batch has uploaded.
|
|
34654
|
+
if (isInterrupted())
|
|
34655
|
+
break;
|
|
34656
|
+
try {
|
|
34657
|
+
const waveUrls = await createUploadUrlsForBatch(client, wave.map(filePath => path.basename(filePath)));
|
|
34658
|
+
(0, assertic_1.assertTruthy)(waveUrls.length === wave.length, `${batchLabel}: createUploadUrls returned ${waveUrls.length} entries for ${wave.length} files`);
|
|
34659
|
+
uploadResults.push(...(await runWithConcurrency(wave, PUT_CONCURRENCY, async (filePath, index) => uploadFile(filePath, waveUrls[index], waveUrls[index].stagedObjectKey))));
|
|
34660
|
+
}
|
|
34661
|
+
catch (error) {
|
|
34662
|
+
// A mint failure on a LATER wave must not discard the earlier waves' successful uploads: those objects
|
|
34663
|
+
// are already staged, and throwing here would leave them orphaned until the 24h expiry with no job
|
|
34664
|
+
// referencing them. Record this wave's files as upload failures and stage whatever did land — the
|
|
34665
|
+
// summary machinery below already reports per-file failures honestly.
|
|
34666
|
+
const message = (0, assertic_1.getMessageFromError)(error);
|
|
34667
|
+
console.warn(`${batchLabel}: failed to mint or upload a wave of ${wave.length} file(s): ${message}`);
|
|
34668
|
+
uploadResults.push(...wave.map(filePath => ({ fileName: path.basename(filePath), error: message })));
|
|
34669
|
+
}
|
|
34670
|
+
}
|
|
34671
|
+
const uploadFailures = uploadResults.filter(result => !isUploaded(result));
|
|
34672
|
+
for (const failure of uploadFailures) {
|
|
34673
|
+
console.warn(`${batchLabel}: failed to upload ${failure.fileName}: ${failure.error}`);
|
|
34674
|
+
}
|
|
34675
|
+
// BulkIngestionContext.metadata (ENG-2527 Phase-7) is available here for a future path-rule feature —
|
|
34676
|
+
// e.g. tagging each staged file with its source folder/glob-derived metadata — but this command has no
|
|
34677
|
+
// such flag yet, so no metadata is stamped today.
|
|
34678
|
+
const stagedContexts = uploadResults
|
|
34679
|
+
.filter(isUploaded)
|
|
34680
|
+
.map(result => ({ type: 'file', stagedObjectKey: result.stagedObjectKey }));
|
|
34681
|
+
if (stagedContexts.length === 0) {
|
|
34682
|
+
console.warn(`${batchLabel}: every file failed to upload; no job was created.`);
|
|
34683
|
+
return { batchIndex, batchCount, uploadFailures, duplicates: [], timedOut: false };
|
|
34684
|
+
}
|
|
34685
|
+
// Re-checked immediately before staging, not only between waves: the wave loop's `break` lands right here,
|
|
34686
|
+
// so without this Ctrl-C would SKIP the remaining uploads and then promptly create a job anyway. Worse, its
|
|
34687
|
+
// id reaches `activeJobIds` only after `cancelActiveJobs` has already snapshotted the set, so the job would
|
|
34688
|
+
// survive the CLI and keep billing. Uploaded objects with no job simply expire on their own 24h clock.
|
|
34689
|
+
if (isInterrupted()) {
|
|
34690
|
+
console.warn(`${batchLabel}: interrupted before job creation; ${stagedContexts.length} uploaded object(s) remain ` +
|
|
34691
|
+
`staged (auto-expire in 24h) and no job was created.`);
|
|
34692
|
+
return {
|
|
34693
|
+
batchIndex,
|
|
34694
|
+
batchCount,
|
|
34695
|
+
uploadFailures,
|
|
34696
|
+
duplicates: [],
|
|
34697
|
+
timedOut: false,
|
|
34698
|
+
stagedCount: stagedContexts.length,
|
|
34699
|
+
};
|
|
34700
|
+
}
|
|
34701
|
+
// The uploads above already succeeded, so a failure from here on is NOT an upload failure: the objects are
|
|
34702
|
+
// already sitting in staging. Catch this call specifically so that outcome is reported honestly instead of
|
|
34703
|
+
// being conflated with "no job created (all uploads failed)".
|
|
34704
|
+
let jobId;
|
|
34705
|
+
let duplicates;
|
|
34706
|
+
try {
|
|
34707
|
+
const staging = client.upsertContexts(knowledgeBaseId, stagedContexts);
|
|
34708
|
+
// The published promise must never REJECT. It is a derived branch of `staging`, and the only rejection
|
|
34709
|
+
// handler on it lives inside the SIGINT path — which usually never runs, so a staging failure would
|
|
34710
|
+
// otherwise surface as an unhandled rejection and take the whole CLI down AFTER it had already reported
|
|
34711
|
+
// the failure honestly. `undefined` is exactly what the handler treats as "no job to cancel".
|
|
34712
|
+
onStagingStarted(staging.then(response => response.jobId).catch(() => undefined));
|
|
34713
|
+
const response = await staging;
|
|
34714
|
+
jobId = response.jobId;
|
|
34715
|
+
// Named by the title the server rejected them under, which for this command is always the file name.
|
|
34716
|
+
duplicates = (response.duplicates ?? []).map(duplicate => duplicate.name);
|
|
34717
|
+
}
|
|
34718
|
+
catch (error) {
|
|
34719
|
+
const message = (0, assertic_1.getMessageFromError)(error);
|
|
34720
|
+
console.error(`${batchLabel}: staged ${stagedContexts.length} upload(s) but job creation failed: ${message}; ` +
|
|
34721
|
+
`${stagedContexts.length} uploaded object(s) remain staged (auto-expire in 24h).`);
|
|
34722
|
+
return {
|
|
34723
|
+
batchIndex,
|
|
34724
|
+
batchCount,
|
|
34725
|
+
uploadFailures,
|
|
34726
|
+
duplicates: [],
|
|
34727
|
+
timedOut: false,
|
|
34728
|
+
stagingError: message,
|
|
34729
|
+
stagedCount: stagedContexts.length,
|
|
34730
|
+
};
|
|
34731
|
+
}
|
|
34732
|
+
if (duplicates.length > 0) {
|
|
34733
|
+
console.log(`${batchLabel}: ${duplicates.length} file(s) skipped as content this knowledge base already holds.`);
|
|
34734
|
+
}
|
|
34735
|
+
activeJobIds.add(jobId);
|
|
34736
|
+
const { finalStatus, timedOut } = await waitForJobCompletion(client, jobId, batchLabel, timeoutMillis, isInterrupted);
|
|
34737
|
+
activeJobIds.delete(jobId);
|
|
34738
|
+
return { batchIndex, batchCount, jobId, uploadFailures, duplicates, finalStatus, timedOut };
|
|
34739
|
+
}
|
|
34740
|
+
/** Mints presigned upload URLs for a batch, chunking requests to the server's per-call cap. */
|
|
34741
|
+
async function createUploadUrlsForBatch(client, fileNames) {
|
|
34742
|
+
const uploads = [];
|
|
34743
|
+
for (const group of chunk(fileNames, MAX_UPLOAD_URLS_PER_CALL)) {
|
|
34744
|
+
const response = await client.createUploadUrls(group);
|
|
34745
|
+
uploads.push(...response.uploads);
|
|
34746
|
+
}
|
|
34747
|
+
return uploads;
|
|
34748
|
+
}
|
|
34749
|
+
/**
|
|
34750
|
+
* PUTs one file's bytes to its presigned URL, retrying once on a network error or non-2xx response.
|
|
34751
|
+
* `upload.requiredHeaders` carries whatever the storage backend mandates beyond `Content-Type` (Azure Blob
|
|
34752
|
+
* rejects a PUT without `x-ms-blob-type`), so it must be sent as given rather than assumed empty.
|
|
34753
|
+
*/
|
|
34754
|
+
async function uploadFile(filePath, upload, stagedObjectKey) {
|
|
34755
|
+
const fileName = path.basename(filePath);
|
|
34756
|
+
const mimeType = EXTENSION_MIME_TYPES[extensionOf(fileName)] || DEFAULT_MIME_TYPE;
|
|
34757
|
+
// Sized once, up front: a presigned PUT needs an explicit Content-Length because a stream body is not
|
|
34758
|
+
// measurable, and knowing it also lets the retry below reopen the file rather than hold it in memory.
|
|
34759
|
+
const { size } = await fs.stat(filePath);
|
|
34760
|
+
let lastError = 'Unknown upload error';
|
|
34761
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
34762
|
+
try {
|
|
34763
|
+
// Streamed from disk, NOT buffered: PUT_CONCURRENCY workers each reading a whole file into memory
|
|
34764
|
+
// allocates their combined size, and the direct-upload contract admits files far larger than this
|
|
34765
|
+
// process should ever hold. A fresh stream per attempt — a consumed one cannot be replayed.
|
|
34766
|
+
const response = await fetch(upload.uploadUrl, {
|
|
34767
|
+
method: 'PUT',
|
|
34768
|
+
headers: {
|
|
34769
|
+
'Content-Type': mimeType,
|
|
34770
|
+
'Content-Length': String(size),
|
|
34771
|
+
...(upload.requiredHeaders ?? {}),
|
|
34772
|
+
},
|
|
34773
|
+
body: stream_1.Readable.toWeb((0, fs_1.createReadStream)(filePath)),
|
|
34774
|
+
// Node requires this for a streaming request body; without it fetch rejects the stream outright.
|
|
34775
|
+
duplex: 'half',
|
|
34776
|
+
});
|
|
34777
|
+
if (response.ok) {
|
|
34778
|
+
return { fileName, stagedObjectKey };
|
|
34779
|
+
}
|
|
34780
|
+
lastError = `HTTP ${response.status}: ${await response.text()}`;
|
|
34781
|
+
}
|
|
34782
|
+
catch (error) {
|
|
34783
|
+
lastError = (0, assertic_1.getMessageFromError)(error);
|
|
34784
|
+
}
|
|
34785
|
+
}
|
|
34786
|
+
return { fileName, error: lastError };
|
|
34787
|
+
}
|
|
34788
|
+
/**
|
|
34789
|
+
* Polls `bulk/getJob` until the job reaches a terminal state or the timeout elapses. A run can wait up to
|
|
34790
|
+
* `--timeoutMinutes` (default two hours), so a single transient poll error must not crash the whole CLI —
|
|
34791
|
+
* it's logged and retried on the next tick instead.
|
|
34792
|
+
*/
|
|
34793
|
+
async function waitForJobCompletion(client, jobId, batchLabel, timeoutMillis, isInterrupted) {
|
|
34794
|
+
const deadline = Date.now() + timeoutMillis;
|
|
34795
|
+
let status;
|
|
34796
|
+
let isFirstPoll = true;
|
|
34797
|
+
while (!isInterrupted() && Date.now() < deadline && (!status || !TERMINAL_JOB_STATES.has(status.state))) {
|
|
34798
|
+
if (!isFirstPoll) {
|
|
34799
|
+
await sleep(POLL_INTERVAL_MILLIS);
|
|
34800
|
+
}
|
|
34801
|
+
isFirstPoll = false;
|
|
34802
|
+
try {
|
|
34803
|
+
status = await client.getJob(jobId);
|
|
34804
|
+
printProgress(batchLabel, jobId, status);
|
|
34805
|
+
}
|
|
34806
|
+
catch (error) {
|
|
34807
|
+
console.warn(`\n${batchLabel}: transient error polling job ${jobId}, retrying: ${(0, assertic_1.getMessageFromError)(error)}`);
|
|
34808
|
+
}
|
|
34809
|
+
}
|
|
34810
|
+
process.stdout.write('\n');
|
|
34811
|
+
if (!status) {
|
|
34812
|
+
console.warn(`${batchLabel}: could not retrieve job ${jobId}'s status before the timeout.`);
|
|
34813
|
+
return { finalStatus: UNKNOWN_JOB_STATUS, timedOut: true };
|
|
34814
|
+
}
|
|
34815
|
+
const timedOut = !TERMINAL_JOB_STATES.has(status.state) && !isInterrupted();
|
|
34816
|
+
if (timedOut) {
|
|
34817
|
+
console.warn(`${batchLabel}: job ${jobId} did not finish within the timeout; it may still be running server-side.`);
|
|
34818
|
+
}
|
|
34819
|
+
return { finalStatus: status, timedOut };
|
|
34820
|
+
}
|
|
34821
|
+
/** Best-effort cancellation of every job still active when the process is interrupted. */
|
|
34822
|
+
async function cancelActiveJobs(client, activeJobIds) {
|
|
34823
|
+
await Promise.allSettled(Array.from(activeJobIds).map(async (jobId) => {
|
|
34824
|
+
try {
|
|
34825
|
+
await client.cancelJob(jobId);
|
|
34826
|
+
console.log(`Cancelled job ${jobId}.`);
|
|
34827
|
+
}
|
|
34828
|
+
catch (error) {
|
|
34829
|
+
console.warn(`Failed to cancel job ${jobId}: ${(0, assertic_1.getMessageFromError)(error)}`);
|
|
34830
|
+
}
|
|
34831
|
+
}));
|
|
34832
|
+
}
|
|
34833
|
+
function printProgress(batchLabel, jobId, status) {
|
|
34834
|
+
const { counts, state } = status;
|
|
34835
|
+
const line = `${batchLabel} job ${jobId}: ${counts.finalized}/${counts.files} finalized, ${counts.failed} failed, state=${state}`;
|
|
34836
|
+
process.stdout.write(`\r${line}${' '.repeat(Math.max(0, PROGRESS_LINE_WIDTH - line.length))}`);
|
|
34837
|
+
}
|
|
34838
|
+
/** Narrows a `FileUploadResult` to one that uploaded successfully (has a `stagedObjectKey`, no `error`). */
|
|
34839
|
+
function isUploaded(result) {
|
|
34840
|
+
return result.stagedObjectKey !== undefined;
|
|
34841
|
+
}
|
|
34842
|
+
async function printDryRun(dir, files, batchSize) {
|
|
34843
|
+
const preview = files.slice(0, 20);
|
|
34844
|
+
for (const filePath of preview) {
|
|
34845
|
+
console.log(path.relative(dir, filePath));
|
|
34846
|
+
}
|
|
34847
|
+
if (files.length > preview.length) {
|
|
34848
|
+
console.log(`... and ${files.length - preview.length} more`);
|
|
34849
|
+
}
|
|
34850
|
+
// Uses the real grouping rather than a count division: batches are bounded by bytes as well, so a
|
|
34851
|
+
// division would under-report the batch count for exactly the large-corpus runs this flag is used to plan.
|
|
34852
|
+
const batchCount = (await groupFilesIntoBatches(files, batchSize)).length;
|
|
34853
|
+
console.log(`\n${files.length} file(s) would be uploaded in ${batchCount} batch(es) of up to ${batchSize} file(s) ` +
|
|
34854
|
+
`and ${Math.floor(MAX_BATCH_BYTES / (1024 * 1024))} MiB. Dry run: no files were uploaded.`);
|
|
34855
|
+
}
|
|
34856
|
+
function printSummary(totalFiles, results) {
|
|
34857
|
+
const totalFinalized = results.reduce((sum, result) => sum + (result.finalStatus?.counts.finalized ?? 0), 0);
|
|
34858
|
+
const totalServerFailed = results.reduce((sum, result) => sum + (result.finalStatus?.counts.failed ?? 0), 0);
|
|
34859
|
+
const totalUploadFailed = results.reduce((sum, result) => sum + result.uploadFailures.length, 0);
|
|
34860
|
+
const totalDuplicates = results.reduce((sum, result) => sum + result.duplicates.length, 0);
|
|
34861
|
+
const totalStagedButFailed = results.reduce((sum, result) => sum + (result.stagingError ? (result.stagedCount ?? 0) : 0), 0);
|
|
34862
|
+
console.log('\n=== Bulk KB upload summary ===');
|
|
34863
|
+
console.log(`Files scanned: ${totalFiles}`);
|
|
34864
|
+
console.log(`Finalized (server): ${totalFinalized}`);
|
|
34865
|
+
console.log(`Failed (server-side): ${totalServerFailed}`);
|
|
34866
|
+
console.log(`Failed to upload: ${totalUploadFailed}`);
|
|
34867
|
+
if (totalDuplicates > 0) {
|
|
34868
|
+
// Between "scanned" and "finalized" so the two reconcile: a duplicate is neither finalized nor failed,
|
|
34869
|
+
// and reading the summary without this line the difference looks like files that silently disappeared.
|
|
34870
|
+
console.log(`Skipped as duplicate: ${totalDuplicates}`);
|
|
34871
|
+
}
|
|
34872
|
+
if (totalStagedButFailed > 0) {
|
|
34873
|
+
console.log(`Staged but job failed: ${totalStagedButFailed} (uploaded objects remain; auto-expire in 24h)`);
|
|
34874
|
+
}
|
|
34875
|
+
for (const result of results) {
|
|
34876
|
+
const label = `batch ${result.batchIndex + 1}/${result.batchCount}`;
|
|
34877
|
+
if (result.stagingError) {
|
|
34878
|
+
console.log(` ${label}: staged ${result.stagedCount ?? 0} upload(s) but job creation failed: ${result.stagingError}; ` +
|
|
34879
|
+
`uploaded object(s) remain (auto-expire in 24h)`);
|
|
34880
|
+
continue;
|
|
34881
|
+
}
|
|
34882
|
+
if (result.batchError) {
|
|
34883
|
+
console.log(` ${label}: unexpected error before staging: ${result.batchError}`);
|
|
34884
|
+
continue;
|
|
34885
|
+
}
|
|
34886
|
+
if (!result.jobId) {
|
|
34887
|
+
console.log(` ${label}: no job created (all uploads failed)`);
|
|
34888
|
+
continue;
|
|
34889
|
+
}
|
|
34890
|
+
const state = result.timedOut
|
|
34891
|
+
? `${result.finalStatus?.state ?? 'unknown'} (timed out waiting)`
|
|
34892
|
+
: result.finalStatus?.state;
|
|
34893
|
+
console.log(` ${label}: job ${result.jobId} — ${result.finalStatus?.counts.finalized ?? 0}/${result.finalStatus?.counts.files ?? 0} finalized, ${result.finalStatus?.counts.failed ?? 0} failed [${state}]`);
|
|
34894
|
+
// Per-file failure reasons, straight from the job-status response (BulkIngestionFileStatus).
|
|
34895
|
+
const failedFiles = result.finalStatus?.files.filter(file => file.status === 'failed') ?? [];
|
|
34896
|
+
for (const failedFile of failedFiles) {
|
|
34897
|
+
console.log(` - ${failedFile.title}: ${failedFile.errorMessage ?? 'unknown error'}`);
|
|
34898
|
+
}
|
|
34899
|
+
// Named individually for the same reason failures are: "20 skipped" does not tell an operator whether
|
|
34900
|
+
// the right 20 were skipped, and these files never reach the job, so nothing else will ever name them.
|
|
34901
|
+
for (const duplicate of result.duplicates) {
|
|
34902
|
+
console.log(` - ${duplicate}: skipped, already in this knowledge base`);
|
|
34903
|
+
}
|
|
34904
|
+
}
|
|
34905
|
+
}
|
|
34906
|
+
function hasBatchFailed(result) {
|
|
34907
|
+
if (result.uploadFailures.length > 0 || result.timedOut)
|
|
34908
|
+
return true;
|
|
34909
|
+
if (!result.finalStatus)
|
|
34910
|
+
return true;
|
|
34911
|
+
return result.finalStatus.state !== 'completed' || result.finalStatus.counts.failed > 0;
|
|
34912
|
+
}
|
|
34913
|
+
/** Recursively walks `dir`, skipping symlinks and dotfiles/dot-directories, filtered to `extensions`. */
|
|
34914
|
+
async function collectFiles(dir, extensions) {
|
|
34915
|
+
const stat = await fs.stat(dir).catch(() => undefined);
|
|
34916
|
+
if (!stat || !stat.isDirectory()) {
|
|
34917
|
+
(0, process_utils_1.exitWithError)(`--dir must point to an existing directory: ${dir}`);
|
|
34918
|
+
}
|
|
34919
|
+
const files = [];
|
|
34920
|
+
await walk(dir, files, extensions);
|
|
34921
|
+
files.sort();
|
|
34922
|
+
return files;
|
|
34923
|
+
}
|
|
34924
|
+
async function walk(dir, files, extensions) {
|
|
34925
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
34926
|
+
for (const entry of entries) {
|
|
34927
|
+
if (entry.name.startsWith('.') || entry.isSymbolicLink()) {
|
|
34928
|
+
continue;
|
|
34929
|
+
}
|
|
34930
|
+
const fullPath = path.join(dir, entry.name);
|
|
34931
|
+
if (entry.isDirectory()) {
|
|
34932
|
+
await walk(fullPath, files, extensions);
|
|
34933
|
+
}
|
|
34934
|
+
else if (entry.isFile() && extensions.has(extensionOf(entry.name))) {
|
|
34935
|
+
files.push(fullPath);
|
|
34936
|
+
}
|
|
34937
|
+
}
|
|
34938
|
+
}
|
|
34939
|
+
function extensionOf(fileName) {
|
|
34940
|
+
return path.extname(fileName).slice(1).toLowerCase();
|
|
34941
|
+
}
|
|
34942
|
+
function parseExtensions(raw) {
|
|
34943
|
+
const extensions = raw
|
|
34944
|
+
.split(',')
|
|
34945
|
+
.map(extension => extension.trim().replace(/^\./, '').toLowerCase())
|
|
34946
|
+
.filter(extension => extension.length > 0);
|
|
34947
|
+
if (extensions.length === 0) {
|
|
34948
|
+
(0, process_utils_1.exitWithError)('--extensions must list at least one extension');
|
|
34949
|
+
}
|
|
34950
|
+
return new Set(extensions);
|
|
34951
|
+
}
|
|
34952
|
+
function validateBatchSize(batchSize) {
|
|
34953
|
+
if (!Number.isInteger(batchSize) || batchSize < 1 || batchSize > MAX_BATCH_SIZE) {
|
|
34954
|
+
(0, process_utils_1.exitWithError)(`--batchSize must be an integer between 1 and ${MAX_BATCH_SIZE}`);
|
|
34955
|
+
}
|
|
34956
|
+
return batchSize;
|
|
34957
|
+
}
|
|
34958
|
+
/**
|
|
34959
|
+
* The app id the DATA PLANE is addressed by: base id plus environment plus developer id, exactly as
|
|
34960
|
+
* `deploy` (appIdWithEnvironmentId) and `sample` (appIdWithEnvironmentIdAndDevId) build it.
|
|
34961
|
+
*
|
|
34962
|
+
* The base id alone is not a synonym for it. `appIdWithEnvironmentId` renders `prod` as the bare id, so
|
|
34963
|
+
* uploading with an unsuffixed id targets PRODUCTION; and omitting the developer id targets the shared
|
|
34964
|
+
* dev environment instead of the developer's own sandbox — which the API key does not catch, because key
|
|
34965
|
+
* lookup strips the developer id (`omitSquidDevId`), so both authenticate with the same key and the
|
|
34966
|
+
* upload silently lands in the wrong place.
|
|
34967
|
+
*/
|
|
34968
|
+
function getDataPlaneAppId(argv) {
|
|
34969
|
+
const appId = argv.appId || process.env['SQUID_APP_ID'];
|
|
34970
|
+
if (!appId) {
|
|
34971
|
+
(0, process_utils_1.exitWithError)('Missing application ID: pass --appId or set SQUID_APP_ID');
|
|
34972
|
+
}
|
|
34973
|
+
const environmentId = (argv.environmentId || process.env['SQUID_ENVIRONMENT_ID']);
|
|
34974
|
+
const developerId = process.env['SQUID_DEVELOPER_ID'];
|
|
34975
|
+
return (0, communication_types_1.appIdWithEnvironmentIdAndDevId)(appId, environmentId, developerId);
|
|
34976
|
+
}
|
|
34977
|
+
function getRegion(argv) {
|
|
34978
|
+
const region = argv.region || process.env['SQUID_REGION'];
|
|
34979
|
+
if (!region) {
|
|
34980
|
+
(0, process_utils_1.exitWithError)('Missing Squid region: pass --region or set SQUID_REGION');
|
|
34981
|
+
}
|
|
34982
|
+
return region;
|
|
34983
|
+
}
|
|
34984
|
+
function getAuth(argv) {
|
|
34985
|
+
const apiKey = argv.apiKey || process.env['SQUID_API_KEY'];
|
|
34986
|
+
const internalApiKey = argv.internalApiKey || process.env['SQUID_INTERNAL_API_KEY'];
|
|
34987
|
+
if (!apiKey && !internalApiKey) {
|
|
34988
|
+
(0, process_utils_1.exitWithError)('Missing credentials: pass --apiKey (or SQUID_API_KEY) or --internalApiKey (or SQUID_INTERNAL_API_KEY)');
|
|
34989
|
+
}
|
|
34990
|
+
return { apiKey, internalApiKey };
|
|
34991
|
+
}
|
|
34992
|
+
function chunk(items, size) {
|
|
34993
|
+
const chunks = [];
|
|
34994
|
+
for (let i = 0; i < items.length; i += size) {
|
|
34995
|
+
chunks.push(items.slice(i, i + size));
|
|
34996
|
+
}
|
|
34997
|
+
return chunks;
|
|
34998
|
+
}
|
|
34999
|
+
/**
|
|
35000
|
+
* Groups files into batches bounded by BOTH count and total bytes.
|
|
35001
|
+
*
|
|
35002
|
+
* Count alone is not a bound on what the server will accept: it caps a job's staged CONTENT at
|
|
35003
|
+
* BULK_INGESTION_MAX_STAGED_BYTES, so a default 200-file batch of individually legal 2 MiB documents adds
|
|
35004
|
+
* up to roughly 400 MiB and the whole job is rejected with BULK_INGESTION_TOO_LARGE — every file in it,
|
|
35005
|
+
* including the 199 that were fine.
|
|
35006
|
+
*
|
|
35007
|
+
* On-disk size is a proxy for extracted content, not an equality: plain text is about 1:1, while a PDF or
|
|
35008
|
+
* a workbook can extract to more text than it occupies. {@link MAX_BATCH_BYTES} is set well under the
|
|
35009
|
+
* server ceiling to absorb that, and a file bigger than the budget still gets its own batch — splitting a
|
|
35010
|
+
* single document is not something this tool can do.
|
|
35011
|
+
*/
|
|
35012
|
+
async function groupFilesIntoBatches(files, batchSize) {
|
|
35013
|
+
const batches = [];
|
|
35014
|
+
let current = [];
|
|
35015
|
+
let currentBytes = 0;
|
|
35016
|
+
for (const filePath of files) {
|
|
35017
|
+
// A file that cannot be stat'ed is counted as weightless rather than skipped: it still belongs in a
|
|
35018
|
+
// batch, and the upload itself is what should report its failure.
|
|
35019
|
+
const size = await fs
|
|
35020
|
+
.stat(filePath)
|
|
35021
|
+
.then(stat => stat.size)
|
|
35022
|
+
.catch(() => 0);
|
|
35023
|
+
if (current.length > 0 && (current.length >= batchSize || currentBytes + size > MAX_BATCH_BYTES)) {
|
|
35024
|
+
batches.push(current);
|
|
35025
|
+
current = [];
|
|
35026
|
+
currentBytes = 0;
|
|
35027
|
+
}
|
|
35028
|
+
current.push(filePath);
|
|
35029
|
+
currentBytes += size;
|
|
35030
|
+
}
|
|
35031
|
+
if (current.length > 0)
|
|
35032
|
+
batches.push(current);
|
|
35033
|
+
return batches;
|
|
35034
|
+
}
|
|
35035
|
+
/** Runs `worker` over `items` with at most `concurrency` in flight at once, preserving result order. */
|
|
35036
|
+
async function runWithConcurrency(items, concurrency, worker) {
|
|
35037
|
+
const results = new Array(items.length);
|
|
35038
|
+
let nextIndex = 0;
|
|
35039
|
+
const runNext = async () => {
|
|
35040
|
+
while (nextIndex < items.length) {
|
|
35041
|
+
const currentIndex = nextIndex;
|
|
35042
|
+
nextIndex += 1;
|
|
35043
|
+
results[currentIndex] = await worker(items[currentIndex], currentIndex);
|
|
35044
|
+
}
|
|
35045
|
+
};
|
|
35046
|
+
const workerCount = Math.min(concurrency, items.length);
|
|
35047
|
+
await Promise.all(Array.from({ length: workerCount }, runNext));
|
|
35048
|
+
return results;
|
|
35049
|
+
}
|
|
35050
|
+
function sleep(millis) {
|
|
35051
|
+
return new Promise(resolve => setTimeout(resolve, millis));
|
|
35052
|
+
}
|
|
35053
|
+
/** Thin raw-fetch client for the Phase-5 bulk-ingestion HTTP surface (no SDK dependency — see report). */
|
|
35054
|
+
class BulkIngestionClient {
|
|
35055
|
+
constructor(region, appId, apiKey, internalApiKey) {
|
|
35056
|
+
this.region = region;
|
|
35057
|
+
this.appId = appId;
|
|
35058
|
+
this.apiKey = apiKey;
|
|
35059
|
+
this.internalApiKey = internalApiKey;
|
|
35060
|
+
this.lp = 'BulkIngestionClient';
|
|
35061
|
+
}
|
|
35062
|
+
async createUploadUrls(fileNames) {
|
|
35063
|
+
return this.post('ai/knowledge-base/bulk/createUploadUrls', { files: fileNames.map(fileName => ({ fileName })) });
|
|
35064
|
+
}
|
|
35065
|
+
async upsertContexts(knowledgeBaseId, contexts) {
|
|
35066
|
+
return this.post('ai/knowledge-base/bulk/upsertContexts', { knowledgeBaseId, contexts });
|
|
35067
|
+
}
|
|
35068
|
+
async getJob(jobId) {
|
|
35069
|
+
return this.post('ai/knowledge-base/bulk/getJob', { jobId });
|
|
35070
|
+
}
|
|
35071
|
+
async cancelJob(jobId) {
|
|
35072
|
+
await this.post('ai/knowledge-base/bulk/cancelJob', { jobId });
|
|
35073
|
+
}
|
|
35074
|
+
async post(urlPath, body) {
|
|
35075
|
+
const lp = `${this.lp}.post:`;
|
|
35076
|
+
const url = (0, http_1.getApplicationUrl)(this.region, this.appId, urlPath);
|
|
35077
|
+
console.debug(`${lp} POST ${url}`);
|
|
35078
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
35079
|
+
if (this.apiKey) {
|
|
35080
|
+
headers['Authorization'] = `ApiKey ${this.apiKey}`;
|
|
35081
|
+
}
|
|
35082
|
+
if (this.internalApiKey) {
|
|
35083
|
+
headers['x-squid-secret'] = this.internalApiKey;
|
|
35084
|
+
}
|
|
35085
|
+
const response = await fetch(url, { method: 'POST', headers, body: JSON.stringify(body) });
|
|
35086
|
+
const text = await response.text();
|
|
35087
|
+
if (!response.ok) {
|
|
35088
|
+
throw new Error(`${urlPath} failed: ${response.status} ${text}`);
|
|
35089
|
+
}
|
|
35090
|
+
return (text ? JSON.parse(text) : undefined);
|
|
35091
|
+
}
|
|
35092
|
+
}
|
|
35093
|
+
|
|
35094
|
+
|
|
33800
35095
|
/***/ },
|
|
33801
35096
|
|
|
33802
35097
|
/***/ 4291
|
|
@@ -33852,6 +35147,7 @@ const build_1 = __webpack_require__(8584);
|
|
|
33852
35147
|
const deploy_1 = __webpack_require__(8705);
|
|
33853
35148
|
const init_env_1 = __webpack_require__(1838);
|
|
33854
35149
|
const init_webpack_1 = __webpack_require__(1134);
|
|
35150
|
+
const kb_upload_1 = __webpack_require__(2713);
|
|
33855
35151
|
const sample_1 = __webpack_require__(4328);
|
|
33856
35152
|
const start_1 = __webpack_require__(496);
|
|
33857
35153
|
const undeploy_1 = __webpack_require__(7097);
|
|
@@ -33879,10 +35175,11 @@ function run() {
|
|
|
33879
35175
|
setupInitEnvCommand(yargs_1.default);
|
|
33880
35176
|
setupInitSampleCommand(yargs_1.default);
|
|
33881
35177
|
setupInitWebpackCommand(yargs_1.default);
|
|
35178
|
+
(0, kb_upload_1.setupKbUploadCommand)(yargs_1.default);
|
|
33882
35179
|
setupStartCommand(yargs_1.default);
|
|
33883
35180
|
setupUndeployCommand(yargs_1.default);
|
|
33884
35181
|
setupUpdateSkillsCommand(yargs_1.default);
|
|
33885
|
-
yargs_1.default.parse();
|
|
35182
|
+
void yargs_1.default.parse();
|
|
33886
35183
|
}
|
|
33887
35184
|
function setupStartCommand(yargs) {
|
|
33888
35185
|
yargs.command('start', 'Starts the local development server', yargs => {
|
|
@@ -34487,8 +35784,9 @@ async function startPython() {
|
|
|
34487
35784
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
34488
35785
|
|
|
34489
35786
|
"use strict";
|
|
35787
|
+
var __webpack_unused_export__;
|
|
34490
35788
|
|
|
34491
|
-
|
|
35789
|
+
__webpack_unused_export__ = ({ value: true });
|
|
34492
35790
|
exports.undeploy = undeploy;
|
|
34493
35791
|
const assertic_1 = __webpack_require__(3205);
|
|
34494
35792
|
const communication_types_1 = __webpack_require__(3443);
|
|
@@ -34837,8 +36135,9 @@ function exitWithError(...messages) {
|
|
|
34837
36135
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
34838
36136
|
|
|
34839
36137
|
"use strict";
|
|
36138
|
+
var __webpack_unused_export__;
|
|
34840
36139
|
|
|
34841
|
-
|
|
36140
|
+
__webpack_unused_export__ = ({ value: true });
|
|
34842
36141
|
exports.reportLocalBackendInitialized = reportLocalBackendInitialized;
|
|
34843
36142
|
const assertic_1 = __webpack_require__(3205);
|
|
34844
36143
|
const http_1 = __webpack_require__(866);
|
|
@@ -35651,6 +36950,9 @@ var typedArrays = availableTypedArrays();
|
|
|
35651
36950
|
|
|
35652
36951
|
var $slice = callBound('String.prototype.slice');
|
|
35653
36952
|
|
|
36953
|
+
/** @import { BoundSet, BoundSlice, Cache, Getter } from './types' */
|
|
36954
|
+
/** @import { TypedArrayName } from '.' */
|
|
36955
|
+
|
|
35654
36956
|
/** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
|
|
35655
36957
|
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
|
|
35656
36958
|
for (var i = 0; i < array.length; i += 1) {
|
|
@@ -35661,8 +36963,7 @@ var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(ar
|
|
|
35661
36963
|
return -1;
|
|
35662
36964
|
};
|
|
35663
36965
|
|
|
35664
|
-
/** @
|
|
35665
|
-
/** @type {import('./types').Cache} */
|
|
36966
|
+
/** @type {Cache} */
|
|
35666
36967
|
var cache = { __proto__: null };
|
|
35667
36968
|
if (hasToStringTag && gOPD && getProto) {
|
|
35668
36969
|
forEach(typedArrays, function (typedArray) {
|
|
@@ -35679,7 +36980,8 @@ if (hasToStringTag && gOPD && getProto) {
|
|
|
35679
36980
|
if (descriptor && descriptor.get) {
|
|
35680
36981
|
var bound = callBind(descriptor.get);
|
|
35681
36982
|
cache[
|
|
35682
|
-
/** @type {`$${
|
|
36983
|
+
/** @type {`$${TypedArrayName}`} */
|
|
36984
|
+
('$' + typedArray)
|
|
35683
36985
|
] = bound;
|
|
35684
36986
|
}
|
|
35685
36987
|
}
|
|
@@ -35689,62 +36991,72 @@ if (hasToStringTag && gOPD && getProto) {
|
|
|
35689
36991
|
var arr = new g[typedArray]();
|
|
35690
36992
|
var fn = arr.slice || arr.set;
|
|
35691
36993
|
if (fn) {
|
|
35692
|
-
var bound = /** @type {
|
|
36994
|
+
var bound = /** @type {BoundSlice | BoundSet} */ (
|
|
35693
36995
|
// @ts-expect-error TODO FIXME
|
|
35694
36996
|
callBind(fn)
|
|
35695
36997
|
);
|
|
35696
36998
|
cache[
|
|
35697
|
-
/** @type {`$${
|
|
36999
|
+
/** @type {`$${TypedArrayName}`} */
|
|
37000
|
+
('$' + typedArray)
|
|
35698
37001
|
] = bound;
|
|
35699
37002
|
}
|
|
35700
37003
|
});
|
|
35701
37004
|
}
|
|
35702
37005
|
|
|
35703
|
-
/** @type {(value: object) => false |
|
|
35704
|
-
|
|
35705
|
-
/** @type {ReturnType<typeof
|
|
37006
|
+
/** @type {(value: object) => false | TypedArrayName} */
|
|
37007
|
+
function tryTypedArrays(value) {
|
|
37008
|
+
/** @type {ReturnType<typeof tryTypedArrays>} */ var found = false;
|
|
35706
37009
|
forEach(
|
|
35707
|
-
/** @type {Record
|
|
35708
|
-
/** @
|
|
37010
|
+
/** @type {Record<`$${TypedArrayName}`, Getter>} */ (cache),
|
|
37011
|
+
/** @param {Getter} getter @param {`$${TypedArrayName}`} typedArray */
|
|
35709
37012
|
function (getter, typedArray) {
|
|
35710
37013
|
if (!found) {
|
|
35711
37014
|
try {
|
|
35712
37015
|
// @ts-expect-error a throw is fine here
|
|
35713
37016
|
if ('$' + getter(value) === typedArray) {
|
|
35714
|
-
found = /** @type {
|
|
37017
|
+
found = /** @type {TypedArrayName} */ ($slice(typedArray, 1));
|
|
35715
37018
|
}
|
|
35716
37019
|
} catch (e) { /**/ }
|
|
35717
37020
|
}
|
|
35718
37021
|
}
|
|
35719
37022
|
);
|
|
35720
37023
|
return found;
|
|
35721
|
-
}
|
|
37024
|
+
}
|
|
35722
37025
|
|
|
35723
|
-
/** @type {(value: object) => false |
|
|
35724
|
-
|
|
35725
|
-
/** @type {ReturnType<typeof
|
|
37026
|
+
/** @type {(value: object) => false | TypedArrayName} */
|
|
37027
|
+
function trySlices(value) {
|
|
37028
|
+
/** @type {ReturnType<typeof trySlices>} */ var found = false;
|
|
35726
37029
|
forEach(
|
|
35727
|
-
/** @type {Record
|
|
35728
|
-
/** @
|
|
37030
|
+
/** @type {Record<`$${TypedArrayName}`, Getter>} */(cache),
|
|
37031
|
+
/** @param {Getter} getter @param {`$${TypedArrayName}`} name */ function (getter, name) {
|
|
35729
37032
|
if (!found) {
|
|
35730
37033
|
try {
|
|
35731
37034
|
// @ts-expect-error a throw is fine here
|
|
35732
37035
|
getter(value);
|
|
35733
|
-
found = /** @type {
|
|
37036
|
+
found = /** @type {TypedArrayName} */ ($slice(name, 1));
|
|
35734
37037
|
} catch (e) { /**/ }
|
|
35735
37038
|
}
|
|
35736
37039
|
}
|
|
35737
37040
|
);
|
|
35738
37041
|
return found;
|
|
35739
|
-
}
|
|
37042
|
+
}
|
|
35740
37043
|
|
|
35741
|
-
/** @type {
|
|
37044
|
+
/** @type {(tag: unknown) => tag is typeof typedArrays[number]} */
|
|
37045
|
+
function isTATag(tag) {
|
|
37046
|
+
return $indexOf(typedArrays, tag) > -1;
|
|
37047
|
+
}
|
|
37048
|
+
|
|
37049
|
+
/**
|
|
37050
|
+
* @type {import('.')}
|
|
37051
|
+
* @param {unknown} value
|
|
37052
|
+
*/
|
|
35742
37053
|
module.exports = function whichTypedArray(value) {
|
|
35743
|
-
if (!value || typeof value !== 'object') {
|
|
37054
|
+
if (!value || typeof value !== 'object') {
|
|
37055
|
+
return false;
|
|
37056
|
+
}
|
|
35744
37057
|
if (!hasToStringTag) {
|
|
35745
|
-
/** @type {string} */
|
|
35746
37058
|
var tag = $slice($toString(value), 8, -1);
|
|
35747
|
-
if (
|
|
37059
|
+
if (isTATag(tag)) {
|
|
35748
37060
|
return tag;
|
|
35749
37061
|
}
|
|
35750
37062
|
if (tag !== 'Object') {
|
|
@@ -35830,7 +37142,7 @@ function extend() {
|
|
|
35830
37142
|
(module) {
|
|
35831
37143
|
|
|
35832
37144
|
function webpackEmptyContext(req) {
|
|
35833
|
-
|
|
37145
|
+
const e = new Error("Cannot find module '" + req + "'");
|
|
35834
37146
|
e.code = 'MODULE_NOT_FOUND';
|
|
35835
37147
|
throw e;
|
|
35836
37148
|
}
|
|
@@ -35845,7 +37157,7 @@ module.exports = webpackEmptyContext;
|
|
|
35845
37157
|
(module) {
|
|
35846
37158
|
|
|
35847
37159
|
function webpackEmptyContext(req) {
|
|
35848
|
-
|
|
37160
|
+
const e = new Error("Cannot find module '" + req + "'");
|
|
35849
37161
|
e.code = 'MODULE_NOT_FOUND';
|
|
35850
37162
|
throw e;
|
|
35851
37163
|
}
|
|
@@ -35860,7 +37172,7 @@ module.exports = webpackEmptyContext;
|
|
|
35860
37172
|
(module) {
|
|
35861
37173
|
|
|
35862
37174
|
function webpackEmptyContext(req) {
|
|
35863
|
-
|
|
37175
|
+
const e = new Error("Cannot find module '" + req + "'");
|
|
35864
37176
|
e.code = 'MODULE_NOT_FOUND';
|
|
35865
37177
|
throw e;
|
|
35866
37178
|
}
|
|
@@ -35874,6 +37186,7 @@ module.exports = webpackEmptyContext;
|
|
|
35874
37186
|
/***/ 3660
|
|
35875
37187
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
35876
37188
|
|
|
37189
|
+
var __webpack_unused_export__;
|
|
35877
37190
|
var fs = __webpack_require__(9896);
|
|
35878
37191
|
var zlib = __webpack_require__(3106);
|
|
35879
37192
|
var fd_slicer = __webpack_require__(4602);
|
|
@@ -35884,15 +37197,15 @@ var Transform = (__webpack_require__(2203).Transform);
|
|
|
35884
37197
|
var PassThrough = (__webpack_require__(2203).PassThrough);
|
|
35885
37198
|
var Writable = (__webpack_require__(2203).Writable);
|
|
35886
37199
|
|
|
35887
|
-
|
|
35888
|
-
|
|
37200
|
+
__webpack_unused_export__ = open;
|
|
37201
|
+
__webpack_unused_export__ = fromFd;
|
|
35889
37202
|
exports.fromBuffer = fromBuffer;
|
|
35890
|
-
|
|
35891
|
-
|
|
35892
|
-
|
|
35893
|
-
|
|
35894
|
-
|
|
35895
|
-
|
|
37203
|
+
__webpack_unused_export__ = fromRandomAccessReader;
|
|
37204
|
+
__webpack_unused_export__ = dosDateTimeToDate;
|
|
37205
|
+
__webpack_unused_export__ = validateFileName;
|
|
37206
|
+
__webpack_unused_export__ = ZipFile;
|
|
37207
|
+
__webpack_unused_export__ = Entry;
|
|
37208
|
+
__webpack_unused_export__ = RandomAccessReader;
|
|
35896
37209
|
|
|
35897
37210
|
function open(path, options, callback) {
|
|
35898
37211
|
if (typeof options === "function") {
|
|
@@ -37392,8 +38705,8 @@ module.exports = y18n;
|
|
|
37392
38705
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
37393
38706
|
|
|
37394
38707
|
"use strict";
|
|
37395
|
-
var t=__webpack_require__(2613);class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}let s,i=[];function n(t,o,a,h){s=h;let l={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return l;const r=/\.json|\..*rc$/.test(t.extends);let h=null;if(r)h=function(t,e){return s.path.resolve(t,e)}(o,t.extends);else try{h=/*require.resolve*/(__webpack_require__(7315).resolve(t.extends))}catch(e){return t}!function(t){if(i.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(h),i.push(h),l=r?JSON.parse(s.readFileSync(h,"utf8")):__webpack_require__(7315)(t.extends),delete t.extends,l=n(l,s.path.dirname(h),a,s)}return i=[],a?r(l,t):Object.assign({},l,t)}function r(t,e){const s={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const n of Object.keys(e))i(e[n])&&i(s[n])?s[n]=r(t[n],e[n]):s[n]=e[n];return s}function o(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${t}`);const n={cmd:i.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,i)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&i===e.length-1&&(r=!0),/^\[/.test(t)?n.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):n.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),n}const a=["first","second","third","fourth","fifth","sixth"];function h(t,s,i){try{let n=0;const[r,a,h]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,i],f=[].slice.call(a);for(;f.length&&void 0===f[f.length-1];)f.pop();const d=h||f.length;if(d<r.demanded.length)throw new e(`Not enough arguments provided. Expected ${r.demanded.length} but received ${f.length}.`);const u=r.demanded.length+r.optional.length;if(d>u)throw new e(`Too many arguments provided. Expected max ${u} but received ${d}.`);r.demanded.forEach((t=>{const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1})),r.optional.forEach((t=>{if(0===f.length)return;const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,i){throw new e(`Invalid ${a[i]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,e,s,i){s.assert.notStrictEqual(t,e,i)}function u(t,e){e.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},e=(()=>!0)){const s={};return p(t).forEach((i=>{e(i,t[i])&&(s[i]=t[i])})),s}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var b=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function O(t,e,s,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,s):n?n.value=s:e.set(t,s),s}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,i=!1){if(h("<array|function> [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if("function"!=typeof t[i])throw Error("middleware must be a function");const n=t[i];n.applyBeforeValidation=e,n.global=s}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const n=t;n.applyBeforeValidation=e,n.global=s,n.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((t=>{const i=[...s[e]||[],e];return!t.option||!i.includes(t.option)})),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function C(t,e,s,i){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==i)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(f(t))return t.then((t=>Promise.all([t,s(t,e)]))).then((([t,e])=>Object.assign(t,e)));{const i=s(t,e);return f(i)?i.then((e=>Object.assign(t,e))):Object.assign(t,i)}}),t)}function j(t,e,s=(t=>{throw t})){try{const s="function"==typeof t?t():t;return f(s)?s.then((t=>e(t))):e(s)}catch(t){return s(t)}}const M=/(^\*)|(^\$0)/;class _{constructor(t,e,s,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,i){"boolean"!=typeof(i=i||{}).recurse&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);const n="function"==typeof i.visit?i.visit:t=>t;i.visit=(t,e,s)=>{const i=n(t,e,s);if(i){if(this.requireCache.has(e))return i;this.requireCache.add(e),this.addHandler(i)}return i},this.shim.requireDirectory({require:e,filename:s},t,i)}addHandler(t,e,s,i,n,r){let a=[];const h=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(n);if(i=i||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...a]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(s))return void this.addHandler([t].concat(a),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const n=o(t);a=a.map((t=>o(t).cmd));let l=!1;const c=[n.cmd].concat(a).filter((t=>!M.test(t)||(l=!0,!1)));0===c.length&&l&&c.push("$0"),l&&(n.cmd=c[0],a=c.slice(1),t=t.replace(M,n.cmd)),a.forEach((t=>{this.aliasMap[t]=n.cmd})),!1!==e&&this.usage.command(t,e,l,a,r),this.handlers[n.cmd]={original:t,description:e,handler:i,builder:s||{},middlewares:h,deprecated:r,demanded:n.demanded,optional:n.optional},l&&(this.defaultCommand=this.handlers[n.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,i,n,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),h=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const c=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,h,i,n,r);return f(c)?c.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,n,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,c.innerArgv,a,n,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,i,n,r,o,a){const h=e.builder;let l=s;if(x(h)){s.getInternalMethods().getUsageInstance().freeze();const c=h(s.getInternalMethods().reset(i),a);if(f(c))return c.then((i=>{var a;return l=(a=i)&&"function"==typeof a.getInternalMethods?i:s,this.parseAndUpdateUsage(t,e,l,n,r,o)}))}else(function(t){return"object"==typeof t})(h)&&(s.getInternalMethods().getUsageInstance().freeze(),l=s.getInternalMethods().reset(i),Object.keys(e.builder).forEach((t=>{l.option(t,h[t])})));return this.parseAndUpdateUsage(t,e,l,n,r,o)}parseAndUpdateUsage(t,e,s,i,n,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,n,r);return f(o)?o.then((t=>({aliases:s.parsed.aliases,innerArgv:t}))):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=M.test(e.original)?e.original.replace(M,"").trim():e.original,i=t.filter((t=>!M.test(t)));return i.push(s),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,s,i,n,r,o,a){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(n,a,r.parsed.error,t);s=j(s,(t=>(e(t),t)))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const i=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,i,!1,!1),s=j(s=C(s,r,o,!1),(t=>{const s=e.handler(t);return f(s)?s.then((()=>t)):t})),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch((t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(i.commands.pop(),i.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,i,n,r,o){let a={};if(n)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,i,o));const h=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),l=C(s,o,h,!0);return f(l)?l.then((s=>this.handleValidationAndGetResult(t,e,s,i,r,o,h,a))):this.handleValidationAndGetResult(t,e,l,i,r,o,h,a)}populatePositionals(t,e,s,i){e._=e._.slice(s.commands.length);const n=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(n.length,e._.length);n.length;){const t=n.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map((t=>""+t))),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),i),o}populatePositional(t,e,s){const i=t.cmd[0];t.variadic?s[i]=e._.splice(0).map(String):e._.length&&(s[i]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=o(t);return s.demanded.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i})),e}postProcessPositionals(t,e,s,i){const n=Object.assign({},i.getOptions());n.default=Object.assign(s.default,n.default);for(const t of Object.keys(s.alias))n.alias[t]=(n.alias[t]||[]).concat(s.alias[t]);n.array=n.array.concat(s.array),n.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{n.configuration["unknown-options-as-args"]&&(n.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},n.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},n,{configuration:o}));if(a.error)i.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach((t=>{s.push(...a.aliases[t])})),Object.keys(a.argv).forEach((n=>{s.includes(n)&&(e[n]||(e[n]=a.argv[n]),!this.isInConfigs(i,n)&&!this.isDefaulted(i,n)&&Object.prototype.hasOwnProperty.call(t,n)&&Object.prototype.hasOwnProperty.call(a.argv,n)&&(Array.isArray(t[n])||Array.isArray(a.argv[n]))?t[n]=[].concat(t[n],a.argv[n]):t[n]=a.argv[n])}))}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some((t=>Object.prototype.hasOwnProperty.call(t,e)))||s.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=M.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(x(e))return e(t,!0);k(e)||Object.keys(e).forEach((s=>{t.option(s,e[s])}))}moduleName(t){const e=function(t){if(false)// removed by dead control flow
|
|
37396
|
-
{}for(let e,s=0,i=Object.keys(__webpack_require__.c);s<i.length;s++)if(e=__webpack_require__.c[i[s]],e.exports===t)return e;return null}(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:s}){for(const i of[t,e,s]){if("string"==typeof i||!1===i)return i;d(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();d(t,void 0,this.shim),({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t)}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function k(t){return"object"==typeof t&&!!t.builder&&"function"==typeof t.handler}function x(t){return"function"==typeof t}function E(t){"undefined"!=typeof process&&[process.stdout,process.stderr].forEach((e=>{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)}))}function A(t){return"boolean"==typeof t}function P(t,s){const i=s.y18n.__,n={},r=[];n.failFn=function(t){r.push(t)};let o=null,a=null,h=!0;n.showHelpOnFail=function(e=!0,s){const[i,r]="string"==typeof e?[!0,e]:[e,s];return t.getInternalMethods().isGlobalContext()&&(a=r),o=r,h=i,n};let l=!1;n.fail=function(s,i){const c=t.getInternalMethods().getLoggerInstance();if(!r.length){if(t.getExitProcess()&&E(!0),!l){l=!0,h&&(t.showHelp("error"),c.error()),(s||i)&&c.error(s||i);const e=o||a;e&&((s||i)&&c.error(""),c.error(e))}if(i=i||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,i);throw i}for(let t=r.length-1;t>=0;--t){const e=r[t];if(A(e)){if(i)throw i;if(s)throw Error(s)}else e(s,i,n)}};let c=[],f=!1;n.usage=(t,e)=>null===t?(f=!0,c=[],n):(f=!1,c.push([t,e||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>f,n.getPositionalGroupName=()=>i("Positionals:");let d=[];n.example=(t,e)=>{d.push([t,e||""])};let u=[];n.command=function(t,e,s,i,n=!1){s&&(u=u.map((t=>(t[2]=!1,t)))),u.push([t,e||"",s,i,n])},n.getCommands=()=>u;let p={};n.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{n.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{n.describe(e,t[e])})):p[t]=e},n.getDescriptions=()=>p;let m=[];n.epilog=t=>{m.push(t)};let y,b=!1;n.wrap=t=>{b=!0,y=t},n.getWrap=()=>s.getEnv("YARGS_DISABLE_WRAP")?null:(b||(y=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),b=!0),y);const v="__yargsString__:";function O(t,e,i){let n=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{n=Math.max(s.stringWidth(i?`${i} ${I(t[0])}`:I(t[0]))+$(t[0]),n)})),e&&(n=Math.min(n,parseInt((.5*e).toString(),10))),n}let w;function C(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,e){let s=`[${i("default:")} `;if(void 0===t&&!e)return null;if(e)s+=e;else switch(typeof t){case"string":s+=`"${t}"`;break;case"object":s+=JSON.stringify(t);break;default:s+=t}return`${s}]`}n.deferY18nLookup=t=>v+t,n.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((i=>{s.alias[i].forEach((r=>{p[r]&&n.describe(i,p[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)}))}))}();const e=t.customScriptName?t.$0:s.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),h=t.getGroups(),l=t.getOptions();let g=[];g=g.concat(Object.keys(p)),g=g.concat(Object.keys(r)),g=g.concat(Object.keys(o)),g=g.concat(Object.keys(l.default)),g=g.filter(C),g=Object.keys(g.reduce(((t,e)=>("_"!==e&&(t[e]=!0),t)),{}));const y=n.getWrap(),b=s.cliui({width:y,wrap:!!y});if(!f)if(c.length)c.forEach((t=>{b.div({text:`${t[0].replace(/\$0/g,e)}`}),t[1]&&b.div({text:`${t[1]}`,padding:[1,0,0,0]})})),b.div();else if(u.length){let t=null;t=o._?`${e} <${i("command")}>\n`:`${e} [${i("command")}]\n`,b.div(`${t}`)}if(u.length>1||1===u.length&&!u[0][2]){b.div(i("Commands:"));const s=t.getInternalMethods().getContext(),n=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(u=u.sort(((t,e)=>t[0].localeCompare(e[0]))));const r=e?`${e} `:"";u.forEach((t=>{const s=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;b.span({text:s,padding:[0,2,0,2],width:O(u,y,`${e}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${i("default")}]`),t[3]&&t[3].length&&o.push(`[${i("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${i("deprecated: %s",t[4])}]`):o.push(`[${i("deprecated")}]`)),o.length?b.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):b.div()})),b.div()}const M=(Object.keys(l.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);g=g.filter((e=>!t.parsed.newAliases[e]&&M.every((t=>-1===(l.alias[t]||[]).indexOf(e)))));const _=i("Options:");h[_]||(h[_]=[]),function(t,e,s,i){let n=[],r=null;Object.keys(s).forEach((t=>{n=n.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==n.indexOf(t)))||s[i].push(t)}))}(g,l.alias,h,_);const k=t=>/^--/.test(I(t)),x=Object.keys(h).filter((t=>h[t].length>0)).map((t=>({groupName:t,normalizedKeys:h[t].filter(C).map((t=>{if(M.includes(t))return t;for(let e,s=0;void 0!==(e=M[s]);s++)if((l.alias[e]||[]).includes(t))return e;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:e})=>{const s=e.reduce(((e,s)=>(e[s]=[s].concat(l.alias[s]||[]).map((e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?l.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e)).sort(((t,e)=>k(t)===k(e)?0:k(t)?1:-1)).join(", "),e)),{});return{groupName:t,normalizedKeys:e,switches:s}}));if(x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>k(e[t])))))&&x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,i;k(e[t])&&(e[t]=(s=e[t],i=4,S(s)?{text:s.text,indentation:s.indentation+i}:{text:s,indentation:i}))}))})),x.forEach((({groupName:e,normalizedKeys:s,switches:o})=>{b.div(e),s.forEach((e=>{const s=o[e];let h=p[e]||"",c=null;h.includes(v)&&(h=i(h.substring(16))),l.boolean.includes(e)&&(c=`[${i("boolean")}]`),l.count.includes(e)&&(c=`[${i("count")}]`),l.string.includes(e)&&(c=`[${i("string")}]`),l.normalize.includes(e)&&(c=`[${i("string")}]`),l.array.includes(e)&&(c=`[${i("array")}]`),l.number.includes(e)&&(c=`[${i("number")}]`);const f=[e in a?(d=a[e],"string"==typeof d?`[${i("deprecated: %s",d)}]`:`[${i("deprecated")}]`):null,c,e in r?`[${i("required")}]`:null,l.choices&&l.choices[e]?`[${i("choices:")} ${n.stringifiedValues(l.choices[e])}]`:null,j(l.default[e],l.defaultDescription[e])].filter(Boolean).join(" ");var d;b.span({text:I(s),padding:[0,2,0,2+$(s)],width:O(o,y)+4},h);const u=!0===t.getInternalMethods().getUsageConfiguration()["hide-types"];f&&!u?b.div({text:f,padding:[0,0,0,2],align:"right"}):b.div()})),b.div()})),d.length&&(b.div(i("Examples:")),d.forEach((t=>{t[0]=t[0].replace(/\$0/g,e)})),d.forEach((t=>{""===t[1]?b.div({text:t[0],padding:[0,2,0,2]}):b.div({text:t[0],padding:[0,2,0,2],width:O(d,y)+4},{text:t[1]})})),b.div()),m.length>0){const t=m.map((t=>t.replace(/\$0/g,e))).join("\n");b.div(`${t}\n`)}return b.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){w=this.help()},n.clearCachedHelpMessage=function(){w=void 0},n.hasCachedHelpMessage=function(){return!!w},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):i("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const i=e||", ",n=[].concat(t);return t&&n.length?(n.forEach((t=>{s.length&&(s+=i),s+=JSON.stringify(t)})),s):s};let M=null;n.version=t=>{M=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(M)},n.reset=function(t){return o=null,l=!1,c=[],f=!1,m=[],d=[],u=[],p=g(p,(e=>!t[e])),n};const _=[];return n.freeze=function(){_.push({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p})},n.unfreeze=function(t=!1){const e=_.pop();e&&(t?(p={...e.descriptions,...p},u=[...e.commands,...u],c=[...e.usages,...c],d=[...e.examples,...d],m=[...e.epilogs,...m]):({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p}=e))},n}function S(t){return"object"==typeof t}function $(t){return S(t)?t.indentation:0}function I(t){return S(t)?t.text:t}class D{constructor(t,e,s,i){var n,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(n=this.shim.getEnv("SHELL"))||void 0===n?void 0:n.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,i){const n=this.command.getCommandHandlers();for(let e=0,s=t.length;e<s;++e)if(n[t[e]]&&n[t[e]].builder){const s=n[t[e]].builder;if(x(s)){this.indexAfterLastReset=e+1;const t=this.yargs.getInternalMethods().reset();return s(t,!0),t.argv}}const r=[];this.commandCompletions(r,t,s),this.optionCompletions(r,t,e,s),this.choicesFromOptionsCompletions(r,t,e,s),this.choicesFromPositionalsCompletions(r,t,e,s),i(null,r)}commandCompletions(t,e,s){const i=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||i[i.length-1]===s||this.previousArgHasChoices(e)||this.usage.getCommands().forEach((s=>{const i=o(s[0]).cmd;if(-1===e.indexOf(i))if(this.zshShell){const e=s[1]||"";t.push(i.replace(/:/g,"\\:")+":"+e)}else t.push(i)}))}optionCompletions(t,e,s,i){if((i.match(/^-/)||""===i&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach((r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);n.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||this.completeOptionKey(r,t,i,o&&!!s.default[r])}))}}choicesFromOptionsCompletions(t,e,s,i){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,e,s,i){if(""===i&&t.length>0&&this.previousArgHasChoices(e))return;const n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=n[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(i)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const i=e.replace(/^-+/,""),n=this.yargs.getOptions(),r=[i,...this.yargs.getAliases()[i]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(n.key,t)&&Array.isArray(n.choices[t])){o=n.choices[t];break}return o?o.filter((t=>!s||t.startsWith(s))):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const i=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(i(e))return!0;if(s&&i(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(i(t))return!0;return!1}completeOptionKey(t,e,s,i){var n,r,o,a;let h=t;if(this.zshShell){const e=this.usage.getDescriptions(),s=null===(r=null===(n=null==this?void 0:this.aliases)||void 0===n?void 0:n[t])||void 0===r?void 0:r.find((t=>{const s=e[t];return"string"==typeof s&&s.length>0})),i=s?e[s]:void 0,l=null!==(a=null!==(o=e[t])&&void 0!==o?o:i)&&void 0!==a?a:"";h=`${t.replace(/:/g,"\\:")}:${l.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const l=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";e.push(l+h),i&&e.push(l+"no-"+h)}customCompletion(t,e,s,i){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return f(t)?t.then((t=>{this.shim.process.nextTick((()=>{i(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{i(t,void 0)}))})):i(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((n=i)=>this.defaultCompletion(t,e,s,n)),(t=>{i(null,t)})):this.customCompletionFunction(s,e,(t=>{i(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),n=this.customCompletionFunction?i=>this.customCompletion(t,i,s,e):i=>this.defaultCompletion(t,i,s,e);return f(i)?i.then(n):n(i)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,i),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let i,n;for(i=0;i<=e.length;i++)s[i]=[i];for(n=0;n<=t.length;n++)s[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?s[i][n]=s[i-1][n-1]:i>1&&n>1&&e.charAt(i-2)===t.charAt(n-1)&&e.charAt(i-1)===t.charAt(n-2)?s[i][n]=s[i-2][n-2]+1:s[i][n]=Math.min(s[i-1][n-1]+1,Math.min(s[i][n-1]+1,s[i-1][n]+1));return s[e.length][t.length]}const H=["$0","--","_"];var z,W,q,U,F,L,V,G,R,T,B,Y,K,J,Z,X,Q,tt,et,st,it,nt,rt,ot,at,ht,lt,ct,ft,dt,ut,pt,gt,mt,yt;const bt=Symbol("copyDoubleDash"),vt=Symbol("copyDoubleDash"),Ot=Symbol("deleteFromParserHintObject"),wt=Symbol("emitWarning"),Ct=Symbol("freeze"),jt=Symbol("getDollarZero"),Mt=Symbol("getParserConfiguration"),_t=Symbol("getUsageConfiguration"),kt=Symbol("guessLocale"),xt=Symbol("guessVersion"),Et=Symbol("parsePositionalNumbers"),At=Symbol("pkgUp"),Pt=Symbol("populateParserHintArray"),St=Symbol("populateParserHintSingleValueDictionary"),$t=Symbol("populateParserHintArrayDictionary"),It=Symbol("populateParserHintDictionary"),Dt=Symbol("sanitizeKey"),Nt=Symbol("setKey"),Ht=Symbol("unfreeze"),zt=Symbol("validateAsync"),Wt=Symbol("getCommandInstance"),qt=Symbol("getContext"),Ut=Symbol("getHasOutput"),Ft=Symbol("getLoggerInstance"),Lt=Symbol("getParseContext"),Vt=Symbol("getUsageInstance"),Gt=Symbol("getValidationInstance"),Rt=Symbol("hasParseCallback"),Tt=Symbol("isGlobalContext"),Bt=Symbol("postProcess"),Yt=Symbol("rebase"),Kt=Symbol("reset"),Jt=Symbol("runYargsParserAndExecuteCommands"),Zt=Symbol("runValidation"),Xt=Symbol("setHasOutput"),Qt=Symbol("kTrackManuallySetKeys");class te{constructor(t=[],e,s,i){this.customScriptName=!1,this.parsed=!1,z.set(this,void 0),W.set(this,void 0),q.set(this,{commands:[],fullCommands:[]}),U.set(this,null),F.set(this,null),L.set(this,"show-hidden"),V.set(this,null),G.set(this,!0),R.set(this,{}),T.set(this,!0),B.set(this,[]),Y.set(this,void 0),K.set(this,{}),J.set(this,!1),Z.set(this,null),X.set(this,!0),Q.set(this,void 0),tt.set(this,""),et.set(this,void 0),st.set(this,void 0),it.set(this,{}),nt.set(this,null),rt.set(this,null),ot.set(this,{}),at.set(this,{}),ht.set(this,void 0),lt.set(this,!1),ct.set(this,void 0),ft.set(this,!1),dt.set(this,!1),ut.set(this,!1),pt.set(this,void 0),gt.set(this,{}),mt.set(this,null),yt.set(this,void 0),O(this,ct,i,"f"),O(this,ht,t,"f"),O(this,W,e,"f"),O(this,st,s,"f"),O(this,Y,new w(this),"f"),this.$0=this[jt](),this[Kt](),O(this,z,v(this,z,"f"),"f"),O(this,pt,v(this,pt,"f"),"f"),O(this,yt,v(this,yt,"f"),"f"),O(this,et,v(this,et,"f"),"f"),v(this,et,"f").showHiddenOpt=v(this,L,"f"),O(this,Q,this[vt](),"f")}addHelpOpt(t,e){return h("[string|boolean] [string]",[t,e],arguments.length),v(this,Z,"f")&&(this[Ot](v(this,Z,"f")),O(this,Z,null,"f")),!1===t&&void 0===e||(O(this,Z,"string"==typeof t?t:"help","f"),this.boolean(v(this,Z,"f")),this.describe(v(this,Z,"f"),e||v(this,pt,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(h("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:v(this,L,"f");return this.boolean(s),this.describe(s,e||v(this,pt,"f").deferY18nLookup("Show hidden options")),v(this,et,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return h("<object|string|array> [string|array]",[t,e],arguments.length),this[$t](this.alias.bind(this),"alias",t,e),this}array(t){return h("<array|string>",[t],arguments.length),this[Pt]("array",t),this[Qt](t),this}boolean(t){return h("<array|string>",[t],arguments.length),this[Pt]("boolean",t),this[Qt](t),this}check(t,e){return h("<function> [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>j((()=>t(e,s.getOptions())),(s=>(s?("string"==typeof s||s instanceof Error)&&v(this,pt,"f").fail(s.toString(),s):v(this,pt,"f").fail(v(this,ct,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(v(this,pt,"f").fail(t.message?t.message:t.toString(),t),e)))),!1,e),this}choices(t,e){return h("<object|string|array> [string|array]",[t,e],arguments.length),this[$t](this.choices.bind(this),"choices",t,e),this}coerce(t,s){if(h("<object|string|array> [function]",[t,s],arguments.length),Array.isArray(t)){if(!s)throw new e("coerce callback must be provided");for(const e of t)this.coerce(e,s);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!s)throw new e("coerce callback must be provided");return v(this,et,"f").key[t]=!0,v(this,Y,"f").addCoerceMiddleware(((i,n)=>{let r;return Object.prototype.hasOwnProperty.call(i,t)?j((()=>(r=n.getAliases(),s(i[t]))),(e=>{i[t]=e;const s=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[t]&&!0!==s)for(const s of r[t])i[s]=e;return i}),(t=>{throw new e(t.message)})):i}),t),this}conflicts(t,e){return h("<string|object> [string|array]",[t,e],arguments.length),v(this,yt,"f").conflicts(t,e),this}config(t="config",e,s){return h("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||v(this,pt,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{v(this,et,"f").config[t]=s||!0})),this):(t=n(t,v(this,W,"f"),this[Mt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return h("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),O(this,F,t||v(this,F,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(v(this,F,"f"),e),s&&v(this,U,"f").registerFunction(s),this}command(t,e,s,i,n,r){return h("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,i,n,r],arguments.length),v(this,z,"f").addHandler(t,e,s,i,n,r),this}commands(t,e,s,i,n,r){return this.command(t,e,s,i,n,r)}commandDir(t,e){h("<string> [object]",[t,e],arguments.length);const s=v(this,st,"f")||v(this,ct,"f").require;return v(this,z,"f").addDirectory(t,s,v(this,ct,"f").getCallerFile(),e),this}count(t){return h("<array|string>",[t],arguments.length),this[Pt]("count",t),this[Qt](t),this}default(t,e,s){return h("<object|string|array> [*] [string]",[t,e,s],arguments.length),s&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]=s),"function"==typeof e&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]||(v(this,et,"f").defaultDescription[t]=v(this,pt,"f").functionDescription(e)),e=e.call()),this[St](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,i){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,i],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),v(this,et,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:i},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(d(s,!0,v(this,ct,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return h("<object|string|array> [string]",[t,e],arguments.length),this[St](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return h("<string> [string|boolean]",[t,e],arguments.length),v(this,et,"f").deprecatedOptions[t]=e,this}describe(t,e){return h("<object|string|array> [string]",[t,e],arguments.length),this[Nt](t,!0),v(this,pt,"f").describe(t,e),this}detectLocale(t){return h("<boolean>",[t],arguments.length),O(this,G,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,et,"f").envPrefix:v(this,et,"f").envPrefix=t||"",this}epilogue(t){return h("<string>",[t],arguments.length),v(this,pt,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return h("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):v(this,pt,"f").example(t,e),this}exit(t,e){O(this,J,!0,"f"),O(this,V,e,"f"),v(this,T,"f")&&v(this,ct,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,T,t,"f"),this}fail(t){if(h("<function|boolean>",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new e("Invalid first argument. Expected function or boolean 'false'");return v(this,pt,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return h("<array> [function]",[t,e],arguments.length),e?v(this,U,"f").getCompletion(t,e):new Promise(((e,s)=>{v(this,U,"f").getCompletion(t,((t,i)=>{t?s(t):e(i)}))}))}getDemandedOptions(){return h([],0),v(this,et,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,et,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,et,"f").deprecatedOptions}getDetectLocale(){return v(this,G,"f")}getExitProcess(){return v(this,T,"f")}getGroups(){return Object.assign({},v(this,K,"f"),v(this,at,"f"))}getHelp(){if(O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Jt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(t))return t.then((()=>v(this,pt,"f").help()))}const t=v(this,z,"f").runDefaultBuilderOn(this);if(f(t))return t.then((()=>v(this,pt,"f").help()))}return Promise.resolve(v(this,pt,"f").help())}getOptions(){return v(this,et,"f")}getStrict(){return v(this,ft,"f")}getStrictCommands(){return v(this,dt,"f")}getStrictOptions(){return v(this,ut,"f")}global(t,e){return h("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?v(this,et,"f").local=v(this,et,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{v(this,et,"f").local.includes(t)||v(this,et,"f").local.push(t)})),this}group(t,e){h("<string|array> <string>",[t,e],arguments.length);const s=v(this,at,"f")[e]||v(this,K,"f")[e];v(this,at,"f")[e]&&delete v(this,at,"f")[e];const i={};return v(this,K,"f")[e]=(s||[]).concat(t).filter((t=>!i[t]&&(i[t]=!0))),this}hide(t){return h("<string>",[t],arguments.length),v(this,et,"f").hiddenOptions.push(t),this}implies(t,e){return h("<string|object> [number|string|array]",[t,e],arguments.length),v(this,yt,"f").implies(t,e),this}locale(t){return h("[string]",[t],arguments.length),void 0===t?(this[kt](),v(this,ct,"f").y18n.getLocale()):(O(this,G,!1,"f"),v(this,ct,"f").y18n.setLocale(t),this)}middleware(t,e,s){return v(this,Y,"f").addMiddleware(t,!!e,s)}nargs(t,e){return h("<string|object|array> [number]",[t,e],arguments.length),this[St](this.nargs.bind(this),"narg",t,e),this}normalize(t){return h("<array|string>",[t],arguments.length),this[Pt]("normalize",t),this}number(t){return h("<array|string>",[t],arguments.length),this[Pt]("number",t),this[Qt](t),this}option(t,e){if(h("<string|object> [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach((e=>{this.options(e,t[e])}));else{"object"!=typeof e&&(e={}),this[Qt](t),!v(this,mt,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[wt](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),void 0,"versionWarning"),v(this,et,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(v(this,et,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const n=e.describe||e.description||e.desc,r=v(this,pt,"f").getDescriptions();Object.prototype.hasOwnProperty.call(r,t)&&"string"!=typeof n||this.describe(t,n),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){h("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[Ct](),void 0===t&&(t=v(this,ht,"f")),"object"==typeof e&&(O(this,rt,e,"f"),e=s),"function"==typeof e&&(O(this,nt,e,"f"),e=!1),e||O(this,ht,t,"f"),v(this,nt,"f")&&O(this,T,!1,"f");const i=this[Jt](t,!!e),n=this.parsed;return v(this,U,"f").setParsed(this.parsed),f(i)?i.then((t=>(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),t,v(this,tt,"f")),t))).catch((t=>{throw v(this,nt,"f")&&v(this,nt,"f")(t,this.parsed.argv,v(this,tt,"f")),t})).finally((()=>{this[Ht](),this.parsed=n})):(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),i,v(this,tt,"f")),this[Ht](),this.parsed=n,i)}parseAsync(t,e,s){const i=this.parse(t,e,s);return f(i)?i:Promise.resolve(i)}parseSync(t,s,i){const n=this.parse(t,s,i);if(f(n))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return h("<object>",[t],arguments.length),O(this,it,t,"f"),this}pkgConf(t,e){h("<string> [string]",[t,e],arguments.length);let s=null;const i=this[At](e||v(this,W,"f"));return i[t]&&"object"==typeof i[t]&&(s=n(i[t],e||v(this,W,"f"),this[Mt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(s)),this}positional(t,e){h("<string> <object>",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=g(e,((t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t)));const i=v(this,q,"f").fullCommands[v(this,q,"f").fullCommands.length-1],n=i?v(this,z,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return p(n).forEach((s=>{const i=n[s];Array.isArray(i)?-1!==i.indexOf(t)&&(e[s]=!0):i[t]&&!(s in e)&&(e[s]=i[t])})),this.group(t,v(this,pt,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,lt,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return h("<array|string|object> [number]",[t],arguments.length),"string"==typeof t&&v(this,et,"f").narg[t]||this[St](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return h("[string] [string]",[t,e],arguments.length),t=t||this.$0,v(this,Q,"f").log(v(this,U,"f").generateCompletionScript(t,e||v(this,F,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Jt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}const e=v(this,z,"f").runDefaultBuilderOn(this);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}return v(this,pt,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return h("[boolean|string] [string]",[t,e],arguments.length),v(this,pt,"f").showHelpOnFail(t,e),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,pt,"f").showVersion(t),this}skipValidation(t){return h("<array|string>",[t],arguments.length),this[Pt]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,ft,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,dt,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,ut,!1!==t,"f"),this}string(t){return h("<array|string>",[t],arguments.length),this[Pt]("string",t),this[Qt](t),this}terminalWidth(){return h([],0),v(this,ct,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("<object>",[t],arguments.length),O(this,G,!1,"f"),v(this,ct,"f").y18n.updateLocale(t),this}usage(t,s,i,n){if(h("<string|null|undefined> [string|boolean] [function|object] [function]",[t,s,i,n],arguments.length),void 0!==s){if(d(t,null,v(this,ct,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,i,n);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,pt,"f").usage(t),this}usageConfiguration(t){return h("<object>",[t],arguments.length),O(this,gt,t,"f"),this}version(t,e,s){const i="version";if(h("[boolean|string] [string] [string]",[t,e,s],arguments.length),v(this,mt,"f")&&(this[Ot](v(this,mt,"f")),v(this,pt,"f").version(void 0),O(this,mt,null,"f")),0===arguments.length)s=this[xt](),t=i;else if(1===arguments.length){if(!1===t)return this;s=t,t=i}else 2===arguments.length&&(s=e,e=void 0);return O(this,mt,"string"==typeof t?t:i,"f"),e=e||v(this,pt,"f").deferY18nLookup("Show version number"),v(this,pt,"f").version(s||void 0),this.boolean(v(this,mt,"f")),this.describe(v(this,mt,"f"),e),this}wrap(t){return h("<number|null|undefined>",[t],arguments.length),v(this,pt,"f").wrap(t),this}[(z=new WeakMap,W=new WeakMap,q=new WeakMap,U=new WeakMap,F=new WeakMap,L=new WeakMap,V=new WeakMap,G=new WeakMap,R=new WeakMap,T=new WeakMap,B=new WeakMap,Y=new WeakMap,K=new WeakMap,J=new WeakMap,Z=new WeakMap,X=new WeakMap,Q=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,at=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,yt=new WeakMap,bt)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[vt](){return{log:(...t)=>{this[Rt]()||console.log(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")},error:(...t)=>{this[Rt]()||console.error(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")}}}[Ot](t){p(v(this,et,"f")).forEach((e=>{if("configObjects"===e)return;const s=v(this,et,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete v(this,pt,"f").getDescriptions()[t]}[wt](t,e,s){v(this,R,"f")[s]||(v(this,ct,"f").process.emitWarning(t,e),v(this,R,"f")[s]=!0)}[Ct](){v(this,B,"f").push({options:v(this,et,"f"),configObjects:v(this,et,"f").configObjects.slice(0),exitProcess:v(this,T,"f"),groups:v(this,K,"f"),strict:v(this,ft,"f"),strictCommands:v(this,dt,"f"),strictOptions:v(this,ut,"f"),completionCommand:v(this,F,"f"),output:v(this,tt,"f"),exitError:v(this,V,"f"),hasOutput:v(this,J,"f"),parsed:this.parsed,parseFn:v(this,nt,"f"),parseContext:v(this,rt,"f")}),v(this,pt,"f").freeze(),v(this,yt,"f").freeze(),v(this,z,"f").freeze(),v(this,Y,"f").freeze()}[jt](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,ct,"f").process.argv()[0])?v(this,ct,"f").process.argv().slice(1,2):v(this,ct,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Yt](v(this,W,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.length<t.length?e:t})).join(" ").trim(),v(this,ct,"f").getEnv("_")&&v(this,ct,"f").getProcessArgvBin()===v(this,ct,"f").getEnv("_")&&(e=v(this,ct,"f").getEnv("_").replace(`${v(this,ct,"f").path.dirname(v(this,ct,"f").process.execPath())}/`,"")),e}[Mt](){return v(this,it,"f")}[_t](){return v(this,gt,"f")}[kt](){if(!v(this,G,"f"))return;const t=v(this,ct,"f").getEnv("LC_ALL")||v(this,ct,"f").getEnv("LC_MESSAGES")||v(this,ct,"f").getEnv("LANG")||v(this,ct,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[xt](){return this[At]().version||"unknown"}[Et](t){const e=t["--"]?t["--"]:t._;for(let t,s=0;void 0!==(t=e[s]);s++)v(this,ct,"f").Parser.looksLikeNumber(t)&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))&&(e[s]=Number(t));return t}[At](t){const e=t||"*";if(v(this,ot,"f")[e])return v(this,ot,"f")[e];let s={};try{let e=t||v(this,ct,"f").mainFilename;!t&&v(this,ct,"f").path.extname(e)&&(e=v(this,ct,"f").path.dirname(e));const i=v(this,ct,"f").findUp(e,((t,e)=>e.includes("package.json")?"package.json":void 0));d(i,void 0,v(this,ct,"f")),s=JSON.parse(v(this,ct,"f").readFileSync(i,"utf8"))}catch(t){}return v(this,ot,"f")[e]=s||{},v(this,ot,"f")[e]}[Pt](t,e){(e=[].concat(e)).forEach((e=>{e=this[Dt](e),v(this,et,"f")[t].push(e)}))}[St](t,e,s,i){this[It](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=s}))}[$t](t,e,s,i){this[It](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=(v(this,et,"f")[t][e]||[]).concat(s)}))}[It](t,e,s,i,n){if(Array.isArray(s))s.forEach((e=>{t(e,i)}));else if((t=>"object"==typeof t)(s))for(const e of p(s))t(e,s[e]);else n(e,this[Dt](s),i)}[Dt](t){return"__proto__"===t?"___proto___":t}[Nt](t,e){return this[St](this[Nt].bind(this),"key",t,e),this}[Ht](){var t,e,s,i,n,r,o,a,h,l,c,f;const u=v(this,B,"f").pop();let p;d(u,void 0,v(this,ct,"f")),t=this,e=this,s=this,i=this,n=this,r=this,o=this,a=this,h=this,l=this,c=this,f=this,({options:{set value(e){O(t,et,e,"f")}}.value,configObjects:p,exitProcess:{set value(t){O(e,T,t,"f")}}.value,groups:{set value(t){O(s,K,t,"f")}}.value,output:{set value(t){O(i,tt,t,"f")}}.value,exitError:{set value(t){O(n,V,t,"f")}}.value,hasOutput:{set value(t){O(r,J,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(o,ft,t,"f")}}.value,strictCommands:{set value(t){O(a,dt,t,"f")}}.value,strictOptions:{set value(t){O(h,ut,t,"f")}}.value,completionCommand:{set value(t){O(l,F,t,"f")}}.value,parseFn:{set value(t){O(c,nt,t,"f")}}.value,parseContext:{set value(t){O(f,rt,t,"f")}}.value}=u),v(this,et,"f").configObjects=p,v(this,pt,"f").unfreeze(),v(this,yt,"f").unfreeze(),v(this,z,"f").unfreeze(),v(this,Y,"f").unfreeze()}[zt](t,e){return j(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[Wt].bind(this),getContext:this[qt].bind(this),getHasOutput:this[Ut].bind(this),getLoggerInstance:this[Ft].bind(this),getParseContext:this[Lt].bind(this),getParserConfiguration:this[Mt].bind(this),getUsageConfiguration:this[_t].bind(this),getUsageInstance:this[Vt].bind(this),getValidationInstance:this[Gt].bind(this),hasParseCallback:this[Rt].bind(this),isGlobalContext:this[Tt].bind(this),postProcess:this[Bt].bind(this),reset:this[Kt].bind(this),runValidation:this[Zt].bind(this),runYargsParserAndExecuteCommands:this[Jt].bind(this),setHasOutput:this[Xt].bind(this)}}[Wt](){return v(this,z,"f")}[qt](){return v(this,q,"f")}[Ut](){return v(this,J,"f")}[Ft](){return v(this,Q,"f")}[Lt](){return v(this,rt,"f")||{}}[Vt](){return v(this,pt,"f")}[Gt](){return v(this,yt,"f")}[Rt](){return!!v(this,nt,"f")}[Tt](){return v(this,X,"f")}[Bt](t,e,s,i){if(s)return t;if(f(t))return t;e||(t=this[bt](t));return(this[Mt]()["parse-positional-numbers"]||void 0===this[Mt]()["parse-positional-numbers"])&&(t=this[Et](t)),i&&(t=C(t,this,v(this,Y,"f").getMiddleware(),!1)),t}[Kt](t={}){O(this,et,v(this,et,"f")||{},"f");const e={};e.local=v(this,et,"f").local||[],e.configObjects=v(this,et,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(v(this,at,"f"),Object.keys(v(this,K,"f")).reduce(((t,e)=>{const i=v(this,K,"f")[e].filter((t=>!(t in s)));return i.length>0&&(t[e]=i),t}),{})),O(this,K,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(v(this,et,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=g(v(this,et,"f")[t],(t=>!s[t]))})),e.envPrefix=v(this,et,"f").envPrefix,O(this,et,e,"f"),O(this,pt,v(this,pt,"f")?v(this,pt,"f").reset(s):P(this,v(this,ct,"f")),"f"),O(this,yt,v(this,yt,"f")?v(this,yt,"f").reset(s):function(t,e,s){const i=s.y18n.__,n=s.y18n.__n,r={nonOptionCount:function(s){const i=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;i._&&(r<i._.min||r>i._.max)&&(r<i._.min?void 0!==i._.minMsg?e.fail(i._.minMsg?i._.minMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.min.toString()):null):e.fail(n("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",r,r.toString(),i._.min.toString())):r>i._.max&&(void 0!==i._.maxMsg?e.fail(i._.maxMsg?i._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.max.toString()):null):e.fail(n("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),i._.max.toString()))))},positionalCount:function(t,s){s<t&&e.fail(n("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",s,s+"",t+""))},requiredArguments:function(t,s){let i=null;for(const e of Object.keys(s))Object.prototype.hasOwnProperty.call(t,e)&&void 0!==t[e]||(i=i||{},i[e]=s[e]);if(i){const t=[];for(const e of Object.keys(i)){const s=i[e];s&&t.indexOf(s)<0&&t.push(s)}const s=t.length?`\n${t.join("\n")}`:"";e.fail(n("Missing required argument: %s","Missing required arguments: %s",Object.keys(i).length,Object.keys(i).join(", ")+s))}},unknownArguments:function(s,i,o,a,h=!0){var l;const c=t.getInternalMethods().getCommandInstance().getCommands(),f=[],d=t.getInternalMethods().getContext();if(Object.keys(s).forEach((e=>{H.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,i)||f.push(e)})),h&&(d.commands.length>0||c.length>0||a)&&s._.slice(d.commands.length).forEach((t=>{c.includes(""+t)||f.push(""+t)})),h){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,i=d.commands.length+e;i<s._.length&&s._.slice(i).forEach((t=>{t=String(t),d.commands.includes(t)||f.includes(t)||f.push(t)}))}f.length&&e.fail(n("Unknown argument: %s","Unknown arguments: %s",f.length,f.map((t=>t.trim()?t:`"${t}"`)).join(", ")))},unknownCommands:function(s){const i=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||i.length>0)&&s._.slice(o.commands.length).forEach((t=>{i.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(n("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const i=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(i,t)||!i[e]))},limitedChoices:function(s){const n=t.getOptions(),r={};if(!Object.keys(n.choices).length)return;Object.keys(s).forEach((t=>{-1===H.indexOf(t)&&Object.prototype.hasOwnProperty.call(n.choices,t)&&[].concat(s[t]).forEach((e=>{-1===n.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=i("Invalid values:");o.forEach((t=>{a+=`\n ${i("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(n.choices[t]))}`})),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,i){h("<string|object> [array|number|string]",[e,i],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(i)?i.forEach((t=>r.implies(e,t))):(d(i,void 0,s),o[e].push(i)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const i=e;(o[e]||[]).forEach((e=>{let n=i;const r=e;n=a(t,n),e=a(t,e),n&&!e&&s.push(` ${i} -> ${r}`)}))})),s.length){let t=`${i("Implications failed:")}\n`;s.forEach((e=>{t+=e})),e.fail(t)}};let l={};r.conflicts=function(e,s){h("<string|object> [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.conflicts(t,e[t])})):(t.global(e),l[e]||(l[e]=[]),Array.isArray(s)?s.forEach((t=>r.conflicts(e,t))):l[e].push(s))},r.getConflicting=()=>l,r.conflicting=function(n){Object.keys(n).forEach((t=>{l[t]&&l[t].forEach((s=>{s&&void 0!==n[t]&&void 0!==n[s]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,s))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach((t=>{l[t].forEach((r=>{r&&void 0!==n[s.Parser.camelCase(t)]&&void 0!==n[s.Parser.camelCase(r)]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,r))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let n=null,r=1/0;for(let e,i=0;void 0!==(e=s[i]);i++){const s=N(t,e);s<=3&&s<r&&(r=s,n=e)}n&&e.fail(i("Did you mean %s?",n))},r.reset=function(t){return o=g(o,(e=>!t[e])),l=g(l,(e=>!t[e])),r};const c=[];return r.freeze=function(){c.push({implied:o,conflicting:l})},r.unfreeze=function(){const t=c.pop();d(t,void 0,s),({implied:o,conflicting:l}=t)},r}(this,v(this,pt,"f"),v(this,ct,"f")),"f"),O(this,z,v(this,z,"f")?v(this,z,"f").reset():function(t,e,s,i){return new _(t,e,s,i)}(v(this,pt,"f"),v(this,yt,"f"),v(this,Y,"f"),v(this,ct,"f")),"f"),v(this,U,"f")||O(this,U,function(t,e,s,i){return new D(t,e,s,i)}(this,v(this,pt,"f"),v(this,z,"f"),v(this,ct,"f")),"f"),v(this,Y,"f").reset(),O(this,F,null,"f"),O(this,tt,"","f"),O(this,V,null,"f"),O(this,J,!1,"f"),this.parsed=!1,this}[Yt](t,e){return v(this,ct,"f").path.relative(t,e)}[Jt](t,s,i,n=0,r=!1){let o=!!i||r;t=t||v(this,ht,"f"),v(this,et,"f").__=v(this,ct,"f").y18n.__,v(this,et,"f").configuration=this[Mt]();const a=!!v(this,et,"f").configuration["populate--"],h=Object.assign({},v(this,et,"f").configuration,{"populate--":!0}),l=v(this,ct,"f").Parser.detailed(t,Object.assign({},v(this,et,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),c=Object.assign(l.argv,v(this,rt,"f"));let d;const u=l.aliases;let p=!1,g=!1;Object.keys(c).forEach((t=>{t===v(this,Z,"f")&&c[t]?p=!0:t===v(this,mt,"f")&&c[t]&&(g=!0)})),c.$0=this.$0,this.parsed=l,0===n&&v(this,pt,"f").clearCachedHelpMessage();try{if(this[kt](),s)return this[Bt](c,a,!!i,!1);if(v(this,Z,"f")){[v(this,Z,"f")].concat(u[v(this,Z,"f")]||[]).filter((t=>t.length>1)).includes(""+c._[c._.length-1])&&(c._.pop(),p=!0)}O(this,X,!1,"f");const h=v(this,z,"f").getCommands(),m=v(this,U,"f").completionKey in c,y=p||m||r;if(c._.length){if(h.length){let t;for(let e,s=n||0;void 0!==c._[s];s++){if(e=String(c._[s]),h.includes(e)&&e!==v(this,F,"f")){const t=v(this,z,"f").runCommand(e,this,l,s+1,r,p||g||r);return this[Bt](t,a,!!i,!1)}if(!t&&e!==v(this,F,"f")){t=e;break}}!v(this,z,"f").hasDefaultCommand()&&v(this,lt,"f")&&t&&!y&&v(this,yt,"f").recommendCommands(t,h)}v(this,F,"f")&&c._.includes(v(this,F,"f"))&&!m&&(v(this,T,"f")&&E(!0),this.showCompletionScript(),this.exit(0))}if(v(this,z,"f").hasDefaultCommand()&&!y){const t=v(this,z,"f").runCommand(null,this,l,0,r,p||g||r);return this[Bt](t,a,!!i,!1)}if(m){v(this,T,"f")&&E(!0);const s=(t=[].concat(t)).slice(t.indexOf(`--${v(this,U,"f").completionKey}`)+1);return v(this,U,"f").getCompletion(s,((t,s)=>{if(t)throw new e(t.message);(s||[]).forEach((t=>{v(this,Q,"f").log(t)})),this.exit(0)})),this[Bt](c,!a,!!i,!1)}if(v(this,J,"f")||(p?(v(this,T,"f")&&E(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(v(this,T,"f")&&E(!0),o=!0,v(this,pt,"f").showVersion("log"),this.exit(0))),!o&&v(this,et,"f").skipValidation.length>0&&(o=Object.keys(c).some((t=>v(this,et,"f").skipValidation.indexOf(t)>=0&&!0===c[t]))),!o){if(l.error)throw new e(l.error.message);if(!m){const t=this[Zt](u,{},l.error);i||(d=C(c,this,v(this,Y,"f").getMiddleware(),!0)),d=this[zt](t,null!=d?d:c),f(d)&&!i&&(d=d.then((()=>C(c,this,v(this,Y,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof e))throw t;v(this,pt,"f").fail(t.message,t)}return this[Bt](null!=d?d:c,a,!!i,!0)}[Zt](t,s,i,n){const r={...this.getDemandedOptions()};return o=>{if(i)throw new e(i.message);v(this,yt,"f").nonOptionCount(o),v(this,yt,"f").requiredArguments(o,r);let a=!1;v(this,dt,"f")&&(a=v(this,yt,"f").unknownCommands(o)),v(this,ft,"f")&&!a?v(this,yt,"f").unknownArguments(o,t,s,!!n):v(this,ut,"f")&&v(this,yt,"f").unknownArguments(o,t,{},!1,!1),v(this,yt,"f").limitedChoices(o),v(this,yt,"f").implications(o),v(this,yt,"f").conflicting(o)}}[Xt](){O(this,J,!0,"f")}[Qt](t){if("string"==typeof t)v(this,et,"f").key[t]=!0;else for(const e of t)v(this,et,"f").key[e]=!0}}var ee,se;const{readFileSync:ie}=__webpack_require__(9896),{inspect:ne}=__webpack_require__(9023),{resolve:re}=__webpack_require__(6928),oe=__webpack_require__(9668),ae=__webpack_require__(6180);var he,le={assert:{notStrictEqual:t.notStrictEqual,strictEqual:t.strictEqual},cliui:__webpack_require__(164),findUp:__webpack_require__(7829),getEnv:t=>process.env[t],getCallerFile:__webpack_require__(2838),getProcessArgvBin:y,inspect:ne,mainFilename:null!==(se=null===(ee= false||void 0===__webpack_require__(7315)?void 0:__webpack_require__.c[__webpack_require__.s])||void 0===ee?void 0:ee.filename)&&void 0!==se?se:process.cwd(),Parser:ae,path:__webpack_require__(6928),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:ie,require:__webpack_require__(7315),requireDirectory:__webpack_require__(9386),stringWidth:__webpack_require__(4813),y18n:oe({directory:re(__dirname,"../locales"),updateFiles:!1})};const ce=(null===(he=null===process||void 0===process?void 0:process.env)||void 0===he?void 0:he.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1])<ce)throw Error(`yargs supports a minimum Node.js version of ${ce}. Read our version support policy: https://github.com/yargs/yargs#supported-nodejs-versions`)}const fe=__webpack_require__(6180);var de,ue={applyExtends:n,cjsPlatformShim:le,Yargs:(de=le,(t=[],e=de.process.cwd(),s)=>{const i=new te(t,e,s,de);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:fe,processArgv:b,YError:e};module.exports=ue;
|
|
38708
|
+
var t=__webpack_require__(2613);class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}let s,i=[];function n(t,o,a,h){s=h;let l={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return l;const r=/\.json|\..*rc$/.test(t.extends);let h=null;if(r)h=function(t,e){return s.path.resolve(t,e)}(o,t.extends);else try{h=/*require.resolve*/(__webpack_require__(7315).resolve(t.extends))}catch(e){return t}!function(t){if(i.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(h),i.push(h),l=r?JSON.parse(s.readFileSync(h,"utf8")):__webpack_require__(7315)(t.extends),delete t.extends,l=n(l,s.path.dirname(h),a,s)}return i=[],a?r(l,t):Object.assign({},l,t)}function r(t,e){const s={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const n of Object.keys(e))i(e[n])&&i(s[n])?s[n]=r(t[n],e[n]):s[n]=e[n];return s}function o(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${t}`);const n={cmd:i.replace(s,""),demanded:[],optional:[]};return e.forEach((t,i)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&i===e.length-1&&(r=!0),/^\[/.test(t)?n.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):n.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})}),n}const a=["first","second","third","fourth","fifth","sixth"];function h(t,s,i){try{let n=0;const[r,a,h]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,i],f=[].slice.call(a);for(;f.length&&void 0===f[f.length-1];)f.pop();const d=h||f.length;if(d<r.demanded.length)throw new e(`Not enough arguments provided. Expected ${r.demanded.length} but received ${f.length}.`);const u=r.demanded.length+r.optional.length;if(d>u)throw new e(`Too many arguments provided. Expected max ${u} but received ${d}.`);r.demanded.forEach(t=>{const e=l(f.shift());0===t.cmd.filter(t=>t===e||"*"===t).length&&c(e,t.cmd,n),n+=1}),r.optional.forEach(t=>{if(0===f.length)return;const e=l(f.shift());0===t.cmd.filter(t=>t===e||"*"===t).length&&c(e,t.cmd,n),n+=1})}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,i){throw new e(`Invalid ${a[i]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,e,s,i){s.assert.notStrictEqual(t,e,i)}function u(t,e){e.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},e=()=>!0){const s={};return p(t).forEach(i=>{e(i,t[i])&&(s[i]=t[i])}),s}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var b=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function O(t,e,s,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,s):n?n.value=s:e.set(t,s),s}"function"==typeof SuppressedError&&SuppressedError;class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,i=!1){if(h("<array|function> [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if("function"!=typeof t[i])throw Error("middleware must be a function");const n=t[i];n.applyBeforeValidation=e,n.global=s}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const n=t;n.applyBeforeValidation=e,n.global=s,n.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(t=>{const i=[...s[e]||[],e];return!t.option||!i.includes(t.option)}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}}function C(t,e,s,i){return s.reduce((t,s)=>{if(s.applyBeforeValidation!==i)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(f(t))return t.then(t=>Promise.all([t,s(t,e)])).then(([t,e])=>Object.assign(t,e));{const i=s(t,e);return f(i)?i.then(e=>Object.assign(t,e)):Object.assign(t,i)}},t)}function j(t,e,s=t=>{throw t}){try{const s="function"==typeof t?t():t;return f(s)?s.then(t=>e(t)):e(s)}catch(t){return s(t)}}const M=/(^\*)|(^\$0)/;class _{constructor(t,e,s,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,i){"boolean"!=typeof(i=i||{}).recurse&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);const n="function"==typeof i.visit?i.visit:t=>t;i.visit=(t,e,s)=>{const i=n(t,e,s);if(i){if(this.requireCache.has(e))return i;this.requireCache.add(e),this.addHandler(i)}return i},this.shim.requireDirectory({require:e,filename:s},t,i)}addHandler(t,e,s,i,n,r){let a=[];const h=function(t){return t?t.map(t=>(t.applyBeforeValidation=!1,t)):[]}(n);if(i=i||(()=>{}),Array.isArray(t))if(function(t){return t.every(t=>"string"==typeof t)}(t))[t,...a]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(s))return void this.addHandler([t].concat(a),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const n=o(t);a=a.map(t=>o(t).cmd);let l=!1;const c=[n.cmd].concat(a).filter(t=>!M.test(t)||(l=!0,!1));0===c.length&&l&&c.push("$0"),l&&(n.cmd=c[0],a=c.slice(1),t=t.replace(M,n.cmd)),a.forEach(t=>{this.aliasMap[t]=n.cmd}),!1!==e&&this.usage.command(t,e,l,a,r),this.handlers[n.cmd]={original:t,description:e,handler:i,builder:s||{},middlewares:h,deprecated:r,demanded:n.demanded,optional:n.optional},l&&(this.defaultCommand=this.handlers[n.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,i,n,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),h=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const c=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,h,i,n,r);return f(c)?c.then(t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,n,t.aliases,e)):this.applyMiddlewareAndGetResult(l,o,c.innerArgv,a,n,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,i,n,r,o,a){const h=e.builder;let l=s;if(E(h)){s.getInternalMethods().getUsageInstance().freeze();const c=h(s.getInternalMethods().reset(i),a);if(f(c))return c.then(i=>{var a;return l=(a=i)&&"function"==typeof a.getInternalMethods?i:s,this.parseAndUpdateUsage(t,e,l,n,r,o)})}else(function(t){return"object"==typeof t})(h)&&(s.getInternalMethods().getUsageInstance().freeze(),l=s.getInternalMethods().reset(i),Object.keys(e.builder).forEach(t=>{l.option(t,h[t])}));return this.parseAndUpdateUsage(t,e,l,n,r,o)}parseAndUpdateUsage(t,e,s,i,n,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,n,r);return f(o)?o.then(t=>({aliases:s.parsed.aliases,innerArgv:t})):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=M.test(e.original)?e.original.replace(M,"").trim():e.original,i=t.filter(t=>!M.test(t));return i.push(s),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,s,i,n,r,o,a){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(n,a,r.parsed.error,t);s=j(s,t=>(e(t),t))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const i=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,i,!1,!1),s=j(s=C(s,r,o,!1),t=>{const s=e.handler(t);return f(s)?s.then(()=>t):t}),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch(t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}})}return t||(i.commands.pop(),i.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,i,n,r,o){let a={};if(n)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,i,o));const h=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),l=C(s,o,h,!0);return f(l)?l.then(s=>this.handleValidationAndGetResult(t,e,s,i,r,o,h,a)):this.handleValidationAndGetResult(t,e,l,i,r,o,h,a)}populatePositionals(t,e,s,i){e._=e._.slice(s.commands.length);const n=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(n.length,e._.length);n.length;){const t=n.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map(t=>""+t)),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),i),o}populatePositional(t,e,s){const i=t.cmd[0];t.variadic?s[i]=e._.splice(0).map(String):e._.length&&(s[i]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=o(t);return s.demanded.forEach(t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i,e.demand[s]=!0}),s.optional.forEach(t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i}),e}postProcessPositionals(t,e,s,i){const n=Object.assign({},i.getOptions());n.default=Object.assign(s.default,n.default);for(const t of Object.keys(s.alias))n.alias[t]=(n.alias[t]||[]).concat(s.alias[t]);n.array=n.array.concat(s.array),n.config={};const r=[];if(Object.keys(e).forEach(t=>{e[t].map(e=>{n.configuration["unknown-options-as-args"]&&(n.key[t]=!0),r.push(`--${t}`),r.push(e)})}),!r.length)return;const o=Object.assign({},n.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},n,{configuration:o}));if(a.error)i.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach(t=>{s.push(...a.aliases[t])}),Object.keys(a.argv).forEach(n=>{s.includes(n)&&(e[n]||(e[n]=a.argv[n]),!this.isInConfigs(i,n)&&!this.isDefaulted(i,n)&&Object.prototype.hasOwnProperty.call(t,n)&&Object.prototype.hasOwnProperty.call(a.argv,n)&&(Array.isArray(t[n])||Array.isArray(a.argv[n]))?t[n]=[].concat(t[n],a.argv[n]):t[n]=a.argv[n])})}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some(t=>Object.prototype.hasOwnProperty.call(t,e))||s.some(t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=M.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(E(e))return e(t,!0);k(e)||Object.keys(e).forEach(s=>{t.option(s,e[s])})}moduleName(t){const e=function(t){if(false)// removed by dead control flow
|
|
38709
|
+
{}for(let e,s=0,i=Object.keys(__webpack_require__.c);s<i.length;s++)if(e=__webpack_require__.c[i[s]],e.exports===t)return e;return null}(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:s}){for(const i of[t,e,s]){if("string"==typeof i||!1===i)return i;d(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();d(t,void 0,this.shim),({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t)}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function k(t){return"object"==typeof t&&!!t.builder&&"function"==typeof t.handler}function E(t){return"function"==typeof t}function x(t){"undefined"!=typeof process&&[process.stdout,process.stderr].forEach(e=>{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)})}function A(t){return"boolean"==typeof t}function P(t,s){const i=s.y18n.__,n={},r=[];n.failFn=function(t){r.push(t)};let o=null,a=null,h=!0;n.showHelpOnFail=function(e=!0,s){const[i,r]="string"==typeof e?[!0,e]:[e,s];return t.getInternalMethods().isGlobalContext()&&(a=r),o=r,h=i,n};let l=!1;n.fail=function(s,i){const c=t.getInternalMethods().getLoggerInstance();if(!r.length){if(t.getExitProcess()&&x(!0),!l){l=!0,h&&(t.showHelp("error"),c.error()),(s||i)&&c.error(s||i);const e=o||a;e&&((s||i)&&c.error(""),c.error(e))}if(i=i||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,i);throw i}for(let t=r.length-1;t>=0;--t){const e=r[t];if(A(e)){if(i)throw i;if(s)throw Error(s)}else e(s,i,n)}};let c=[],f=!1;n.usage=(t,e)=>null===t?(f=!0,c=[],n):(f=!1,c.push([t,e||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>f,n.getPositionalGroupName=()=>i("Positionals:");let d=[];n.example=(t,e)=>{d.push([t,e||""])};let u=[];n.command=function(t,e,s,i,n=!1){s&&(u=u.map(t=>(t[2]=!1,t))),u.push([t,e||"",s,i,n])},n.getCommands=()=>u;let p={};n.describe=function(t,e){Array.isArray(t)?t.forEach(t=>{n.describe(t,e)}):"object"==typeof t?Object.keys(t).forEach(e=>{n.describe(e,t[e])}):p[t]=e},n.getDescriptions=()=>p;let m=[];n.epilog=t=>{m.push(t)};let y,b=!1;n.wrap=t=>{b=!0,y=t},n.getWrap=()=>s.getEnv("YARGS_DISABLE_WRAP")?null:(b||(y=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),b=!0),y);const v="__yargsString__:";function O(t,e,i){let n=0;return Array.isArray(t)||(t=Object.values(t).map(t=>[t])),t.forEach(t=>{n=Math.max(s.stringWidth(i?`${i} ${I(t[0])}`:I(t[0]))+$(t[0]),n)}),e&&(n=Math.min(n,parseInt((.5*e).toString(),10))),n}let w;function C(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,e){let s=`[${i("default:")} `;if(void 0===t&&!e)return null;if(e)s+=e;else switch(typeof t){case"string":s+=`"${t}"`;break;case"object":s+=JSON.stringify(t);break;default:s+=t}return`${s}]`}n.deferY18nLookup=t=>v+t,n.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach(i=>{s.alias[i].forEach(r=>{p[r]&&n.describe(i,p[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)})})}();const e=t.customScriptName?t.$0:s.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),h=t.getGroups(),l=t.getOptions();let g=[];g=g.concat(Object.keys(p)),g=g.concat(Object.keys(r)),g=g.concat(Object.keys(o)),g=g.concat(Object.keys(l.default)),g=g.filter(C),g=Object.keys(g.reduce((t,e)=>("_"!==e&&(t[e]=!0),t),{}));const y=n.getWrap(),b=s.cliui({width:y,wrap:!!y});if(!f)if(c.length)c.forEach(t=>{b.div({text:`${t[0].replace(/\$0/g,e)}`}),t[1]&&b.div({text:`${t[1]}`,padding:[1,0,0,0]})}),b.div();else if(u.length){let t=null;t=o._?`${e} <${i("command")}>\n`:`${e} [${i("command")}]\n`,b.div(`${t}`)}if(u.length>1||1===u.length&&!u[0][2]){b.div(i("Commands:"));const s=t.getInternalMethods().getContext(),n=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(u=u.sort((t,e)=>t[0].localeCompare(e[0])));const r=e?`${e} `:"";u.forEach(t=>{const s=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;b.span({text:s,padding:[0,2,0,2],width:O(u,y,`${e}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${i("default")}]`),t[3]&&t[3].length&&o.push(`[${i("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${i("deprecated: %s",t[4])}]`):o.push(`[${i("deprecated")}]`)),o.length?b.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):b.div()}),b.div()}const M=(Object.keys(l.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);g=g.filter(e=>!t.parsed.newAliases[e]&&M.every(t=>-1===(l.alias[t]||[]).indexOf(e)));const _=i("Options:");h[_]||(h[_]=[]),function(t,e,s,i){let n=[],r=null;Object.keys(s).forEach(t=>{n=n.concat(s[t])}),t.forEach(t=>{r=[t].concat(e[t]),r.some(t=>-1!==n.indexOf(t))||s[i].push(t)})}(g,l.alias,h,_);const k=t=>/^--/.test(I(t)),E=Object.keys(h).filter(t=>h[t].length>0).map(t=>({groupName:t,normalizedKeys:h[t].filter(C).map(t=>{if(M.includes(t))return t;for(let e,s=0;void 0!==(e=M[s]);s++)if((l.alias[e]||[]).includes(t))return e;return t})})).filter(({normalizedKeys:t})=>t.length>0).map(({groupName:t,normalizedKeys:e})=>{const s=e.reduce((e,s)=>(e[s]=[s].concat(l.alias[s]||[]).map(e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?l.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e).sort((t,e)=>k(t)===k(e)?0:k(t)?1:-1).join(", "),e),{});return{groupName:t,normalizedKeys:e,switches:s}});if(E.filter(({groupName:t})=>t!==n.getPositionalGroupName()).some(({normalizedKeys:t,switches:e})=>!t.every(t=>k(e[t])))&&E.filter(({groupName:t})=>t!==n.getPositionalGroupName()).forEach(({normalizedKeys:t,switches:e})=>{t.forEach(t=>{var s,i;k(e[t])&&(e[t]=(s=e[t],i=4,S(s)?{text:s.text,indentation:s.indentation+i}:{text:s,indentation:i}))})}),E.forEach(({groupName:e,normalizedKeys:s,switches:o})=>{b.div(e),s.forEach(e=>{const s=o[e];let h=p[e]||"",c=null;h.includes(v)&&(h=i(h.substring(16))),l.boolean.includes(e)&&(c=`[${i("boolean")}]`),l.count.includes(e)&&(c=`[${i("count")}]`),l.string.includes(e)&&(c=`[${i("string")}]`),l.normalize.includes(e)&&(c=`[${i("string")}]`),l.array.includes(e)&&(c=`[${i("array")}]`),l.number.includes(e)&&(c=`[${i("number")}]`);const f=[e in a?(d=a[e],"string"==typeof d?`[${i("deprecated: %s",d)}]`:`[${i("deprecated")}]`):null,c,e in r?`[${i("required")}]`:null,l.choices&&l.choices[e]?`[${i("choices:")} ${n.stringifiedValues(l.choices[e])}]`:null,j(l.default[e],l.defaultDescription[e])].filter(Boolean).join(" ");var d;b.span({text:I(s),padding:[0,2,0,2+$(s)],width:O(o,y)+4},h);const u=!0===t.getInternalMethods().getUsageConfiguration()["hide-types"];f&&!u?b.div({text:f,padding:[0,0,0,2],align:"right"}):b.div()}),b.div()}),d.length&&(b.div(i("Examples:")),d.forEach(t=>{t[0]=t[0].replace(/\$0/g,e)}),d.forEach(t=>{""===t[1]?b.div({text:t[0],padding:[0,2,0,2]}):b.div({text:t[0],padding:[0,2,0,2],width:O(d,y)+4},{text:t[1]})}),b.div()),m.length>0){const t=m.map(t=>t.replace(/\$0/g,e)).join("\n");b.div(`${t}\n`)}return b.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){w=this.help()},n.clearCachedHelpMessage=function(){w=void 0},n.hasCachedHelpMessage=function(){return!!w},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):i("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const i=e||", ",n=[].concat(t);return t&&n.length?(n.forEach(t=>{s.length&&(s+=i),s+=JSON.stringify(t)}),s):s};let M=null;n.version=t=>{M=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(M)},n.reset=function(t){return o=null,l=!1,c=[],f=!1,m=[],d=[],u=[],p=g(p,e=>!t[e]),n};const _=[];return n.freeze=function(){_.push({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p})},n.unfreeze=function(t=!1){const e=_.pop();e&&(t?(p={...e.descriptions,...p},u=[...e.commands,...u],c=[...e.usages,...c],d=[...e.examples,...d],m=[...e.epilogs,...m]):({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p}=e))},n}function S(t){return"object"==typeof t}function $(t){return S(t)?t.indentation:0}function I(t){return S(t)?t.text:t}class D{constructor(t,e,s,i){var n,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(n=this.shim.getEnv("SHELL"))||void 0===n?void 0:n.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,i){const n=this.command.getCommandHandlers();for(let e=0,s=t.length;e<s;++e)if(n[t[e]]&&n[t[e]].builder){const s=n[t[e]].builder;if(E(s)){this.indexAfterLastReset=e+1;const t=this.yargs.getInternalMethods().reset();return s(t,!0),t.argv}}const r=[];this.commandCompletions(r,t,s),this.optionCompletions(r,t,e,s),this.choicesFromOptionsCompletions(r,t,e,s),this.choicesFromPositionalsCompletions(r,t,e,s),i(null,r)}commandCompletions(t,e,s){const i=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||i[i.length-1]===s||this.previousArgHasChoices(e)||this.usage.getCommands().forEach(s=>{const i=o(s[0]).cmd;if(-1===e.indexOf(i))if(this.zshShell){const e=s[1]||"";t.push(i.replace(/:/g,"\\:")+":"+e)}else t.push(i)})}optionCompletions(t,e,s,i){if((i.match(/^-/)||""===i&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);n.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||this.completeOptionKey(r,t,i,o&&!!s.default[r])})}}choicesFromOptionsCompletions(t,e,s,i){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map(t=>t.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,s,i){if(""===i&&t.length>0&&this.previousArgHasChoices(e))return;const n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=n[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(i)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const i=e.replace(/^-+/,""),n=this.yargs.getOptions(),r=[i,...this.yargs.getAliases()[i]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(n.key,t)&&Array.isArray(n.choices[t])){o=n.choices[t];break}return o?o.filter(t=>!s||t.startsWith(s)):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const i=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(i(e))return!0;if(s&&i(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(i(t))return!0;return!1}completeOptionKey(t,e,s,i){var n,r,o,a;let h=t;if(this.zshShell){const e=this.usage.getDescriptions(),s=null===(r=null===(n=null==this?void 0:this.aliases)||void 0===n?void 0:n[t])||void 0===r?void 0:r.find(t=>{const s=e[t];return"string"==typeof s&&s.length>0}),i=s?e[s]:void 0,l=null!==(a=null!==(o=e[t])&&void 0!==o?o:i)&&void 0!==a?a:"";h=`${t.replace(/:/g,"\\:")}:${l.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const l=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";e.push(l+h),i&&e.push(l+"no-"+h)}customCompletion(t,e,s,i){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return f(t)?t.then(t=>{this.shim.process.nextTick(()=>{i(null,t)})}).catch(t=>{this.shim.process.nextTick(()=>{i(t,void 0)})}):i(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,(n=i)=>this.defaultCompletion(t,e,s,n),t=>{i(null,t)}):this.customCompletionFunction(s,e,t=>{i(null,t)})}getCompletion(t,e){const s=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),n=this.customCompletionFunction?i=>this.customCompletion(t,i,s,e):i=>this.defaultCompletion(t,i,s,e);return f(i)?i.then(n):n(i)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,i),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let i,n;for(i=0;i<=e.length;i++)s[i]=[i];for(n=0;n<=t.length;n++)s[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?s[i][n]=s[i-1][n-1]:i>1&&n>1&&e.charAt(i-2)===t.charAt(n-1)&&e.charAt(i-1)===t.charAt(n-2)?s[i][n]=s[i-2][n-2]+1:s[i][n]=Math.min(s[i-1][n-1]+1,Math.min(s[i][n-1]+1,s[i-1][n]+1));return s[e.length][t.length]}const H=["$0","--","_"];var z,W,q,U,F,L,V,G,R,T,B,Y,K,J,Z,X,Q,tt,et,st,it,nt,rt,ot,at,ht,lt,ct,ft,dt,ut,pt,gt,mt,yt;const bt=Symbol("copyDoubleDash"),vt=Symbol("copyDoubleDash"),Ot=Symbol("deleteFromParserHintObject"),wt=Symbol("emitWarning"),Ct=Symbol("freeze"),jt=Symbol("getDollarZero"),Mt=Symbol("getParserConfiguration"),_t=Symbol("getUsageConfiguration"),kt=Symbol("guessLocale"),Et=Symbol("guessVersion"),xt=Symbol("parsePositionalNumbers"),At=Symbol("pkgUp"),Pt=Symbol("populateParserHintArray"),St=Symbol("populateParserHintSingleValueDictionary"),$t=Symbol("populateParserHintArrayDictionary"),It=Symbol("populateParserHintDictionary"),Dt=Symbol("sanitizeKey"),Nt=Symbol("setKey"),Ht=Symbol("unfreeze"),zt=Symbol("validateAsync"),Wt=Symbol("getCommandInstance"),qt=Symbol("getContext"),Ut=Symbol("getHasOutput"),Ft=Symbol("getLoggerInstance"),Lt=Symbol("getParseContext"),Vt=Symbol("getUsageInstance"),Gt=Symbol("getValidationInstance"),Rt=Symbol("hasParseCallback"),Tt=Symbol("isGlobalContext"),Bt=Symbol("postProcess"),Yt=Symbol("rebase"),Kt=Symbol("reset"),Jt=Symbol("runYargsParserAndExecuteCommands"),Zt=Symbol("runValidation"),Xt=Symbol("setHasOutput"),Qt=Symbol("kTrackManuallySetKeys");class te{constructor(t=[],e,s,i){this.customScriptName=!1,this.parsed=!1,z.set(this,void 0),W.set(this,void 0),q.set(this,{commands:[],fullCommands:[]}),U.set(this,null),F.set(this,null),L.set(this,"show-hidden"),V.set(this,null),G.set(this,!0),R.set(this,{}),T.set(this,!0),B.set(this,[]),Y.set(this,void 0),K.set(this,{}),J.set(this,!1),Z.set(this,null),X.set(this,!0),Q.set(this,void 0),tt.set(this,""),et.set(this,void 0),st.set(this,void 0),it.set(this,{}),nt.set(this,null),rt.set(this,null),ot.set(this,{}),at.set(this,{}),ht.set(this,void 0),lt.set(this,!1),ct.set(this,void 0),ft.set(this,!1),dt.set(this,!1),ut.set(this,!1),pt.set(this,void 0),gt.set(this,{}),mt.set(this,null),yt.set(this,void 0),O(this,ct,i,"f"),O(this,ht,t,"f"),O(this,W,e,"f"),O(this,st,s,"f"),O(this,Y,new w(this),"f"),this.$0=this[jt](),this[Kt](),O(this,z,v(this,z,"f"),"f"),O(this,pt,v(this,pt,"f"),"f"),O(this,yt,v(this,yt,"f"),"f"),O(this,et,v(this,et,"f"),"f"),v(this,et,"f").showHiddenOpt=v(this,L,"f"),O(this,Q,this[vt](),"f")}addHelpOpt(t,e){return h("[string|boolean] [string]",[t,e],arguments.length),v(this,Z,"f")&&(this[Ot](v(this,Z,"f")),O(this,Z,null,"f")),!1===t&&void 0===e||(O(this,Z,"string"==typeof t?t:"help","f"),this.boolean(v(this,Z,"f")),this.describe(v(this,Z,"f"),e||v(this,pt,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(h("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:v(this,L,"f");return this.boolean(s),this.describe(s,e||v(this,pt,"f").deferY18nLookup("Show hidden options")),v(this,et,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return h("<object|string|array> [string|array]",[t,e],arguments.length),this[$t](this.alias.bind(this),"alias",t,e),this}array(t){return h("<array|string>",[t],arguments.length),this[Pt]("array",t),this[Qt](t),this}boolean(t){return h("<array|string>",[t],arguments.length),this[Pt]("boolean",t),this[Qt](t),this}check(t,e){return h("<function> [boolean]",[t,e],arguments.length),this.middleware((e,s)=>j(()=>t(e,s.getOptions()),s=>(s?("string"==typeof s||s instanceof Error)&&v(this,pt,"f").fail(s.toString(),s):v(this,pt,"f").fail(v(this,ct,"f").y18n.__("Argument check failed: %s",t.toString())),e),t=>(v(this,pt,"f").fail(t.message?t.message:t.toString(),t),e)),!1,e),this}choices(t,e){return h("<object|string|array> [string|array]",[t,e],arguments.length),this[$t](this.choices.bind(this),"choices",t,e),this}coerce(t,s){if(h("<object|string|array> [function]",[t,s],arguments.length),Array.isArray(t)){if(!s)throw new e("coerce callback must be provided");for(const e of t)this.coerce(e,s);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!s)throw new e("coerce callback must be provided");return v(this,et,"f").key[t]=!0,v(this,Y,"f").addCoerceMiddleware((i,n)=>{let r;return Object.prototype.hasOwnProperty.call(i,t)?j(()=>(r=n.getAliases(),s(i[t])),e=>{i[t]=e;const s=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[t]&&!0!==s)for(const s of r[t])i[s]=e;return i},t=>{throw new e(t.message)}):i},t),this}conflicts(t,e){return h("<string|object> [string|array]",[t,e],arguments.length),v(this,yt,"f").conflicts(t,e),this}config(t="config",e,s){return h("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||v(this,pt,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(t=>{v(this,et,"f").config[t]=s||!0}),this):(t=n(t,v(this,W,"f"),this[Mt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return h("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),O(this,F,t||v(this,F,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(v(this,F,"f"),e),s&&v(this,U,"f").registerFunction(s),this}command(t,e,s,i,n,r){return h("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,i,n,r],arguments.length),v(this,z,"f").addHandler(t,e,s,i,n,r),this}commands(t,e,s,i,n,r){return this.command(t,e,s,i,n,r)}commandDir(t,e){h("<string> [object]",[t,e],arguments.length);const s=v(this,st,"f")||v(this,ct,"f").require;return v(this,z,"f").addDirectory(t,s,v(this,ct,"f").getCallerFile(),e),this}count(t){return h("<array|string>",[t],arguments.length),this[Pt]("count",t),this[Qt](t),this}default(t,e,s){return h("<object|string|array> [*] [string]",[t,e,s],arguments.length),s&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]=s),"function"==typeof e&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]||(v(this,et,"f").defaultDescription[t]=v(this,pt,"f").functionDescription(e)),e=e.call()),this[St](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,i){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,i],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),v(this,et,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:i},this}demand(t,e,s){return Array.isArray(e)?(e.forEach(t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)}),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(d(s,!0,v(this,ct,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach(t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)}):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return h("<object|string|array> [string]",[t,e],arguments.length),this[St](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return h("<string> [string|boolean]",[t,e],arguments.length),v(this,et,"f").deprecatedOptions[t]=e,this}describe(t,e){return h("<object|string|array> [string]",[t,e],arguments.length),this[Nt](t,!0),v(this,pt,"f").describe(t,e),this}detectLocale(t){return h("<boolean>",[t],arguments.length),O(this,G,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,et,"f").envPrefix:v(this,et,"f").envPrefix=t||"",this}epilogue(t){return h("<string>",[t],arguments.length),v(this,pt,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return h("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(t=>this.example(...t)):v(this,pt,"f").example(t,e),this}exit(t,e){O(this,J,!0,"f"),O(this,V,e,"f"),v(this,T,"f")&&v(this,ct,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,T,t,"f"),this}fail(t){if(h("<function|boolean>",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new e("Invalid first argument. Expected function or boolean 'false'");return v(this,pt,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return h("<array> [function]",[t,e],arguments.length),e?v(this,U,"f").getCompletion(t,e):new Promise((e,s)=>{v(this,U,"f").getCompletion(t,(t,i)=>{t?s(t):e(i)})})}getDemandedOptions(){return h([],0),v(this,et,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,et,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,et,"f").deprecatedOptions}getDetectLocale(){return v(this,G,"f")}getExitProcess(){return v(this,T,"f")}getGroups(){return Object.assign({},v(this,K,"f"),v(this,at,"f"))}getHelp(){if(O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Jt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(t))return t.then(()=>v(this,pt,"f").help())}const t=v(this,z,"f").runDefaultBuilderOn(this);if(f(t))return t.then(()=>v(this,pt,"f").help())}return Promise.resolve(v(this,pt,"f").help())}getOptions(){return v(this,et,"f")}getStrict(){return v(this,ft,"f")}getStrictCommands(){return v(this,dt,"f")}getStrictOptions(){return v(this,ut,"f")}global(t,e){return h("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?v(this,et,"f").local=v(this,et,"f").local.filter(e=>-1===t.indexOf(e)):t.forEach(t=>{v(this,et,"f").local.includes(t)||v(this,et,"f").local.push(t)}),this}group(t,e){h("<string|array> <string>",[t,e],arguments.length);const s=v(this,at,"f")[e]||v(this,K,"f")[e];v(this,at,"f")[e]&&delete v(this,at,"f")[e];const i={};return v(this,K,"f")[e]=(s||[]).concat(t).filter(t=>!i[t]&&(i[t]=!0)),this}hide(t){return h("<string>",[t],arguments.length),v(this,et,"f").hiddenOptions.push(t),this}implies(t,e){return h("<string|object> [number|string|array]",[t,e],arguments.length),v(this,yt,"f").implies(t,e),this}locale(t){return h("[string]",[t],arguments.length),void 0===t?(this[kt](),v(this,ct,"f").y18n.getLocale()):(O(this,G,!1,"f"),v(this,ct,"f").y18n.setLocale(t),this)}middleware(t,e,s){return v(this,Y,"f").addMiddleware(t,!!e,s)}nargs(t,e){return h("<string|object|array> [number]",[t,e],arguments.length),this[St](this.nargs.bind(this),"narg",t,e),this}normalize(t){return h("<array|string>",[t],arguments.length),this[Pt]("normalize",t),this}number(t){return h("<array|string>",[t],arguments.length),this[Pt]("number",t),this[Qt](t),this}option(t,e){if(h("<string|object> [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach(e=>{this.options(e,t[e])});else{"object"!=typeof e&&(e={}),this[Qt](t),!v(this,mt,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[wt](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),void 0,"versionWarning"),v(this,et,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(v(this,et,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const n=e.describe||e.description||e.desc,r=v(this,pt,"f").getDescriptions();Object.prototype.hasOwnProperty.call(r,t)&&"string"!=typeof n||this.describe(t,n),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){h("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[Ct](),void 0===t&&(t=v(this,ht,"f")),"object"==typeof e&&(O(this,rt,e,"f"),e=s),"function"==typeof e&&(O(this,nt,e,"f"),e=!1),e||O(this,ht,t,"f"),v(this,nt,"f")&&O(this,T,!1,"f");const i=this[Jt](t,!!e),n=this.parsed;return v(this,U,"f").setParsed(this.parsed),f(i)?i.then(t=>(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),t,v(this,tt,"f")),t)).catch(t=>{throw v(this,nt,"f")&&v(this,nt,"f")(t,this.parsed.argv,v(this,tt,"f")),t}).finally(()=>{this[Ht](),this.parsed=n}):(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),i,v(this,tt,"f")),this[Ht](),this.parsed=n,i)}parseAsync(t,e,s){const i=this.parse(t,e,s);return f(i)?i:Promise.resolve(i)}parseSync(t,s,i){const n=this.parse(t,s,i);if(f(n))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return h("<object>",[t],arguments.length),O(this,it,t,"f"),this}pkgConf(t,e){h("<string> [string]",[t,e],arguments.length);let s=null;const i=this[At](e||v(this,W,"f"));return i[t]&&"object"==typeof i[t]&&(s=n(i[t],e||v(this,W,"f"),this[Mt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(s)),this}positional(t,e){h("<string> <object>",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=g(e,(t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t));const i=v(this,q,"f").fullCommands[v(this,q,"f").fullCommands.length-1],n=i?v(this,z,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return p(n).forEach(s=>{const i=n[s];Array.isArray(i)?-1!==i.indexOf(t)&&(e[s]=!0):i[t]&&!(s in e)&&(e[s]=i[t])}),this.group(t,v(this,pt,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,lt,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return h("<array|string|object> [number]",[t],arguments.length),"string"==typeof t&&v(this,et,"f").narg[t]||this[St](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return h("[string] [string]",[t,e],arguments.length),t=t||this.$0,v(this,Q,"f").log(v(this,U,"f").generateCompletionScript(t,e||v(this,F,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Jt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(e))return e.then(()=>{v(this,pt,"f").showHelp(t)}),this}const e=v(this,z,"f").runDefaultBuilderOn(this);if(f(e))return e.then(()=>{v(this,pt,"f").showHelp(t)}),this}return v(this,pt,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return h("[boolean|string] [string]",[t,e],arguments.length),v(this,pt,"f").showHelpOnFail(t,e),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,pt,"f").showVersion(t),this}skipValidation(t){return h("<array|string>",[t],arguments.length),this[Pt]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,ft,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,dt,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,ut,!1!==t,"f"),this}string(t){return h("<array|string>",[t],arguments.length),this[Pt]("string",t),this[Qt](t),this}terminalWidth(){return h([],0),v(this,ct,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("<object>",[t],arguments.length),O(this,G,!1,"f"),v(this,ct,"f").y18n.updateLocale(t),this}usage(t,s,i,n){if(h("<string|null|undefined> [string|boolean] [function|object] [function]",[t,s,i,n],arguments.length),void 0!==s){if(d(t,null,v(this,ct,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,i,n);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,pt,"f").usage(t),this}usageConfiguration(t){return h("<object>",[t],arguments.length),O(this,gt,t,"f"),this}version(t,e,s){const i="version";if(h("[boolean|string] [string] [string]",[t,e,s],arguments.length),v(this,mt,"f")&&(this[Ot](v(this,mt,"f")),v(this,pt,"f").version(void 0),O(this,mt,null,"f")),0===arguments.length)s=this[Et](),t=i;else if(1===arguments.length){if(!1===t)return this;s=t,t=i}else 2===arguments.length&&(s=e,e=void 0);return O(this,mt,"string"==typeof t?t:i,"f"),e=e||v(this,pt,"f").deferY18nLookup("Show version number"),v(this,pt,"f").version(s||void 0),this.boolean(v(this,mt,"f")),this.describe(v(this,mt,"f"),e),this}wrap(t){return h("<number|null|undefined>",[t],arguments.length),v(this,pt,"f").wrap(t),this}[(z=new WeakMap,W=new WeakMap,q=new WeakMap,U=new WeakMap,F=new WeakMap,L=new WeakMap,V=new WeakMap,G=new WeakMap,R=new WeakMap,T=new WeakMap,B=new WeakMap,Y=new WeakMap,K=new WeakMap,J=new WeakMap,Z=new WeakMap,X=new WeakMap,Q=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,at=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,yt=new WeakMap,bt)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[vt](){return{log:(...t)=>{this[Rt]()||console.log(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")},error:(...t)=>{this[Rt]()||console.error(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")}}}[Ot](t){p(v(this,et,"f")).forEach(e=>{if("configObjects"===e)return;const s=v(this,et,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]}),delete v(this,pt,"f").getDescriptions()[t]}[wt](t,e,s){v(this,R,"f")[s]||(v(this,ct,"f").process.emitWarning(t,e),v(this,R,"f")[s]=!0)}[Ct](){v(this,B,"f").push({options:v(this,et,"f"),configObjects:v(this,et,"f").configObjects.slice(0),exitProcess:v(this,T,"f"),groups:v(this,K,"f"),strict:v(this,ft,"f"),strictCommands:v(this,dt,"f"),strictOptions:v(this,ut,"f"),completionCommand:v(this,F,"f"),output:v(this,tt,"f"),exitError:v(this,V,"f"),hasOutput:v(this,J,"f"),parsed:this.parsed,parseFn:v(this,nt,"f"),parseContext:v(this,rt,"f")}),v(this,pt,"f").freeze(),v(this,yt,"f").freeze(),v(this,z,"f").freeze(),v(this,Y,"f").freeze()}[jt](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,ct,"f").process.argv()[0])?v(this,ct,"f").process.argv().slice(1,2):v(this,ct,"f").process.argv().slice(0,1),e=t.map(t=>{const e=this[Yt](v(this,W,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.length<t.length?e:t}).join(" ").trim(),v(this,ct,"f").getEnv("_")&&v(this,ct,"f").getProcessArgvBin()===v(this,ct,"f").getEnv("_")&&(e=v(this,ct,"f").getEnv("_").replace(`${v(this,ct,"f").path.dirname(v(this,ct,"f").process.execPath())}/`,"")),e}[Mt](){return v(this,it,"f")}[_t](){return v(this,gt,"f")}[kt](){if(!v(this,G,"f"))return;const t=v(this,ct,"f").getEnv("LC_ALL")||v(this,ct,"f").getEnv("LC_MESSAGES")||v(this,ct,"f").getEnv("LANG")||v(this,ct,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Et](){return this[At]().version||"unknown"}[xt](t){const e=t["--"]?t["--"]:t._;for(let t,s=0;void 0!==(t=e[s]);s++)v(this,ct,"f").Parser.looksLikeNumber(t)&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))&&(e[s]=Number(t));return t}[At](t){const e=t||"*";if(v(this,ot,"f")[e])return v(this,ot,"f")[e];let s={};try{let e=t||v(this,ct,"f").mainFilename;!t&&v(this,ct,"f").path.extname(e)&&(e=v(this,ct,"f").path.dirname(e));const i=v(this,ct,"f").findUp(e,(t,e)=>e.includes("package.json")?"package.json":void 0);d(i,void 0,v(this,ct,"f")),s=JSON.parse(v(this,ct,"f").readFileSync(i,"utf8"))}catch(t){}return v(this,ot,"f")[e]=s||{},v(this,ot,"f")[e]}[Pt](t,e){(e=[].concat(e)).forEach(e=>{e=this[Dt](e),v(this,et,"f")[t].push(e)})}[St](t,e,s,i){this[It](t,e,s,i,(t,e,s)=>{v(this,et,"f")[t][e]=s})}[$t](t,e,s,i){this[It](t,e,s,i,(t,e,s)=>{v(this,et,"f")[t][e]=(v(this,et,"f")[t][e]||[]).concat(s)})}[It](t,e,s,i,n){if(Array.isArray(s))s.forEach(e=>{t(e,i)});else if((t=>"object"==typeof t)(s))for(const e of p(s))t(e,s[e]);else n(e,this[Dt](s),i)}[Dt](t){return"__proto__"===t?"___proto___":t}[Nt](t,e){return this[St](this[Nt].bind(this),"key",t,e),this}[Ht](){var t,e,s,i,n,r,o,a,h,l,c,f;const u=v(this,B,"f").pop();let p;d(u,void 0,v(this,ct,"f")),t=this,e=this,s=this,i=this,n=this,r=this,o=this,a=this,h=this,l=this,c=this,f=this,({options:{set value(e){O(t,et,e,"f")}}.value,configObjects:p,exitProcess:{set value(t){O(e,T,t,"f")}}.value,groups:{set value(t){O(s,K,t,"f")}}.value,output:{set value(t){O(i,tt,t,"f")}}.value,exitError:{set value(t){O(n,V,t,"f")}}.value,hasOutput:{set value(t){O(r,J,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(o,ft,t,"f")}}.value,strictCommands:{set value(t){O(a,dt,t,"f")}}.value,strictOptions:{set value(t){O(h,ut,t,"f")}}.value,completionCommand:{set value(t){O(l,F,t,"f")}}.value,parseFn:{set value(t){O(c,nt,t,"f")}}.value,parseContext:{set value(t){O(f,rt,t,"f")}}.value}=u),v(this,et,"f").configObjects=p,v(this,pt,"f").unfreeze(),v(this,yt,"f").unfreeze(),v(this,z,"f").unfreeze(),v(this,Y,"f").unfreeze()}[zt](t,e){return j(e,e=>(t(e),e))}getInternalMethods(){return{getCommandInstance:this[Wt].bind(this),getContext:this[qt].bind(this),getHasOutput:this[Ut].bind(this),getLoggerInstance:this[Ft].bind(this),getParseContext:this[Lt].bind(this),getParserConfiguration:this[Mt].bind(this),getUsageConfiguration:this[_t].bind(this),getUsageInstance:this[Vt].bind(this),getValidationInstance:this[Gt].bind(this),hasParseCallback:this[Rt].bind(this),isGlobalContext:this[Tt].bind(this),postProcess:this[Bt].bind(this),reset:this[Kt].bind(this),runValidation:this[Zt].bind(this),runYargsParserAndExecuteCommands:this[Jt].bind(this),setHasOutput:this[Xt].bind(this)}}[Wt](){return v(this,z,"f")}[qt](){return v(this,q,"f")}[Ut](){return v(this,J,"f")}[Ft](){return v(this,Q,"f")}[Lt](){return v(this,rt,"f")||{}}[Vt](){return v(this,pt,"f")}[Gt](){return v(this,yt,"f")}[Rt](){return!!v(this,nt,"f")}[Tt](){return v(this,X,"f")}[Bt](t,e,s,i){if(s)return t;if(f(t))return t;e||(t=this[bt](t));return(this[Mt]()["parse-positional-numbers"]||void 0===this[Mt]()["parse-positional-numbers"])&&(t=this[xt](t)),i&&(t=C(t,this,v(this,Y,"f").getMiddleware(),!1)),t}[Kt](t={}){O(this,et,v(this,et,"f")||{},"f");const e={};e.local=v(this,et,"f").local||[],e.configObjects=v(this,et,"f").configObjects||[];const s={};e.local.forEach(e=>{s[e]=!0,(t[e]||[]).forEach(t=>{s[t]=!0})}),Object.assign(v(this,at,"f"),Object.keys(v(this,K,"f")).reduce((t,e)=>{const i=v(this,K,"f")[e].filter(t=>!(t in s));return i.length>0&&(t[e]=i),t},{})),O(this,K,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach(t=>{e[t]=(v(this,et,"f")[t]||[]).filter(t=>!s[t])}),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach(t=>{e[t]=g(v(this,et,"f")[t],t=>!s[t])}),e.envPrefix=v(this,et,"f").envPrefix,O(this,et,e,"f"),O(this,pt,v(this,pt,"f")?v(this,pt,"f").reset(s):P(this,v(this,ct,"f")),"f"),O(this,yt,v(this,yt,"f")?v(this,yt,"f").reset(s):function(t,e,s){const i=s.y18n.__,n=s.y18n.__n,r={nonOptionCount:function(s){const i=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;i._&&(r<i._.min||r>i._.max)&&(r<i._.min?void 0!==i._.minMsg?e.fail(i._.minMsg?i._.minMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.min.toString()):null):e.fail(n("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",r,r.toString(),i._.min.toString())):r>i._.max&&(void 0!==i._.maxMsg?e.fail(i._.maxMsg?i._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.max.toString()):null):e.fail(n("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),i._.max.toString()))))},positionalCount:function(t,s){s<t&&e.fail(n("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",s,s+"",t+""))},requiredArguments:function(t,s){let i=null;for(const e of Object.keys(s))Object.prototype.hasOwnProperty.call(t,e)&&void 0!==t[e]||(i=i||{},i[e]=s[e]);if(i){const t=[];for(const e of Object.keys(i)){const s=i[e];s&&t.indexOf(s)<0&&t.push(s)}const s=t.length?`\n${t.join("\n")}`:"";e.fail(n("Missing required argument: %s","Missing required arguments: %s",Object.keys(i).length,Object.keys(i).join(", ")+s))}},unknownArguments:function(s,i,o,a,h=!0){var l;const c=t.getInternalMethods().getCommandInstance().getCommands(),f=[],d=t.getInternalMethods().getContext();if(Object.keys(s).forEach(e=>{H.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,i)||f.push(e)}),h&&(d.commands.length>0||c.length>0||a)&&s._.slice(d.commands.length).forEach(t=>{c.includes(""+t)||f.push(""+t)}),h){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,i=d.commands.length+e;i<s._.length&&s._.slice(i).forEach(t=>{t=String(t),d.commands.includes(t)||f.includes(t)||f.push(t)})}f.length&&e.fail(n("Unknown argument: %s","Unknown arguments: %s",f.length,f.map(t=>t.trim()?t:`"${t}"`).join(", ")))},unknownCommands:function(s){const i=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||i.length>0)&&s._.slice(o.commands.length).forEach(t=>{i.includes(""+t)||r.push(""+t)}),r.length>0&&(e.fail(n("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const i=t.parsed.newAliases;return[e,...s[e]].some(t=>!Object.prototype.hasOwnProperty.call(i,t)||!i[e])},limitedChoices:function(s){const n=t.getOptions(),r={};if(!Object.keys(n.choices).length)return;Object.keys(s).forEach(t=>{-1===H.indexOf(t)&&Object.prototype.hasOwnProperty.call(n.choices,t)&&[].concat(s[t]).forEach(e=>{-1===n.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))})});const o=Object.keys(r);if(!o.length)return;let a=i("Invalid values:");o.forEach(t=>{a+=`\n ${i("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(n.choices[t]))}`}),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,i){h("<string|object> [array|number|string]",[e,i],arguments.length),"object"==typeof e?Object.keys(e).forEach(t=>{r.implies(t,e[t])}):(t.global(e),o[e]||(o[e]=[]),Array.isArray(i)?i.forEach(t=>r.implies(e,t)):(d(i,void 0,s),o[e].push(i)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach(e=>{const i=e;(o[e]||[]).forEach(e=>{let n=i;const r=e;n=a(t,n),e=a(t,e),n&&!e&&s.push(` ${i} -> ${r}`)})}),s.length){let t=`${i("Implications failed:")}\n`;s.forEach(e=>{t+=e}),e.fail(t)}};let l={};r.conflicts=function(e,s){h("<string|object> [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach(t=>{r.conflicts(t,e[t])}):(t.global(e),l[e]||(l[e]=[]),Array.isArray(s)?s.forEach(t=>r.conflicts(e,t)):l[e].push(s))},r.getConflicting=()=>l,r.conflicting=function(n){Object.keys(n).forEach(t=>{l[t]&&l[t].forEach(s=>{s&&void 0!==n[t]&&void 0!==n[s]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,s))})}),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach(t=>{l[t].forEach(r=>{r&&void 0!==n[s.Parser.camelCase(t)]&&void 0!==n[s.Parser.camelCase(r)]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,r))})})},r.recommendCommands=function(t,s){s=s.sort((t,e)=>e.length-t.length);let n=null,r=1/0;for(let e,i=0;void 0!==(e=s[i]);i++){const s=N(t,e);s<=3&&s<r&&(r=s,n=e)}n&&e.fail(i("Did you mean %s?",n))},r.reset=function(t){return o=g(o,e=>!t[e]),l=g(l,e=>!t[e]),r};const c=[];return r.freeze=function(){c.push({implied:o,conflicting:l})},r.unfreeze=function(){const t=c.pop();d(t,void 0,s),({implied:o,conflicting:l}=t)},r}(this,v(this,pt,"f"),v(this,ct,"f")),"f"),O(this,z,v(this,z,"f")?v(this,z,"f").reset():function(t,e,s,i){return new _(t,e,s,i)}(v(this,pt,"f"),v(this,yt,"f"),v(this,Y,"f"),v(this,ct,"f")),"f"),v(this,U,"f")||O(this,U,function(t,e,s,i){return new D(t,e,s,i)}(this,v(this,pt,"f"),v(this,z,"f"),v(this,ct,"f")),"f"),v(this,Y,"f").reset(),O(this,F,null,"f"),O(this,tt,"","f"),O(this,V,null,"f"),O(this,J,!1,"f"),this.parsed=!1,this}[Yt](t,e){return v(this,ct,"f").path.relative(t,e)}[Jt](t,s,i,n=0,r=!1){let o=!!i||r;t=t||v(this,ht,"f"),v(this,et,"f").__=v(this,ct,"f").y18n.__,v(this,et,"f").configuration=this[Mt]();const a=!!v(this,et,"f").configuration["populate--"],h=Object.assign({},v(this,et,"f").configuration,{"populate--":!0}),l=v(this,ct,"f").Parser.detailed(t,Object.assign({},v(this,et,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),c=Object.assign(l.argv,v(this,rt,"f"));let d;const u=l.aliases;let p=!1,g=!1;Object.keys(c).forEach(t=>{t===v(this,Z,"f")&&c[t]?p=!0:t===v(this,mt,"f")&&c[t]&&(g=!0)}),c.$0=this.$0,this.parsed=l,0===n&&v(this,pt,"f").clearCachedHelpMessage();try{if(this[kt](),s)return this[Bt](c,a,!!i,!1);if(v(this,Z,"f")){[v(this,Z,"f")].concat(u[v(this,Z,"f")]||[]).filter(t=>t.length>1).includes(""+c._[c._.length-1])&&(c._.pop(),p=!0)}O(this,X,!1,"f");const h=v(this,z,"f").getCommands(),m=v(this,U,"f").completionKey in c,y=p||m||r;if(c._.length){if(h.length){let t;for(let e,s=n||0;void 0!==c._[s];s++){if(e=String(c._[s]),h.includes(e)&&e!==v(this,F,"f")){const t=v(this,z,"f").runCommand(e,this,l,s+1,r,p||g||r);return this[Bt](t,a,!!i,!1)}if(!t&&e!==v(this,F,"f")){t=e;break}}!v(this,z,"f").hasDefaultCommand()&&v(this,lt,"f")&&t&&!y&&v(this,yt,"f").recommendCommands(t,h)}v(this,F,"f")&&c._.includes(v(this,F,"f"))&&!m&&(v(this,T,"f")&&x(!0),this.showCompletionScript(),this.exit(0))}if(v(this,z,"f").hasDefaultCommand()&&!y){const t=v(this,z,"f").runCommand(null,this,l,0,r,p||g||r);return this[Bt](t,a,!!i,!1)}if(m){v(this,T,"f")&&x(!0);const s=(t=[].concat(t)).slice(t.indexOf(`--${v(this,U,"f").completionKey}`)+1);return v(this,U,"f").getCompletion(s,(t,s)=>{if(t)throw new e(t.message);(s||[]).forEach(t=>{v(this,Q,"f").log(t)}),this.exit(0)}),this[Bt](c,!a,!!i,!1)}if(v(this,J,"f")||(p?(v(this,T,"f")&&x(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(v(this,T,"f")&&x(!0),o=!0,v(this,pt,"f").showVersion("log"),this.exit(0))),!o&&v(this,et,"f").skipValidation.length>0&&(o=Object.keys(c).some(t=>v(this,et,"f").skipValidation.indexOf(t)>=0&&!0===c[t])),!o){if(l.error)throw new e(l.error.message);if(!m){const t=this[Zt](u,{},l.error);i||(d=C(c,this,v(this,Y,"f").getMiddleware(),!0)),d=this[zt](t,null!=d?d:c),f(d)&&!i&&(d=d.then(()=>C(c,this,v(this,Y,"f").getMiddleware(),!1)))}}}catch(t){if(!(t instanceof e))throw t;v(this,pt,"f").fail(t.message,t)}return this[Bt](null!=d?d:c,a,!!i,!0)}[Zt](t,s,i,n){const r={...this.getDemandedOptions()};return o=>{if(i)throw new e(i.message);v(this,yt,"f").nonOptionCount(o),v(this,yt,"f").requiredArguments(o,r);let a=!1;v(this,dt,"f")&&(a=v(this,yt,"f").unknownCommands(o)),v(this,ft,"f")&&!a?v(this,yt,"f").unknownArguments(o,t,s,!!n):v(this,ut,"f")&&v(this,yt,"f").unknownArguments(o,t,{},!1,!1),v(this,yt,"f").limitedChoices(o),v(this,yt,"f").implications(o),v(this,yt,"f").conflicting(o)}}[Xt](){O(this,J,!0,"f")}[Qt](t){if("string"==typeof t)v(this,et,"f").key[t]=!0;else for(const e of t)v(this,et,"f").key[e]=!0}}var ee,se;const{readFileSync:ie}=__webpack_require__(9896),{inspect:ne}=__webpack_require__(9023),{resolve:re}=__webpack_require__(6928),oe=__webpack_require__(9668),ae=__webpack_require__(6180);var he,le={assert:{notStrictEqual:t.notStrictEqual,strictEqual:t.strictEqual},cliui:__webpack_require__(164),findUp:__webpack_require__(7829),getEnv:t=>process.env[t],getCallerFile:__webpack_require__(2838),getProcessArgvBin:y,inspect:ne,mainFilename:null!==(se=null===(ee= false||void 0===__webpack_require__(7315)?void 0:__webpack_require__.c[__webpack_require__.s])||void 0===ee?void 0:ee.filename)&&void 0!==se?se:process.cwd(),Parser:ae,path:__webpack_require__(6928),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:ie,require:__webpack_require__(7315),requireDirectory:__webpack_require__(9386),stringWidth:__webpack_require__(4813),y18n:oe({directory:re(__dirname,"../locales"),updateFiles:!1})};const ce=(null===(he=null===process||void 0===process?void 0:process.env)||void 0===he?void 0:he.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1])<ce)throw Error(`yargs supports a minimum Node.js version of ${ce}. Read our version support policy: https://github.com/yargs/yargs#supported-nodejs-versions`)}const fe=__webpack_require__(6180);var de,ue={applyExtends:n,cjsPlatformShim:le,Yargs:(de=le,(t=[],e=de.process.cwd(),s)=>{const i=new te(t,e,s,de);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:fe,processArgv:b,YError:e};module.exports=ue;
|
|
37397
38710
|
|
|
37398
38711
|
|
|
37399
38712
|
/***/ },
|
|
@@ -39416,24 +40729,24 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"seek-bzip","version":"1.0.6",
|
|
|
39416
40729
|
(module) {
|
|
39417
40730
|
|
|
39418
40731
|
"use strict";
|
|
39419
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.
|
|
40732
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.486","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.486","adm-zip":"^0.5.16","copy-webpack-plugin":"^14.0.0","decompress":"^4.2.1","logpipes":"^1.11.0","nodemon":"^3.1.9","terser-webpack-plugin":"^5.5.0","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.106.2","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/adm-zip":"^0.5.7","@types/decompress":"^4.2.7","terminal-link":"^3.0.0"}}');
|
|
39420
40733
|
|
|
39421
40734
|
/***/ }
|
|
39422
40735
|
|
|
39423
40736
|
/******/ });
|
|
39424
40737
|
/************************************************************************/
|
|
39425
40738
|
/******/ // The module cache
|
|
39426
|
-
/******/
|
|
40739
|
+
/******/ const __webpack_module_cache__ = {};
|
|
39427
40740
|
/******/
|
|
39428
40741
|
/******/ // The require function
|
|
39429
40742
|
/******/ function __webpack_require__(moduleId) {
|
|
39430
40743
|
/******/ // Check if module is in cache
|
|
39431
|
-
/******/
|
|
40744
|
+
/******/ const cachedModule = __webpack_module_cache__[moduleId];
|
|
39432
40745
|
/******/ if (cachedModule !== undefined) {
|
|
39433
40746
|
/******/ return cachedModule.exports;
|
|
39434
40747
|
/******/ }
|
|
39435
40748
|
/******/ // Create a new module (and put it into the cache)
|
|
39436
|
-
/******/
|
|
40749
|
+
/******/ const module = __webpack_module_cache__[moduleId] = {
|
|
39437
40750
|
/******/ id: moduleId,
|
|
39438
40751
|
/******/ loaded: false,
|
|
39439
40752
|
/******/ exports: {}
|
|
@@ -39455,11 +40768,26 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1
|
|
|
39455
40768
|
/************************************************************************/
|
|
39456
40769
|
/******/ /* webpack/runtime/define property getters */
|
|
39457
40770
|
/******/ (() => {
|
|
39458
|
-
/******/ // define getter functions for harmony exports
|
|
40771
|
+
/******/ // define getter/value functions for harmony exports
|
|
39459
40772
|
/******/ __webpack_require__.d = (exports, definition) => {
|
|
39460
|
-
/******/
|
|
39461
|
-
/******/
|
|
39462
|
-
/******/
|
|
40773
|
+
/******/ if(Array.isArray(definition)) {
|
|
40774
|
+
/******/ var i = 0;
|
|
40775
|
+
/******/ while(i < definition.length) {
|
|
40776
|
+
/******/ var key = definition[i++];
|
|
40777
|
+
/******/ var binding = definition[i++];
|
|
40778
|
+
/******/ if(!__webpack_require__.o(exports, key)) {
|
|
40779
|
+
/******/ if(binding === 0) {
|
|
40780
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
|
|
40781
|
+
/******/ } else {
|
|
40782
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
|
|
40783
|
+
/******/ }
|
|
40784
|
+
/******/ } else if(binding === 0) { i++; }
|
|
40785
|
+
/******/ }
|
|
40786
|
+
/******/ } else {
|
|
40787
|
+
/******/ for(var key in definition) {
|
|
40788
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
40789
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
40790
|
+
/******/ }
|
|
39463
40791
|
/******/ }
|
|
39464
40792
|
/******/ }
|
|
39465
40793
|
/******/ };
|
|
@@ -39474,7 +40802,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1
|
|
|
39474
40802
|
/******/ (() => {
|
|
39475
40803
|
/******/ // define __esModule on exports
|
|
39476
40804
|
/******/ __webpack_require__.r = (exports) => {
|
|
39477
|
-
/******/ if(
|
|
40805
|
+
/******/ if(Symbol.toStringTag) {
|
|
39478
40806
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
39479
40807
|
/******/ }
|
|
39480
40808
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -39495,8 +40823,8 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1
|
|
|
39495
40823
|
/******/ // module cache are used so entry inlining is disabled
|
|
39496
40824
|
/******/ // startup
|
|
39497
40825
|
/******/ // Load entry module and return exports
|
|
39498
|
-
/******/
|
|
39499
|
-
/******/
|
|
40826
|
+
/******/ let __webpack_exports__ = __webpack_require__(__webpack_require__.s = 6568);
|
|
40827
|
+
/******/ const __webpack_export_target__ = exports;
|
|
39500
40828
|
/******/ for(var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
39501
40829
|
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
|
39502
40830
|
/******/
|