@fern-api/generator-cli 0.3.0 → 0.4.3
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/api.cjs +500 -350
- package/dist/cli.cjs +519 -397
- package/package.json +12 -18
package/dist/api.cjs
CHANGED
|
@@ -147,9 +147,9 @@ var require_ms = __commonJS({
|
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
150
|
+
// ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js
|
|
151
151
|
var require_common = __commonJS({
|
|
152
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
152
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js"(exports2, module2) {
|
|
153
153
|
"use strict";
|
|
154
154
|
function setup(env) {
|
|
155
155
|
createDebug.debug = createDebug;
|
|
@@ -325,9 +325,9 @@ var require_common = __commonJS({
|
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
327
|
|
|
328
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
328
|
+
// ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js
|
|
329
329
|
var require_browser = __commonJS({
|
|
330
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
330
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js"(exports2, module2) {
|
|
331
331
|
"use strict";
|
|
332
332
|
exports2.formatArgs = formatArgs;
|
|
333
333
|
exports2.save = save;
|
|
@@ -496,37 +496,28 @@ var require_browser = __commonJS({
|
|
|
496
496
|
}
|
|
497
497
|
});
|
|
498
498
|
|
|
499
|
-
// ../../node_modules/.pnpm/has-flag@
|
|
499
|
+
// ../../node_modules/.pnpm/has-flag@2.0.0/node_modules/has-flag/index.js
|
|
500
500
|
var require_has_flag = __commonJS({
|
|
501
|
-
"../../node_modules/.pnpm/has-flag@
|
|
501
|
+
"../../node_modules/.pnpm/has-flag@2.0.0/node_modules/has-flag/index.js"(exports2, module2) {
|
|
502
502
|
"use strict";
|
|
503
|
-
module2.exports = (flag, argv)
|
|
503
|
+
module2.exports = function(flag, argv) {
|
|
504
504
|
argv = argv || process.argv;
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
var terminatorPos = argv.indexOf("--");
|
|
506
|
+
var prefix = /^-{1,2}/.test(flag) ? "" : "--";
|
|
507
|
+
var pos = argv.indexOf(prefix + flag);
|
|
508
508
|
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
});
|
|
512
512
|
|
|
513
|
-
// ../../node_modules/.pnpm/supports-color@
|
|
513
|
+
// ../../node_modules/.pnpm/supports-color@4.5.0/node_modules/supports-color/index.js
|
|
514
514
|
var require_supports_color = __commonJS({
|
|
515
|
-
"../../node_modules/.pnpm/supports-color@
|
|
515
|
+
"../../node_modules/.pnpm/supports-color@4.5.0/node_modules/supports-color/index.js"(exports2, module2) {
|
|
516
516
|
"use strict";
|
|
517
517
|
var os = require("os");
|
|
518
518
|
var hasFlag = require_has_flag();
|
|
519
519
|
var env = process.env;
|
|
520
|
-
var
|
|
521
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
|
|
522
|
-
forceColor = false;
|
|
523
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
524
|
-
forceColor = true;
|
|
525
|
-
}
|
|
526
|
-
if ("FORCE_COLOR" in env) {
|
|
527
|
-
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
|
528
|
-
}
|
|
529
|
-
function translateLevel(level) {
|
|
520
|
+
var support = (level) => {
|
|
530
521
|
if (level === 0) {
|
|
531
522
|
return false;
|
|
532
523
|
}
|
|
@@ -536,9 +527,9 @@ var require_supports_color = __commonJS({
|
|
|
536
527
|
has256: level >= 2,
|
|
537
528
|
has16m: level >= 3
|
|
538
529
|
};
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
if (
|
|
530
|
+
};
|
|
531
|
+
var supportLevel = (() => {
|
|
532
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
|
|
542
533
|
return 0;
|
|
543
534
|
}
|
|
544
535
|
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
@@ -547,14 +538,16 @@ var require_supports_color = __commonJS({
|
|
|
547
538
|
if (hasFlag("color=256")) {
|
|
548
539
|
return 2;
|
|
549
540
|
}
|
|
550
|
-
if (
|
|
541
|
+
if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
542
|
+
return 1;
|
|
543
|
+
}
|
|
544
|
+
if (process.stdout && !process.stdout.isTTY) {
|
|
551
545
|
return 0;
|
|
552
546
|
}
|
|
553
|
-
const min = forceColor ? 1 : 0;
|
|
554
547
|
if (process.platform === "win32") {
|
|
555
548
|
const osRelease = os.release().split(".");
|
|
556
549
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
557
|
-
return
|
|
550
|
+
return 2;
|
|
558
551
|
}
|
|
559
552
|
return 1;
|
|
560
553
|
}
|
|
@@ -562,19 +555,18 @@ var require_supports_color = __commonJS({
|
|
|
562
555
|
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
563
556
|
return 1;
|
|
564
557
|
}
|
|
565
|
-
return
|
|
558
|
+
return 0;
|
|
566
559
|
}
|
|
567
560
|
if ("TEAMCITY_VERSION" in env) {
|
|
568
561
|
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
569
562
|
}
|
|
570
|
-
if (env.COLORTERM === "truecolor") {
|
|
571
|
-
return 3;
|
|
572
|
-
}
|
|
573
563
|
if ("TERM_PROGRAM" in env) {
|
|
574
564
|
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
575
565
|
switch (env.TERM_PROGRAM) {
|
|
576
566
|
case "iTerm.app":
|
|
577
567
|
return version >= 3 ? 3 : 2;
|
|
568
|
+
case "Hyper":
|
|
569
|
+
return 3;
|
|
578
570
|
case "Apple_Terminal":
|
|
579
571
|
return 2;
|
|
580
572
|
}
|
|
@@ -582,32 +574,27 @@ var require_supports_color = __commonJS({
|
|
|
582
574
|
if (/-256(color)?$/i.test(env.TERM)) {
|
|
583
575
|
return 2;
|
|
584
576
|
}
|
|
585
|
-
if (/^screen|^xterm|^vt100|^
|
|
577
|
+
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
586
578
|
return 1;
|
|
587
579
|
}
|
|
588
580
|
if ("COLORTERM" in env) {
|
|
589
581
|
return 1;
|
|
590
582
|
}
|
|
591
583
|
if (env.TERM === "dumb") {
|
|
592
|
-
return
|
|
584
|
+
return 0;
|
|
593
585
|
}
|
|
594
|
-
return
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
return translateLevel(level);
|
|
586
|
+
return 0;
|
|
587
|
+
})();
|
|
588
|
+
if ("FORCE_COLOR" in env) {
|
|
589
|
+
supportLevel = parseInt(env.FORCE_COLOR, 10) === 0 ? 0 : supportLevel || 1;
|
|
599
590
|
}
|
|
600
|
-
module2.exports =
|
|
601
|
-
supportsColor: getSupportLevel,
|
|
602
|
-
stdout: getSupportLevel(process.stdout),
|
|
603
|
-
stderr: getSupportLevel(process.stderr)
|
|
604
|
-
};
|
|
591
|
+
module2.exports = process && support(supportLevel);
|
|
605
592
|
}
|
|
606
593
|
});
|
|
607
594
|
|
|
608
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
595
|
+
// ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js
|
|
609
596
|
var require_node = __commonJS({
|
|
610
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
597
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js"(exports2, module2) {
|
|
611
598
|
"use strict";
|
|
612
599
|
var tty = require("tty");
|
|
613
600
|
var util = require("util");
|
|
@@ -780,9 +767,9 @@ var require_node = __commonJS({
|
|
|
780
767
|
}
|
|
781
768
|
});
|
|
782
769
|
|
|
783
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
770
|
+
// ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js
|
|
784
771
|
var require_src = __commonJS({
|
|
785
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
772
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js"(exports2, module2) {
|
|
786
773
|
"use strict";
|
|
787
774
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
788
775
|
module2.exports = require_browser();
|
|
@@ -1310,34 +1297,19 @@ module.exports = __toCommonJS(api_exports2);
|
|
|
1310
1297
|
// src/api/generate-readme.ts
|
|
1311
1298
|
var import_node_stream = require("stream");
|
|
1312
1299
|
|
|
1313
|
-
// ../../node_modules/.pnpm/simple-git@3.
|
|
1300
|
+
// ../../node_modules/.pnpm/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
|
|
1301
|
+
var import_node_buffer = require("buffer");
|
|
1314
1302
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
1315
1303
|
var import_debug = __toESM(require_src(), 1);
|
|
1316
1304
|
var import_child_process = require("child_process");
|
|
1317
1305
|
var import_promise_deferred = __toESM(require_dist2(), 1);
|
|
1306
|
+
var import_node_path = require("path");
|
|
1318
1307
|
var import_promise_deferred2 = __toESM(require_dist2(), 1);
|
|
1319
1308
|
var import_node_events = require("events");
|
|
1320
1309
|
var __defProp2 = Object.defineProperty;
|
|
1321
|
-
var __defProps = Object.defineProperties;
|
|
1322
1310
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1323
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1324
1311
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1325
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1326
1312
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1327
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1328
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1329
|
-
var __spreadValues = (a, b) => {
|
|
1330
|
-
for (var prop in b || (b = {}))
|
|
1331
|
-
if (__hasOwnProp2.call(b, prop))
|
|
1332
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1333
|
-
if (__getOwnPropSymbols)
|
|
1334
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
1335
|
-
if (__propIsEnum.call(b, prop))
|
|
1336
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1337
|
-
}
|
|
1338
|
-
return a;
|
|
1339
|
-
};
|
|
1340
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1341
1313
|
var __esm = (fn, res) => function __init() {
|
|
1342
1314
|
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
1343
1315
|
};
|
|
@@ -1357,26 +1329,6 @@ var __copyProps2 = (to, from, except, desc) => {
|
|
|
1357
1329
|
return to;
|
|
1358
1330
|
};
|
|
1359
1331
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1360
|
-
var __async = (__this, __arguments, generator) => {
|
|
1361
|
-
return new Promise((resolve3, reject) => {
|
|
1362
|
-
var fulfilled = (value) => {
|
|
1363
|
-
try {
|
|
1364
|
-
step(generator.next(value));
|
|
1365
|
-
} catch (e) {
|
|
1366
|
-
reject(e);
|
|
1367
|
-
}
|
|
1368
|
-
};
|
|
1369
|
-
var rejected = (value) => {
|
|
1370
|
-
try {
|
|
1371
|
-
step(generator.throw(value));
|
|
1372
|
-
} catch (e) {
|
|
1373
|
-
reject(e);
|
|
1374
|
-
}
|
|
1375
|
-
};
|
|
1376
|
-
var step = (x) => x.done ? resolve3(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1377
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1378
|
-
});
|
|
1379
|
-
};
|
|
1380
1332
|
function pathspec(...paths) {
|
|
1381
1333
|
const key = new String(paths);
|
|
1382
1334
|
cache.set(key, paths);
|
|
@@ -1434,7 +1386,10 @@ var init_task_configuration_error = __esm({
|
|
|
1434
1386
|
}
|
|
1435
1387
|
});
|
|
1436
1388
|
function asFunction(source) {
|
|
1437
|
-
|
|
1389
|
+
if (typeof source !== "function") {
|
|
1390
|
+
return NOOP;
|
|
1391
|
+
}
|
|
1392
|
+
return source;
|
|
1438
1393
|
}
|
|
1439
1394
|
function isUserFunction(source) {
|
|
1440
1395
|
return typeof source === "function" && source !== NOOP;
|
|
@@ -1455,7 +1410,7 @@ function last(input, offset = 0) {
|
|
|
1455
1410
|
}
|
|
1456
1411
|
}
|
|
1457
1412
|
function isArrayLike(input) {
|
|
1458
|
-
return
|
|
1413
|
+
return filterHasLength(input);
|
|
1459
1414
|
}
|
|
1460
1415
|
function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
1461
1416
|
return input.split(separator).reduce((output, line) => {
|
|
@@ -1502,15 +1457,22 @@ function remove(target, item) {
|
|
|
1502
1457
|
function asArray(source) {
|
|
1503
1458
|
return Array.isArray(source) ? source : [source];
|
|
1504
1459
|
}
|
|
1460
|
+
function asCamelCase(str) {
|
|
1461
|
+
return str.replace(/[\s-]+(.)/g, (_all, chr) => {
|
|
1462
|
+
return chr.toUpperCase();
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1505
1465
|
function asStringArray(source) {
|
|
1506
|
-
return asArray(source).map(
|
|
1466
|
+
return asArray(source).map((item) => {
|
|
1467
|
+
return item instanceof String ? item : String(item);
|
|
1468
|
+
});
|
|
1507
1469
|
}
|
|
1508
1470
|
function asNumber(source, onNaN = 0) {
|
|
1509
1471
|
if (source == null) {
|
|
1510
1472
|
return onNaN;
|
|
1511
1473
|
}
|
|
1512
1474
|
const num = parseInt(source, 10);
|
|
1513
|
-
return isNaN(num) ? onNaN : num;
|
|
1475
|
+
return Number.isNaN(num) ? onNaN : num;
|
|
1514
1476
|
}
|
|
1515
1477
|
function prefixedArray(input, prefix) {
|
|
1516
1478
|
const output = [];
|
|
@@ -1520,13 +1482,16 @@ function prefixedArray(input, prefix) {
|
|
|
1520
1482
|
return output;
|
|
1521
1483
|
}
|
|
1522
1484
|
function bufferToString(input) {
|
|
1523
|
-
return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8");
|
|
1485
|
+
return (Array.isArray(input) ? import_node_buffer.Buffer.concat(input) : input).toString("utf-8");
|
|
1524
1486
|
}
|
|
1525
1487
|
function pick(source, properties) {
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1488
|
+
const out = {};
|
|
1489
|
+
properties.forEach((key) => {
|
|
1490
|
+
if (source[key] !== void 0) {
|
|
1491
|
+
out[key] = source[key];
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
return out;
|
|
1530
1495
|
}
|
|
1531
1496
|
function delay(duration = 0) {
|
|
1532
1497
|
return new Promise((done) => setTimeout(done, duration));
|
|
@@ -1543,6 +1508,7 @@ var objectToString;
|
|
|
1543
1508
|
var init_util = __esm({
|
|
1544
1509
|
"src/lib/utils/util.ts"() {
|
|
1545
1510
|
"use strict";
|
|
1511
|
+
init_argument_filters();
|
|
1546
1512
|
NULL = "\0";
|
|
1547
1513
|
NOOP = () => {
|
|
1548
1514
|
};
|
|
@@ -1566,24 +1532,24 @@ function filterFunction(input) {
|
|
|
1566
1532
|
return typeof input === "function";
|
|
1567
1533
|
}
|
|
1568
1534
|
var filterArray;
|
|
1535
|
+
var filterNumber;
|
|
1569
1536
|
var filterString;
|
|
1570
|
-
var filterStringArray;
|
|
1571
1537
|
var filterStringOrStringArray;
|
|
1572
1538
|
var filterHasLength;
|
|
1573
1539
|
var init_argument_filters = __esm({
|
|
1574
1540
|
"src/lib/utils/argument-filters.ts"() {
|
|
1575
1541
|
"use strict";
|
|
1576
|
-
init_util();
|
|
1577
1542
|
init_pathspec();
|
|
1543
|
+
init_util();
|
|
1578
1544
|
filterArray = (input) => {
|
|
1579
1545
|
return Array.isArray(input);
|
|
1580
1546
|
};
|
|
1547
|
+
filterNumber = (input) => {
|
|
1548
|
+
return typeof input === "number";
|
|
1549
|
+
};
|
|
1581
1550
|
filterString = (input) => {
|
|
1582
1551
|
return typeof input === "string";
|
|
1583
1552
|
};
|
|
1584
|
-
filterStringArray = (input) => {
|
|
1585
|
-
return Array.isArray(input) && input.every(filterString);
|
|
1586
|
-
};
|
|
1587
1553
|
filterStringOrStringArray = (input) => {
|
|
1588
1554
|
return filterString(input) || Array.isArray(input) && input.every(filterString);
|
|
1589
1555
|
};
|
|
@@ -1591,7 +1557,7 @@ var init_argument_filters = __esm({
|
|
|
1591
1557
|
if (input == null || "number|boolean|function".includes(typeof input)) {
|
|
1592
1558
|
return false;
|
|
1593
1559
|
}
|
|
1594
|
-
return
|
|
1560
|
+
return typeof input.length === "number";
|
|
1595
1561
|
};
|
|
1596
1562
|
}
|
|
1597
1563
|
});
|
|
@@ -1612,17 +1578,20 @@ var GitOutputStreams;
|
|
|
1612
1578
|
var init_git_output_streams = __esm({
|
|
1613
1579
|
"src/lib/utils/git-output-streams.ts"() {
|
|
1614
1580
|
"use strict";
|
|
1615
|
-
GitOutputStreams = class {
|
|
1581
|
+
GitOutputStreams = class _GitOutputStreams {
|
|
1616
1582
|
constructor(stdOut, stdErr) {
|
|
1617
1583
|
this.stdOut = stdOut;
|
|
1618
1584
|
this.stdErr = stdErr;
|
|
1619
1585
|
}
|
|
1620
1586
|
asStrings() {
|
|
1621
|
-
return new
|
|
1587
|
+
return new _GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
|
|
1622
1588
|
}
|
|
1623
1589
|
};
|
|
1624
1590
|
}
|
|
1625
1591
|
});
|
|
1592
|
+
function useMatchesDefault() {
|
|
1593
|
+
throw new Error(`LineParser:useMatches not implemented`);
|
|
1594
|
+
}
|
|
1626
1595
|
var LineParser;
|
|
1627
1596
|
var RemoteLineParser;
|
|
1628
1597
|
var init_line_parser = __esm({
|
|
@@ -1631,6 +1600,7 @@ var init_line_parser = __esm({
|
|
|
1631
1600
|
LineParser = class {
|
|
1632
1601
|
constructor(regExp, useMatches) {
|
|
1633
1602
|
this.matches = [];
|
|
1603
|
+
this.useMatches = useMatchesDefault;
|
|
1634
1604
|
this.parse = (line, target) => {
|
|
1635
1605
|
this.resetMatches();
|
|
1636
1606
|
if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
|
|
@@ -1643,9 +1613,6 @@ var init_line_parser = __esm({
|
|
|
1643
1613
|
this.useMatches = useMatches;
|
|
1644
1614
|
}
|
|
1645
1615
|
}
|
|
1646
|
-
useMatches(target, match) {
|
|
1647
|
-
throw new Error(`LineParser:useMatches not implemented`);
|
|
1648
|
-
}
|
|
1649
1616
|
resetMatches() {
|
|
1650
1617
|
this.matches.length = 0;
|
|
1651
1618
|
}
|
|
@@ -1678,7 +1645,7 @@ var init_line_parser = __esm({
|
|
|
1678
1645
|
function createInstanceConfig(...options) {
|
|
1679
1646
|
const baseDir = process.cwd();
|
|
1680
1647
|
const config = Object.assign(
|
|
1681
|
-
|
|
1648
|
+
{ baseDir, ...defaultOptions },
|
|
1682
1649
|
...options.filter((o) => typeof o === "object" && o)
|
|
1683
1650
|
);
|
|
1684
1651
|
config.baseDir = config.baseDir || baseDir;
|
|
@@ -1707,6 +1674,12 @@ function appendTaskOptions(options, commands = []) {
|
|
|
1707
1674
|
commands2.push(value);
|
|
1708
1675
|
} else if (filterPrimitives(value, ["boolean"])) {
|
|
1709
1676
|
commands2.push(key + "=" + value);
|
|
1677
|
+
} else if (Array.isArray(value)) {
|
|
1678
|
+
for (const v of value) {
|
|
1679
|
+
if (!filterPrimitives(v, ["string", "number"])) {
|
|
1680
|
+
commands2.push(key + "=" + v);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1710
1683
|
} else {
|
|
1711
1684
|
commands2.push(key);
|
|
1712
1685
|
}
|
|
@@ -1728,7 +1701,7 @@ function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
|
|
|
1728
1701
|
}
|
|
1729
1702
|
function trailingArrayArgument(args) {
|
|
1730
1703
|
const hasTrailingCallback = typeof last(args) === "function";
|
|
1731
|
-
return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []);
|
|
1704
|
+
return asStringArray(filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []));
|
|
1732
1705
|
}
|
|
1733
1706
|
function trailingOptionsArgument(args) {
|
|
1734
1707
|
const hasTrailingCallback = filterFunction(last(args));
|
|
@@ -1746,8 +1719,8 @@ var init_task_options = __esm({
|
|
|
1746
1719
|
init_pathspec();
|
|
1747
1720
|
}
|
|
1748
1721
|
});
|
|
1749
|
-
function callTaskParser(
|
|
1750
|
-
return
|
|
1722
|
+
function callTaskParser(parser4, streams) {
|
|
1723
|
+
return parser4(streams.stdOut, streams.stdErr);
|
|
1751
1724
|
}
|
|
1752
1725
|
function parseStringResponse(result, parsers12, texts, trim = true) {
|
|
1753
1726
|
asArray(texts).forEach((text) => {
|
|
@@ -1780,6 +1753,7 @@ __export2(utils_exports, {
|
|
|
1780
1753
|
append: () => append,
|
|
1781
1754
|
appendTaskOptions: () => appendTaskOptions,
|
|
1782
1755
|
asArray: () => asArray,
|
|
1756
|
+
asCamelCase: () => asCamelCase,
|
|
1783
1757
|
asFunction: () => asFunction,
|
|
1784
1758
|
asNumber: () => asNumber,
|
|
1785
1759
|
asStringArray: () => asStringArray,
|
|
@@ -1790,10 +1764,10 @@ __export2(utils_exports, {
|
|
|
1790
1764
|
filterArray: () => filterArray,
|
|
1791
1765
|
filterFunction: () => filterFunction,
|
|
1792
1766
|
filterHasLength: () => filterHasLength,
|
|
1767
|
+
filterNumber: () => filterNumber,
|
|
1793
1768
|
filterPlainObject: () => filterPlainObject,
|
|
1794
1769
|
filterPrimitives: () => filterPrimitives,
|
|
1795
1770
|
filterString: () => filterString,
|
|
1796
|
-
filterStringArray: () => filterStringArray,
|
|
1797
1771
|
filterStringOrStringArray: () => filterStringOrStringArray,
|
|
1798
1772
|
filterType: () => filterType,
|
|
1799
1773
|
first: () => first,
|
|
@@ -1937,11 +1911,11 @@ __export2(task_exports, {
|
|
|
1937
1911
|
straightThroughBufferTask: () => straightThroughBufferTask,
|
|
1938
1912
|
straightThroughStringTask: () => straightThroughStringTask
|
|
1939
1913
|
});
|
|
1940
|
-
function adhocExecTask(
|
|
1914
|
+
function adhocExecTask(parser4) {
|
|
1941
1915
|
return {
|
|
1942
1916
|
commands: EMPTY_COMMANDS,
|
|
1943
1917
|
format: "empty",
|
|
1944
|
-
parser:
|
|
1918
|
+
parser: parser4
|
|
1945
1919
|
};
|
|
1946
1920
|
}
|
|
1947
1921
|
function configurationErrorTask(error) {
|
|
@@ -2156,7 +2130,7 @@ var init_ConfigList = __esm({
|
|
|
2156
2130
|
}
|
|
2157
2131
|
addValue(file, key, value) {
|
|
2158
2132
|
const values = this.addFile(file);
|
|
2159
|
-
if (!
|
|
2133
|
+
if (!Object.hasOwn(values, key)) {
|
|
2160
2134
|
values[key] = value;
|
|
2161
2135
|
} else if (Array.isArray(values[key])) {
|
|
2162
2136
|
values[key].push(value);
|
|
@@ -2169,7 +2143,7 @@ var init_ConfigList = __esm({
|
|
|
2169
2143
|
}
|
|
2170
2144
|
});
|
|
2171
2145
|
function asConfigScope(scope, fallback) {
|
|
2172
|
-
if (typeof scope === "string" &&
|
|
2146
|
+
if (typeof scope === "string" && Object.hasOwn(GitConfigScope, scope)) {
|
|
2173
2147
|
return scope;
|
|
2174
2148
|
}
|
|
2175
2149
|
return fallback;
|
|
@@ -2390,13 +2364,14 @@ function getResetMode(mode) {
|
|
|
2390
2364
|
return;
|
|
2391
2365
|
}
|
|
2392
2366
|
function isValidResetMode(mode) {
|
|
2393
|
-
return
|
|
2367
|
+
return typeof mode === "string" && validResetModes.includes(mode);
|
|
2394
2368
|
}
|
|
2395
2369
|
var ResetMode;
|
|
2396
|
-
var
|
|
2370
|
+
var validResetModes;
|
|
2397
2371
|
var init_reset = __esm({
|
|
2398
2372
|
"src/lib/tasks/reset.ts"() {
|
|
2399
2373
|
"use strict";
|
|
2374
|
+
init_utils();
|
|
2400
2375
|
init_task();
|
|
2401
2376
|
ResetMode = /* @__PURE__ */ ((ResetMode2) => {
|
|
2402
2377
|
ResetMode2["MIXED"] = "mixed";
|
|
@@ -2406,7 +2381,7 @@ var init_reset = __esm({
|
|
|
2406
2381
|
ResetMode2["KEEP"] = "keep";
|
|
2407
2382
|
return ResetMode2;
|
|
2408
2383
|
})(ResetMode || {});
|
|
2409
|
-
|
|
2384
|
+
validResetModes = asStringArray(Object.values(ResetMode));
|
|
2410
2385
|
}
|
|
2411
2386
|
});
|
|
2412
2387
|
function createLog() {
|
|
@@ -2473,14 +2448,13 @@ var init_git_logger = __esm({
|
|
|
2473
2448
|
};
|
|
2474
2449
|
}
|
|
2475
2450
|
});
|
|
2476
|
-
var _TasksPendingQueue;
|
|
2477
2451
|
var TasksPendingQueue;
|
|
2478
2452
|
var init_tasks_pending_queue = __esm({
|
|
2479
2453
|
"src/lib/runners/tasks-pending-queue.ts"() {
|
|
2480
2454
|
"use strict";
|
|
2481
2455
|
init_git_error();
|
|
2482
2456
|
init_git_logger();
|
|
2483
|
-
|
|
2457
|
+
TasksPendingQueue = class _TasksPendingQueue {
|
|
2484
2458
|
constructor(logLabel = "GitExecutor") {
|
|
2485
2459
|
this.logLabel = logLabel;
|
|
2486
2460
|
this._queue = /* @__PURE__ */ new Map();
|
|
@@ -2539,9 +2513,10 @@ var init_tasks_pending_queue = __esm({
|
|
|
2539
2513
|
static getName(name = "empty") {
|
|
2540
2514
|
return `task:${name}:${++_TasksPendingQueue.counter}`;
|
|
2541
2515
|
}
|
|
2516
|
+
static {
|
|
2517
|
+
this.counter = 0;
|
|
2518
|
+
}
|
|
2542
2519
|
};
|
|
2543
|
-
TasksPendingQueue = _TasksPendingQueue;
|
|
2544
|
-
TasksPendingQueue.counter = 0;
|
|
2545
2520
|
}
|
|
2546
2521
|
});
|
|
2547
2522
|
function pluginContext(task, commands) {
|
|
@@ -2598,20 +2573,18 @@ var init_git_executor_chain = __esm({
|
|
|
2598
2573
|
this._queue.push(task);
|
|
2599
2574
|
return this._chain = this._chain.then(() => this.attemptTask(task));
|
|
2600
2575
|
}
|
|
2601
|
-
attemptTask(task) {
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
}
|
|
2614
|
-
});
|
|
2576
|
+
async attemptTask(task) {
|
|
2577
|
+
const onScheduleComplete = await this._scheduler.next();
|
|
2578
|
+
const onQueueComplete = () => this._queue.complete(task);
|
|
2579
|
+
try {
|
|
2580
|
+
const { logger } = this._queue.attempt(task);
|
|
2581
|
+
return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));
|
|
2582
|
+
} catch (e) {
|
|
2583
|
+
throw this.onFatalException(task, e);
|
|
2584
|
+
} finally {
|
|
2585
|
+
onQueueComplete();
|
|
2586
|
+
onScheduleComplete();
|
|
2587
|
+
}
|
|
2615
2588
|
}
|
|
2616
2589
|
onFatalException(task, e) {
|
|
2617
2590
|
const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
|
|
@@ -2619,34 +2592,30 @@ var init_git_executor_chain = __esm({
|
|
|
2619
2592
|
this._queue.fatal(gitError);
|
|
2620
2593
|
return gitError;
|
|
2621
2594
|
}
|
|
2622
|
-
attemptRemoteTask(task, logger) {
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
return callTaskParser(task.parser, outputStreams.asStrings());
|
|
2643
|
-
});
|
|
2595
|
+
async attemptRemoteTask(task, logger) {
|
|
2596
|
+
const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
|
|
2597
|
+
const args = this._plugins.exec(
|
|
2598
|
+
"spawn.args",
|
|
2599
|
+
[...task.commands],
|
|
2600
|
+
pluginContext(task, task.commands)
|
|
2601
|
+
);
|
|
2602
|
+
const raw = await this.gitResponse(
|
|
2603
|
+
task,
|
|
2604
|
+
binary,
|
|
2605
|
+
args,
|
|
2606
|
+
this.outputHandler,
|
|
2607
|
+
logger.step("SPAWN")
|
|
2608
|
+
);
|
|
2609
|
+
const outputStreams = await this.handleTaskData(task, args, raw, logger.step("HANDLE"));
|
|
2610
|
+
logger(`passing response to task's parser as a %s`, task.format);
|
|
2611
|
+
if (isBufferTask(task)) {
|
|
2612
|
+
return callTaskParser(task.parser, outputStreams);
|
|
2613
|
+
}
|
|
2614
|
+
return callTaskParser(task.parser, outputStreams.asStrings());
|
|
2644
2615
|
}
|
|
2645
|
-
attemptEmptyTask(task, logger) {
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
return task.parser(this);
|
|
2649
|
-
});
|
|
2616
|
+
async attemptEmptyTask(task, logger) {
|
|
2617
|
+
logger(`empty task bypassing child process to call to task's parser`);
|
|
2618
|
+
return task.parser(this);
|
|
2650
2619
|
}
|
|
2651
2620
|
handleTaskData(task, args, result, logger) {
|
|
2652
2621
|
const { exitCode, rejection, stdOut, stdErr } = result;
|
|
@@ -2655,7 +2624,10 @@ var init_git_executor_chain = __esm({
|
|
|
2655
2624
|
const { error } = this._plugins.exec(
|
|
2656
2625
|
"task.error",
|
|
2657
2626
|
{ error: rejection },
|
|
2658
|
-
|
|
2627
|
+
{
|
|
2628
|
+
...pluginContext(task, args),
|
|
2629
|
+
...result
|
|
2630
|
+
}
|
|
2659
2631
|
);
|
|
2660
2632
|
if (error && task.onError) {
|
|
2661
2633
|
logger.info(`exitCode=%s handling with custom error handler`);
|
|
@@ -2688,79 +2660,80 @@ var init_git_executor_chain = __esm({
|
|
|
2688
2660
|
done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
|
|
2689
2661
|
});
|
|
2690
2662
|
}
|
|
2691
|
-
gitResponse(task, command, args, outputHandler, logger) {
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2663
|
+
async gitResponse(task, command, args, outputHandler, logger) {
|
|
2664
|
+
const outputLogger = logger.sibling("output");
|
|
2665
|
+
const spawnOptions = this._plugins.exec(
|
|
2666
|
+
"spawn.options",
|
|
2667
|
+
{
|
|
2668
|
+
cwd: this.cwd,
|
|
2669
|
+
env: this.env,
|
|
2670
|
+
windowsHide: true
|
|
2671
|
+
},
|
|
2672
|
+
pluginContext(task, task.commands)
|
|
2673
|
+
);
|
|
2674
|
+
return new Promise((done) => {
|
|
2675
|
+
const stdOut = [];
|
|
2676
|
+
const stdErr = [];
|
|
2677
|
+
logger.info(`%s %o`, command, args);
|
|
2678
|
+
logger("%O", spawnOptions);
|
|
2679
|
+
let rejection = this._beforeSpawn(task, args);
|
|
2680
|
+
if (rejection) {
|
|
2681
|
+
return done({
|
|
2682
|
+
stdOut,
|
|
2683
|
+
stdErr,
|
|
2684
|
+
exitCode: 9901,
|
|
2685
|
+
rejection
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
this._plugins.exec("spawn.before", void 0, {
|
|
2689
|
+
...pluginContext(task, args),
|
|
2690
|
+
kill(reason) {
|
|
2691
|
+
rejection = reason || rejection;
|
|
2692
|
+
}
|
|
2693
|
+
});
|
|
2694
|
+
const spawned = (0, import_child_process.spawn)(command, args, spawnOptions);
|
|
2695
|
+
spawned.stdout.on(
|
|
2696
|
+
"data",
|
|
2697
|
+
onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
|
|
2698
|
+
);
|
|
2699
|
+
spawned.stderr.on(
|
|
2700
|
+
"data",
|
|
2701
|
+
onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))
|
|
2702
2702
|
);
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2703
|
+
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
2704
|
+
if (outputHandler) {
|
|
2705
|
+
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
|
2706
|
+
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
|
2707
|
+
}
|
|
2708
|
+
this._plugins.exec("spawn.after", void 0, {
|
|
2709
|
+
...pluginContext(task, args),
|
|
2710
|
+
spawned,
|
|
2711
|
+
close(exitCode, reason) {
|
|
2712
|
+
done({
|
|
2711
2713
|
stdOut,
|
|
2712
2714
|
stdErr,
|
|
2713
|
-
exitCode
|
|
2714
|
-
rejection
|
|
2715
|
+
exitCode,
|
|
2716
|
+
rejection: rejection || reason
|
|
2715
2717
|
});
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2718
|
+
},
|
|
2719
|
+
kill(reason) {
|
|
2720
|
+
if (spawned.killed) {
|
|
2721
|
+
return;
|
|
2720
2722
|
}
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
spawned.stdout.on(
|
|
2724
|
-
"data",
|
|
2725
|
-
onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
|
|
2726
|
-
);
|
|
2727
|
-
spawned.stderr.on(
|
|
2728
|
-
"data",
|
|
2729
|
-
onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))
|
|
2730
|
-
);
|
|
2731
|
-
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
2732
|
-
if (outputHandler) {
|
|
2733
|
-
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
|
2734
|
-
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
|
2723
|
+
rejection = reason;
|
|
2724
|
+
spawned.kill("SIGINT");
|
|
2735
2725
|
}
|
|
2736
|
-
this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
|
|
2737
|
-
spawned,
|
|
2738
|
-
close(exitCode, reason) {
|
|
2739
|
-
done({
|
|
2740
|
-
stdOut,
|
|
2741
|
-
stdErr,
|
|
2742
|
-
exitCode,
|
|
2743
|
-
rejection: rejection || reason
|
|
2744
|
-
});
|
|
2745
|
-
},
|
|
2746
|
-
kill(reason) {
|
|
2747
|
-
if (spawned.killed) {
|
|
2748
|
-
return;
|
|
2749
|
-
}
|
|
2750
|
-
rejection = reason;
|
|
2751
|
-
spawned.kill("SIGINT");
|
|
2752
|
-
}
|
|
2753
|
-
}));
|
|
2754
2726
|
});
|
|
2755
2727
|
});
|
|
2756
2728
|
}
|
|
2757
2729
|
_beforeSpawn(task, args) {
|
|
2758
2730
|
let rejection;
|
|
2759
|
-
this._plugins.exec("spawn.before", void 0,
|
|
2731
|
+
this._plugins.exec("spawn.before", void 0, {
|
|
2732
|
+
...pluginContext(task, args),
|
|
2760
2733
|
kill(reason) {
|
|
2761
2734
|
rejection = reason || rejection;
|
|
2762
2735
|
}
|
|
2763
|
-
})
|
|
2736
|
+
});
|
|
2764
2737
|
return rejection;
|
|
2765
2738
|
}
|
|
2766
2739
|
};
|
|
@@ -2796,7 +2769,7 @@ function taskCallback(task, response, callback = NOOP) {
|
|
|
2796
2769
|
callback(null, data);
|
|
2797
2770
|
};
|
|
2798
2771
|
const onError2 = (err) => {
|
|
2799
|
-
if (
|
|
2772
|
+
if (err?.task === task) {
|
|
2800
2773
|
callback(
|
|
2801
2774
|
err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,
|
|
2802
2775
|
void 0
|
|
@@ -2886,6 +2859,47 @@ var init_checkout = __esm({
|
|
|
2886
2859
|
init_task();
|
|
2887
2860
|
}
|
|
2888
2861
|
});
|
|
2862
|
+
function countObjectsResponse() {
|
|
2863
|
+
return {
|
|
2864
|
+
count: 0,
|
|
2865
|
+
garbage: 0,
|
|
2866
|
+
inPack: 0,
|
|
2867
|
+
packs: 0,
|
|
2868
|
+
prunePackable: 0,
|
|
2869
|
+
size: 0,
|
|
2870
|
+
sizeGarbage: 0,
|
|
2871
|
+
sizePack: 0
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
function count_objects_default() {
|
|
2875
|
+
return {
|
|
2876
|
+
countObjects() {
|
|
2877
|
+
return this._runTask({
|
|
2878
|
+
commands: ["count-objects", "--verbose"],
|
|
2879
|
+
format: "utf-8",
|
|
2880
|
+
parser(stdOut) {
|
|
2881
|
+
return parseStringResponse(countObjectsResponse(), [parser2], stdOut);
|
|
2882
|
+
}
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
};
|
|
2886
|
+
}
|
|
2887
|
+
var parser2;
|
|
2888
|
+
var init_count_objects = __esm({
|
|
2889
|
+
"src/lib/tasks/count-objects.ts"() {
|
|
2890
|
+
"use strict";
|
|
2891
|
+
init_utils();
|
|
2892
|
+
parser2 = new LineParser(
|
|
2893
|
+
/([a-z-]+): (\d+)$/,
|
|
2894
|
+
(result, [key, value]) => {
|
|
2895
|
+
const property = asCamelCase(key);
|
|
2896
|
+
if (Object.hasOwn(result, property)) {
|
|
2897
|
+
result[property] = asNumber(value);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
);
|
|
2901
|
+
}
|
|
2902
|
+
});
|
|
2889
2903
|
function parseCommitResult(stdOut) {
|
|
2890
2904
|
const result = {
|
|
2891
2905
|
author: null,
|
|
@@ -2967,7 +2981,10 @@ function commit_default() {
|
|
|
2967
2981
|
const task = rejectDeprecatedSignatures(message) || commitTask(
|
|
2968
2982
|
asArray(message),
|
|
2969
2983
|
asArray(filterType(rest[0], filterStringOrStringArray, [])),
|
|
2970
|
-
[
|
|
2984
|
+
[
|
|
2985
|
+
...asStringArray(filterType(rest[1], filterArray, [])),
|
|
2986
|
+
...getTrailingOptions(arguments, 0, true)
|
|
2987
|
+
]
|
|
2971
2988
|
);
|
|
2972
2989
|
return this._runTask(task, next);
|
|
2973
2990
|
}
|
|
@@ -3112,8 +3129,8 @@ var init_DiffSummary = __esm({
|
|
|
3112
3129
|
}
|
|
3113
3130
|
});
|
|
3114
3131
|
function getDiffParser(format = "") {
|
|
3115
|
-
const
|
|
3116
|
-
return (stdOut) => parseStringResponse(new DiffSummary(),
|
|
3132
|
+
const parser4 = diffSummaryParsers[format];
|
|
3133
|
+
return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false);
|
|
3117
3134
|
}
|
|
3118
3135
|
var statParser;
|
|
3119
3136
|
var numStatParser;
|
|
@@ -3157,8 +3174,8 @@ var init_parse_diff_summary = __esm({
|
|
|
3157
3174
|
const inserted = /(\d+) i/.exec(summary);
|
|
3158
3175
|
const deleted = /(\d+) d/.exec(summary);
|
|
3159
3176
|
result.changed = asNumber(changed);
|
|
3160
|
-
result.insertions = asNumber(inserted
|
|
3161
|
-
result.deletions = asNumber(deleted
|
|
3177
|
+
result.insertions = asNumber(inserted?.[1]);
|
|
3178
|
+
result.deletions = asNumber(deleted?.[1]);
|
|
3162
3179
|
}
|
|
3163
3180
|
)
|
|
3164
3181
|
];
|
|
@@ -3205,15 +3222,17 @@ var init_parse_diff_summary = __esm({
|
|
|
3205
3222
|
nameStatusParser = [
|
|
3206
3223
|
new LineParser(
|
|
3207
3224
|
/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,
|
|
3208
|
-
(result, [status,
|
|
3225
|
+
(result, [status, similarity, from, _to, to]) => {
|
|
3209
3226
|
result.changed++;
|
|
3210
3227
|
result.files.push({
|
|
3211
|
-
file: to
|
|
3228
|
+
file: to ?? from,
|
|
3212
3229
|
changes: 0,
|
|
3213
|
-
status: orVoid(isDiffNameStatus(status) && status),
|
|
3214
3230
|
insertions: 0,
|
|
3215
3231
|
deletions: 0,
|
|
3216
|
-
binary: false
|
|
3232
|
+
binary: false,
|
|
3233
|
+
status: orVoid(isDiffNameStatus(status) && status),
|
|
3234
|
+
from: orVoid(!!to && from !== to && from),
|
|
3235
|
+
similarity: asNumber(similarity)
|
|
3217
3236
|
});
|
|
3218
3237
|
}
|
|
3219
3238
|
)
|
|
@@ -3255,15 +3274,12 @@ function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNa
|
|
|
3255
3274
|
const parseDiffResult = getDiffParser(logFormat);
|
|
3256
3275
|
return function(stdOut) {
|
|
3257
3276
|
const all = toLinesWithContent(
|
|
3258
|
-
stdOut,
|
|
3259
|
-
|
|
3277
|
+
stdOut.trim(),
|
|
3278
|
+
false,
|
|
3260
3279
|
START_BOUNDARY
|
|
3261
3280
|
).map(function(item) {
|
|
3262
|
-
const lineDetail = item.
|
|
3263
|
-
const listLogLine = lineBuilder(
|
|
3264
|
-
lineDetail[0].trim().split(splitter),
|
|
3265
|
-
fields
|
|
3266
|
-
);
|
|
3281
|
+
const lineDetail = item.split(COMMIT_BOUNDARY);
|
|
3282
|
+
const listLogLine = lineBuilder(lineDetail[0].split(splitter), fields);
|
|
3267
3283
|
if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
|
|
3268
3284
|
listLogLine.diff = parseDiffResult(lineDetail[1]);
|
|
3269
3285
|
}
|
|
@@ -3351,7 +3367,7 @@ function userOptions(input) {
|
|
|
3351
3367
|
}
|
|
3352
3368
|
function parseLogOptions(opt = {}, customArgs = []) {
|
|
3353
3369
|
const splitter = filterType(opt.splitter, filterString, SPLITTER);
|
|
3354
|
-
const format =
|
|
3370
|
+
const format = filterPlainObject(opt.format) ? opt.format : {
|
|
3355
3371
|
hash: "%H",
|
|
3356
3372
|
date: opt.strictDate === false ? "%ai" : "%aI",
|
|
3357
3373
|
message: "%s",
|
|
@@ -3385,11 +3401,11 @@ function parseLogOptions(opt = {}, customArgs = []) {
|
|
|
3385
3401
|
};
|
|
3386
3402
|
}
|
|
3387
3403
|
function logTask(splitter, fields, customArgs) {
|
|
3388
|
-
const
|
|
3404
|
+
const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
|
|
3389
3405
|
return {
|
|
3390
3406
|
commands: ["log", ...customArgs],
|
|
3391
3407
|
format: "utf-8",
|
|
3392
|
-
parser:
|
|
3408
|
+
parser: parser4
|
|
3393
3409
|
};
|
|
3394
3410
|
}
|
|
3395
3411
|
function log_default() {
|
|
@@ -3398,7 +3414,7 @@ function log_default() {
|
|
|
3398
3414
|
const next = trailingFunctionArgument(arguments);
|
|
3399
3415
|
const options = parseLogOptions(
|
|
3400
3416
|
trailingOptionsArgument(arguments),
|
|
3401
|
-
filterType(arguments[0], filterArray)
|
|
3417
|
+
asStringArray(filterType(arguments[0], filterArray, []))
|
|
3402
3418
|
);
|
|
3403
3419
|
const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
|
|
3404
3420
|
return this._runTask(task, next);
|
|
@@ -3767,9 +3783,10 @@ var init_parse_push = __esm({
|
|
|
3767
3783
|
result.repo = repo;
|
|
3768
3784
|
}),
|
|
3769
3785
|
new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
|
|
3770
|
-
result.ref =
|
|
3786
|
+
result.ref = {
|
|
3787
|
+
...result.ref || {},
|
|
3771
3788
|
local
|
|
3772
|
-
}
|
|
3789
|
+
};
|
|
3773
3790
|
}),
|
|
3774
3791
|
new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
|
|
3775
3792
|
result.pushed.push(pushResultPushedItem(local, remote, type));
|
|
@@ -3777,11 +3794,12 @@ var init_parse_push = __esm({
|
|
|
3777
3794
|
new LineParser(
|
|
3778
3795
|
/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,
|
|
3779
3796
|
(result, [local, remote, remoteName]) => {
|
|
3780
|
-
result.branch =
|
|
3797
|
+
result.branch = {
|
|
3798
|
+
...result.branch || {},
|
|
3781
3799
|
local,
|
|
3782
3800
|
remote,
|
|
3783
3801
|
remoteName
|
|
3784
|
-
}
|
|
3802
|
+
};
|
|
3785
3803
|
}
|
|
3786
3804
|
),
|
|
3787
3805
|
new LineParser(
|
|
@@ -3803,7 +3821,10 @@ var init_parse_push = __esm({
|
|
|
3803
3821
|
parsePushResult = (stdOut, stdErr) => {
|
|
3804
3822
|
const pushDetail = parsePushDetail(stdOut, stdErr);
|
|
3805
3823
|
const responseDetail = parseRemoteMessages(stdOut, stdErr);
|
|
3806
|
-
return
|
|
3824
|
+
return {
|
|
3825
|
+
...pushDetail,
|
|
3826
|
+
...responseDetail
|
|
3827
|
+
};
|
|
3807
3828
|
};
|
|
3808
3829
|
parsePushDetail = (stdOut, stdErr) => {
|
|
3809
3830
|
return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
|
|
@@ -3876,16 +3897,16 @@ var FileStatusSummary;
|
|
|
3876
3897
|
var init_FileStatusSummary = __esm({
|
|
3877
3898
|
"src/lib/responses/FileStatusSummary.ts"() {
|
|
3878
3899
|
"use strict";
|
|
3879
|
-
fromPathRegex = /^(.+)
|
|
3900
|
+
fromPathRegex = /^(.+)\0(.+)$/;
|
|
3880
3901
|
FileStatusSummary = class {
|
|
3881
3902
|
constructor(path3, index, working_dir) {
|
|
3882
3903
|
this.path = path3;
|
|
3883
3904
|
this.index = index;
|
|
3884
3905
|
this.working_dir = working_dir;
|
|
3885
|
-
if ("R"
|
|
3906
|
+
if (index === "R" || working_dir === "R") {
|
|
3886
3907
|
const detail = fromPathRegex.exec(path3) || [null, path3, path3];
|
|
3887
|
-
this.from = detail[
|
|
3888
|
-
this.path = detail[
|
|
3908
|
+
this.from = detail[2] || "";
|
|
3909
|
+
this.path = detail[1] || "";
|
|
3889
3910
|
}
|
|
3890
3911
|
}
|
|
3891
3912
|
};
|
|
@@ -3898,11 +3919,11 @@ function renamedFile(line) {
|
|
|
3898
3919
|
to
|
|
3899
3920
|
};
|
|
3900
3921
|
}
|
|
3901
|
-
function
|
|
3922
|
+
function parser3(indexX, indexY, handler) {
|
|
3902
3923
|
return [`${indexX}${indexY}`, handler];
|
|
3903
3924
|
}
|
|
3904
3925
|
function conflicts(indexX, ...indexY) {
|
|
3905
|
-
return indexY.map((y) =>
|
|
3926
|
+
return indexY.map((y) => parser3(indexX, y, (result, file) => append(result.conflicted, file)));
|
|
3906
3927
|
}
|
|
3907
3928
|
function splitLine(result, lineStr) {
|
|
3908
3929
|
const trimmed2 = lineStr.trim();
|
|
@@ -3921,7 +3942,7 @@ function splitLine(result, lineStr) {
|
|
|
3921
3942
|
handler(result, path3);
|
|
3922
3943
|
}
|
|
3923
3944
|
if (raw !== "##" && raw !== "!!") {
|
|
3924
|
-
result.files.push(new FileStatusSummary(path3
|
|
3945
|
+
result.files.push(new FileStatusSummary(path3, index, workingDir));
|
|
3925
3946
|
}
|
|
3926
3947
|
}
|
|
3927
3948
|
}
|
|
@@ -3955,58 +3976,58 @@ var init_StatusSummary = __esm({
|
|
|
3955
3976
|
}
|
|
3956
3977
|
};
|
|
3957
3978
|
parsers6 = new Map([
|
|
3958
|
-
|
|
3979
|
+
parser3(
|
|
3959
3980
|
" ",
|
|
3960
3981
|
"A",
|
|
3961
3982
|
(result, file) => append(result.created, file)
|
|
3962
3983
|
),
|
|
3963
|
-
|
|
3984
|
+
parser3(
|
|
3964
3985
|
" ",
|
|
3965
3986
|
"D",
|
|
3966
3987
|
(result, file) => append(result.deleted, file)
|
|
3967
3988
|
),
|
|
3968
|
-
|
|
3989
|
+
parser3(
|
|
3969
3990
|
" ",
|
|
3970
3991
|
"M",
|
|
3971
3992
|
(result, file) => append(result.modified, file)
|
|
3972
3993
|
),
|
|
3973
|
-
|
|
3994
|
+
parser3(
|
|
3974
3995
|
"A",
|
|
3975
3996
|
" ",
|
|
3976
3997
|
(result, file) => append(result.created, file) && append(result.staged, file)
|
|
3977
3998
|
),
|
|
3978
|
-
|
|
3999
|
+
parser3(
|
|
3979
4000
|
"A",
|
|
3980
4001
|
"M",
|
|
3981
4002
|
(result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)
|
|
3982
4003
|
),
|
|
3983
|
-
|
|
4004
|
+
parser3(
|
|
3984
4005
|
"D",
|
|
3985
4006
|
" ",
|
|
3986
4007
|
(result, file) => append(result.deleted, file) && append(result.staged, file)
|
|
3987
4008
|
),
|
|
3988
|
-
|
|
4009
|
+
parser3(
|
|
3989
4010
|
"M",
|
|
3990
4011
|
" ",
|
|
3991
4012
|
(result, file) => append(result.modified, file) && append(result.staged, file)
|
|
3992
4013
|
),
|
|
3993
|
-
|
|
4014
|
+
parser3(
|
|
3994
4015
|
"M",
|
|
3995
4016
|
"M",
|
|
3996
4017
|
(result, file) => append(result.modified, file) && append(result.staged, file)
|
|
3997
4018
|
),
|
|
3998
|
-
|
|
4019
|
+
parser3("R", " ", (result, file) => {
|
|
3999
4020
|
append(result.renamed, renamedFile(file));
|
|
4000
4021
|
}),
|
|
4001
|
-
|
|
4022
|
+
parser3("R", "M", (result, file) => {
|
|
4002
4023
|
const renamed = renamedFile(file);
|
|
4003
4024
|
append(result.renamed, renamed);
|
|
4004
4025
|
append(result.modified, renamed.to);
|
|
4005
4026
|
}),
|
|
4006
|
-
|
|
4027
|
+
parser3("!", "!", (_result, _file) => {
|
|
4007
4028
|
append(_result.ignored = _result.ignored || [], _file);
|
|
4008
4029
|
}),
|
|
4009
|
-
|
|
4030
|
+
parser3(
|
|
4010
4031
|
"?",
|
|
4011
4032
|
"?",
|
|
4012
4033
|
(result, file) => append(result.not_added, file)
|
|
@@ -4037,18 +4058,19 @@ var init_StatusSummary = __esm({
|
|
|
4037
4058
|
const behindReg = /behind (\d+)/;
|
|
4038
4059
|
const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
|
|
4039
4060
|
const trackingReg = /\.{3}(\S*)/;
|
|
4040
|
-
const onEmptyBranchReg = /\son\s(
|
|
4041
|
-
let regexResult;
|
|
4042
|
-
regexResult = aheadReg.exec(line);
|
|
4061
|
+
const onEmptyBranchReg = /\son\s(\S+?)(?=\.{3}|$)/;
|
|
4062
|
+
let regexResult = aheadReg.exec(line);
|
|
4043
4063
|
result.ahead = regexResult && +regexResult[1] || 0;
|
|
4044
4064
|
regexResult = behindReg.exec(line);
|
|
4045
4065
|
result.behind = regexResult && +regexResult[1] || 0;
|
|
4046
4066
|
regexResult = currentReg.exec(line);
|
|
4047
|
-
result.current = regexResult
|
|
4067
|
+
result.current = filterType(regexResult?.[1], filterString, null);
|
|
4048
4068
|
regexResult = trackingReg.exec(line);
|
|
4049
|
-
result.tracking = regexResult
|
|
4069
|
+
result.tracking = filterType(regexResult?.[1], filterString, null);
|
|
4050
4070
|
regexResult = onEmptyBranchReg.exec(line);
|
|
4051
|
-
|
|
4071
|
+
if (regexResult) {
|
|
4072
|
+
result.current = filterType(regexResult?.[1], filterString, result.current);
|
|
4073
|
+
}
|
|
4052
4074
|
result.detached = /\(no branch\)/.test(line);
|
|
4053
4075
|
}
|
|
4054
4076
|
]
|
|
@@ -4177,6 +4199,7 @@ var init_simple_git_api = __esm({
|
|
|
4177
4199
|
init_task_callback();
|
|
4178
4200
|
init_change_working_directory();
|
|
4179
4201
|
init_checkout();
|
|
4202
|
+
init_count_objects();
|
|
4180
4203
|
init_commit();
|
|
4181
4204
|
init_config();
|
|
4182
4205
|
init_first_commit();
|
|
@@ -4218,7 +4241,7 @@ var init_simple_git_api = __esm({
|
|
|
4218
4241
|
if (typeof directory === "string") {
|
|
4219
4242
|
return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
|
|
4220
4243
|
}
|
|
4221
|
-
if (typeof
|
|
4244
|
+
if (typeof directory?.path === "string") {
|
|
4222
4245
|
return this._runTask(
|
|
4223
4246
|
changeWorkingDirectoryTask(
|
|
4224
4247
|
directory.path,
|
|
@@ -4295,6 +4318,7 @@ var init_simple_git_api = __esm({
|
|
|
4295
4318
|
checkout_default(),
|
|
4296
4319
|
commit_default(),
|
|
4297
4320
|
config_default(),
|
|
4321
|
+
count_objects_default(),
|
|
4298
4322
|
first_commit_default(),
|
|
4299
4323
|
grep_default(),
|
|
4300
4324
|
log_default(),
|
|
@@ -4467,10 +4491,15 @@ var init_BranchSummary = __esm({
|
|
|
4467
4491
|
function branchStatus(input) {
|
|
4468
4492
|
return input ? input.charAt(0) : "";
|
|
4469
4493
|
}
|
|
4470
|
-
function parseBranchSummary(stdOut) {
|
|
4471
|
-
return parseStringResponse(
|
|
4494
|
+
function parseBranchSummary(stdOut, currentOnly = false) {
|
|
4495
|
+
return parseStringResponse(
|
|
4496
|
+
new BranchSummaryResult(),
|
|
4497
|
+
currentOnly ? [currentBranchParser] : parsers9,
|
|
4498
|
+
stdOut
|
|
4499
|
+
);
|
|
4472
4500
|
}
|
|
4473
4501
|
var parsers9;
|
|
4502
|
+
var currentBranchParser;
|
|
4474
4503
|
var init_parse_branch = __esm({
|
|
4475
4504
|
"src/lib/parsers/parse-branch.ts"() {
|
|
4476
4505
|
"use strict";
|
|
@@ -4484,12 +4513,15 @@ var init_parse_branch = __esm({
|
|
|
4484
4513
|
}
|
|
4485
4514
|
),
|
|
4486
4515
|
new LineParser(
|
|
4487
|
-
|
|
4516
|
+
/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,
|
|
4488
4517
|
(result, [current, name, commit, label]) => {
|
|
4489
4518
|
result.push(branchStatus(current), false, name, commit, label);
|
|
4490
4519
|
}
|
|
4491
4520
|
)
|
|
4492
4521
|
];
|
|
4522
|
+
currentBranchParser = new LineParser(/^(\S+)$/s, (result, [name]) => {
|
|
4523
|
+
result.push("*", false, name, "", "");
|
|
4524
|
+
});
|
|
4493
4525
|
}
|
|
4494
4526
|
});
|
|
4495
4527
|
var branch_exports = {};
|
|
@@ -4506,6 +4538,7 @@ function containsDeleteBranchCommand(commands) {
|
|
|
4506
4538
|
}
|
|
4507
4539
|
function branchTask(customArgs) {
|
|
4508
4540
|
const isDelete = containsDeleteBranchCommand(customArgs);
|
|
4541
|
+
const isCurrentOnly = customArgs.includes("--show-current");
|
|
4509
4542
|
const commands = ["branch", ...customArgs];
|
|
4510
4543
|
if (commands.length === 1) {
|
|
4511
4544
|
commands.push("-a");
|
|
@@ -4520,16 +4553,17 @@ function branchTask(customArgs) {
|
|
|
4520
4553
|
if (isDelete) {
|
|
4521
4554
|
return parseBranchDeletions(stdOut, stdErr).all[0];
|
|
4522
4555
|
}
|
|
4523
|
-
return parseBranchSummary(stdOut);
|
|
4556
|
+
return parseBranchSummary(stdOut, isCurrentOnly);
|
|
4524
4557
|
}
|
|
4525
4558
|
};
|
|
4526
4559
|
}
|
|
4527
4560
|
function branchLocalTask() {
|
|
4528
|
-
const parser3 = parseBranchSummary;
|
|
4529
4561
|
return {
|
|
4530
4562
|
format: "utf-8",
|
|
4531
4563
|
commands: ["branch", "-v"],
|
|
4532
|
-
parser
|
|
4564
|
+
parser(stdOut) {
|
|
4565
|
+
return parseBranchSummary(stdOut);
|
|
4566
|
+
}
|
|
4533
4567
|
};
|
|
4534
4568
|
}
|
|
4535
4569
|
function deleteBranchesTask(branches, forceDelete = false) {
|
|
@@ -4575,12 +4609,16 @@ var init_branch = __esm({
|
|
|
4575
4609
|
init_utils();
|
|
4576
4610
|
}
|
|
4577
4611
|
});
|
|
4612
|
+
function toPath(input) {
|
|
4613
|
+
const path3 = input.trim().replace(/^["']|["']$/g, "");
|
|
4614
|
+
return path3 && (0, import_node_path.normalize)(path3);
|
|
4615
|
+
}
|
|
4578
4616
|
var parseCheckIgnore;
|
|
4579
4617
|
var init_CheckIgnore = __esm({
|
|
4580
4618
|
"src/lib/responses/CheckIgnore.ts"() {
|
|
4581
4619
|
"use strict";
|
|
4582
4620
|
parseCheckIgnore = (text) => {
|
|
4583
|
-
return text.split(/\n/g).map(
|
|
4621
|
+
return text.split(/\n/g).map(toPath).filter(Boolean);
|
|
4584
4622
|
};
|
|
4585
4623
|
}
|
|
4586
4624
|
});
|
|
@@ -4786,7 +4824,7 @@ function parseGetRemotes(text) {
|
|
|
4786
4824
|
function parseGetRemotesVerbose(text) {
|
|
4787
4825
|
const remotes = {};
|
|
4788
4826
|
forEach(text, ([name, url, purpose]) => {
|
|
4789
|
-
if (!
|
|
4827
|
+
if (!Object.hasOwn(remotes, name)) {
|
|
4790
4828
|
remotes[name] = {
|
|
4791
4829
|
name,
|
|
4792
4830
|
refs: { fetch: "", push: "" }
|
|
@@ -4860,7 +4898,7 @@ __export2(stash_list_exports, {
|
|
|
4860
4898
|
function stashListTask(opt = {}, customArgs) {
|
|
4861
4899
|
const options = parseLogOptions(opt);
|
|
4862
4900
|
const commands = ["stash", "list", ...options.commands, ...customArgs];
|
|
4863
|
-
const
|
|
4901
|
+
const parser4 = createListLogSummaryParser(
|
|
4864
4902
|
options.splitter,
|
|
4865
4903
|
options.fields,
|
|
4866
4904
|
logFormatFromCommand(commands)
|
|
@@ -4868,7 +4906,7 @@ function stashListTask(opt = {}, customArgs) {
|
|
|
4868
4906
|
return validateLogFormatConfig(commands) || {
|
|
4869
4907
|
commands,
|
|
4870
4908
|
format: "utf-8",
|
|
4871
|
-
parser:
|
|
4909
|
+
parser: parser4
|
|
4872
4910
|
};
|
|
4873
4911
|
}
|
|
4874
4912
|
var init_stash_list = __esm({
|
|
@@ -4910,8 +4948,8 @@ var init_sub_module = __esm({
|
|
|
4910
4948
|
}
|
|
4911
4949
|
});
|
|
4912
4950
|
function singleSorted(a, b) {
|
|
4913
|
-
const aIsNum = isNaN(a);
|
|
4914
|
-
const bIsNum = isNaN(b);
|
|
4951
|
+
const aIsNum = Number.isNaN(a);
|
|
4952
|
+
const bIsNum = Number.isNaN(b);
|
|
4915
4953
|
if (aIsNum !== bIsNum) {
|
|
4916
4954
|
return aIsNum ? 1 : -1;
|
|
4917
4955
|
}
|
|
@@ -5539,27 +5577,24 @@ function completionDetectionPlugin({
|
|
|
5539
5577
|
}
|
|
5540
5578
|
return {
|
|
5541
5579
|
type: "spawn.after",
|
|
5542
|
-
action(
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
if (deferClose) {
|
|
5556
|
-
yield delay(50);
|
|
5557
|
-
}
|
|
5558
|
-
close(events.exitCode);
|
|
5559
|
-
} catch (err) {
|
|
5560
|
-
close(events.exitCode, err);
|
|
5580
|
+
async action(_data, { spawned, close }) {
|
|
5581
|
+
const events = createEvents();
|
|
5582
|
+
let deferClose = true;
|
|
5583
|
+
let quickClose = () => void (deferClose = false);
|
|
5584
|
+
spawned.stdout?.on("data", quickClose);
|
|
5585
|
+
spawned.stderr?.on("data", quickClose);
|
|
5586
|
+
spawned.on("error", quickClose);
|
|
5587
|
+
spawned.on("close", (code) => events.close(code));
|
|
5588
|
+
spawned.on("exit", (code) => events.exit(code));
|
|
5589
|
+
try {
|
|
5590
|
+
await events.result;
|
|
5591
|
+
if (deferClose) {
|
|
5592
|
+
await delay(50);
|
|
5561
5593
|
}
|
|
5562
|
-
|
|
5594
|
+
close(events.exitCode);
|
|
5595
|
+
} catch (err) {
|
|
5596
|
+
close(events.exitCode, err);
|
|
5597
|
+
}
|
|
5563
5598
|
}
|
|
5564
5599
|
};
|
|
5565
5600
|
}
|
|
@@ -5673,11 +5708,10 @@ function progressMonitorPlugin(progress) {
|
|
|
5673
5708
|
const onProgress = {
|
|
5674
5709
|
type: "spawn.after",
|
|
5675
5710
|
action(_data, context) {
|
|
5676
|
-
var _a2;
|
|
5677
5711
|
if (!context.commands.includes(progressCommand)) {
|
|
5678
5712
|
return;
|
|
5679
5713
|
}
|
|
5680
|
-
|
|
5714
|
+
context.spawned.stderr?.on("data", (chunk) => {
|
|
5681
5715
|
const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
|
|
5682
5716
|
if (!message) {
|
|
5683
5717
|
return;
|
|
@@ -5712,7 +5746,7 @@ function spawnOptionsPlugin(spawnOptions) {
|
|
|
5712
5746
|
return {
|
|
5713
5747
|
type: "spawn.options",
|
|
5714
5748
|
action(data) {
|
|
5715
|
-
return
|
|
5749
|
+
return { ...options, ...data };
|
|
5716
5750
|
}
|
|
5717
5751
|
};
|
|
5718
5752
|
}
|
|
@@ -5725,16 +5759,14 @@ function timeoutPlugin({
|
|
|
5725
5759
|
return {
|
|
5726
5760
|
type: "spawn.after",
|
|
5727
5761
|
action(_data, context) {
|
|
5728
|
-
var _a2, _b;
|
|
5729
5762
|
let timeout;
|
|
5730
5763
|
function wait() {
|
|
5731
5764
|
timeout && clearTimeout(timeout);
|
|
5732
5765
|
timeout = setTimeout(kill, block);
|
|
5733
5766
|
}
|
|
5734
5767
|
function stop() {
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
(_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait);
|
|
5768
|
+
context.spawned.stdout?.off("data", wait);
|
|
5769
|
+
context.spawned.stderr?.off("data", wait);
|
|
5738
5770
|
context.spawned.off("exit", stop);
|
|
5739
5771
|
context.spawned.off("close", stop);
|
|
5740
5772
|
timeout && clearTimeout(timeout);
|
|
@@ -5743,8 +5775,8 @@ function timeoutPlugin({
|
|
|
5743
5775
|
stop();
|
|
5744
5776
|
context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
|
|
5745
5777
|
}
|
|
5746
|
-
stdOut &&
|
|
5747
|
-
stdErr &&
|
|
5778
|
+
stdOut && context.spawned.stdout?.on("data", wait);
|
|
5779
|
+
stdErr && context.spawned.stderr?.on("data", wait);
|
|
5748
5780
|
context.spawned.on("exit", stop);
|
|
5749
5781
|
context.spawned.on("close", stop);
|
|
5750
5782
|
wait();
|
|
@@ -5783,7 +5815,6 @@ function suffixPathsPlugin() {
|
|
|
5783
5815
|
init_utils();
|
|
5784
5816
|
var Git = require_git();
|
|
5785
5817
|
function gitInstanceFactory(baseDir, options) {
|
|
5786
|
-
var _a2;
|
|
5787
5818
|
const plugins = new PluginStore();
|
|
5788
5819
|
const config = createInstanceConfig(
|
|
5789
5820
|
baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {},
|
|
@@ -5807,27 +5838,27 @@ function gitInstanceFactory(baseDir, options) {
|
|
|
5807
5838
|
config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
|
|
5808
5839
|
plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
|
|
5809
5840
|
config.errors && plugins.add(errorDetectionPlugin(config.errors));
|
|
5810
|
-
customBinaryPlugin(plugins, config.binary,
|
|
5841
|
+
customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);
|
|
5811
5842
|
return new Git(config, plugins);
|
|
5812
5843
|
}
|
|
5813
5844
|
init_git_response_error();
|
|
5814
5845
|
var esm_default = gitInstanceFactory;
|
|
5815
5846
|
|
|
5816
|
-
// ../commons/github/
|
|
5847
|
+
// ../commons/github/lib/cloneRepository.js
|
|
5817
5848
|
var import_tmp_promise = __toESM(require_tmp_promise(), 1);
|
|
5818
5849
|
|
|
5819
|
-
// ../commons/github/
|
|
5850
|
+
// ../commons/github/lib/ClonedRepository.js
|
|
5820
5851
|
var import_promises = require("fs/promises");
|
|
5821
5852
|
var import_path = __toESM(require("path"), 1);
|
|
5822
5853
|
|
|
5823
|
-
// ../commons/github/
|
|
5854
|
+
// ../commons/github/lib/constants.js
|
|
5824
5855
|
var DEFAULT_REMOTE = "github.com";
|
|
5825
5856
|
var README_FILEPATH = "README.md";
|
|
5826
5857
|
var FERNIGNORE = ".fernignore";
|
|
5827
5858
|
var GITIGNORE = ".gitignore";
|
|
5828
5859
|
var GIT_DIR = ".git";
|
|
5829
5860
|
|
|
5830
|
-
// ../commons/github/
|
|
5861
|
+
// ../commons/github/lib/ClonedRepository.js
|
|
5831
5862
|
var DEFAULT_IGNORED_FILES = [FERNIGNORE, GITIGNORE, GIT_DIR];
|
|
5832
5863
|
var ClonedRepository = class {
|
|
5833
5864
|
clonePath;
|
|
@@ -5892,6 +5923,27 @@ var ClonedRepository = class {
|
|
|
5892
5923
|
await this.git.cwd(this.clonePath);
|
|
5893
5924
|
await this.git.push();
|
|
5894
5925
|
}
|
|
5926
|
+
async isRemoteEmpty() {
|
|
5927
|
+
await this.git.cwd(this.clonePath);
|
|
5928
|
+
try {
|
|
5929
|
+
const result = await this.git.raw(["ls-remote", "--heads", "origin"]);
|
|
5930
|
+
return result.trim().length === 0;
|
|
5931
|
+
} catch (_error) {
|
|
5932
|
+
return true;
|
|
5933
|
+
}
|
|
5934
|
+
}
|
|
5935
|
+
async checkoutOrCreateLocal(branch) {
|
|
5936
|
+
await this.git.cwd(this.clonePath);
|
|
5937
|
+
try {
|
|
5938
|
+
await this.git.checkout(branch);
|
|
5939
|
+
} catch (_error) {
|
|
5940
|
+
await this.git.checkoutLocalBranch(branch);
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
async pushUpstream(branch) {
|
|
5944
|
+
await this.git.cwd(this.clonePath);
|
|
5945
|
+
await this.git.push("origin", branch, { "--set-upstream": null });
|
|
5946
|
+
}
|
|
5895
5947
|
async overwriteLocalContents(sourceDirectoryPath) {
|
|
5896
5948
|
const [sourceContents, destContents] = await Promise.all([
|
|
5897
5949
|
(0, import_promises.readdir)(sourceDirectoryPath),
|
|
@@ -5925,7 +5977,7 @@ async function doesPathExist(filepath) {
|
|
|
5925
5977
|
}
|
|
5926
5978
|
}
|
|
5927
5979
|
|
|
5928
|
-
// ../commons/github/
|
|
5980
|
+
// ../commons/github/lib/parseRepository.js
|
|
5929
5981
|
function parseRepository(githubRepository) {
|
|
5930
5982
|
let remote = DEFAULT_REMOTE;
|
|
5931
5983
|
let owner;
|
|
@@ -5967,7 +6019,7 @@ function getCloneUrl({ remote, owner, repo }) {
|
|
|
5967
6019
|
return `https://${remote}/${owner}/${repo}.git`;
|
|
5968
6020
|
}
|
|
5969
6021
|
|
|
5970
|
-
// ../commons/github/
|
|
6022
|
+
// ../commons/github/lib/cloneRepository.js
|
|
5971
6023
|
async function cloneRepository({ githubRepository, installationToken }) {
|
|
5972
6024
|
const repositoryReference = parseRepository(githubRepository);
|
|
5973
6025
|
const cloneUrl = installationToken != null ? repositoryReference.getAuthedCloneUrl(installationToken) : repositoryReference.cloneUrl;
|
|
@@ -5985,7 +6037,7 @@ async function cloneRepository({ githubRepository, installationToken }) {
|
|
|
5985
6037
|
var import_compat = require("es-toolkit/compat");
|
|
5986
6038
|
var import_string = require("es-toolkit/string");
|
|
5987
6039
|
|
|
5988
|
-
// src/configuration/
|
|
6040
|
+
// src/configuration/sdk/api/index.ts
|
|
5989
6041
|
var api_exports = {};
|
|
5990
6042
|
__export(api_exports, {
|
|
5991
6043
|
ExampleStyle: () => ExampleStyle,
|
|
@@ -5999,13 +6051,13 @@ __export(api_exports, {
|
|
|
5999
6051
|
reference: () => reference_exports
|
|
6000
6052
|
});
|
|
6001
6053
|
|
|
6002
|
-
// src/configuration/
|
|
6054
|
+
// src/configuration/sdk/api/resources/feature/index.ts
|
|
6003
6055
|
var feature_exports = {};
|
|
6004
6056
|
__export(feature_exports, {
|
|
6005
6057
|
StructuredFeatureId: () => StructuredFeatureId
|
|
6006
6058
|
});
|
|
6007
6059
|
|
|
6008
|
-
// src/configuration/
|
|
6060
|
+
// src/configuration/sdk/api/resources/feature/types/StructuredFeatureId.ts
|
|
6009
6061
|
var StructuredFeatureId = {
|
|
6010
6062
|
Authentication: "AUTHENTICATION",
|
|
6011
6063
|
Errors: "ERRORS",
|
|
@@ -6045,10 +6097,10 @@ var StructuredFeatureId = {
|
|
|
6045
6097
|
}
|
|
6046
6098
|
};
|
|
6047
6099
|
|
|
6048
|
-
// src/configuration/
|
|
6100
|
+
// src/configuration/sdk/api/resources/github/index.ts
|
|
6049
6101
|
var github_exports = {};
|
|
6050
6102
|
|
|
6051
|
-
// src/configuration/
|
|
6103
|
+
// src/configuration/sdk/api/resources/readme/index.ts
|
|
6052
6104
|
var readme_exports = {};
|
|
6053
6105
|
__export(readme_exports, {
|
|
6054
6106
|
ExampleStyle: () => ExampleStyle,
|
|
@@ -6056,7 +6108,7 @@ __export(readme_exports, {
|
|
|
6056
6108
|
Remote: () => Remote
|
|
6057
6109
|
});
|
|
6058
6110
|
|
|
6059
|
-
// src/configuration/
|
|
6111
|
+
// src/configuration/sdk/api/resources/readme/types/Remote.ts
|
|
6060
6112
|
var Remote = {
|
|
6061
6113
|
github: (value) => {
|
|
6062
6114
|
return {
|
|
@@ -6077,7 +6129,7 @@ var Remote = {
|
|
|
6077
6129
|
}
|
|
6078
6130
|
};
|
|
6079
6131
|
|
|
6080
|
-
// src/configuration/
|
|
6132
|
+
// src/configuration/sdk/api/resources/readme/types/LanguageInfo.ts
|
|
6081
6133
|
var LanguageInfo = {
|
|
6082
6134
|
typescript: (value) => {
|
|
6083
6135
|
return {
|
|
@@ -6186,7 +6238,7 @@ var LanguageInfo = {
|
|
|
6186
6238
|
}
|
|
6187
6239
|
};
|
|
6188
6240
|
|
|
6189
|
-
// src/configuration/
|
|
6241
|
+
// src/configuration/sdk/api/resources/readme/types/ExampleStyle.ts
|
|
6190
6242
|
var ExampleStyle = {
|
|
6191
6243
|
Minimal: "minimal",
|
|
6192
6244
|
Comprehensive: "comprehensive",
|
|
@@ -6202,13 +6254,13 @@ var ExampleStyle = {
|
|
|
6202
6254
|
}
|
|
6203
6255
|
};
|
|
6204
6256
|
|
|
6205
|
-
// src/configuration/
|
|
6257
|
+
// src/configuration/sdk/api/resources/reference/index.ts
|
|
6206
6258
|
var reference_exports = {};
|
|
6207
6259
|
__export(reference_exports, {
|
|
6208
6260
|
Language: () => Language
|
|
6209
6261
|
});
|
|
6210
6262
|
|
|
6211
|
-
// src/configuration/
|
|
6263
|
+
// src/configuration/sdk/api/resources/reference/types/Language.ts
|
|
6212
6264
|
var Language = {
|
|
6213
6265
|
Java: "JAVA",
|
|
6214
6266
|
Python: "PYTHON",
|
|
@@ -6467,11 +6519,13 @@ var ReadmeGenerator = class {
|
|
|
6467
6519
|
}
|
|
6468
6520
|
async generateReadme({ output }) {
|
|
6469
6521
|
const blocks = await this.generateBlocks();
|
|
6522
|
+
const mergedBlocks = await this.mergeBlocks({ blocks });
|
|
6470
6523
|
const writer = new StreamWriter(output);
|
|
6471
6524
|
await this.writeHeader({ writer });
|
|
6525
|
+
await this.writeTableOfContents({ writer, blocks: mergedBlocks });
|
|
6472
6526
|
await this.writeBlocks({
|
|
6473
6527
|
writer,
|
|
6474
|
-
blocks:
|
|
6528
|
+
blocks: mergedBlocks
|
|
6475
6529
|
});
|
|
6476
6530
|
await writer.end();
|
|
6477
6531
|
}
|
|
@@ -6676,6 +6730,54 @@ var ReadmeGenerator = class {
|
|
|
6676
6730
|
);
|
|
6677
6731
|
await writer.writeLine();
|
|
6678
6732
|
}
|
|
6733
|
+
async writeTableOfContents({ writer, blocks }) {
|
|
6734
|
+
if (blocks.length === 0) {
|
|
6735
|
+
return;
|
|
6736
|
+
}
|
|
6737
|
+
await writer.writeLine("## Table of Contents");
|
|
6738
|
+
await writer.writeLine();
|
|
6739
|
+
for (const block of blocks) {
|
|
6740
|
+
const title = this.getBlockTitle(block.id);
|
|
6741
|
+
const anchor = this.getBlockAnchor(title);
|
|
6742
|
+
if (block.id === this.ADVANCED_FEATURE_ID) {
|
|
6743
|
+
await writer.writeLine(`- [${title}](#${anchor})`);
|
|
6744
|
+
const advancedFeatures = this.readmeConfig.features?.filter((feat) => this.isAdvanced(feat)) ?? [];
|
|
6745
|
+
for (const feature of advancedFeatures) {
|
|
6746
|
+
if (this.shouldSkipFeature({ feature })) {
|
|
6747
|
+
continue;
|
|
6748
|
+
}
|
|
6749
|
+
const featureTitle = featureIDToTitle(feature.id);
|
|
6750
|
+
const featureAnchor = this.getBlockAnchor(featureTitle);
|
|
6751
|
+
await writer.writeLine(` - [${featureTitle}](#${featureAnchor})`);
|
|
6752
|
+
}
|
|
6753
|
+
} else {
|
|
6754
|
+
await writer.writeLine(`- [${title}](#${anchor})`);
|
|
6755
|
+
}
|
|
6756
|
+
}
|
|
6757
|
+
await writer.writeLine();
|
|
6758
|
+
}
|
|
6759
|
+
getBlockTitle(blockId) {
|
|
6760
|
+
if (blockId === this.ADVANCED_FEATURE_ID) {
|
|
6761
|
+
return featureIDToTitle(blockId);
|
|
6762
|
+
}
|
|
6763
|
+
switch (blockId.toUpperCase()) {
|
|
6764
|
+
case "DOCUMENTATION":
|
|
6765
|
+
return "Documentation";
|
|
6766
|
+
case "REFERENCE":
|
|
6767
|
+
return "Reference";
|
|
6768
|
+
case "REQUIREMENTS":
|
|
6769
|
+
return "Requirements";
|
|
6770
|
+
case "INSTALLATION":
|
|
6771
|
+
return "Installation";
|
|
6772
|
+
case "CONTRIBUTING":
|
|
6773
|
+
return "Contributing";
|
|
6774
|
+
default:
|
|
6775
|
+
return featureIDToTitle(blockId);
|
|
6776
|
+
}
|
|
6777
|
+
}
|
|
6778
|
+
getBlockAnchor(title) {
|
|
6779
|
+
return title.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").trim();
|
|
6780
|
+
}
|
|
6679
6781
|
async generateDocumentation({ docsLink }) {
|
|
6680
6782
|
const writer = new StringWriter();
|
|
6681
6783
|
await writer.writeLine("## Documentation");
|
|
@@ -7169,7 +7271,32 @@ function languageToTitle(language) {
|
|
|
7169
7271
|
}
|
|
7170
7272
|
}
|
|
7171
7273
|
function featureIDToTitle(featureID) {
|
|
7172
|
-
|
|
7274
|
+
const words = featureID.split("_").map((s) => pascalCase(s));
|
|
7275
|
+
const lowercaseWords = /* @__PURE__ */ new Set([
|
|
7276
|
+
"And",
|
|
7277
|
+
"Or",
|
|
7278
|
+
"Nor",
|
|
7279
|
+
"But",
|
|
7280
|
+
"For",
|
|
7281
|
+
"Yet",
|
|
7282
|
+
"So",
|
|
7283
|
+
"At",
|
|
7284
|
+
"By",
|
|
7285
|
+
"In",
|
|
7286
|
+
"Of",
|
|
7287
|
+
"On",
|
|
7288
|
+
"To",
|
|
7289
|
+
"As"
|
|
7290
|
+
]);
|
|
7291
|
+
return words.map((word, index) => {
|
|
7292
|
+
if (index === 0 || index === words.length - 1) {
|
|
7293
|
+
return word;
|
|
7294
|
+
}
|
|
7295
|
+
if (lowercaseWords.has(word)) {
|
|
7296
|
+
return word.toLowerCase();
|
|
7297
|
+
}
|
|
7298
|
+
return word;
|
|
7299
|
+
}).join(" ");
|
|
7173
7300
|
}
|
|
7174
7301
|
function pascalCase(s) {
|
|
7175
7302
|
return (0, import_string.upperFirst)((0, import_string.camelCase)(s));
|
|
@@ -7400,15 +7527,20 @@ async function generateReference(params) {
|
|
|
7400
7527
|
return content.join("");
|
|
7401
7528
|
}
|
|
7402
7529
|
|
|
7403
|
-
//
|
|
7530
|
+
// ../commons/path-utils/lib/convertToOsPath.js
|
|
7531
|
+
function convertToOsPath(path3) {
|
|
7532
|
+
return path3.replace(/\\/g, "/");
|
|
7533
|
+
}
|
|
7534
|
+
|
|
7535
|
+
// ../commons/fs-utils/lib/cwd.js
|
|
7404
7536
|
function cwd() {
|
|
7405
7537
|
return process.cwd();
|
|
7406
7538
|
}
|
|
7407
7539
|
|
|
7408
|
-
//
|
|
7540
|
+
// ../commons/fs-utils/lib/resolve.js
|
|
7409
7541
|
var import_path2 = __toESM(require("path"), 1);
|
|
7410
7542
|
function resolve2(...paths) {
|
|
7411
|
-
return import_path2.default.resolve(...paths);
|
|
7543
|
+
return import_path2.default.resolve(...paths.map(convertToOsPath));
|
|
7412
7544
|
}
|
|
7413
7545
|
|
|
7414
7546
|
// src/github/GitHub.ts
|
|
@@ -7428,15 +7560,26 @@ var GitHub = class {
|
|
|
7428
7560
|
githubRepository: this.githubConfig.uri,
|
|
7429
7561
|
installationToken: this.githubConfig.token
|
|
7430
7562
|
});
|
|
7431
|
-
const
|
|
7432
|
-
|
|
7433
|
-
|
|
7563
|
+
const isEmptyRepo = await repository.isRemoteEmpty();
|
|
7564
|
+
let branch;
|
|
7565
|
+
if (isEmptyRepo) {
|
|
7566
|
+
branch = this.githubConfig.branch ?? "main";
|
|
7567
|
+
await repository.checkoutOrCreateLocal(branch);
|
|
7568
|
+
} else {
|
|
7569
|
+
branch = this.githubConfig.branch ?? await repository.getDefaultBranch();
|
|
7570
|
+
await repository.checkout(branch);
|
|
7571
|
+
await repository.pull(branch);
|
|
7572
|
+
}
|
|
7434
7573
|
const fernIgnoreFiles = await this.getFernignoreFiles(repository);
|
|
7435
7574
|
await repository.overwriteLocalContents(sourceDirectory);
|
|
7436
7575
|
await repository.add(".");
|
|
7437
7576
|
await this.restoreFiles(repository, fernIgnoreFiles);
|
|
7438
7577
|
await repository.commit("SDK Generation");
|
|
7439
|
-
|
|
7578
|
+
if (isEmptyRepo) {
|
|
7579
|
+
await repository.pushUpstream(branch);
|
|
7580
|
+
} else {
|
|
7581
|
+
await repository.push();
|
|
7582
|
+
}
|
|
7440
7583
|
} catch (error) {
|
|
7441
7584
|
console.error("Error during GitHub push:", error);
|
|
7442
7585
|
throw error;
|
|
@@ -7450,12 +7593,21 @@ var GitHub = class {
|
|
|
7450
7593
|
githubRepository: this.githubConfig.uri,
|
|
7451
7594
|
installationToken: this.githubConfig.token
|
|
7452
7595
|
});
|
|
7453
|
-
const
|
|
7596
|
+
const isEmptyRepo = await repository.isRemoteEmpty();
|
|
7597
|
+
let baseBranch;
|
|
7598
|
+
if (isEmptyRepo) {
|
|
7599
|
+
baseBranch = this.githubConfig.branch ?? "main";
|
|
7600
|
+
await repository.checkoutOrCreateLocal(baseBranch);
|
|
7601
|
+
await repository.commit("Initial commit");
|
|
7602
|
+
await repository.pushUpstream(baseBranch);
|
|
7603
|
+
} else {
|
|
7604
|
+
baseBranch = this.githubConfig.branch ?? await repository.getDefaultBranch();
|
|
7605
|
+
await repository.checkout(baseBranch);
|
|
7606
|
+
await repository.pull(baseBranch);
|
|
7607
|
+
}
|
|
7454
7608
|
const now = /* @__PURE__ */ new Date();
|
|
7455
7609
|
const formattedDate = now.toISOString().replace("T", "_").replace(/:/g, "-").replace(/\..+/, "");
|
|
7456
7610
|
const prBranch = `fern-bot/${formattedDate}`;
|
|
7457
|
-
await repository.checkout(baseBranch);
|
|
7458
|
-
await repository.pull(baseBranch);
|
|
7459
7611
|
await repository.checkout(prBranch);
|
|
7460
7612
|
const fernIgnoreFiles = await this.getFernignoreFiles(repository);
|
|
7461
7613
|
await repository.overwriteLocalContents(sourceDirectory);
|
|
@@ -7466,10 +7618,8 @@ var GitHub = class {
|
|
|
7466
7618
|
const octokit = new import_rest.Octokit({
|
|
7467
7619
|
auth: this.githubConfig.token
|
|
7468
7620
|
});
|
|
7469
|
-
const
|
|
7470
|
-
|
|
7471
|
-
throw new Error(`Invalid repository URI: ${this.githubConfig.uri}`);
|
|
7472
|
-
}
|
|
7621
|
+
const parsedRepo = parseRepository(this.githubConfig.uri);
|
|
7622
|
+
const { owner, repo } = parsedRepo;
|
|
7473
7623
|
const head = `${owner}:${prBranch}`;
|
|
7474
7624
|
try {
|
|
7475
7625
|
await octokit.pulls.create({
|