@modern-js/base-generator 3.0.11 → 3.1.1
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 +1152 -909
- package/package.json +7 -7
- package/templates/base-templates/.gitignore.handlebars +2 -0
package/dist/index.js
CHANGED
|
@@ -133454,55 +133454,58 @@ var require_recursive_readdir2 = __commonJS({
|
|
|
133454
133454
|
var require_commander2 = __commonJS({
|
|
133455
133455
|
"../../../toolkit/utils/compiled/commander/index.js"(exports, module2) {
|
|
133456
133456
|
(() => {
|
|
133457
|
-
var
|
|
133457
|
+
var t = { 81: (t2) => {
|
|
133458
133458
|
"use strict";
|
|
133459
|
-
|
|
133460
|
-
}, 361: (
|
|
133459
|
+
t2.exports = require("child_process");
|
|
133460
|
+
}, 361: (t2) => {
|
|
133461
133461
|
"use strict";
|
|
133462
|
-
|
|
133463
|
-
}, 147: (
|
|
133462
|
+
t2.exports = require("events");
|
|
133463
|
+
}, 147: (t2) => {
|
|
133464
133464
|
"use strict";
|
|
133465
|
-
|
|
133466
|
-
}, 17: (
|
|
133465
|
+
t2.exports = require("fs");
|
|
133466
|
+
}, 17: (t2) => {
|
|
133467
133467
|
"use strict";
|
|
133468
|
-
|
|
133469
|
-
},
|
|
133470
|
-
|
|
133471
|
-
|
|
133472
|
-
|
|
133473
|
-
const {
|
|
133474
|
-
const {
|
|
133475
|
-
|
|
133476
|
-
|
|
133477
|
-
|
|
133478
|
-
t2.
|
|
133479
|
-
|
|
133480
|
-
|
|
133481
|
-
|
|
133482
|
-
|
|
133483
|
-
|
|
133484
|
-
|
|
133485
|
-
|
|
133468
|
+
t2.exports = require("path");
|
|
133469
|
+
}, 282: (t2) => {
|
|
133470
|
+
"use strict";
|
|
133471
|
+
t2.exports = require("process");
|
|
133472
|
+
}, 632: (t2, e2, i2) => {
|
|
133473
|
+
const { Argument: n } = i2(535);
|
|
133474
|
+
const { Command: s } = i2(302);
|
|
133475
|
+
const { CommanderError: r, InvalidArgumentError: o } = i2(796);
|
|
133476
|
+
const { Help: a } = i2(519);
|
|
133477
|
+
const { Option: l } = i2(437);
|
|
133478
|
+
e2 = t2.exports = new s();
|
|
133479
|
+
e2.program = e2;
|
|
133480
|
+
e2.Argument = n;
|
|
133481
|
+
e2.Command = s;
|
|
133482
|
+
e2.CommanderError = r;
|
|
133483
|
+
e2.Help = a;
|
|
133484
|
+
e2.InvalidArgumentError = o;
|
|
133485
|
+
e2.InvalidOptionArgumentError = o;
|
|
133486
|
+
e2.Option = l;
|
|
133487
|
+
}, 535: (t2, e2, i2) => {
|
|
133488
|
+
const { InvalidArgumentError: n } = i2(796);
|
|
133486
133489
|
class Argument {
|
|
133487
|
-
constructor(
|
|
133488
|
-
this.description =
|
|
133490
|
+
constructor(t3, e3) {
|
|
133491
|
+
this.description = e3 || "";
|
|
133489
133492
|
this.variadic = false;
|
|
133490
133493
|
this.parseArg = void 0;
|
|
133491
133494
|
this.defaultValue = void 0;
|
|
133492
133495
|
this.defaultValueDescription = void 0;
|
|
133493
133496
|
this.argChoices = void 0;
|
|
133494
|
-
switch (
|
|
133497
|
+
switch (t3[0]) {
|
|
133495
133498
|
case "<":
|
|
133496
133499
|
this.required = true;
|
|
133497
|
-
this._name =
|
|
133500
|
+
this._name = t3.slice(1, -1);
|
|
133498
133501
|
break;
|
|
133499
133502
|
case "[":
|
|
133500
133503
|
this.required = false;
|
|
133501
|
-
this._name =
|
|
133504
|
+
this._name = t3.slice(1, -1);
|
|
133502
133505
|
break;
|
|
133503
133506
|
default:
|
|
133504
133507
|
this.required = true;
|
|
133505
|
-
this._name =
|
|
133508
|
+
this._name = t3;
|
|
133506
133509
|
break;
|
|
133507
133510
|
}
|
|
133508
133511
|
if (this._name.length > 3 && this._name.slice(-3) === "...") {
|
|
@@ -133513,31 +133516,31 @@ var require_commander2 = __commonJS({
|
|
|
133513
133516
|
name() {
|
|
133514
133517
|
return this._name;
|
|
133515
133518
|
}
|
|
133516
|
-
_concatValue(
|
|
133517
|
-
if (
|
|
133518
|
-
return [
|
|
133519
|
+
_concatValue(t3, e3) {
|
|
133520
|
+
if (e3 === this.defaultValue || !Array.isArray(e3)) {
|
|
133521
|
+
return [t3];
|
|
133519
133522
|
}
|
|
133520
|
-
return
|
|
133523
|
+
return e3.concat(t3);
|
|
133521
133524
|
}
|
|
133522
|
-
default(
|
|
133523
|
-
this.defaultValue =
|
|
133524
|
-
this.defaultValueDescription =
|
|
133525
|
+
default(t3, e3) {
|
|
133526
|
+
this.defaultValue = t3;
|
|
133527
|
+
this.defaultValueDescription = e3;
|
|
133525
133528
|
return this;
|
|
133526
133529
|
}
|
|
133527
|
-
argParser(
|
|
133528
|
-
this.parseArg =
|
|
133530
|
+
argParser(t3) {
|
|
133531
|
+
this.parseArg = t3;
|
|
133529
133532
|
return this;
|
|
133530
133533
|
}
|
|
133531
|
-
choices(
|
|
133532
|
-
this.argChoices =
|
|
133533
|
-
this.parseArg = (
|
|
133534
|
-
if (!
|
|
133535
|
-
throw new n(`Allowed choices are ${
|
|
133534
|
+
choices(t3) {
|
|
133535
|
+
this.argChoices = t3.slice();
|
|
133536
|
+
this.parseArg = (t4, e3) => {
|
|
133537
|
+
if (!this.argChoices.includes(t4)) {
|
|
133538
|
+
throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
133536
133539
|
}
|
|
133537
133540
|
if (this.variadic) {
|
|
133538
|
-
return this._concatValue(
|
|
133541
|
+
return this._concatValue(t4, e3);
|
|
133539
133542
|
}
|
|
133540
|
-
return
|
|
133543
|
+
return t4;
|
|
133541
133544
|
};
|
|
133542
133545
|
return this;
|
|
133543
133546
|
}
|
|
@@ -133550,24 +133553,25 @@ var require_commander2 = __commonJS({
|
|
|
133550
133553
|
return this;
|
|
133551
133554
|
}
|
|
133552
133555
|
}
|
|
133553
|
-
function humanReadableArgName(
|
|
133554
|
-
const
|
|
133555
|
-
return
|
|
133556
|
+
function humanReadableArgName(t3) {
|
|
133557
|
+
const e3 = t3.name() + (t3.variadic === true ? "..." : "");
|
|
133558
|
+
return t3.required ? "<" + e3 + ">" : "[" + e3 + "]";
|
|
133556
133559
|
}
|
|
133557
|
-
|
|
133558
|
-
|
|
133559
|
-
},
|
|
133560
|
+
e2.Argument = Argument;
|
|
133561
|
+
e2.humanReadableArgName = humanReadableArgName;
|
|
133562
|
+
}, 302: (t2, e2, i2) => {
|
|
133560
133563
|
const n = i2(361).EventEmitter;
|
|
133561
133564
|
const s = i2(81);
|
|
133562
133565
|
const r = i2(17);
|
|
133563
133566
|
const o = i2(147);
|
|
133564
|
-
const
|
|
133565
|
-
const {
|
|
133566
|
-
const {
|
|
133567
|
-
const {
|
|
133568
|
-
const {
|
|
133567
|
+
const a = i2(282);
|
|
133568
|
+
const { Argument: l, humanReadableArgName: h } = i2(535);
|
|
133569
|
+
const { CommanderError: u } = i2(796);
|
|
133570
|
+
const { Help: c } = i2(519);
|
|
133571
|
+
const { Option: p, splitOptionFlags: m, DualOptions: d } = i2(437);
|
|
133572
|
+
const { suggestSimilar: f } = i2(860);
|
|
133569
133573
|
class Command2 extends n {
|
|
133570
|
-
constructor(
|
|
133574
|
+
constructor(t3) {
|
|
133571
133575
|
super();
|
|
133572
133576
|
this.commands = [];
|
|
133573
133577
|
this.options = [];
|
|
@@ -133579,25 +133583,27 @@ var require_commander2 = __commonJS({
|
|
|
133579
133583
|
this.rawArgs = [];
|
|
133580
133584
|
this.processedArgs = [];
|
|
133581
133585
|
this._scriptPath = null;
|
|
133582
|
-
this._name =
|
|
133586
|
+
this._name = t3 || "";
|
|
133583
133587
|
this._optionValues = {};
|
|
133584
133588
|
this._optionValueSources = {};
|
|
133585
133589
|
this._storeOptionsAsProperties = false;
|
|
133586
133590
|
this._actionHandler = null;
|
|
133587
133591
|
this._executableHandler = false;
|
|
133588
133592
|
this._executableFile = null;
|
|
133593
|
+
this._executableDir = null;
|
|
133589
133594
|
this._defaultCommandName = null;
|
|
133590
133595
|
this._exitCallback = null;
|
|
133591
133596
|
this._aliases = [];
|
|
133592
133597
|
this._combineFlagAndOptionalValue = true;
|
|
133593
133598
|
this._description = "";
|
|
133599
|
+
this._summary = "";
|
|
133594
133600
|
this._argsDescription = void 0;
|
|
133595
133601
|
this._enablePositionalOptions = false;
|
|
133596
133602
|
this._passThroughOptions = false;
|
|
133597
133603
|
this._lifeCycleHooks = {};
|
|
133598
133604
|
this._showHelpAfterError = false;
|
|
133599
|
-
this._showSuggestionAfterError =
|
|
133600
|
-
this._outputConfiguration = { writeOut: (
|
|
133605
|
+
this._showSuggestionAfterError = true;
|
|
133606
|
+
this._outputConfiguration = { writeOut: (t4) => a.stdout.write(t4), writeErr: (t4) => a.stderr.write(t4), getOutHelpWidth: () => a.stdout.isTTY ? a.stdout.columns : void 0, getErrHelpWidth: () => a.stderr.isTTY ? a.stderr.columns : void 0, outputError: (t4, e3) => e3(t4) };
|
|
133601
133607
|
this._hidden = false;
|
|
133602
133608
|
this._hasHelpOption = true;
|
|
133603
133609
|
this._helpFlags = "-h, --help";
|
|
@@ -133610,35 +133616,35 @@ var require_commander2 = __commonJS({
|
|
|
133610
133616
|
this._helpCommandDescription = "display help for command";
|
|
133611
133617
|
this._helpConfiguration = {};
|
|
133612
133618
|
}
|
|
133613
|
-
copyInheritedSettings(
|
|
133614
|
-
this._outputConfiguration =
|
|
133615
|
-
this._hasHelpOption =
|
|
133616
|
-
this._helpFlags =
|
|
133617
|
-
this._helpDescription =
|
|
133618
|
-
this._helpShortFlag =
|
|
133619
|
-
this._helpLongFlag =
|
|
133620
|
-
this._helpCommandName =
|
|
133621
|
-
this._helpCommandnameAndArgs =
|
|
133622
|
-
this._helpCommandDescription =
|
|
133623
|
-
this._helpConfiguration =
|
|
133624
|
-
this._exitCallback =
|
|
133625
|
-
this._storeOptionsAsProperties =
|
|
133626
|
-
this._combineFlagAndOptionalValue =
|
|
133627
|
-
this._allowExcessArguments =
|
|
133628
|
-
this._enablePositionalOptions =
|
|
133629
|
-
this._showHelpAfterError =
|
|
133630
|
-
this._showSuggestionAfterError =
|
|
133619
|
+
copyInheritedSettings(t3) {
|
|
133620
|
+
this._outputConfiguration = t3._outputConfiguration;
|
|
133621
|
+
this._hasHelpOption = t3._hasHelpOption;
|
|
133622
|
+
this._helpFlags = t3._helpFlags;
|
|
133623
|
+
this._helpDescription = t3._helpDescription;
|
|
133624
|
+
this._helpShortFlag = t3._helpShortFlag;
|
|
133625
|
+
this._helpLongFlag = t3._helpLongFlag;
|
|
133626
|
+
this._helpCommandName = t3._helpCommandName;
|
|
133627
|
+
this._helpCommandnameAndArgs = t3._helpCommandnameAndArgs;
|
|
133628
|
+
this._helpCommandDescription = t3._helpCommandDescription;
|
|
133629
|
+
this._helpConfiguration = t3._helpConfiguration;
|
|
133630
|
+
this._exitCallback = t3._exitCallback;
|
|
133631
|
+
this._storeOptionsAsProperties = t3._storeOptionsAsProperties;
|
|
133632
|
+
this._combineFlagAndOptionalValue = t3._combineFlagAndOptionalValue;
|
|
133633
|
+
this._allowExcessArguments = t3._allowExcessArguments;
|
|
133634
|
+
this._enablePositionalOptions = t3._enablePositionalOptions;
|
|
133635
|
+
this._showHelpAfterError = t3._showHelpAfterError;
|
|
133636
|
+
this._showSuggestionAfterError = t3._showSuggestionAfterError;
|
|
133631
133637
|
return this;
|
|
133632
133638
|
}
|
|
133633
|
-
command(
|
|
133634
|
-
let n2 =
|
|
133639
|
+
command(t3, e3, i3) {
|
|
133640
|
+
let n2 = e3;
|
|
133635
133641
|
let s2 = i3;
|
|
133636
133642
|
if (typeof n2 === "object" && n2 !== null) {
|
|
133637
133643
|
s2 = n2;
|
|
133638
133644
|
n2 = null;
|
|
133639
133645
|
}
|
|
133640
133646
|
s2 = s2 || {};
|
|
133641
|
-
const [, r2, o2] =
|
|
133647
|
+
const [, r2, o2] = t3.match(/([^ ]+) *(.*)/);
|
|
133642
133648
|
const a2 = this.createCommand(r2);
|
|
133643
133649
|
if (n2) {
|
|
133644
133650
|
a2.description(n2);
|
|
@@ -133657,60 +133663,53 @@ var require_commander2 = __commonJS({
|
|
|
133657
133663
|
return this;
|
|
133658
133664
|
return a2;
|
|
133659
133665
|
}
|
|
133660
|
-
createCommand(
|
|
133661
|
-
return new Command2(
|
|
133666
|
+
createCommand(t3) {
|
|
133667
|
+
return new Command2(t3);
|
|
133662
133668
|
}
|
|
133663
133669
|
createHelp() {
|
|
133664
|
-
return Object.assign(new
|
|
133670
|
+
return Object.assign(new c(), this.configureHelp());
|
|
133665
133671
|
}
|
|
133666
|
-
configureHelp(
|
|
133667
|
-
if (
|
|
133672
|
+
configureHelp(t3) {
|
|
133673
|
+
if (t3 === void 0)
|
|
133668
133674
|
return this._helpConfiguration;
|
|
133669
|
-
this._helpConfiguration =
|
|
133675
|
+
this._helpConfiguration = t3;
|
|
133670
133676
|
return this;
|
|
133671
133677
|
}
|
|
133672
|
-
configureOutput(
|
|
133673
|
-
if (
|
|
133678
|
+
configureOutput(t3) {
|
|
133679
|
+
if (t3 === void 0)
|
|
133674
133680
|
return this._outputConfiguration;
|
|
133675
|
-
Object.assign(this._outputConfiguration,
|
|
133681
|
+
Object.assign(this._outputConfiguration, t3);
|
|
133676
133682
|
return this;
|
|
133677
133683
|
}
|
|
133678
|
-
showHelpAfterError(
|
|
133679
|
-
if (typeof
|
|
133680
|
-
|
|
133681
|
-
this._showHelpAfterError =
|
|
133684
|
+
showHelpAfterError(t3 = true) {
|
|
133685
|
+
if (typeof t3 !== "string")
|
|
133686
|
+
t3 = !!t3;
|
|
133687
|
+
this._showHelpAfterError = t3;
|
|
133682
133688
|
return this;
|
|
133683
133689
|
}
|
|
133684
|
-
showSuggestionAfterError(
|
|
133685
|
-
this._showSuggestionAfterError = !!
|
|
133690
|
+
showSuggestionAfterError(t3 = true) {
|
|
133691
|
+
this._showSuggestionAfterError = !!t3;
|
|
133686
133692
|
return this;
|
|
133687
133693
|
}
|
|
133688
|
-
addCommand(
|
|
133689
|
-
if (!
|
|
133690
|
-
throw new Error(
|
|
133691
|
-
|
|
133692
|
-
e4.forEach((e5) => {
|
|
133693
|
-
if (e5._executableHandler && !e5._executableFile) {
|
|
133694
|
-
throw new Error(`Must specify executableFile for deeply nested executable: ${e5.name()}`);
|
|
133695
|
-
}
|
|
133696
|
-
checkExplicitNames(e5.commands);
|
|
133697
|
-
});
|
|
133694
|
+
addCommand(t3, e3) {
|
|
133695
|
+
if (!t3._name) {
|
|
133696
|
+
throw new Error(`Command passed to .addCommand() must have a name
|
|
133697
|
+
- specify the name in Command constructor or using .name()`);
|
|
133698
133698
|
}
|
|
133699
|
-
|
|
133700
|
-
|
|
133701
|
-
|
|
133702
|
-
|
|
133703
|
-
|
|
133704
|
-
|
|
133705
|
-
this
|
|
133706
|
-
e3.parent = this;
|
|
133699
|
+
e3 = e3 || {};
|
|
133700
|
+
if (e3.isDefault)
|
|
133701
|
+
this._defaultCommandName = t3._name;
|
|
133702
|
+
if (e3.noHelp || e3.hidden)
|
|
133703
|
+
t3._hidden = true;
|
|
133704
|
+
this.commands.push(t3);
|
|
133705
|
+
t3.parent = this;
|
|
133707
133706
|
return this;
|
|
133708
133707
|
}
|
|
133709
|
-
createArgument(
|
|
133710
|
-
return new
|
|
133708
|
+
createArgument(t3, e3) {
|
|
133709
|
+
return new l(t3, e3);
|
|
133711
133710
|
}
|
|
133712
|
-
argument(
|
|
133713
|
-
const s2 = this.createArgument(
|
|
133711
|
+
argument(t3, e3, i3, n2) {
|
|
133712
|
+
const s2 = this.createArgument(t3, e3);
|
|
133714
133713
|
if (typeof i3 === "function") {
|
|
133715
133714
|
s2.default(n2).argParser(i3);
|
|
133716
133715
|
} else {
|
|
@@ -133719,33 +133718,33 @@ var require_commander2 = __commonJS({
|
|
|
133719
133718
|
this.addArgument(s2);
|
|
133720
133719
|
return this;
|
|
133721
133720
|
}
|
|
133722
|
-
arguments(
|
|
133723
|
-
|
|
133724
|
-
this.argument(
|
|
133721
|
+
arguments(t3) {
|
|
133722
|
+
t3.split(/ +/).forEach((t4) => {
|
|
133723
|
+
this.argument(t4);
|
|
133725
133724
|
});
|
|
133726
133725
|
return this;
|
|
133727
133726
|
}
|
|
133728
|
-
addArgument(
|
|
133729
|
-
const
|
|
133730
|
-
if (
|
|
133731
|
-
throw new Error(`only the last argument can be variadic '${
|
|
133727
|
+
addArgument(t3) {
|
|
133728
|
+
const e3 = this._args.slice(-1)[0];
|
|
133729
|
+
if (e3 && e3.variadic) {
|
|
133730
|
+
throw new Error(`only the last argument can be variadic '${e3.name()}'`);
|
|
133732
133731
|
}
|
|
133733
|
-
if (
|
|
133734
|
-
throw new Error(`a default value for a required argument is never used: '${
|
|
133732
|
+
if (t3.required && t3.defaultValue !== void 0 && t3.parseArg === void 0) {
|
|
133733
|
+
throw new Error(`a default value for a required argument is never used: '${t3.name()}'`);
|
|
133735
133734
|
}
|
|
133736
|
-
this._args.push(
|
|
133735
|
+
this._args.push(t3);
|
|
133737
133736
|
return this;
|
|
133738
133737
|
}
|
|
133739
|
-
addHelpCommand(
|
|
133740
|
-
if (
|
|
133738
|
+
addHelpCommand(t3, e3) {
|
|
133739
|
+
if (t3 === false) {
|
|
133741
133740
|
this._addImplicitHelpCommand = false;
|
|
133742
133741
|
} else {
|
|
133743
133742
|
this._addImplicitHelpCommand = true;
|
|
133744
|
-
if (typeof
|
|
133745
|
-
this._helpCommandName =
|
|
133746
|
-
this._helpCommandnameAndArgs =
|
|
133743
|
+
if (typeof t3 === "string") {
|
|
133744
|
+
this._helpCommandName = t3.split(" ")[0];
|
|
133745
|
+
this._helpCommandnameAndArgs = t3;
|
|
133747
133746
|
}
|
|
133748
|
-
this._helpCommandDescription =
|
|
133747
|
+
this._helpCommandDescription = e3 || this._helpCommandDescription;
|
|
133749
133748
|
}
|
|
133750
133749
|
return this;
|
|
133751
133750
|
}
|
|
@@ -133755,116 +133754,121 @@ var require_commander2 = __commonJS({
|
|
|
133755
133754
|
}
|
|
133756
133755
|
return this._addImplicitHelpCommand;
|
|
133757
133756
|
}
|
|
133758
|
-
hook(
|
|
133759
|
-
const i3 = ["preAction", "postAction"];
|
|
133760
|
-
if (!i3.includes(
|
|
133761
|
-
throw new Error(`Unexpected value for event passed to hook : '${
|
|
133757
|
+
hook(t3, e3) {
|
|
133758
|
+
const i3 = ["preSubcommand", "preAction", "postAction"];
|
|
133759
|
+
if (!i3.includes(t3)) {
|
|
133760
|
+
throw new Error(`Unexpected value for event passed to hook : '${t3}'.
|
|
133762
133761
|
Expecting one of '${i3.join("', '")}'`);
|
|
133763
133762
|
}
|
|
133764
|
-
if (this._lifeCycleHooks[
|
|
133765
|
-
this._lifeCycleHooks[
|
|
133763
|
+
if (this._lifeCycleHooks[t3]) {
|
|
133764
|
+
this._lifeCycleHooks[t3].push(e3);
|
|
133766
133765
|
} else {
|
|
133767
|
-
this._lifeCycleHooks[
|
|
133766
|
+
this._lifeCycleHooks[t3] = [e3];
|
|
133768
133767
|
}
|
|
133769
133768
|
return this;
|
|
133770
133769
|
}
|
|
133771
|
-
exitOverride(
|
|
133772
|
-
if (
|
|
133773
|
-
this._exitCallback =
|
|
133770
|
+
exitOverride(t3) {
|
|
133771
|
+
if (t3) {
|
|
133772
|
+
this._exitCallback = t3;
|
|
133774
133773
|
} else {
|
|
133775
|
-
this._exitCallback = (
|
|
133776
|
-
if (
|
|
133777
|
-
throw
|
|
133774
|
+
this._exitCallback = (t4) => {
|
|
133775
|
+
if (t4.code !== "commander.executeSubCommandAsync") {
|
|
133776
|
+
throw t4;
|
|
133778
133777
|
} else {
|
|
133779
133778
|
}
|
|
133780
133779
|
};
|
|
133781
133780
|
}
|
|
133782
133781
|
return this;
|
|
133783
133782
|
}
|
|
133784
|
-
_exit(
|
|
133783
|
+
_exit(t3, e3, i3) {
|
|
133785
133784
|
if (this._exitCallback) {
|
|
133786
|
-
this._exitCallback(new
|
|
133785
|
+
this._exitCallback(new u(t3, e3, i3));
|
|
133787
133786
|
}
|
|
133788
|
-
|
|
133787
|
+
a.exit(t3);
|
|
133789
133788
|
}
|
|
133790
|
-
action(
|
|
133791
|
-
const listener = (
|
|
133789
|
+
action(t3) {
|
|
133790
|
+
const listener = (e3) => {
|
|
133792
133791
|
const i3 = this._args.length;
|
|
133793
|
-
const n2 =
|
|
133792
|
+
const n2 = e3.slice(0, i3);
|
|
133794
133793
|
if (this._storeOptionsAsProperties) {
|
|
133795
133794
|
n2[i3] = this;
|
|
133796
133795
|
} else {
|
|
133797
133796
|
n2[i3] = this.opts();
|
|
133798
133797
|
}
|
|
133799
133798
|
n2.push(this);
|
|
133800
|
-
return
|
|
133799
|
+
return t3.apply(this, n2);
|
|
133801
133800
|
};
|
|
133802
133801
|
this._actionHandler = listener;
|
|
133803
133802
|
return this;
|
|
133804
133803
|
}
|
|
133805
|
-
createOption(
|
|
133806
|
-
return new
|
|
133804
|
+
createOption(t3, e3) {
|
|
133805
|
+
return new p(t3, e3);
|
|
133807
133806
|
}
|
|
133808
|
-
addOption(
|
|
133809
|
-
const
|
|
133810
|
-
const i3 =
|
|
133811
|
-
|
|
133812
|
-
|
|
133813
|
-
if (
|
|
133814
|
-
|
|
133815
|
-
n2 = this._findOption(t4) ? this.getOptionValue(i3) : true;
|
|
133816
|
-
}
|
|
133817
|
-
if (n2 !== void 0) {
|
|
133818
|
-
this.setOptionValueWithSource(i3, n2, "default");
|
|
133807
|
+
addOption(t3) {
|
|
133808
|
+
const e3 = t3.name();
|
|
133809
|
+
const i3 = t3.attributeName();
|
|
133810
|
+
if (t3.negate) {
|
|
133811
|
+
const e4 = t3.long.replace(/^--no-/, "--");
|
|
133812
|
+
if (!this._findOption(e4)) {
|
|
133813
|
+
this.setOptionValueWithSource(i3, t3.defaultValue === void 0 ? true : t3.defaultValue, "default");
|
|
133819
133814
|
}
|
|
133815
|
+
} else if (t3.defaultValue !== void 0) {
|
|
133816
|
+
this.setOptionValueWithSource(i3, t3.defaultValue, "default");
|
|
133820
133817
|
}
|
|
133821
|
-
this.options.push(
|
|
133822
|
-
const handleOptionValue = (
|
|
133823
|
-
|
|
133824
|
-
|
|
133818
|
+
this.options.push(t3);
|
|
133819
|
+
const handleOptionValue = (e4, n2, s2) => {
|
|
133820
|
+
if (e4 == null && t3.presetArg !== void 0) {
|
|
133821
|
+
e4 = t3.presetArg;
|
|
133822
|
+
}
|
|
133823
|
+
const r2 = this.getOptionValue(i3);
|
|
133824
|
+
if (e4 !== null && t3.parseArg) {
|
|
133825
133825
|
try {
|
|
133826
|
-
|
|
133827
|
-
} catch (
|
|
133828
|
-
if (
|
|
133829
|
-
const
|
|
133830
|
-
this.
|
|
133826
|
+
e4 = t3.parseArg(e4, r2);
|
|
133827
|
+
} catch (t4) {
|
|
133828
|
+
if (t4.code === "commander.invalidArgument") {
|
|
133829
|
+
const e5 = `${n2} ${t4.message}`;
|
|
133830
|
+
this.error(e5, { exitCode: t4.exitCode, code: t4.code });
|
|
133831
133831
|
}
|
|
133832
|
-
throw
|
|
133832
|
+
throw t4;
|
|
133833
133833
|
}
|
|
133834
|
-
} else if (
|
|
133835
|
-
|
|
133834
|
+
} else if (e4 !== null && t3.variadic) {
|
|
133835
|
+
e4 = t3._concatValue(e4, r2);
|
|
133836
133836
|
}
|
|
133837
|
-
if (
|
|
133838
|
-
if (
|
|
133839
|
-
|
|
133837
|
+
if (e4 == null) {
|
|
133838
|
+
if (t3.negate) {
|
|
133839
|
+
e4 = false;
|
|
133840
|
+
} else if (t3.isBoolean() || t3.optional) {
|
|
133841
|
+
e4 = true;
|
|
133840
133842
|
} else {
|
|
133841
|
-
|
|
133843
|
+
e4 = "";
|
|
133842
133844
|
}
|
|
133843
|
-
} else if (t4 !== null) {
|
|
133844
|
-
this.setOptionValueWithSource(i3, e3.negate ? false : t4, r2);
|
|
133845
133845
|
}
|
|
133846
|
+
this.setOptionValueWithSource(i3, e4, s2);
|
|
133846
133847
|
};
|
|
133847
|
-
this.on("option:" +
|
|
133848
|
-
const i4 = `error: option '${
|
|
133849
|
-
handleOptionValue(
|
|
133848
|
+
this.on("option:" + e3, (e4) => {
|
|
133849
|
+
const i4 = `error: option '${t3.flags}' argument '${e4}' is invalid.`;
|
|
133850
|
+
handleOptionValue(e4, i4, "cli");
|
|
133850
133851
|
});
|
|
133851
|
-
if (
|
|
133852
|
-
this.on("optionEnv:" +
|
|
133853
|
-
const i4 = `error: option '${
|
|
133854
|
-
handleOptionValue(
|
|
133852
|
+
if (t3.envVar) {
|
|
133853
|
+
this.on("optionEnv:" + e3, (e4) => {
|
|
133854
|
+
const i4 = `error: option '${t3.flags}' value '${e4}' from env '${t3.envVar}' is invalid.`;
|
|
133855
|
+
handleOptionValue(e4, i4, "env");
|
|
133855
133856
|
});
|
|
133856
133857
|
}
|
|
133857
133858
|
return this;
|
|
133858
133859
|
}
|
|
133859
|
-
_optionEx(
|
|
133860
|
-
|
|
133861
|
-
|
|
133860
|
+
_optionEx(t3, e3, i3, n2, s2) {
|
|
133861
|
+
if (typeof e3 === "object" && e3 instanceof p) {
|
|
133862
|
+
throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
|
|
133863
|
+
}
|
|
133864
|
+
const r2 = this.createOption(e3, i3);
|
|
133865
|
+
r2.makeOptionMandatory(!!t3.mandatory);
|
|
133862
133866
|
if (typeof n2 === "function") {
|
|
133863
133867
|
r2.default(s2).argParser(n2);
|
|
133864
133868
|
} else if (n2 instanceof RegExp) {
|
|
133865
|
-
const
|
|
133866
|
-
n2 = (
|
|
133867
|
-
const n3 =
|
|
133869
|
+
const t4 = n2;
|
|
133870
|
+
n2 = (e4, i4) => {
|
|
133871
|
+
const n3 = t4.exec(e4);
|
|
133868
133872
|
return n3 ? n3[0] : i4;
|
|
133869
133873
|
};
|
|
133870
133874
|
r2.default(s2).argParser(n2);
|
|
@@ -133873,209 +133877,233 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
133873
133877
|
}
|
|
133874
133878
|
return this.addOption(r2);
|
|
133875
133879
|
}
|
|
133876
|
-
option(
|
|
133877
|
-
return this._optionEx({},
|
|
133880
|
+
option(t3, e3, i3, n2) {
|
|
133881
|
+
return this._optionEx({}, t3, e3, i3, n2);
|
|
133878
133882
|
}
|
|
133879
|
-
requiredOption(
|
|
133880
|
-
return this._optionEx({ mandatory: true },
|
|
133883
|
+
requiredOption(t3, e3, i3, n2) {
|
|
133884
|
+
return this._optionEx({ mandatory: true }, t3, e3, i3, n2);
|
|
133881
133885
|
}
|
|
133882
|
-
combineFlagAndOptionalValue(
|
|
133883
|
-
this._combineFlagAndOptionalValue = !!
|
|
133886
|
+
combineFlagAndOptionalValue(t3 = true) {
|
|
133887
|
+
this._combineFlagAndOptionalValue = !!t3;
|
|
133884
133888
|
return this;
|
|
133885
133889
|
}
|
|
133886
|
-
allowUnknownOption(
|
|
133887
|
-
this._allowUnknownOption = !!
|
|
133890
|
+
allowUnknownOption(t3 = true) {
|
|
133891
|
+
this._allowUnknownOption = !!t3;
|
|
133888
133892
|
return this;
|
|
133889
133893
|
}
|
|
133890
|
-
allowExcessArguments(
|
|
133891
|
-
this._allowExcessArguments = !!
|
|
133894
|
+
allowExcessArguments(t3 = true) {
|
|
133895
|
+
this._allowExcessArguments = !!t3;
|
|
133892
133896
|
return this;
|
|
133893
133897
|
}
|
|
133894
|
-
enablePositionalOptions(
|
|
133895
|
-
this._enablePositionalOptions = !!
|
|
133898
|
+
enablePositionalOptions(t3 = true) {
|
|
133899
|
+
this._enablePositionalOptions = !!t3;
|
|
133896
133900
|
return this;
|
|
133897
133901
|
}
|
|
133898
|
-
passThroughOptions(
|
|
133899
|
-
this._passThroughOptions = !!
|
|
133900
|
-
if (!!this.parent &&
|
|
133902
|
+
passThroughOptions(t3 = true) {
|
|
133903
|
+
this._passThroughOptions = !!t3;
|
|
133904
|
+
if (!!this.parent && t3 && !this.parent._enablePositionalOptions) {
|
|
133901
133905
|
throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
|
|
133902
133906
|
}
|
|
133903
133907
|
return this;
|
|
133904
133908
|
}
|
|
133905
|
-
storeOptionsAsProperties(
|
|
133906
|
-
this._storeOptionsAsProperties = !!
|
|
133909
|
+
storeOptionsAsProperties(t3 = true) {
|
|
133910
|
+
this._storeOptionsAsProperties = !!t3;
|
|
133907
133911
|
if (this.options.length) {
|
|
133908
133912
|
throw new Error("call .storeOptionsAsProperties() before adding options");
|
|
133909
133913
|
}
|
|
133910
133914
|
return this;
|
|
133911
133915
|
}
|
|
133912
|
-
getOptionValue(
|
|
133916
|
+
getOptionValue(t3) {
|
|
133913
133917
|
if (this._storeOptionsAsProperties) {
|
|
133914
|
-
return this[
|
|
133918
|
+
return this[t3];
|
|
133915
133919
|
}
|
|
133916
|
-
return this._optionValues[
|
|
133920
|
+
return this._optionValues[t3];
|
|
133917
133921
|
}
|
|
133918
|
-
setOptionValue(
|
|
133922
|
+
setOptionValue(t3, e3) {
|
|
133923
|
+
return this.setOptionValueWithSource(t3, e3, void 0);
|
|
133924
|
+
}
|
|
133925
|
+
setOptionValueWithSource(t3, e3, i3) {
|
|
133919
133926
|
if (this._storeOptionsAsProperties) {
|
|
133920
|
-
this[
|
|
133927
|
+
this[t3] = e3;
|
|
133921
133928
|
} else {
|
|
133922
|
-
this._optionValues[
|
|
133929
|
+
this._optionValues[t3] = e3;
|
|
133923
133930
|
}
|
|
133931
|
+
this._optionValueSources[t3] = i3;
|
|
133924
133932
|
return this;
|
|
133925
133933
|
}
|
|
133926
|
-
|
|
133927
|
-
this.
|
|
133928
|
-
this._optionValueSources[e3] = i3;
|
|
133929
|
-
return this;
|
|
133934
|
+
getOptionValueSource(t3) {
|
|
133935
|
+
return this._optionValueSources[t3];
|
|
133930
133936
|
}
|
|
133931
|
-
|
|
133932
|
-
|
|
133937
|
+
getOptionValueSourceWithGlobals(t3) {
|
|
133938
|
+
let e3;
|
|
133939
|
+
getCommandAndParents(this).forEach((i3) => {
|
|
133940
|
+
if (i3.getOptionValueSource(t3) !== void 0) {
|
|
133941
|
+
e3 = i3.getOptionValueSource(t3);
|
|
133942
|
+
}
|
|
133943
|
+
});
|
|
133944
|
+
return e3;
|
|
133933
133945
|
}
|
|
133934
|
-
_prepareUserArgs(
|
|
133935
|
-
if (
|
|
133946
|
+
_prepareUserArgs(t3, e3) {
|
|
133947
|
+
if (t3 !== void 0 && !Array.isArray(t3)) {
|
|
133936
133948
|
throw new Error("first parameter to parse must be array or undefined");
|
|
133937
133949
|
}
|
|
133938
|
-
|
|
133939
|
-
if (
|
|
133940
|
-
|
|
133941
|
-
if (
|
|
133942
|
-
|
|
133950
|
+
e3 = e3 || {};
|
|
133951
|
+
if (t3 === void 0) {
|
|
133952
|
+
t3 = a.argv;
|
|
133953
|
+
if (a.versions && a.versions.electron) {
|
|
133954
|
+
e3.from = "electron";
|
|
133943
133955
|
}
|
|
133944
133956
|
}
|
|
133945
|
-
this.rawArgs =
|
|
133957
|
+
this.rawArgs = t3.slice();
|
|
133946
133958
|
let i3;
|
|
133947
|
-
switch (
|
|
133959
|
+
switch (e3.from) {
|
|
133948
133960
|
case void 0:
|
|
133949
133961
|
case "node":
|
|
133950
|
-
this._scriptPath =
|
|
133951
|
-
i3 =
|
|
133962
|
+
this._scriptPath = t3[1];
|
|
133963
|
+
i3 = t3.slice(2);
|
|
133952
133964
|
break;
|
|
133953
133965
|
case "electron":
|
|
133954
|
-
if (
|
|
133955
|
-
this._scriptPath =
|
|
133956
|
-
i3 =
|
|
133966
|
+
if (a.defaultApp) {
|
|
133967
|
+
this._scriptPath = t3[1];
|
|
133968
|
+
i3 = t3.slice(2);
|
|
133957
133969
|
} else {
|
|
133958
|
-
i3 =
|
|
133970
|
+
i3 = t3.slice(1);
|
|
133959
133971
|
}
|
|
133960
133972
|
break;
|
|
133961
133973
|
case "user":
|
|
133962
|
-
i3 =
|
|
133974
|
+
i3 = t3.slice(0);
|
|
133963
133975
|
break;
|
|
133964
133976
|
default:
|
|
133965
|
-
throw new Error(`unexpected parse option { from: '${
|
|
133977
|
+
throw new Error(`unexpected parse option { from: '${e3.from}' }`);
|
|
133966
133978
|
}
|
|
133967
|
-
if (!this.
|
|
133968
|
-
this._scriptPath
|
|
133969
|
-
|
|
133970
|
-
this._name = this._name || this._scriptPath && r.basename(this._scriptPath, r.extname(this._scriptPath));
|
|
133979
|
+
if (!this._name && this._scriptPath)
|
|
133980
|
+
this.nameFromFilename(this._scriptPath);
|
|
133981
|
+
this._name = this._name || "program";
|
|
133971
133982
|
return i3;
|
|
133972
133983
|
}
|
|
133973
|
-
parse(
|
|
133974
|
-
const i3 = this._prepareUserArgs(
|
|
133984
|
+
parse(t3, e3) {
|
|
133985
|
+
const i3 = this._prepareUserArgs(t3, e3);
|
|
133975
133986
|
this._parseCommand([], i3);
|
|
133976
133987
|
return this;
|
|
133977
133988
|
}
|
|
133978
|
-
parseAsync(
|
|
133989
|
+
parseAsync(t3, e3) {
|
|
133979
133990
|
return __async(this, null, function* () {
|
|
133980
|
-
const i3 = this._prepareUserArgs(
|
|
133991
|
+
const i3 = this._prepareUserArgs(t3, e3);
|
|
133981
133992
|
yield this._parseCommand([], i3);
|
|
133982
133993
|
return this;
|
|
133983
133994
|
});
|
|
133984
133995
|
}
|
|
133985
|
-
_executeSubCommand(
|
|
133986
|
-
|
|
133996
|
+
_executeSubCommand(t3, e3) {
|
|
133997
|
+
e3 = e3.slice();
|
|
133987
133998
|
let i3 = false;
|
|
133988
133999
|
const n2 = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
133989
|
-
|
|
133990
|
-
|
|
133991
|
-
|
|
133992
|
-
|
|
133993
|
-
|
|
133994
|
-
|
|
133995
|
-
|
|
133996
|
-
|
|
133997
|
-
|
|
133998
|
-
|
|
133999
|
-
h2 = ".";
|
|
134000
|
+
function findFile(t4, e4) {
|
|
134001
|
+
const i4 = r.resolve(t4, e4);
|
|
134002
|
+
if (o.existsSync(i4))
|
|
134003
|
+
return i4;
|
|
134004
|
+
if (n2.includes(r.extname(e4)))
|
|
134005
|
+
return void 0;
|
|
134006
|
+
const s2 = n2.find((t5) => o.existsSync(`${i4}${t5}`));
|
|
134007
|
+
if (s2)
|
|
134008
|
+
return `${i4}${s2}`;
|
|
134009
|
+
return void 0;
|
|
134000
134010
|
}
|
|
134001
|
-
|
|
134002
|
-
|
|
134003
|
-
|
|
134011
|
+
this._checkForMissingMandatoryOptions();
|
|
134012
|
+
this._checkForConflictingOptions();
|
|
134013
|
+
let l2 = t3._executableFile || `${this._name}-${t3._name}`;
|
|
134014
|
+
let h2 = this._executableDir || "";
|
|
134015
|
+
if (this._scriptPath) {
|
|
134016
|
+
let t4;
|
|
134017
|
+
try {
|
|
134018
|
+
t4 = o.realpathSync(this._scriptPath);
|
|
134019
|
+
} catch (e4) {
|
|
134020
|
+
t4 = this._scriptPath;
|
|
134021
|
+
}
|
|
134022
|
+
h2 = r.resolve(r.dirname(t4), h2);
|
|
134004
134023
|
}
|
|
134005
|
-
|
|
134006
|
-
|
|
134007
|
-
|
|
134008
|
-
|
|
134009
|
-
|
|
134010
|
-
|
|
134011
|
-
u2 = `${c2}${e4}`;
|
|
134024
|
+
if (h2) {
|
|
134025
|
+
let e4 = findFile(h2, l2);
|
|
134026
|
+
if (!e4 && !t3._executableFile && this._scriptPath) {
|
|
134027
|
+
const i4 = r.basename(this._scriptPath, r.extname(this._scriptPath));
|
|
134028
|
+
if (i4 !== this._name) {
|
|
134029
|
+
e4 = findFile(h2, `${i4}-${t3._name}`);
|
|
134012
134030
|
}
|
|
134013
|
-
}
|
|
134031
|
+
}
|
|
134032
|
+
l2 = e4 || l2;
|
|
134014
134033
|
}
|
|
134015
|
-
i3 = n2.includes(r.extname(
|
|
134016
|
-
let
|
|
134017
|
-
if (
|
|
134034
|
+
i3 = n2.includes(r.extname(l2));
|
|
134035
|
+
let c2;
|
|
134036
|
+
if (a.platform !== "win32") {
|
|
134018
134037
|
if (i3) {
|
|
134019
|
-
|
|
134020
|
-
|
|
134021
|
-
|
|
134038
|
+
e3.unshift(l2);
|
|
134039
|
+
e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
|
|
134040
|
+
c2 = s.spawn(a.argv[0], e3, { stdio: "inherit" });
|
|
134022
134041
|
} else {
|
|
134023
|
-
|
|
134042
|
+
c2 = s.spawn(l2, e3, { stdio: "inherit" });
|
|
134024
134043
|
}
|
|
134025
134044
|
} else {
|
|
134026
|
-
|
|
134027
|
-
|
|
134028
|
-
|
|
134029
|
-
}
|
|
134030
|
-
|
|
134031
|
-
|
|
134032
|
-
|
|
134033
|
-
|
|
134034
|
-
|
|
134035
|
-
|
|
134045
|
+
e3.unshift(l2);
|
|
134046
|
+
e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
|
|
134047
|
+
c2 = s.spawn(a.execPath, e3, { stdio: "inherit" });
|
|
134048
|
+
}
|
|
134049
|
+
if (!c2.killed) {
|
|
134050
|
+
const t4 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
134051
|
+
t4.forEach((t5) => {
|
|
134052
|
+
a.on(t5, () => {
|
|
134053
|
+
if (c2.killed === false && c2.exitCode === null) {
|
|
134054
|
+
c2.kill(t5);
|
|
134055
|
+
}
|
|
134056
|
+
});
|
|
134036
134057
|
});
|
|
134037
|
-
}
|
|
134038
|
-
const
|
|
134039
|
-
if (!
|
|
134040
|
-
|
|
134058
|
+
}
|
|
134059
|
+
const p2 = this._exitCallback;
|
|
134060
|
+
if (!p2) {
|
|
134061
|
+
c2.on("close", a.exit.bind(a));
|
|
134041
134062
|
} else {
|
|
134042
|
-
|
|
134043
|
-
|
|
134063
|
+
c2.on("close", () => {
|
|
134064
|
+
p2(new u(a.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
|
|
134044
134065
|
});
|
|
134045
134066
|
}
|
|
134046
|
-
|
|
134047
|
-
if (
|
|
134048
|
-
const
|
|
134049
|
-
|
|
134050
|
-
- if
|
|
134051
|
-
|
|
134052
|
-
|
|
134053
|
-
throw new Error(
|
|
134054
|
-
}
|
|
134055
|
-
|
|
134056
|
-
|
|
134067
|
+
c2.on("error", (e4) => {
|
|
134068
|
+
if (e4.code === "ENOENT") {
|
|
134069
|
+
const e5 = h2 ? `searched for local subcommand relative to directory '${h2}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
134070
|
+
const i4 = `'${l2}' does not exist
|
|
134071
|
+
- if '${t3._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
134072
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
134073
|
+
- ${e5}`;
|
|
134074
|
+
throw new Error(i4);
|
|
134075
|
+
} else if (e4.code === "EACCES") {
|
|
134076
|
+
throw new Error(`'${l2}' not executable`);
|
|
134077
|
+
}
|
|
134078
|
+
if (!p2) {
|
|
134079
|
+
a.exit(1);
|
|
134057
134080
|
} else {
|
|
134058
|
-
const
|
|
134059
|
-
|
|
134060
|
-
|
|
134081
|
+
const t4 = new u(1, "commander.executeSubCommandAsync", "(error)");
|
|
134082
|
+
t4.nestedError = e4;
|
|
134083
|
+
p2(t4);
|
|
134061
134084
|
}
|
|
134062
134085
|
});
|
|
134063
|
-
this.runningCommand =
|
|
134086
|
+
this.runningCommand = c2;
|
|
134064
134087
|
}
|
|
134065
|
-
_dispatchSubcommand(
|
|
134066
|
-
const n2 = this._findCommand(
|
|
134088
|
+
_dispatchSubcommand(t3, e3, i3) {
|
|
134089
|
+
const n2 = this._findCommand(t3);
|
|
134067
134090
|
if (!n2)
|
|
134068
134091
|
this.help({ error: true });
|
|
134069
|
-
|
|
134070
|
-
|
|
134071
|
-
|
|
134072
|
-
|
|
134073
|
-
|
|
134092
|
+
let s2;
|
|
134093
|
+
s2 = this._chainOrCallSubCommandHook(s2, n2, "preSubcommand");
|
|
134094
|
+
s2 = this._chainOrCall(s2, () => {
|
|
134095
|
+
if (n2._executableHandler) {
|
|
134096
|
+
this._executeSubCommand(n2, e3.concat(i3));
|
|
134097
|
+
} else {
|
|
134098
|
+
return n2._parseCommand(e3, i3);
|
|
134099
|
+
}
|
|
134100
|
+
});
|
|
134101
|
+
return s2;
|
|
134074
134102
|
}
|
|
134075
134103
|
_checkNumberOfArguments() {
|
|
134076
|
-
this._args.forEach((
|
|
134077
|
-
if (
|
|
134078
|
-
this.missingArgument(
|
|
134104
|
+
this._args.forEach((t3, e3) => {
|
|
134105
|
+
if (t3.required && this.args[e3] == null) {
|
|
134106
|
+
this.missingArgument(t3.name());
|
|
134079
134107
|
}
|
|
134080
134108
|
});
|
|
134081
134109
|
if (this._args.length > 0 && this._args[this._args.length - 1].variadic) {
|
|
@@ -134086,15 +134114,15 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134086
134114
|
}
|
|
134087
134115
|
}
|
|
134088
134116
|
_processArguments() {
|
|
134089
|
-
const myParseArg = (
|
|
134090
|
-
let n2 =
|
|
134091
|
-
if (
|
|
134117
|
+
const myParseArg = (t4, e3, i3) => {
|
|
134118
|
+
let n2 = e3;
|
|
134119
|
+
if (e3 !== null && t4.parseArg) {
|
|
134092
134120
|
try {
|
|
134093
|
-
n2 =
|
|
134121
|
+
n2 = t4.parseArg(e3, i3);
|
|
134094
134122
|
} catch (i4) {
|
|
134095
134123
|
if (i4.code === "commander.invalidArgument") {
|
|
134096
|
-
const n3 = `error: command-argument value '${
|
|
134097
|
-
this.
|
|
134124
|
+
const n3 = `error: command-argument value '${e3}' is invalid for argument '${t4.name()}'. ${i4.message}`;
|
|
134125
|
+
this.error(n3, { exitCode: i4.exitCode, code: i4.code });
|
|
134098
134126
|
}
|
|
134099
134127
|
throw i4;
|
|
134100
134128
|
}
|
|
@@ -134102,74 +134130,85 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134102
134130
|
return n2;
|
|
134103
134131
|
};
|
|
134104
134132
|
this._checkNumberOfArguments();
|
|
134105
|
-
const
|
|
134106
|
-
this._args.forEach((
|
|
134107
|
-
let n2 =
|
|
134108
|
-
if (
|
|
134133
|
+
const t3 = [];
|
|
134134
|
+
this._args.forEach((e3, i3) => {
|
|
134135
|
+
let n2 = e3.defaultValue;
|
|
134136
|
+
if (e3.variadic) {
|
|
134109
134137
|
if (i3 < this.args.length) {
|
|
134110
134138
|
n2 = this.args.slice(i3);
|
|
134111
|
-
if (
|
|
134112
|
-
n2 = n2.reduce((
|
|
134139
|
+
if (e3.parseArg) {
|
|
134140
|
+
n2 = n2.reduce((t4, i4) => myParseArg(e3, i4, t4), e3.defaultValue);
|
|
134113
134141
|
}
|
|
134114
134142
|
} else if (n2 === void 0) {
|
|
134115
134143
|
n2 = [];
|
|
134116
134144
|
}
|
|
134117
134145
|
} else if (i3 < this.args.length) {
|
|
134118
134146
|
n2 = this.args[i3];
|
|
134119
|
-
if (
|
|
134120
|
-
n2 = myParseArg(
|
|
134147
|
+
if (e3.parseArg) {
|
|
134148
|
+
n2 = myParseArg(e3, n2, e3.defaultValue);
|
|
134121
134149
|
}
|
|
134122
134150
|
}
|
|
134123
|
-
|
|
134151
|
+
t3[i3] = n2;
|
|
134124
134152
|
});
|
|
134125
|
-
this.processedArgs =
|
|
134153
|
+
this.processedArgs = t3;
|
|
134126
134154
|
}
|
|
134127
|
-
_chainOrCall(
|
|
134128
|
-
if (
|
|
134129
|
-
return
|
|
134155
|
+
_chainOrCall(t3, e3) {
|
|
134156
|
+
if (t3 && t3.then && typeof t3.then === "function") {
|
|
134157
|
+
return t3.then(() => e3());
|
|
134130
134158
|
}
|
|
134131
|
-
return
|
|
134159
|
+
return e3();
|
|
134132
134160
|
}
|
|
134133
|
-
_chainOrCallHooks(
|
|
134134
|
-
let i3 =
|
|
134161
|
+
_chainOrCallHooks(t3, e3) {
|
|
134162
|
+
let i3 = t3;
|
|
134135
134163
|
const n2 = [];
|
|
134136
|
-
getCommandAndParents(this).reverse().filter((
|
|
134137
|
-
|
|
134138
|
-
n2.push({ hookedCommand:
|
|
134164
|
+
getCommandAndParents(this).reverse().filter((t4) => t4._lifeCycleHooks[e3] !== void 0).forEach((t4) => {
|
|
134165
|
+
t4._lifeCycleHooks[e3].forEach((e4) => {
|
|
134166
|
+
n2.push({ hookedCommand: t4, callback: e4 });
|
|
134139
134167
|
});
|
|
134140
134168
|
});
|
|
134141
|
-
if (
|
|
134169
|
+
if (e3 === "postAction") {
|
|
134142
134170
|
n2.reverse();
|
|
134143
134171
|
}
|
|
134144
|
-
n2.forEach((
|
|
134145
|
-
i3 = this._chainOrCall(i3, () =>
|
|
134172
|
+
n2.forEach((t4) => {
|
|
134173
|
+
i3 = this._chainOrCall(i3, () => t4.callback(t4.hookedCommand, this));
|
|
134146
134174
|
});
|
|
134147
134175
|
return i3;
|
|
134148
134176
|
}
|
|
134149
|
-
|
|
134150
|
-
|
|
134151
|
-
this.
|
|
134152
|
-
|
|
134153
|
-
|
|
134154
|
-
|
|
134155
|
-
if (e3 && this._findCommand(e3[0])) {
|
|
134156
|
-
return this._dispatchSubcommand(e3[0], e3.slice(1), t3);
|
|
134177
|
+
_chainOrCallSubCommandHook(t3, e3, i3) {
|
|
134178
|
+
let n2 = t3;
|
|
134179
|
+
if (this._lifeCycleHooks[i3] !== void 0) {
|
|
134180
|
+
this._lifeCycleHooks[i3].forEach((t4) => {
|
|
134181
|
+
n2 = this._chainOrCall(n2, () => t4(this, e3));
|
|
134182
|
+
});
|
|
134157
134183
|
}
|
|
134158
|
-
|
|
134159
|
-
|
|
134184
|
+
return n2;
|
|
134185
|
+
}
|
|
134186
|
+
_parseCommand(t3, e3) {
|
|
134187
|
+
const i3 = this.parseOptions(e3);
|
|
134188
|
+
this._parseOptionsEnv();
|
|
134189
|
+
this._parseOptionsImplied();
|
|
134190
|
+
t3 = t3.concat(i3.operands);
|
|
134191
|
+
e3 = i3.unknown;
|
|
134192
|
+
this.args = t3.concat(e3);
|
|
134193
|
+
if (t3 && this._findCommand(t3[0])) {
|
|
134194
|
+
return this._dispatchSubcommand(t3[0], t3.slice(1), e3);
|
|
134195
|
+
}
|
|
134196
|
+
if (this._hasImplicitHelpCommand() && t3[0] === this._helpCommandName) {
|
|
134197
|
+
if (t3.length === 1) {
|
|
134160
134198
|
this.help();
|
|
134161
134199
|
}
|
|
134162
|
-
return this._dispatchSubcommand(
|
|
134200
|
+
return this._dispatchSubcommand(t3[1], [], [this._helpLongFlag]);
|
|
134163
134201
|
}
|
|
134164
134202
|
if (this._defaultCommandName) {
|
|
134165
|
-
outputHelpIfRequested(this,
|
|
134166
|
-
return this._dispatchSubcommand(this._defaultCommandName,
|
|
134203
|
+
outputHelpIfRequested(this, e3);
|
|
134204
|
+
return this._dispatchSubcommand(this._defaultCommandName, t3, e3);
|
|
134167
134205
|
}
|
|
134168
134206
|
if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
|
|
134169
134207
|
this.help({ error: true });
|
|
134170
134208
|
}
|
|
134171
134209
|
outputHelpIfRequested(this, i3.unknown);
|
|
134172
134210
|
this._checkForMissingMandatoryOptions();
|
|
134211
|
+
this._checkForConflictingOptions();
|
|
134173
134212
|
const checkForUnknownOptions = () => {
|
|
134174
134213
|
if (i3.unknown.length > 0) {
|
|
134175
134214
|
this.unknownOption(i3.unknown[0]);
|
|
@@ -134182,21 +134221,24 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134182
134221
|
let i4;
|
|
134183
134222
|
i4 = this._chainOrCallHooks(i4, "preAction");
|
|
134184
134223
|
i4 = this._chainOrCall(i4, () => this._actionHandler(this.processedArgs));
|
|
134185
|
-
if (this.parent)
|
|
134186
|
-
this.
|
|
134224
|
+
if (this.parent) {
|
|
134225
|
+
i4 = this._chainOrCall(i4, () => {
|
|
134226
|
+
this.parent.emit(n2, t3, e3);
|
|
134227
|
+
});
|
|
134228
|
+
}
|
|
134187
134229
|
i4 = this._chainOrCallHooks(i4, "postAction");
|
|
134188
134230
|
return i4;
|
|
134189
134231
|
}
|
|
134190
134232
|
if (this.parent && this.parent.listenerCount(n2)) {
|
|
134191
134233
|
checkForUnknownOptions();
|
|
134192
134234
|
this._processArguments();
|
|
134193
|
-
this.parent.emit(n2,
|
|
134194
|
-
} else if (
|
|
134235
|
+
this.parent.emit(n2, t3, e3);
|
|
134236
|
+
} else if (t3.length) {
|
|
134195
134237
|
if (this._findCommand("*")) {
|
|
134196
|
-
return this._dispatchSubcommand("*",
|
|
134238
|
+
return this._dispatchSubcommand("*", t3, e3);
|
|
134197
134239
|
}
|
|
134198
134240
|
if (this.listenerCount("command:*")) {
|
|
134199
|
-
this.emit("command:*",
|
|
134241
|
+
this.emit("command:*", t3, e3);
|
|
134200
134242
|
} else if (this.commands.length) {
|
|
134201
134243
|
this.unknownCommand();
|
|
134202
134244
|
} else {
|
|
@@ -134211,131 +134253,155 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134211
134253
|
this._processArguments();
|
|
134212
134254
|
}
|
|
134213
134255
|
}
|
|
134214
|
-
_findCommand(
|
|
134215
|
-
if (!
|
|
134256
|
+
_findCommand(t3) {
|
|
134257
|
+
if (!t3)
|
|
134216
134258
|
return void 0;
|
|
134217
|
-
return this.commands.find((
|
|
134259
|
+
return this.commands.find((e3) => e3._name === t3 || e3._aliases.includes(t3));
|
|
134218
134260
|
}
|
|
134219
|
-
_findOption(
|
|
134220
|
-
return this.options.find((
|
|
134261
|
+
_findOption(t3) {
|
|
134262
|
+
return this.options.find((e3) => e3.is(t3));
|
|
134221
134263
|
}
|
|
134222
134264
|
_checkForMissingMandatoryOptions() {
|
|
134223
|
-
for (let
|
|
134224
|
-
|
|
134225
|
-
if (
|
|
134226
|
-
|
|
134265
|
+
for (let t3 = this; t3; t3 = t3.parent) {
|
|
134266
|
+
t3.options.forEach((e3) => {
|
|
134267
|
+
if (e3.mandatory && t3.getOptionValue(e3.attributeName()) === void 0) {
|
|
134268
|
+
t3.missingMandatoryOptionValue(e3);
|
|
134227
134269
|
}
|
|
134228
134270
|
});
|
|
134229
134271
|
}
|
|
134230
134272
|
}
|
|
134231
|
-
|
|
134232
|
-
const t3 =
|
|
134273
|
+
_checkForConflictingLocalOptions() {
|
|
134274
|
+
const t3 = this.options.filter((t4) => {
|
|
134275
|
+
const e4 = t4.attributeName();
|
|
134276
|
+
if (this.getOptionValue(e4) === void 0) {
|
|
134277
|
+
return false;
|
|
134278
|
+
}
|
|
134279
|
+
return this.getOptionValueSource(e4) !== "default";
|
|
134280
|
+
});
|
|
134281
|
+
const e3 = t3.filter((t4) => t4.conflictsWith.length > 0);
|
|
134282
|
+
e3.forEach((e4) => {
|
|
134283
|
+
const i3 = t3.find((t4) => e4.conflictsWith.includes(t4.attributeName()));
|
|
134284
|
+
if (i3) {
|
|
134285
|
+
this._conflictingOption(e4, i3);
|
|
134286
|
+
}
|
|
134287
|
+
});
|
|
134288
|
+
}
|
|
134289
|
+
_checkForConflictingOptions() {
|
|
134290
|
+
for (let t3 = this; t3; t3 = t3.parent) {
|
|
134291
|
+
t3._checkForConflictingLocalOptions();
|
|
134292
|
+
}
|
|
134293
|
+
}
|
|
134294
|
+
parseOptions(t3) {
|
|
134295
|
+
const e3 = [];
|
|
134233
134296
|
const i3 = [];
|
|
134234
|
-
let n2 =
|
|
134235
|
-
const s2 =
|
|
134236
|
-
function maybeOption(
|
|
134237
|
-
return
|
|
134297
|
+
let n2 = e3;
|
|
134298
|
+
const s2 = t3.slice();
|
|
134299
|
+
function maybeOption(t4) {
|
|
134300
|
+
return t4.length > 1 && t4[0] === "-";
|
|
134238
134301
|
}
|
|
134239
134302
|
let r2 = null;
|
|
134240
134303
|
while (s2.length) {
|
|
134241
|
-
const
|
|
134242
|
-
if (
|
|
134304
|
+
const t4 = s2.shift();
|
|
134305
|
+
if (t4 === "--") {
|
|
134243
134306
|
if (n2 === i3)
|
|
134244
|
-
n2.push(
|
|
134307
|
+
n2.push(t4);
|
|
134245
134308
|
n2.push(...s2);
|
|
134246
134309
|
break;
|
|
134247
134310
|
}
|
|
134248
|
-
if (r2 && !maybeOption(
|
|
134249
|
-
this.emit(`option:${r2.name()}`,
|
|
134311
|
+
if (r2 && !maybeOption(t4)) {
|
|
134312
|
+
this.emit(`option:${r2.name()}`, t4);
|
|
134250
134313
|
continue;
|
|
134251
134314
|
}
|
|
134252
134315
|
r2 = null;
|
|
134253
|
-
if (maybeOption(
|
|
134254
|
-
const
|
|
134255
|
-
if (
|
|
134256
|
-
if (
|
|
134257
|
-
const
|
|
134258
|
-
if (
|
|
134259
|
-
this.optionMissingArgument(
|
|
134260
|
-
this.emit(`option:${
|
|
134261
|
-
} else if (
|
|
134262
|
-
let
|
|
134316
|
+
if (maybeOption(t4)) {
|
|
134317
|
+
const e4 = this._findOption(t4);
|
|
134318
|
+
if (e4) {
|
|
134319
|
+
if (e4.required) {
|
|
134320
|
+
const t5 = s2.shift();
|
|
134321
|
+
if (t5 === void 0)
|
|
134322
|
+
this.optionMissingArgument(e4);
|
|
134323
|
+
this.emit(`option:${e4.name()}`, t5);
|
|
134324
|
+
} else if (e4.optional) {
|
|
134325
|
+
let t5 = null;
|
|
134263
134326
|
if (s2.length > 0 && !maybeOption(s2[0])) {
|
|
134264
|
-
|
|
134327
|
+
t5 = s2.shift();
|
|
134265
134328
|
}
|
|
134266
|
-
this.emit(`option:${
|
|
134329
|
+
this.emit(`option:${e4.name()}`, t5);
|
|
134267
134330
|
} else {
|
|
134268
|
-
this.emit(`option:${
|
|
134331
|
+
this.emit(`option:${e4.name()}`);
|
|
134269
134332
|
}
|
|
134270
|
-
r2 =
|
|
134333
|
+
r2 = e4.variadic ? e4 : null;
|
|
134271
134334
|
continue;
|
|
134272
134335
|
}
|
|
134273
134336
|
}
|
|
134274
|
-
if (
|
|
134275
|
-
const
|
|
134276
|
-
if (
|
|
134277
|
-
if (
|
|
134278
|
-
this.emit(`option:${
|
|
134337
|
+
if (t4.length > 2 && t4[0] === "-" && t4[1] !== "-") {
|
|
134338
|
+
const e4 = this._findOption(`-${t4[1]}`);
|
|
134339
|
+
if (e4) {
|
|
134340
|
+
if (e4.required || e4.optional && this._combineFlagAndOptionalValue) {
|
|
134341
|
+
this.emit(`option:${e4.name()}`, t4.slice(2));
|
|
134279
134342
|
} else {
|
|
134280
|
-
this.emit(`option:${
|
|
134281
|
-
s2.unshift(`-${
|
|
134343
|
+
this.emit(`option:${e4.name()}`);
|
|
134344
|
+
s2.unshift(`-${t4.slice(2)}`);
|
|
134282
134345
|
}
|
|
134283
134346
|
continue;
|
|
134284
134347
|
}
|
|
134285
134348
|
}
|
|
134286
|
-
if (/^--[^=]+=/.test(
|
|
134287
|
-
const
|
|
134288
|
-
const i4 = this._findOption(
|
|
134349
|
+
if (/^--[^=]+=/.test(t4)) {
|
|
134350
|
+
const e4 = t4.indexOf("=");
|
|
134351
|
+
const i4 = this._findOption(t4.slice(0, e4));
|
|
134289
134352
|
if (i4 && (i4.required || i4.optional)) {
|
|
134290
|
-
this.emit(`option:${i4.name()}`,
|
|
134353
|
+
this.emit(`option:${i4.name()}`, t4.slice(e4 + 1));
|
|
134291
134354
|
continue;
|
|
134292
134355
|
}
|
|
134293
134356
|
}
|
|
134294
|
-
if (maybeOption(
|
|
134357
|
+
if (maybeOption(t4)) {
|
|
134295
134358
|
n2 = i3;
|
|
134296
134359
|
}
|
|
134297
|
-
if ((this._enablePositionalOptions || this._passThroughOptions) &&
|
|
134298
|
-
if (this._findCommand(
|
|
134299
|
-
|
|
134360
|
+
if ((this._enablePositionalOptions || this._passThroughOptions) && e3.length === 0 && i3.length === 0) {
|
|
134361
|
+
if (this._findCommand(t4)) {
|
|
134362
|
+
e3.push(t4);
|
|
134300
134363
|
if (s2.length > 0)
|
|
134301
134364
|
i3.push(...s2);
|
|
134302
134365
|
break;
|
|
134303
|
-
} else if (
|
|
134304
|
-
|
|
134366
|
+
} else if (t4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
|
|
134367
|
+
e3.push(t4);
|
|
134305
134368
|
if (s2.length > 0)
|
|
134306
|
-
|
|
134369
|
+
e3.push(...s2);
|
|
134307
134370
|
break;
|
|
134308
134371
|
} else if (this._defaultCommandName) {
|
|
134309
|
-
i3.push(
|
|
134372
|
+
i3.push(t4);
|
|
134310
134373
|
if (s2.length > 0)
|
|
134311
134374
|
i3.push(...s2);
|
|
134312
134375
|
break;
|
|
134313
134376
|
}
|
|
134314
134377
|
}
|
|
134315
134378
|
if (this._passThroughOptions) {
|
|
134316
|
-
n2.push(
|
|
134379
|
+
n2.push(t4);
|
|
134317
134380
|
if (s2.length > 0)
|
|
134318
134381
|
n2.push(...s2);
|
|
134319
134382
|
break;
|
|
134320
134383
|
}
|
|
134321
|
-
n2.push(
|
|
134384
|
+
n2.push(t4);
|
|
134322
134385
|
}
|
|
134323
|
-
return { operands:
|
|
134386
|
+
return { operands: e3, unknown: i3 };
|
|
134324
134387
|
}
|
|
134325
134388
|
opts() {
|
|
134326
134389
|
if (this._storeOptionsAsProperties) {
|
|
134327
|
-
const
|
|
134328
|
-
const
|
|
134329
|
-
for (let i3 = 0; i3 <
|
|
134330
|
-
const
|
|
134331
|
-
|
|
134390
|
+
const t3 = {};
|
|
134391
|
+
const e3 = this.options.length;
|
|
134392
|
+
for (let i3 = 0; i3 < e3; i3++) {
|
|
134393
|
+
const e4 = this.options[i3].attributeName();
|
|
134394
|
+
t3[e4] = e4 === this._versionOptionName ? this._version : this[e4];
|
|
134332
134395
|
}
|
|
134333
|
-
return
|
|
134396
|
+
return t3;
|
|
134334
134397
|
}
|
|
134335
134398
|
return this._optionValues;
|
|
134336
134399
|
}
|
|
134337
|
-
|
|
134338
|
-
this.
|
|
134400
|
+
optsWithGlobals() {
|
|
134401
|
+
return getCommandAndParents(this).reduce((t3, e3) => Object.assign(t3, e3.opts()), {});
|
|
134402
|
+
}
|
|
134403
|
+
error(t3, e3) {
|
|
134404
|
+
this._outputConfiguration.outputError(`${t3}
|
|
134339
134405
|
`, this._outputConfiguration.writeErr);
|
|
134340
134406
|
if (typeof this._showHelpAfterError === "string") {
|
|
134341
134407
|
this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
@@ -134344,166 +134410,217 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134344
134410
|
this._outputConfiguration.writeErr("\n");
|
|
134345
134411
|
this.outputHelp({ error: true });
|
|
134346
134412
|
}
|
|
134347
|
-
|
|
134413
|
+
const i3 = e3 || {};
|
|
134414
|
+
const n2 = i3.exitCode || 1;
|
|
134415
|
+
const s2 = i3.code || "commander.error";
|
|
134416
|
+
this._exit(n2, s2, t3);
|
|
134348
134417
|
}
|
|
134349
134418
|
_parseOptionsEnv() {
|
|
134350
|
-
this.options.forEach((
|
|
134351
|
-
if (
|
|
134352
|
-
const
|
|
134353
|
-
if (this.getOptionValue(
|
|
134354
|
-
if (
|
|
134355
|
-
this.emit(`optionEnv:${
|
|
134419
|
+
this.options.forEach((t3) => {
|
|
134420
|
+
if (t3.envVar && t3.envVar in a.env) {
|
|
134421
|
+
const e3 = t3.attributeName();
|
|
134422
|
+
if (this.getOptionValue(e3) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(e3))) {
|
|
134423
|
+
if (t3.required || t3.optional) {
|
|
134424
|
+
this.emit(`optionEnv:${t3.name()}`, a.env[t3.envVar]);
|
|
134356
134425
|
} else {
|
|
134357
|
-
this.emit(`optionEnv:${
|
|
134426
|
+
this.emit(`optionEnv:${t3.name()}`);
|
|
134358
134427
|
}
|
|
134359
134428
|
}
|
|
134360
134429
|
}
|
|
134361
134430
|
});
|
|
134362
134431
|
}
|
|
134363
|
-
|
|
134364
|
-
const t3 =
|
|
134365
|
-
this.
|
|
134366
|
-
|
|
134367
|
-
|
|
134368
|
-
|
|
134369
|
-
|
|
134432
|
+
_parseOptionsImplied() {
|
|
134433
|
+
const t3 = new d(this.options);
|
|
134434
|
+
const hasCustomOptionValue = (t4) => this.getOptionValue(t4) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(t4));
|
|
134435
|
+
this.options.filter((e3) => e3.implied !== void 0 && hasCustomOptionValue(e3.attributeName()) && t3.valueFromOption(this.getOptionValue(e3.attributeName()), e3)).forEach((t4) => {
|
|
134436
|
+
Object.keys(t4.implied).filter((t5) => !hasCustomOptionValue(t5)).forEach((e3) => {
|
|
134437
|
+
this.setOptionValueWithSource(e3, t4.implied[e3], "implied");
|
|
134438
|
+
});
|
|
134439
|
+
});
|
|
134370
134440
|
}
|
|
134371
|
-
|
|
134372
|
-
const
|
|
134373
|
-
this.
|
|
134441
|
+
missingArgument(t3) {
|
|
134442
|
+
const e3 = `error: missing required argument '${t3}'`;
|
|
134443
|
+
this.error(e3, { code: "commander.missingArgument" });
|
|
134444
|
+
}
|
|
134445
|
+
optionMissingArgument(t3) {
|
|
134446
|
+
const e3 = `error: option '${t3.flags}' argument missing`;
|
|
134447
|
+
this.error(e3, { code: "commander.optionMissingArgument" });
|
|
134448
|
+
}
|
|
134449
|
+
missingMandatoryOptionValue(t3) {
|
|
134450
|
+
const e3 = `error: required option '${t3.flags}' not specified`;
|
|
134451
|
+
this.error(e3, { code: "commander.missingMandatoryOptionValue" });
|
|
134452
|
+
}
|
|
134453
|
+
_conflictingOption(t3, e3) {
|
|
134454
|
+
const findBestOptionFromValue = (t4) => {
|
|
134455
|
+
const e4 = t4.attributeName();
|
|
134456
|
+
const i4 = this.getOptionValue(e4);
|
|
134457
|
+
const n2 = this.options.find((t5) => t5.negate && e4 === t5.attributeName());
|
|
134458
|
+
const s2 = this.options.find((t5) => !t5.negate && e4 === t5.attributeName());
|
|
134459
|
+
if (n2 && (n2.presetArg === void 0 && i4 === false || n2.presetArg !== void 0 && i4 === n2.presetArg)) {
|
|
134460
|
+
return n2;
|
|
134461
|
+
}
|
|
134462
|
+
return s2 || t4;
|
|
134463
|
+
};
|
|
134464
|
+
const getErrorMessage = (t4) => {
|
|
134465
|
+
const e4 = findBestOptionFromValue(t4);
|
|
134466
|
+
const i4 = e4.attributeName();
|
|
134467
|
+
const n2 = this.getOptionValueSource(i4);
|
|
134468
|
+
if (n2 === "env") {
|
|
134469
|
+
return `environment variable '${e4.envVar}'`;
|
|
134470
|
+
}
|
|
134471
|
+
return `option '${e4.flags}'`;
|
|
134472
|
+
};
|
|
134473
|
+
const i3 = `error: ${getErrorMessage(t3)} cannot be used with ${getErrorMessage(e3)}`;
|
|
134474
|
+
this.error(i3, { code: "commander.conflictingOption" });
|
|
134374
134475
|
}
|
|
134375
|
-
unknownOption(
|
|
134476
|
+
unknownOption(t3) {
|
|
134376
134477
|
if (this._allowUnknownOption)
|
|
134377
134478
|
return;
|
|
134378
|
-
let
|
|
134379
|
-
if (
|
|
134479
|
+
let e3 = "";
|
|
134480
|
+
if (t3.startsWith("--") && this._showSuggestionAfterError) {
|
|
134380
134481
|
let i4 = [];
|
|
134381
134482
|
let n2 = this;
|
|
134382
134483
|
do {
|
|
134383
|
-
const
|
|
134384
|
-
i4 = i4.concat(
|
|
134484
|
+
const t4 = n2.createHelp().visibleOptions(n2).filter((t5) => t5.long).map((t5) => t5.long);
|
|
134485
|
+
i4 = i4.concat(t4);
|
|
134385
134486
|
n2 = n2.parent;
|
|
134386
134487
|
} while (n2 && !n2._enablePositionalOptions);
|
|
134387
|
-
|
|
134488
|
+
e3 = f(t3, i4);
|
|
134388
134489
|
}
|
|
134389
|
-
const i3 = `error: unknown option '${
|
|
134390
|
-
this.
|
|
134490
|
+
const i3 = `error: unknown option '${t3}'${e3}`;
|
|
134491
|
+
this.error(i3, { code: "commander.unknownOption" });
|
|
134391
134492
|
}
|
|
134392
|
-
_excessArguments(
|
|
134493
|
+
_excessArguments(t3) {
|
|
134393
134494
|
if (this._allowExcessArguments)
|
|
134394
134495
|
return;
|
|
134395
|
-
const
|
|
134396
|
-
const i3 =
|
|
134496
|
+
const e3 = this._args.length;
|
|
134497
|
+
const i3 = e3 === 1 ? "" : "s";
|
|
134397
134498
|
const n2 = this.parent ? ` for '${this.name()}'` : "";
|
|
134398
|
-
const s2 = `error: too many arguments${n2}. Expected ${
|
|
134399
|
-
this.
|
|
134499
|
+
const s2 = `error: too many arguments${n2}. Expected ${e3} argument${i3} but got ${t3.length}.`;
|
|
134500
|
+
this.error(s2, { code: "commander.excessArguments" });
|
|
134400
134501
|
}
|
|
134401
134502
|
unknownCommand() {
|
|
134402
|
-
const
|
|
134403
|
-
let
|
|
134503
|
+
const t3 = this.args[0];
|
|
134504
|
+
let e3 = "";
|
|
134404
134505
|
if (this._showSuggestionAfterError) {
|
|
134405
134506
|
const i4 = [];
|
|
134406
|
-
this.createHelp().visibleCommands(this).forEach((
|
|
134407
|
-
i4.push(
|
|
134408
|
-
if (
|
|
134409
|
-
i4.push(
|
|
134507
|
+
this.createHelp().visibleCommands(this).forEach((t4) => {
|
|
134508
|
+
i4.push(t4.name());
|
|
134509
|
+
if (t4.alias())
|
|
134510
|
+
i4.push(t4.alias());
|
|
134410
134511
|
});
|
|
134411
|
-
|
|
134512
|
+
e3 = f(t3, i4);
|
|
134412
134513
|
}
|
|
134413
|
-
const i3 = `error: unknown command '${
|
|
134414
|
-
this.
|
|
134514
|
+
const i3 = `error: unknown command '${t3}'${e3}`;
|
|
134515
|
+
this.error(i3, { code: "commander.unknownCommand" });
|
|
134415
134516
|
}
|
|
134416
|
-
version(
|
|
134417
|
-
if (
|
|
134517
|
+
version(t3, e3, i3) {
|
|
134518
|
+
if (t3 === void 0)
|
|
134418
134519
|
return this._version;
|
|
134419
|
-
this._version =
|
|
134420
|
-
|
|
134520
|
+
this._version = t3;
|
|
134521
|
+
e3 = e3 || "-V, --version";
|
|
134421
134522
|
i3 = i3 || "output the version number";
|
|
134422
|
-
const n2 = this.createOption(
|
|
134523
|
+
const n2 = this.createOption(e3, i3);
|
|
134423
134524
|
this._versionOptionName = n2.attributeName();
|
|
134424
134525
|
this.options.push(n2);
|
|
134425
134526
|
this.on("option:" + n2.name(), () => {
|
|
134426
|
-
this._outputConfiguration.writeOut(`${
|
|
134527
|
+
this._outputConfiguration.writeOut(`${t3}
|
|
134427
134528
|
`);
|
|
134428
|
-
this._exit(0, "commander.version",
|
|
134529
|
+
this._exit(0, "commander.version", t3);
|
|
134429
134530
|
});
|
|
134430
134531
|
return this;
|
|
134431
134532
|
}
|
|
134432
|
-
description(
|
|
134433
|
-
if (
|
|
134533
|
+
description(t3, e3) {
|
|
134534
|
+
if (t3 === void 0 && e3 === void 0)
|
|
134434
134535
|
return this._description;
|
|
134435
|
-
this._description =
|
|
134436
|
-
if (
|
|
134437
|
-
this._argsDescription =
|
|
134536
|
+
this._description = t3;
|
|
134537
|
+
if (e3) {
|
|
134538
|
+
this._argsDescription = e3;
|
|
134438
134539
|
}
|
|
134439
134540
|
return this;
|
|
134440
134541
|
}
|
|
134441
|
-
|
|
134442
|
-
if (
|
|
134542
|
+
summary(t3) {
|
|
134543
|
+
if (t3 === void 0)
|
|
134544
|
+
return this._summary;
|
|
134545
|
+
this._summary = t3;
|
|
134546
|
+
return this;
|
|
134547
|
+
}
|
|
134548
|
+
alias(t3) {
|
|
134549
|
+
if (t3 === void 0)
|
|
134443
134550
|
return this._aliases[0];
|
|
134444
|
-
let
|
|
134551
|
+
let e3 = this;
|
|
134445
134552
|
if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
|
|
134446
|
-
|
|
134553
|
+
e3 = this.commands[this.commands.length - 1];
|
|
134447
134554
|
}
|
|
134448
|
-
if (
|
|
134555
|
+
if (t3 === e3._name)
|
|
134449
134556
|
throw new Error("Command alias can't be the same as its name");
|
|
134450
|
-
|
|
134557
|
+
e3._aliases.push(t3);
|
|
134451
134558
|
return this;
|
|
134452
134559
|
}
|
|
134453
|
-
aliases(
|
|
134454
|
-
if (
|
|
134560
|
+
aliases(t3) {
|
|
134561
|
+
if (t3 === void 0)
|
|
134455
134562
|
return this._aliases;
|
|
134456
|
-
|
|
134563
|
+
t3.forEach((t4) => this.alias(t4));
|
|
134457
134564
|
return this;
|
|
134458
134565
|
}
|
|
134459
|
-
usage(
|
|
134460
|
-
if (
|
|
134566
|
+
usage(t3) {
|
|
134567
|
+
if (t3 === void 0) {
|
|
134461
134568
|
if (this._usage)
|
|
134462
134569
|
return this._usage;
|
|
134463
|
-
const
|
|
134464
|
-
return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ?
|
|
134570
|
+
const t4 = this._args.map((t5) => h(t5));
|
|
134571
|
+
return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? t4 : []).join(" ");
|
|
134465
134572
|
}
|
|
134466
|
-
this._usage =
|
|
134573
|
+
this._usage = t3;
|
|
134467
134574
|
return this;
|
|
134468
134575
|
}
|
|
134469
|
-
name(
|
|
134470
|
-
if (
|
|
134576
|
+
name(t3) {
|
|
134577
|
+
if (t3 === void 0)
|
|
134471
134578
|
return this._name;
|
|
134472
|
-
this._name =
|
|
134579
|
+
this._name = t3;
|
|
134473
134580
|
return this;
|
|
134474
134581
|
}
|
|
134475
|
-
|
|
134476
|
-
|
|
134477
|
-
|
|
134478
|
-
|
|
134582
|
+
nameFromFilename(t3) {
|
|
134583
|
+
this._name = r.basename(t3, r.extname(t3));
|
|
134584
|
+
return this;
|
|
134585
|
+
}
|
|
134586
|
+
executableDir(t3) {
|
|
134587
|
+
if (t3 === void 0)
|
|
134588
|
+
return this._executableDir;
|
|
134589
|
+
this._executableDir = t3;
|
|
134590
|
+
return this;
|
|
134591
|
+
}
|
|
134592
|
+
helpInformation(t3) {
|
|
134593
|
+
const e3 = this.createHelp();
|
|
134594
|
+
if (e3.helpWidth === void 0) {
|
|
134595
|
+
e3.helpWidth = t3 && t3.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
|
|
134479
134596
|
}
|
|
134480
|
-
return
|
|
134597
|
+
return e3.formatHelp(this, e3);
|
|
134481
134598
|
}
|
|
134482
|
-
_getHelpContext(
|
|
134483
|
-
|
|
134484
|
-
const
|
|
134599
|
+
_getHelpContext(t3) {
|
|
134600
|
+
t3 = t3 || {};
|
|
134601
|
+
const e3 = { error: !!t3.error };
|
|
134485
134602
|
let i3;
|
|
134486
|
-
if (
|
|
134487
|
-
i3 = (
|
|
134603
|
+
if (e3.error) {
|
|
134604
|
+
i3 = (t4) => this._outputConfiguration.writeErr(t4);
|
|
134488
134605
|
} else {
|
|
134489
|
-
i3 = (
|
|
134606
|
+
i3 = (t4) => this._outputConfiguration.writeOut(t4);
|
|
134490
134607
|
}
|
|
134491
|
-
|
|
134492
|
-
|
|
134493
|
-
return
|
|
134608
|
+
e3.write = t3.write || i3;
|
|
134609
|
+
e3.command = this;
|
|
134610
|
+
return e3;
|
|
134494
134611
|
}
|
|
134495
|
-
outputHelp(
|
|
134496
|
-
let
|
|
134497
|
-
if (typeof
|
|
134498
|
-
|
|
134499
|
-
|
|
134612
|
+
outputHelp(t3) {
|
|
134613
|
+
let e3;
|
|
134614
|
+
if (typeof t3 === "function") {
|
|
134615
|
+
e3 = t3;
|
|
134616
|
+
t3 = void 0;
|
|
134500
134617
|
}
|
|
134501
|
-
const i3 = this._getHelpContext(
|
|
134502
|
-
getCommandAndParents(this).reverse().forEach((
|
|
134618
|
+
const i3 = this._getHelpContext(t3);
|
|
134619
|
+
getCommandAndParents(this).reverse().forEach((t4) => t4.emit("beforeAllHelp", i3));
|
|
134503
134620
|
this.emit("beforeHelp", i3);
|
|
134504
134621
|
let n2 = this.helpInformation(i3);
|
|
134505
|
-
if (
|
|
134506
|
-
n2 =
|
|
134622
|
+
if (e3) {
|
|
134623
|
+
n2 = e3(n2);
|
|
134507
134624
|
if (typeof n2 !== "string" && !Buffer.isBuffer(n2)) {
|
|
134508
134625
|
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
134509
134626
|
}
|
|
@@ -134511,306 +134628,342 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134511
134628
|
i3.write(n2);
|
|
134512
134629
|
this.emit(this._helpLongFlag);
|
|
134513
134630
|
this.emit("afterHelp", i3);
|
|
134514
|
-
getCommandAndParents(this).forEach((
|
|
134631
|
+
getCommandAndParents(this).forEach((t4) => t4.emit("afterAllHelp", i3));
|
|
134515
134632
|
}
|
|
134516
|
-
helpOption(
|
|
134517
|
-
if (typeof
|
|
134518
|
-
this._hasHelpOption =
|
|
134633
|
+
helpOption(t3, e3) {
|
|
134634
|
+
if (typeof t3 === "boolean") {
|
|
134635
|
+
this._hasHelpOption = t3;
|
|
134519
134636
|
return this;
|
|
134520
134637
|
}
|
|
134521
|
-
this._helpFlags =
|
|
134522
|
-
this._helpDescription =
|
|
134523
|
-
const i3 =
|
|
134638
|
+
this._helpFlags = t3 || this._helpFlags;
|
|
134639
|
+
this._helpDescription = e3 || this._helpDescription;
|
|
134640
|
+
const i3 = m(this._helpFlags);
|
|
134524
134641
|
this._helpShortFlag = i3.shortFlag;
|
|
134525
134642
|
this._helpLongFlag = i3.longFlag;
|
|
134526
134643
|
return this;
|
|
134527
134644
|
}
|
|
134528
|
-
help(
|
|
134529
|
-
this.outputHelp(
|
|
134530
|
-
let
|
|
134531
|
-
if (
|
|
134532
|
-
|
|
134645
|
+
help(t3) {
|
|
134646
|
+
this.outputHelp(t3);
|
|
134647
|
+
let e3 = a.exitCode || 0;
|
|
134648
|
+
if (e3 === 0 && t3 && typeof t3 !== "function" && t3.error) {
|
|
134649
|
+
e3 = 1;
|
|
134533
134650
|
}
|
|
134534
|
-
this._exit(
|
|
134651
|
+
this._exit(e3, "commander.help", "(outputHelp)");
|
|
134535
134652
|
}
|
|
134536
|
-
addHelpText(
|
|
134653
|
+
addHelpText(t3, e3) {
|
|
134537
134654
|
const i3 = ["beforeAll", "before", "after", "afterAll"];
|
|
134538
|
-
if (!i3.includes(
|
|
134655
|
+
if (!i3.includes(t3)) {
|
|
134539
134656
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
134540
134657
|
Expecting one of '${i3.join("', '")}'`);
|
|
134541
134658
|
}
|
|
134542
|
-
const n2 = `${
|
|
134543
|
-
this.on(n2, (
|
|
134659
|
+
const n2 = `${t3}Help`;
|
|
134660
|
+
this.on(n2, (t4) => {
|
|
134544
134661
|
let i4;
|
|
134545
|
-
if (typeof
|
|
134546
|
-
i4 =
|
|
134662
|
+
if (typeof e3 === "function") {
|
|
134663
|
+
i4 = e3({ error: t4.error, command: t4.command });
|
|
134547
134664
|
} else {
|
|
134548
|
-
i4 =
|
|
134665
|
+
i4 = e3;
|
|
134549
134666
|
}
|
|
134550
134667
|
if (i4) {
|
|
134551
|
-
|
|
134668
|
+
t4.write(`${i4}
|
|
134552
134669
|
`);
|
|
134553
134670
|
}
|
|
134554
134671
|
});
|
|
134555
134672
|
return this;
|
|
134556
134673
|
}
|
|
134557
134674
|
}
|
|
134558
|
-
function outputHelpIfRequested(
|
|
134559
|
-
const i3 =
|
|
134675
|
+
function outputHelpIfRequested(t3, e3) {
|
|
134676
|
+
const i3 = t3._hasHelpOption && e3.find((e4) => e4 === t3._helpLongFlag || e4 === t3._helpShortFlag);
|
|
134560
134677
|
if (i3) {
|
|
134561
|
-
|
|
134562
|
-
|
|
134678
|
+
t3.outputHelp();
|
|
134679
|
+
t3._exit(0, "commander.helpDisplayed", "(outputHelp)");
|
|
134563
134680
|
}
|
|
134564
134681
|
}
|
|
134565
|
-
function incrementNodeInspectorPort(
|
|
134566
|
-
return
|
|
134567
|
-
if (!
|
|
134568
|
-
return
|
|
134682
|
+
function incrementNodeInspectorPort(t3) {
|
|
134683
|
+
return t3.map((t4) => {
|
|
134684
|
+
if (!t4.startsWith("--inspect")) {
|
|
134685
|
+
return t4;
|
|
134569
134686
|
}
|
|
134570
|
-
let
|
|
134687
|
+
let e3;
|
|
134571
134688
|
let i3 = "127.0.0.1";
|
|
134572
134689
|
let n2 = "9229";
|
|
134573
134690
|
let s2;
|
|
134574
|
-
if ((s2 =
|
|
134575
|
-
|
|
134576
|
-
} else if ((s2 =
|
|
134577
|
-
|
|
134691
|
+
if ((s2 = t4.match(/^(--inspect(-brk)?)$/)) !== null) {
|
|
134692
|
+
e3 = s2[1];
|
|
134693
|
+
} else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
|
134694
|
+
e3 = s2[1];
|
|
134578
134695
|
if (/^\d+$/.test(s2[3])) {
|
|
134579
134696
|
n2 = s2[3];
|
|
134580
134697
|
} else {
|
|
134581
134698
|
i3 = s2[3];
|
|
134582
134699
|
}
|
|
134583
|
-
} else if ((s2 =
|
|
134584
|
-
|
|
134700
|
+
} else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
|
134701
|
+
e3 = s2[1];
|
|
134585
134702
|
i3 = s2[3];
|
|
134586
134703
|
n2 = s2[4];
|
|
134587
134704
|
}
|
|
134588
|
-
if (
|
|
134589
|
-
return `${
|
|
134705
|
+
if (e3 && n2 !== "0") {
|
|
134706
|
+
return `${e3}=${i3}:${parseInt(n2) + 1}`;
|
|
134590
134707
|
}
|
|
134591
|
-
return
|
|
134708
|
+
return t4;
|
|
134592
134709
|
});
|
|
134593
134710
|
}
|
|
134594
|
-
function getCommandAndParents(
|
|
134595
|
-
const
|
|
134596
|
-
for (let i3 =
|
|
134597
|
-
|
|
134711
|
+
function getCommandAndParents(t3) {
|
|
134712
|
+
const e3 = [];
|
|
134713
|
+
for (let i3 = t3; i3; i3 = i3.parent) {
|
|
134714
|
+
e3.push(i3);
|
|
134598
134715
|
}
|
|
134599
|
-
return
|
|
134716
|
+
return e3;
|
|
134600
134717
|
}
|
|
134601
|
-
|
|
134602
|
-
},
|
|
134718
|
+
e2.Command = Command2;
|
|
134719
|
+
}, 796: (t2, e2) => {
|
|
134603
134720
|
class CommanderError extends Error {
|
|
134604
|
-
constructor(
|
|
134721
|
+
constructor(t3, e3, i2) {
|
|
134605
134722
|
super(i2);
|
|
134606
134723
|
Error.captureStackTrace(this, this.constructor);
|
|
134607
134724
|
this.name = this.constructor.name;
|
|
134608
|
-
this.code =
|
|
134609
|
-
this.exitCode =
|
|
134725
|
+
this.code = e3;
|
|
134726
|
+
this.exitCode = t3;
|
|
134610
134727
|
this.nestedError = void 0;
|
|
134611
134728
|
}
|
|
134612
134729
|
}
|
|
134613
134730
|
class InvalidArgumentError extends CommanderError {
|
|
134614
|
-
constructor(
|
|
134615
|
-
super(1, "commander.invalidArgument",
|
|
134731
|
+
constructor(t3) {
|
|
134732
|
+
super(1, "commander.invalidArgument", t3);
|
|
134616
134733
|
Error.captureStackTrace(this, this.constructor);
|
|
134617
134734
|
this.name = this.constructor.name;
|
|
134618
134735
|
}
|
|
134619
134736
|
}
|
|
134620
|
-
|
|
134621
|
-
|
|
134622
|
-
},
|
|
134623
|
-
const { humanReadableArgName: n } = i2(
|
|
134737
|
+
e2.CommanderError = CommanderError;
|
|
134738
|
+
e2.InvalidArgumentError = InvalidArgumentError;
|
|
134739
|
+
}, 519: (t2, e2, i2) => {
|
|
134740
|
+
const { humanReadableArgName: n } = i2(535);
|
|
134624
134741
|
class Help {
|
|
134625
134742
|
constructor() {
|
|
134626
134743
|
this.helpWidth = void 0;
|
|
134627
134744
|
this.sortSubcommands = false;
|
|
134628
134745
|
this.sortOptions = false;
|
|
134629
|
-
|
|
134630
|
-
|
|
134631
|
-
|
|
134632
|
-
|
|
134633
|
-
|
|
134634
|
-
const
|
|
134635
|
-
s.
|
|
134746
|
+
this.showGlobalOptions = false;
|
|
134747
|
+
}
|
|
134748
|
+
visibleCommands(t3) {
|
|
134749
|
+
const e3 = t3.commands.filter((t4) => !t4._hidden);
|
|
134750
|
+
if (t3._hasImplicitHelpCommand()) {
|
|
134751
|
+
const [, i3, n2] = t3._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
|
|
134752
|
+
const s = t3.createCommand(i3).helpOption(false);
|
|
134753
|
+
s.description(t3._helpCommandDescription);
|
|
134636
134754
|
if (n2)
|
|
134637
134755
|
s.arguments(n2);
|
|
134638
|
-
|
|
134756
|
+
e3.push(s);
|
|
134639
134757
|
}
|
|
134640
134758
|
if (this.sortSubcommands) {
|
|
134641
|
-
|
|
134759
|
+
e3.sort((t4, e4) => t4.name().localeCompare(e4.name()));
|
|
134642
134760
|
}
|
|
134643
|
-
return
|
|
134761
|
+
return e3;
|
|
134644
134762
|
}
|
|
134645
|
-
|
|
134646
|
-
const
|
|
134647
|
-
|
|
134648
|
-
|
|
134763
|
+
compareOptions(t3, e3) {
|
|
134764
|
+
const getSortKey = (t4) => t4.short ? t4.short.replace(/^-/, "") : t4.long.replace(/^--/, "");
|
|
134765
|
+
return getSortKey(t3).localeCompare(getSortKey(e3));
|
|
134766
|
+
}
|
|
134767
|
+
visibleOptions(t3) {
|
|
134768
|
+
const e3 = t3.options.filter((t4) => !t4.hidden);
|
|
134769
|
+
const i3 = t3._hasHelpOption && t3._helpShortFlag && !t3._findOption(t3._helpShortFlag);
|
|
134770
|
+
const n2 = t3._hasHelpOption && !t3._findOption(t3._helpLongFlag);
|
|
134649
134771
|
if (i3 || n2) {
|
|
134650
134772
|
let s;
|
|
134651
134773
|
if (!i3) {
|
|
134652
|
-
s =
|
|
134774
|
+
s = t3.createOption(t3._helpLongFlag, t3._helpDescription);
|
|
134653
134775
|
} else if (!n2) {
|
|
134654
|
-
s =
|
|
134776
|
+
s = t3.createOption(t3._helpShortFlag, t3._helpDescription);
|
|
134655
134777
|
} else {
|
|
134656
|
-
s =
|
|
134778
|
+
s = t3.createOption(t3._helpFlags, t3._helpDescription);
|
|
134657
134779
|
}
|
|
134658
|
-
|
|
134780
|
+
e3.push(s);
|
|
134659
134781
|
}
|
|
134660
134782
|
if (this.sortOptions) {
|
|
134661
|
-
|
|
134662
|
-
t3.sort((e4, t4) => getSortKey(e4).localeCompare(getSortKey(t4)));
|
|
134783
|
+
e3.sort(this.compareOptions);
|
|
134663
134784
|
}
|
|
134664
|
-
return
|
|
134785
|
+
return e3;
|
|
134665
134786
|
}
|
|
134666
|
-
|
|
134667
|
-
if (
|
|
134668
|
-
|
|
134669
|
-
|
|
134787
|
+
visibleGlobalOptions(t3) {
|
|
134788
|
+
if (!this.showGlobalOptions)
|
|
134789
|
+
return [];
|
|
134790
|
+
const e3 = [];
|
|
134791
|
+
for (let i3 = t3.parent; i3; i3 = i3.parent) {
|
|
134792
|
+
const t4 = i3.options.filter((t5) => !t5.hidden);
|
|
134793
|
+
e3.push(...t4);
|
|
134794
|
+
}
|
|
134795
|
+
if (this.sortOptions) {
|
|
134796
|
+
e3.sort(this.compareOptions);
|
|
134797
|
+
}
|
|
134798
|
+
return e3;
|
|
134799
|
+
}
|
|
134800
|
+
visibleArguments(t3) {
|
|
134801
|
+
if (t3._argsDescription) {
|
|
134802
|
+
t3._args.forEach((e3) => {
|
|
134803
|
+
e3.description = e3.description || t3._argsDescription[e3.name()] || "";
|
|
134670
134804
|
});
|
|
134671
134805
|
}
|
|
134672
|
-
if (
|
|
134673
|
-
return
|
|
134806
|
+
if (t3._args.find((t4) => t4.description)) {
|
|
134807
|
+
return t3._args;
|
|
134674
134808
|
}
|
|
134675
134809
|
return [];
|
|
134676
134810
|
}
|
|
134677
|
-
subcommandTerm(
|
|
134678
|
-
const
|
|
134679
|
-
return
|
|
134811
|
+
subcommandTerm(t3) {
|
|
134812
|
+
const e3 = t3._args.map((t4) => n(t4)).join(" ");
|
|
134813
|
+
return t3._name + (t3._aliases[0] ? "|" + t3._aliases[0] : "") + (t3.options.length ? " [options]" : "") + (e3 ? " " + e3 : "");
|
|
134680
134814
|
}
|
|
134681
|
-
optionTerm(
|
|
134682
|
-
return
|
|
134815
|
+
optionTerm(t3) {
|
|
134816
|
+
return t3.flags;
|
|
134683
134817
|
}
|
|
134684
|
-
argumentTerm(
|
|
134685
|
-
return
|
|
134818
|
+
argumentTerm(t3) {
|
|
134819
|
+
return t3.name();
|
|
134686
134820
|
}
|
|
134687
|
-
longestSubcommandTermLength(
|
|
134688
|
-
return
|
|
134821
|
+
longestSubcommandTermLength(t3, e3) {
|
|
134822
|
+
return e3.visibleCommands(t3).reduce((t4, i3) => Math.max(t4, e3.subcommandTerm(i3).length), 0);
|
|
134689
134823
|
}
|
|
134690
|
-
longestOptionTermLength(
|
|
134691
|
-
return
|
|
134824
|
+
longestOptionTermLength(t3, e3) {
|
|
134825
|
+
return e3.visibleOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
|
|
134692
134826
|
}
|
|
134693
|
-
|
|
134694
|
-
return
|
|
134827
|
+
longestGlobalOptionTermLength(t3, e3) {
|
|
134828
|
+
return e3.visibleGlobalOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
|
|
134695
134829
|
}
|
|
134696
|
-
|
|
134697
|
-
|
|
134698
|
-
|
|
134699
|
-
|
|
134830
|
+
longestArgumentTermLength(t3, e3) {
|
|
134831
|
+
return e3.visibleArguments(t3).reduce((t4, i3) => Math.max(t4, e3.argumentTerm(i3).length), 0);
|
|
134832
|
+
}
|
|
134833
|
+
commandUsage(t3) {
|
|
134834
|
+
let e3 = t3._name;
|
|
134835
|
+
if (t3._aliases[0]) {
|
|
134836
|
+
e3 = e3 + "|" + t3._aliases[0];
|
|
134700
134837
|
}
|
|
134701
134838
|
let i3 = "";
|
|
134702
|
-
for (let
|
|
134703
|
-
i3 =
|
|
134839
|
+
for (let e4 = t3.parent; e4; e4 = e4.parent) {
|
|
134840
|
+
i3 = e4.name() + " " + i3;
|
|
134704
134841
|
}
|
|
134705
|
-
return i3 +
|
|
134842
|
+
return i3 + e3 + " " + t3.usage();
|
|
134706
134843
|
}
|
|
134707
|
-
commandDescription(
|
|
134708
|
-
return
|
|
134844
|
+
commandDescription(t3) {
|
|
134845
|
+
return t3.description();
|
|
134709
134846
|
}
|
|
134710
|
-
subcommandDescription(
|
|
134711
|
-
return
|
|
134847
|
+
subcommandDescription(t3) {
|
|
134848
|
+
return t3.summary() || t3.description();
|
|
134712
134849
|
}
|
|
134713
|
-
optionDescription(
|
|
134714
|
-
const
|
|
134715
|
-
if (
|
|
134716
|
-
|
|
134850
|
+
optionDescription(t3) {
|
|
134851
|
+
const e3 = [];
|
|
134852
|
+
if (t3.argChoices) {
|
|
134853
|
+
e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
|
|
134717
134854
|
}
|
|
134718
|
-
if (
|
|
134719
|
-
t3.
|
|
134855
|
+
if (t3.defaultValue !== void 0) {
|
|
134856
|
+
const i3 = t3.required || t3.optional || t3.isBoolean() && typeof t3.defaultValue === "boolean";
|
|
134857
|
+
if (i3) {
|
|
134858
|
+
e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
|
|
134859
|
+
}
|
|
134720
134860
|
}
|
|
134721
|
-
if (
|
|
134722
|
-
|
|
134861
|
+
if (t3.presetArg !== void 0 && t3.optional) {
|
|
134862
|
+
e3.push(`preset: ${JSON.stringify(t3.presetArg)}`);
|
|
134723
134863
|
}
|
|
134724
|
-
if (t3.
|
|
134725
|
-
|
|
134864
|
+
if (t3.envVar !== void 0) {
|
|
134865
|
+
e3.push(`env: ${t3.envVar}`);
|
|
134726
134866
|
}
|
|
134727
|
-
|
|
134867
|
+
if (e3.length > 0) {
|
|
134868
|
+
return `${t3.description} (${e3.join(", ")})`;
|
|
134869
|
+
}
|
|
134870
|
+
return t3.description;
|
|
134728
134871
|
}
|
|
134729
|
-
argumentDescription(
|
|
134730
|
-
const
|
|
134731
|
-
if (
|
|
134732
|
-
|
|
134872
|
+
argumentDescription(t3) {
|
|
134873
|
+
const e3 = [];
|
|
134874
|
+
if (t3.argChoices) {
|
|
134875
|
+
e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
|
|
134733
134876
|
}
|
|
134734
|
-
if (
|
|
134735
|
-
|
|
134877
|
+
if (t3.defaultValue !== void 0) {
|
|
134878
|
+
e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
|
|
134736
134879
|
}
|
|
134737
|
-
if (
|
|
134738
|
-
const i3 = `(${
|
|
134739
|
-
if (
|
|
134740
|
-
return `${
|
|
134880
|
+
if (e3.length > 0) {
|
|
134881
|
+
const i3 = `(${e3.join(", ")})`;
|
|
134882
|
+
if (t3.description) {
|
|
134883
|
+
return `${t3.description} ${i3}`;
|
|
134741
134884
|
}
|
|
134742
134885
|
return i3;
|
|
134743
134886
|
}
|
|
134744
|
-
return
|
|
134887
|
+
return t3.description;
|
|
134745
134888
|
}
|
|
134746
|
-
formatHelp(
|
|
134747
|
-
const i3 =
|
|
134748
|
-
const n2 =
|
|
134889
|
+
formatHelp(t3, e3) {
|
|
134890
|
+
const i3 = e3.padWidth(t3, e3);
|
|
134891
|
+
const n2 = e3.helpWidth || 80;
|
|
134749
134892
|
const s = 2;
|
|
134750
134893
|
const r = 2;
|
|
134751
|
-
function formatItem(
|
|
134894
|
+
function formatItem(t4, o2) {
|
|
134752
134895
|
if (o2) {
|
|
134753
|
-
const a2 = `${
|
|
134754
|
-
return
|
|
134896
|
+
const a2 = `${t4.padEnd(i3 + r)}${o2}`;
|
|
134897
|
+
return e3.wrap(a2, n2 - s, i3 + r);
|
|
134755
134898
|
}
|
|
134756
|
-
return
|
|
134899
|
+
return t4;
|
|
134757
134900
|
}
|
|
134758
|
-
function formatList(
|
|
134759
|
-
return
|
|
134901
|
+
function formatList(t4) {
|
|
134902
|
+
return t4.join("\n").replace(/^/gm, " ".repeat(s));
|
|
134760
134903
|
}
|
|
134761
|
-
let o = [`Usage: ${
|
|
134762
|
-
const a =
|
|
134904
|
+
let o = [`Usage: ${e3.commandUsage(t3)}`, ""];
|
|
134905
|
+
const a = e3.commandDescription(t3);
|
|
134763
134906
|
if (a.length > 0) {
|
|
134764
|
-
o = o.concat([a, ""]);
|
|
134907
|
+
o = o.concat([e3.wrap(a, n2, 0), ""]);
|
|
134765
134908
|
}
|
|
134766
|
-
const
|
|
134909
|
+
const l = e3.visibleArguments(t3).map((t4) => formatItem(e3.argumentTerm(t4), e3.argumentDescription(t4)));
|
|
134910
|
+
if (l.length > 0) {
|
|
134911
|
+
o = o.concat(["Arguments:", formatList(l), ""]);
|
|
134912
|
+
}
|
|
134913
|
+
const h = e3.visibleOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
|
|
134767
134914
|
if (h.length > 0) {
|
|
134768
|
-
o = o.concat(["
|
|
134915
|
+
o = o.concat(["Options:", formatList(h), ""]);
|
|
134769
134916
|
}
|
|
134770
|
-
|
|
134771
|
-
|
|
134772
|
-
|
|
134917
|
+
if (this.showGlobalOptions) {
|
|
134918
|
+
const i4 = e3.visibleGlobalOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
|
|
134919
|
+
if (i4.length > 0) {
|
|
134920
|
+
o = o.concat(["Global Options:", formatList(i4), ""]);
|
|
134921
|
+
}
|
|
134773
134922
|
}
|
|
134774
|
-
const u =
|
|
134923
|
+
const u = e3.visibleCommands(t3).map((t4) => formatItem(e3.subcommandTerm(t4), e3.subcommandDescription(t4)));
|
|
134775
134924
|
if (u.length > 0) {
|
|
134776
134925
|
o = o.concat(["Commands:", formatList(u), ""]);
|
|
134777
134926
|
}
|
|
134778
134927
|
return o.join("\n");
|
|
134779
134928
|
}
|
|
134780
|
-
padWidth(
|
|
134781
|
-
return Math.max(
|
|
134929
|
+
padWidth(t3, e3) {
|
|
134930
|
+
return Math.max(e3.longestOptionTermLength(t3, e3), e3.longestGlobalOptionTermLength(t3, e3), e3.longestSubcommandTermLength(t3, e3), e3.longestArgumentTermLength(t3, e3));
|
|
134782
134931
|
}
|
|
134783
|
-
wrap(
|
|
134784
|
-
|
|
134785
|
-
|
|
134786
|
-
|
|
134787
|
-
|
|
134788
|
-
|
|
134789
|
-
|
|
134790
|
-
|
|
134791
|
-
const a =
|
|
134792
|
-
const
|
|
134793
|
-
const
|
|
134794
|
-
|
|
134795
|
-
|
|
134796
|
-
|
|
134797
|
-
|
|
134798
|
-
|
|
134932
|
+
wrap(t3, e3, i3, n2 = 40) {
|
|
134933
|
+
const s = " \\f\\t\\v - \uFEFF";
|
|
134934
|
+
const r = new RegExp(`[\\n][${s}]+`);
|
|
134935
|
+
if (t3.match(r))
|
|
134936
|
+
return t3;
|
|
134937
|
+
const o = e3 - i3;
|
|
134938
|
+
if (o < n2)
|
|
134939
|
+
return t3;
|
|
134940
|
+
const a = t3.slice(0, i3);
|
|
134941
|
+
const l = t3.slice(i3).replace("\r\n", "\n");
|
|
134942
|
+
const h = " ".repeat(i3);
|
|
134943
|
+
const u = "";
|
|
134944
|
+
const c = `\\s${u}`;
|
|
134945
|
+
const p = new RegExp(`
|
|
134946
|
+
|.{1,${o - 1}}([${c}]|$)|[^${c}]+?([${c}]|$)`, "g");
|
|
134947
|
+
const m = l.match(p) || [];
|
|
134948
|
+
return a + m.map((t4, e4) => {
|
|
134949
|
+
if (t4 === "\n")
|
|
134950
|
+
return "";
|
|
134951
|
+
return (e4 > 0 ? h : "") + t4.trimEnd();
|
|
134799
134952
|
}).join("\n");
|
|
134800
134953
|
}
|
|
134801
134954
|
}
|
|
134802
|
-
|
|
134803
|
-
},
|
|
134804
|
-
const { InvalidArgumentError: n } = i2(
|
|
134955
|
+
e2.Help = Help;
|
|
134956
|
+
}, 437: (t2, e2, i2) => {
|
|
134957
|
+
const { InvalidArgumentError: n } = i2(796);
|
|
134805
134958
|
class Option {
|
|
134806
|
-
constructor(
|
|
134807
|
-
this.flags =
|
|
134808
|
-
this.description =
|
|
134809
|
-
this.required =
|
|
134810
|
-
this.optional =
|
|
134811
|
-
this.variadic = /\w\.\.\.[>\]]$/.test(
|
|
134959
|
+
constructor(t3, e3) {
|
|
134960
|
+
this.flags = t3;
|
|
134961
|
+
this.description = e3 || "";
|
|
134962
|
+
this.required = t3.includes("<");
|
|
134963
|
+
this.optional = t3.includes("[");
|
|
134964
|
+
this.variadic = /\w\.\.\.[>\]]$/.test(t3);
|
|
134812
134965
|
this.mandatory = false;
|
|
134813
|
-
const i3 = splitOptionFlags(
|
|
134966
|
+
const i3 = splitOptionFlags(t3);
|
|
134814
134967
|
this.short = i3.shortFlag;
|
|
134815
134968
|
this.long = i3.longFlag;
|
|
134816
134969
|
this.negate = false;
|
|
@@ -134819,48 +134972,63 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134819
134972
|
}
|
|
134820
134973
|
this.defaultValue = void 0;
|
|
134821
134974
|
this.defaultValueDescription = void 0;
|
|
134975
|
+
this.presetArg = void 0;
|
|
134822
134976
|
this.envVar = void 0;
|
|
134823
134977
|
this.parseArg = void 0;
|
|
134824
134978
|
this.hidden = false;
|
|
134825
134979
|
this.argChoices = void 0;
|
|
134980
|
+
this.conflictsWith = [];
|
|
134981
|
+
this.implied = void 0;
|
|
134826
134982
|
}
|
|
134827
|
-
default(
|
|
134828
|
-
this.defaultValue =
|
|
134829
|
-
this.defaultValueDescription =
|
|
134983
|
+
default(t3, e3) {
|
|
134984
|
+
this.defaultValue = t3;
|
|
134985
|
+
this.defaultValueDescription = e3;
|
|
134830
134986
|
return this;
|
|
134831
134987
|
}
|
|
134832
|
-
|
|
134833
|
-
this.
|
|
134988
|
+
preset(t3) {
|
|
134989
|
+
this.presetArg = t3;
|
|
134834
134990
|
return this;
|
|
134835
134991
|
}
|
|
134836
|
-
|
|
134837
|
-
this.
|
|
134992
|
+
conflicts(t3) {
|
|
134993
|
+
this.conflictsWith = this.conflictsWith.concat(t3);
|
|
134838
134994
|
return this;
|
|
134839
134995
|
}
|
|
134840
|
-
|
|
134841
|
-
this.
|
|
134996
|
+
implies(t3) {
|
|
134997
|
+
this.implied = Object.assign(this.implied || {}, t3);
|
|
134842
134998
|
return this;
|
|
134843
134999
|
}
|
|
134844
|
-
|
|
134845
|
-
this.
|
|
135000
|
+
env(t3) {
|
|
135001
|
+
this.envVar = t3;
|
|
135002
|
+
return this;
|
|
135003
|
+
}
|
|
135004
|
+
argParser(t3) {
|
|
135005
|
+
this.parseArg = t3;
|
|
135006
|
+
return this;
|
|
135007
|
+
}
|
|
135008
|
+
makeOptionMandatory(t3 = true) {
|
|
135009
|
+
this.mandatory = !!t3;
|
|
135010
|
+
return this;
|
|
135011
|
+
}
|
|
135012
|
+
hideHelp(t3 = true) {
|
|
135013
|
+
this.hidden = !!t3;
|
|
134846
135014
|
return this;
|
|
134847
135015
|
}
|
|
134848
|
-
_concatValue(
|
|
134849
|
-
if (
|
|
134850
|
-
return [
|
|
135016
|
+
_concatValue(t3, e3) {
|
|
135017
|
+
if (e3 === this.defaultValue || !Array.isArray(e3)) {
|
|
135018
|
+
return [t3];
|
|
134851
135019
|
}
|
|
134852
|
-
return
|
|
135020
|
+
return e3.concat(t3);
|
|
134853
135021
|
}
|
|
134854
|
-
choices(
|
|
134855
|
-
this.argChoices =
|
|
134856
|
-
this.parseArg = (
|
|
134857
|
-
if (!
|
|
134858
|
-
throw new n(`Allowed choices are ${
|
|
135022
|
+
choices(t3) {
|
|
135023
|
+
this.argChoices = t3.slice();
|
|
135024
|
+
this.parseArg = (t4, e3) => {
|
|
135025
|
+
if (!this.argChoices.includes(t4)) {
|
|
135026
|
+
throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
134859
135027
|
}
|
|
134860
135028
|
if (this.variadic) {
|
|
134861
|
-
return this._concatValue(
|
|
135029
|
+
return this._concatValue(t4, e3);
|
|
134862
135030
|
}
|
|
134863
|
-
return
|
|
135031
|
+
return t4;
|
|
134864
135032
|
};
|
|
134865
135033
|
return this;
|
|
134866
135034
|
}
|
|
@@ -134873,86 +135041,117 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134873
135041
|
attributeName() {
|
|
134874
135042
|
return camelcase(this.name().replace(/^no-/, ""));
|
|
134875
135043
|
}
|
|
134876
|
-
is(
|
|
134877
|
-
return this.short ===
|
|
135044
|
+
is(t3) {
|
|
135045
|
+
return this.short === t3 || this.long === t3;
|
|
135046
|
+
}
|
|
135047
|
+
isBoolean() {
|
|
135048
|
+
return !this.required && !this.optional && !this.negate;
|
|
134878
135049
|
}
|
|
134879
135050
|
}
|
|
134880
|
-
|
|
134881
|
-
|
|
135051
|
+
class DualOptions {
|
|
135052
|
+
constructor(t3) {
|
|
135053
|
+
this.positiveOptions = /* @__PURE__ */ new Map();
|
|
135054
|
+
this.negativeOptions = /* @__PURE__ */ new Map();
|
|
135055
|
+
this.dualOptions = /* @__PURE__ */ new Set();
|
|
135056
|
+
t3.forEach((t4) => {
|
|
135057
|
+
if (t4.negate) {
|
|
135058
|
+
this.negativeOptions.set(t4.attributeName(), t4);
|
|
135059
|
+
} else {
|
|
135060
|
+
this.positiveOptions.set(t4.attributeName(), t4);
|
|
135061
|
+
}
|
|
135062
|
+
});
|
|
135063
|
+
this.negativeOptions.forEach((t4, e3) => {
|
|
135064
|
+
if (this.positiveOptions.has(e3)) {
|
|
135065
|
+
this.dualOptions.add(e3);
|
|
135066
|
+
}
|
|
135067
|
+
});
|
|
135068
|
+
}
|
|
135069
|
+
valueFromOption(t3, e3) {
|
|
135070
|
+
const i3 = e3.attributeName();
|
|
135071
|
+
if (!this.dualOptions.has(i3))
|
|
135072
|
+
return true;
|
|
135073
|
+
const n2 = this.negativeOptions.get(i3).presetArg;
|
|
135074
|
+
const s = n2 !== void 0 ? n2 : false;
|
|
135075
|
+
return e3.negate === (s === t3);
|
|
135076
|
+
}
|
|
134882
135077
|
}
|
|
134883
|
-
function
|
|
134884
|
-
|
|
135078
|
+
function camelcase(t3) {
|
|
135079
|
+
return t3.split("-").reduce((t4, e3) => t4 + e3[0].toUpperCase() + e3.slice(1));
|
|
135080
|
+
}
|
|
135081
|
+
function splitOptionFlags(t3) {
|
|
135082
|
+
let e3;
|
|
134885
135083
|
let i3;
|
|
134886
|
-
const n2 =
|
|
135084
|
+
const n2 = t3.split(/[ |,]+/);
|
|
134887
135085
|
if (n2.length > 1 && !/^[[<]/.test(n2[1]))
|
|
134888
|
-
|
|
135086
|
+
e3 = n2.shift();
|
|
134889
135087
|
i3 = n2.shift();
|
|
134890
|
-
if (!
|
|
134891
|
-
|
|
135088
|
+
if (!e3 && /^-[^-]$/.test(i3)) {
|
|
135089
|
+
e3 = i3;
|
|
134892
135090
|
i3 = void 0;
|
|
134893
135091
|
}
|
|
134894
|
-
return { shortFlag:
|
|
135092
|
+
return { shortFlag: e3, longFlag: i3 };
|
|
134895
135093
|
}
|
|
134896
|
-
|
|
134897
|
-
|
|
134898
|
-
|
|
135094
|
+
e2.Option = Option;
|
|
135095
|
+
e2.splitOptionFlags = splitOptionFlags;
|
|
135096
|
+
e2.DualOptions = DualOptions;
|
|
135097
|
+
}, 860: (t2, e2) => {
|
|
134899
135098
|
const i2 = 3;
|
|
134900
|
-
function editDistance(
|
|
134901
|
-
if (Math.abs(
|
|
134902
|
-
return Math.max(
|
|
135099
|
+
function editDistance(t3, e3) {
|
|
135100
|
+
if (Math.abs(t3.length - e3.length) > i2)
|
|
135101
|
+
return Math.max(t3.length, e3.length);
|
|
134903
135102
|
const n = [];
|
|
134904
|
-
for (let t4 = 0; t4 <= e3.length; t4++) {
|
|
134905
|
-
n[t4] = [t4];
|
|
134906
|
-
}
|
|
134907
135103
|
for (let e4 = 0; e4 <= t3.length; e4++) {
|
|
134908
|
-
n[
|
|
135104
|
+
n[e4] = [e4];
|
|
134909
135105
|
}
|
|
134910
|
-
for (let
|
|
134911
|
-
|
|
135106
|
+
for (let t4 = 0; t4 <= e3.length; t4++) {
|
|
135107
|
+
n[0][t4] = t4;
|
|
135108
|
+
}
|
|
135109
|
+
for (let i3 = 1; i3 <= e3.length; i3++) {
|
|
135110
|
+
for (let s = 1; s <= t3.length; s++) {
|
|
134912
135111
|
let r = 1;
|
|
134913
|
-
if (
|
|
135112
|
+
if (t3[s - 1] === e3[i3 - 1]) {
|
|
134914
135113
|
r = 0;
|
|
134915
135114
|
} else {
|
|
134916
135115
|
r = 1;
|
|
134917
135116
|
}
|
|
134918
135117
|
n[s][i3] = Math.min(n[s - 1][i3] + 1, n[s][i3 - 1] + 1, n[s - 1][i3 - 1] + r);
|
|
134919
|
-
if (s > 1 && i3 > 1 &&
|
|
135118
|
+
if (s > 1 && i3 > 1 && t3[s - 1] === e3[i3 - 2] && t3[s - 2] === e3[i3 - 1]) {
|
|
134920
135119
|
n[s][i3] = Math.min(n[s][i3], n[s - 2][i3 - 2] + 1);
|
|
134921
135120
|
}
|
|
134922
135121
|
}
|
|
134923
135122
|
}
|
|
134924
|
-
return n[
|
|
135123
|
+
return n[t3.length][e3.length];
|
|
134925
135124
|
}
|
|
134926
|
-
function suggestSimilar(
|
|
134927
|
-
if (!
|
|
135125
|
+
function suggestSimilar(t3, e3) {
|
|
135126
|
+
if (!e3 || e3.length === 0)
|
|
134928
135127
|
return "";
|
|
134929
|
-
|
|
134930
|
-
const n =
|
|
135128
|
+
e3 = Array.from(new Set(e3));
|
|
135129
|
+
const n = t3.startsWith("--");
|
|
134931
135130
|
if (n) {
|
|
134932
|
-
|
|
134933
|
-
|
|
135131
|
+
t3 = t3.slice(2);
|
|
135132
|
+
e3 = e3.map((t4) => t4.slice(2));
|
|
134934
135133
|
}
|
|
134935
135134
|
let s = [];
|
|
134936
135135
|
let r = i2;
|
|
134937
135136
|
const o = 0.4;
|
|
134938
|
-
|
|
134939
|
-
if (
|
|
135137
|
+
e3.forEach((e4) => {
|
|
135138
|
+
if (e4.length <= 1)
|
|
134940
135139
|
return;
|
|
134941
|
-
const i3 = editDistance(
|
|
134942
|
-
const n2 = Math.max(
|
|
135140
|
+
const i3 = editDistance(t3, e4);
|
|
135141
|
+
const n2 = Math.max(t3.length, e4.length);
|
|
134943
135142
|
const a = (n2 - i3) / n2;
|
|
134944
135143
|
if (a > o) {
|
|
134945
135144
|
if (i3 < r) {
|
|
134946
135145
|
r = i3;
|
|
134947
|
-
s = [
|
|
135146
|
+
s = [e4];
|
|
134948
135147
|
} else if (i3 === r) {
|
|
134949
|
-
s.push(
|
|
135148
|
+
s.push(e4);
|
|
134950
135149
|
}
|
|
134951
135150
|
}
|
|
134952
135151
|
});
|
|
134953
|
-
s.sort((
|
|
135152
|
+
s.sort((t4, e4) => t4.localeCompare(e4));
|
|
134954
135153
|
if (n) {
|
|
134955
|
-
s = s.map((
|
|
135154
|
+
s = s.map((t4) => `--${t4}`);
|
|
134956
135155
|
}
|
|
134957
135156
|
if (s.length > 1) {
|
|
134958
135157
|
return `
|
|
@@ -134964,28 +135163,28 @@ Expecting one of '${i3.join("', '")}'`);
|
|
|
134964
135163
|
}
|
|
134965
135164
|
return "";
|
|
134966
135165
|
}
|
|
134967
|
-
|
|
135166
|
+
e2.suggestSimilar = suggestSimilar;
|
|
134968
135167
|
} };
|
|
134969
|
-
var
|
|
135168
|
+
var e = {};
|
|
134970
135169
|
function __nccwpck_require__(i2) {
|
|
134971
|
-
var n =
|
|
135170
|
+
var n = e[i2];
|
|
134972
135171
|
if (n !== void 0) {
|
|
134973
135172
|
return n.exports;
|
|
134974
135173
|
}
|
|
134975
|
-
var s =
|
|
135174
|
+
var s = e[i2] = { exports: {} };
|
|
134976
135175
|
var r = true;
|
|
134977
135176
|
try {
|
|
134978
|
-
|
|
135177
|
+
t[i2](s, s.exports, __nccwpck_require__);
|
|
134979
135178
|
r = false;
|
|
134980
135179
|
} finally {
|
|
134981
135180
|
if (r)
|
|
134982
|
-
delete
|
|
135181
|
+
delete e[i2];
|
|
134983
135182
|
}
|
|
134984
135183
|
return s.exports;
|
|
134985
135184
|
}
|
|
134986
135185
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
134987
135186
|
__nccwpck_require__.ab = __dirname + "/";
|
|
134988
|
-
var i = __nccwpck_require__(
|
|
135187
|
+
var i = __nccwpck_require__(632);
|
|
134989
135188
|
module2.exports = i;
|
|
134990
135189
|
})();
|
|
134991
135190
|
}
|
|
@@ -135125,12 +135324,17 @@ var require_commands = __commonJS({
|
|
|
135125
135324
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
135126
135325
|
var commands_exports = {};
|
|
135127
135326
|
__export2(commands_exports, {
|
|
135327
|
+
getArgv: () => getArgv,
|
|
135128
135328
|
getCommand: () => getCommand,
|
|
135129
135329
|
isDevCommand: () => isDevCommand
|
|
135130
135330
|
});
|
|
135131
135331
|
module2.exports = __toCommonJS2(commands_exports);
|
|
135332
|
+
var getArgv = () => {
|
|
135333
|
+
var _a2;
|
|
135334
|
+
return (((_a2 = process.env.MODERN_ARGV) == null ? void 0 : _a2.split(" ")) || process.argv).slice(2);
|
|
135335
|
+
};
|
|
135132
135336
|
var getCommand = () => {
|
|
135133
|
-
const args =
|
|
135337
|
+
const args = getArgv();
|
|
135134
135338
|
const command = args[0];
|
|
135135
135339
|
return command;
|
|
135136
135340
|
};
|
|
@@ -135141,108 +135345,6 @@ var require_commands = __commonJS({
|
|
|
135141
135345
|
}
|
|
135142
135346
|
});
|
|
135143
135347
|
|
|
135144
|
-
// ../../../toolkit/utils/dist/format.js
|
|
135145
|
-
var require_format2 = __commonJS({
|
|
135146
|
-
"../../../toolkit/utils/dist/format.js"(exports, module2) {
|
|
135147
|
-
var __defProp2 = Object.defineProperty;
|
|
135148
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
135149
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
135150
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
135151
|
-
var __export2 = (target, all) => {
|
|
135152
|
-
for (var name in all)
|
|
135153
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
135154
|
-
};
|
|
135155
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
135156
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
135157
|
-
for (let key of __getOwnPropNames2(from))
|
|
135158
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
135159
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
135160
|
-
}
|
|
135161
|
-
return to;
|
|
135162
|
-
};
|
|
135163
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
135164
|
-
var format_exports = {};
|
|
135165
|
-
__export2(format_exports, {
|
|
135166
|
-
formatWebpackMessages: () => formatWebpackMessages
|
|
135167
|
-
});
|
|
135168
|
-
module2.exports = __toCommonJS2(format_exports);
|
|
135169
|
-
var friendlySyntaxErrorLabel = "SyntaxError:";
|
|
135170
|
-
function isLikelyASyntaxError(message) {
|
|
135171
|
-
return message.includes(friendlySyntaxErrorLabel);
|
|
135172
|
-
}
|
|
135173
|
-
function formatMessage(stats) {
|
|
135174
|
-
let lines = [];
|
|
135175
|
-
let message;
|
|
135176
|
-
if (typeof stats === "object") {
|
|
135177
|
-
const fileName = stats.moduleName ? `File: ${stats.moduleName}
|
|
135178
|
-
` : "";
|
|
135179
|
-
const mainMessage = stats.message;
|
|
135180
|
-
const details = stats.details ? `
|
|
135181
|
-
Details: ${stats.details}
|
|
135182
|
-
` : "";
|
|
135183
|
-
const stack = stats.stack ? `
|
|
135184
|
-
${stats.stack}` : "";
|
|
135185
|
-
message = `${fileName}${mainMessage}${details}${stack}`;
|
|
135186
|
-
} else {
|
|
135187
|
-
message = stats;
|
|
135188
|
-
}
|
|
135189
|
-
lines = message.split("\n");
|
|
135190
|
-
lines = lines.map((line) => {
|
|
135191
|
-
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
|
|
135192
|
-
line
|
|
135193
|
-
);
|
|
135194
|
-
if (!parsingError) {
|
|
135195
|
-
return line;
|
|
135196
|
-
}
|
|
135197
|
-
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
135198
|
-
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
135199
|
-
});
|
|
135200
|
-
message = lines.join("\n");
|
|
135201
|
-
message = message.replace(
|
|
135202
|
-
/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
|
|
135203
|
-
`${friendlySyntaxErrorLabel} $3 ($1:$2)
|
|
135204
|
-
`
|
|
135205
|
-
);
|
|
135206
|
-
lines = message.split("\n");
|
|
135207
|
-
if (lines.length > 2 && lines[1].trim() === "") {
|
|
135208
|
-
lines.splice(1, 1);
|
|
135209
|
-
}
|
|
135210
|
-
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
|
|
135211
|
-
if (lines[1] && lines[1].indexOf("Module not found:") !== -1) {
|
|
135212
|
-
lines[1] = lines[1].replace("Error: ", "");
|
|
135213
|
-
}
|
|
135214
|
-
message = lines.join("\n");
|
|
135215
|
-
message = message.replace(
|
|
135216
|
-
/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
|
|
135217
|
-
""
|
|
135218
|
-
);
|
|
135219
|
-
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
|
|
135220
|
-
lines = message.split("\n");
|
|
135221
|
-
lines = lines.filter(
|
|
135222
|
-
(line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
|
|
135223
|
-
);
|
|
135224
|
-
message = lines.join("\n");
|
|
135225
|
-
return message.trim();
|
|
135226
|
-
}
|
|
135227
|
-
function formatWebpackMessages(json) {
|
|
135228
|
-
var _a2, _b, _c;
|
|
135229
|
-
const formattedErrors = (_a2 = json == null ? void 0 : json.errors) == null ? void 0 : _a2.map(formatMessage);
|
|
135230
|
-
const formattedWarnings = (_b = json == null ? void 0 : json.warnings) == null ? void 0 : _b.map(formatMessage);
|
|
135231
|
-
const result = {
|
|
135232
|
-
errors: formattedErrors || [],
|
|
135233
|
-
warnings: formattedWarnings || []
|
|
135234
|
-
};
|
|
135235
|
-
if ((_c = result.errors) == null ? void 0 : _c.some(isLikelyASyntaxError)) {
|
|
135236
|
-
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
135237
|
-
}
|
|
135238
|
-
if (result.errors.length > 1) {
|
|
135239
|
-
result.errors.length = 1;
|
|
135240
|
-
}
|
|
135241
|
-
return result;
|
|
135242
|
-
}
|
|
135243
|
-
}
|
|
135244
|
-
});
|
|
135245
|
-
|
|
135246
135348
|
// ../../../toolkit/utils/dist/logger.js
|
|
135247
135349
|
var require_logger4 = __commonJS({
|
|
135248
135350
|
"../../../toolkit/utils/dist/logger.js"(exports, module2) {
|
|
@@ -136027,10 +136129,10 @@ var require_constants6 = __commonJS({
|
|
|
136027
136129
|
API_DIR: () => API_DIR,
|
|
136028
136130
|
CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
|
|
136029
136131
|
CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
|
|
136132
|
+
DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
|
|
136030
136133
|
DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
|
|
136031
136134
|
DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
|
|
136032
136135
|
ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
|
|
136033
|
-
HMR_SOCK_PATH: () => HMR_SOCK_PATH,
|
|
136034
136136
|
INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
|
|
136035
136137
|
INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
|
|
136036
136138
|
INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
|
|
@@ -136044,8 +136146,7 @@ var require_constants6 = __commonJS({
|
|
|
136044
136146
|
MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
|
|
136045
136147
|
OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
|
|
136046
136148
|
PLUGIN_SCHEMAS: () => PLUGIN_SCHEMAS,
|
|
136047
|
-
|
|
136048
|
-
ROUTE_MINIFEST_FILE: () => ROUTE_MINIFEST_FILE,
|
|
136149
|
+
ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
|
|
136049
136150
|
ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
|
|
136050
136151
|
SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
|
|
136051
136152
|
SERVER_DIR: () => SERVER_DIR,
|
|
@@ -136061,7 +136162,6 @@ var require_constants6 = __commonJS({
|
|
|
136061
136162
|
SHARED_DIR: () => SHARED_DIR
|
|
136062
136163
|
});
|
|
136063
136164
|
module2.exports = __toCommonJS2(constants_exports);
|
|
136064
|
-
var HMR_SOCK_PATH = "/webpack-hmr";
|
|
136065
136165
|
var ROUTE_SPEC_FILE = "route.json";
|
|
136066
136166
|
var MAIN_ENTRY_NAME = "main";
|
|
136067
136167
|
var LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
|
|
@@ -136077,8 +136177,7 @@ var require_constants6 = __commonJS({
|
|
|
136077
136177
|
var CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
|
|
136078
136178
|
var OUTPUT_CONFIG_FILE = "modern.config.json";
|
|
136079
136179
|
var DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
|
136080
|
-
var
|
|
136081
|
-
var ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
|
|
136180
|
+
var ROUTE_MANIFEST_FILE = "routes-manifest.json";
|
|
136082
136181
|
var LOADER_ROUTES_DIR = `loader-routes`;
|
|
136083
136182
|
var DEFAULT_DEV_HOST = "0.0.0.0";
|
|
136084
136183
|
var INTERNAL_APP_TOOLS_PLUGINS = {
|
|
@@ -136282,6 +136381,15 @@ var require_constants6 = __commonJS({
|
|
|
136282
136381
|
],
|
|
136283
136382
|
"@modern-js/plugin-nocode": []
|
|
136284
136383
|
};
|
|
136384
|
+
var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
|
|
136385
|
+
allowNamespaces: true,
|
|
136386
|
+
allExtensions: true,
|
|
136387
|
+
allowDeclareFields: true,
|
|
136388
|
+
// aligns Babel's behavior with TypeScript's default behavior.
|
|
136389
|
+
// https://babeljs.io/docs/en/babel-preset-typescript#optimizeconstenums
|
|
136390
|
+
optimizeConstEnums: true,
|
|
136391
|
+
isTSX: true
|
|
136392
|
+
};
|
|
136285
136393
|
}
|
|
136286
136394
|
});
|
|
136287
136395
|
|
|
@@ -137803,9 +137911,9 @@ var require_getServerConfig2 = __commonJS({
|
|
|
137803
137911
|
}
|
|
137804
137912
|
});
|
|
137805
137913
|
|
|
137806
|
-
// ../../../toolkit/utils/dist/
|
|
137807
|
-
var
|
|
137808
|
-
"../../../toolkit/utils/dist/
|
|
137914
|
+
// ../../../toolkit/utils/dist/resolve.js
|
|
137915
|
+
var require_resolve = __commonJS({
|
|
137916
|
+
"../../../toolkit/utils/dist/resolve.js"(exports, module2) {
|
|
137809
137917
|
var __defProp2 = Object.defineProperty;
|
|
137810
137918
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
137811
137919
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
@@ -137823,12 +137931,13 @@ var require_tryResolve2 = __commonJS({
|
|
|
137823
137931
|
return to;
|
|
137824
137932
|
};
|
|
137825
137933
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
137826
|
-
var
|
|
137827
|
-
__export2(
|
|
137934
|
+
var resolve_exports = {};
|
|
137935
|
+
__export2(resolve_exports, {
|
|
137936
|
+
getAntdMajorVersion: () => getAntdMajorVersion,
|
|
137828
137937
|
isPackageInstalled: () => isPackageInstalled,
|
|
137829
137938
|
tryResolve: () => tryResolve
|
|
137830
137939
|
});
|
|
137831
|
-
module2.exports = __toCommonJS2(
|
|
137940
|
+
module2.exports = __toCommonJS2(resolve_exports);
|
|
137832
137941
|
var import_ensureArray = require_ensureArray2();
|
|
137833
137942
|
var tryResolve = (name, resolvePath) => {
|
|
137834
137943
|
let filePath = "";
|
|
@@ -137851,6 +137960,17 @@ var require_tryResolve2 = __commonJS({
|
|
|
137851
137960
|
return false;
|
|
137852
137961
|
}
|
|
137853
137962
|
};
|
|
137963
|
+
var getAntdMajorVersion = (appDirectory) => {
|
|
137964
|
+
try {
|
|
137965
|
+
const pkgJsonPath = require.resolve("antd/package.json", {
|
|
137966
|
+
paths: [appDirectory]
|
|
137967
|
+
});
|
|
137968
|
+
const { version } = require(pkgJsonPath);
|
|
137969
|
+
return Number(version.split(".")[0]);
|
|
137970
|
+
} catch (err) {
|
|
137971
|
+
return null;
|
|
137972
|
+
}
|
|
137973
|
+
};
|
|
137854
137974
|
}
|
|
137855
137975
|
});
|
|
137856
137976
|
|
|
@@ -137911,15 +138031,16 @@ var require_analyzeProject2 = __commonJS({
|
|
|
137911
138031
|
});
|
|
137912
138032
|
module2.exports = __toCommonJS2(analyzeProject_exports);
|
|
137913
138033
|
var path3 = __toESM2(require("path"));
|
|
138034
|
+
var import_commands = require_commands();
|
|
137914
138035
|
var import_compiled = require_compiled2();
|
|
137915
138036
|
var isApiOnly = (appDirectory, entryDir) => __async2(void 0, null, function* () {
|
|
137916
138037
|
const srcDir = path3.join(appDirectory, entryDir != null ? entryDir : "src");
|
|
137917
138038
|
const existSrc = yield import_compiled.fs.pathExists(srcDir);
|
|
137918
|
-
const options = (0, import_compiled.minimist)(
|
|
138039
|
+
const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
|
|
137919
138040
|
return !existSrc || Boolean(options["api-only"]);
|
|
137920
138041
|
});
|
|
137921
138042
|
var isWebOnly = () => __async2(void 0, null, function* () {
|
|
137922
|
-
const options = (0, import_compiled.minimist)(
|
|
138043
|
+
const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
|
|
137923
138044
|
return Boolean(options["web-only"]);
|
|
137924
138045
|
});
|
|
137925
138046
|
}
|
|
@@ -137990,27 +138111,10 @@ var require_chainId2 = __commonJS({
|
|
|
137990
138111
|
},
|
|
137991
138112
|
/** Predefined rule groups */
|
|
137992
138113
|
ONE_OF: {
|
|
137993
|
-
JS: "js",
|
|
137994
|
-
TS: "ts",
|
|
137995
|
-
CSS: "css",
|
|
137996
|
-
LESS: "less",
|
|
137997
|
-
SASS: "sass",
|
|
137998
|
-
YAML: "yml",
|
|
137999
|
-
TOML: "toml",
|
|
138000
|
-
FALLBACK: "fallback",
|
|
138001
|
-
MARKDOWN: "markdown",
|
|
138002
|
-
BFF_CLIENT: "bff-client",
|
|
138003
|
-
CSS_MODULES: "css-modules",
|
|
138004
|
-
LESS_MODULES: "less-modules",
|
|
138005
|
-
SASS_MODULES: "sass-modules",
|
|
138006
138114
|
SVG: "svg",
|
|
138007
138115
|
SVG_URL: "svg-url",
|
|
138008
138116
|
SVG_ASSET: "svg-asset",
|
|
138009
|
-
SVG_INLINE: "svg-inline"
|
|
138010
|
-
ASSETS: "assets",
|
|
138011
|
-
ASSETS_URL: "assets-url",
|
|
138012
|
-
ASSETS_INLINE: "assets-inline",
|
|
138013
|
-
IMAGE_COMPRESS: "image-compress"
|
|
138117
|
+
SVG_INLINE: "svg-inline"
|
|
138014
138118
|
},
|
|
138015
138119
|
/** Predefined loaders */
|
|
138016
138120
|
USE: {
|
|
@@ -138537,6 +138641,143 @@ var require_getTargetDir = __commonJS({
|
|
|
138537
138641
|
}
|
|
138538
138642
|
});
|
|
138539
138643
|
|
|
138644
|
+
// ../../../toolkit/utils/dist/babel.js
|
|
138645
|
+
var require_babel = __commonJS({
|
|
138646
|
+
"../../../toolkit/utils/dist/babel.js"(exports, module2) {
|
|
138647
|
+
var __defProp2 = Object.defineProperty;
|
|
138648
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
138649
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
138650
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
138651
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
138652
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
138653
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
138654
|
+
var __spreadValues2 = (a, b) => {
|
|
138655
|
+
for (var prop in b || (b = {}))
|
|
138656
|
+
if (__hasOwnProp2.call(b, prop))
|
|
138657
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
138658
|
+
if (__getOwnPropSymbols2)
|
|
138659
|
+
for (var prop of __getOwnPropSymbols2(b)) {
|
|
138660
|
+
if (__propIsEnum2.call(b, prop))
|
|
138661
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
138662
|
+
}
|
|
138663
|
+
return a;
|
|
138664
|
+
};
|
|
138665
|
+
var __export2 = (target, all) => {
|
|
138666
|
+
for (var name in all)
|
|
138667
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
138668
|
+
};
|
|
138669
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
138670
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
138671
|
+
for (let key of __getOwnPropNames2(from))
|
|
138672
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
138673
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
138674
|
+
}
|
|
138675
|
+
return to;
|
|
138676
|
+
};
|
|
138677
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
138678
|
+
var babel_exports = {};
|
|
138679
|
+
__export2(babel_exports, {
|
|
138680
|
+
applyUserBabelConfig: () => applyUserBabelConfig,
|
|
138681
|
+
getBabelUtils: () => getBabelUtils
|
|
138682
|
+
});
|
|
138683
|
+
module2.exports = __toCommonJS2(babel_exports);
|
|
138684
|
+
var import_path4 = require("path");
|
|
138685
|
+
var import_applyOptionsChain = require_applyOptionsChain2();
|
|
138686
|
+
var import_ensureArray = require_ensureArray2();
|
|
138687
|
+
var import_path22 = require_path2();
|
|
138688
|
+
var formatPath = (originPath) => {
|
|
138689
|
+
if ((0, import_path4.isAbsolute)(originPath)) {
|
|
138690
|
+
return originPath.split(import_path4.sep).join("/");
|
|
138691
|
+
}
|
|
138692
|
+
return originPath;
|
|
138693
|
+
};
|
|
138694
|
+
var getPluginItemName = (item) => {
|
|
138695
|
+
if (typeof item === "string") {
|
|
138696
|
+
return formatPath(item);
|
|
138697
|
+
}
|
|
138698
|
+
if (Array.isArray(item) && typeof item[0] === "string") {
|
|
138699
|
+
return formatPath(item[0]);
|
|
138700
|
+
}
|
|
138701
|
+
return null;
|
|
138702
|
+
};
|
|
138703
|
+
var addPlugins = (plugins, config) => {
|
|
138704
|
+
if (config.plugins) {
|
|
138705
|
+
config.plugins.push(...plugins);
|
|
138706
|
+
} else {
|
|
138707
|
+
config.plugins = plugins;
|
|
138708
|
+
}
|
|
138709
|
+
};
|
|
138710
|
+
var addPresets = (presets, config) => {
|
|
138711
|
+
if (config.presets) {
|
|
138712
|
+
config.presets.push(...presets);
|
|
138713
|
+
} else {
|
|
138714
|
+
config.presets = presets;
|
|
138715
|
+
}
|
|
138716
|
+
};
|
|
138717
|
+
var removePlugins = (plugins, config) => {
|
|
138718
|
+
if (!config.plugins) {
|
|
138719
|
+
return;
|
|
138720
|
+
}
|
|
138721
|
+
const removeList = (0, import_ensureArray.ensureArray)(plugins);
|
|
138722
|
+
config.plugins = config.plugins.filter((item) => {
|
|
138723
|
+
const name = getPluginItemName(item);
|
|
138724
|
+
if (name) {
|
|
138725
|
+
return !removeList.find((removeItem) => name.includes(removeItem));
|
|
138726
|
+
}
|
|
138727
|
+
return true;
|
|
138728
|
+
});
|
|
138729
|
+
};
|
|
138730
|
+
var removePresets = (presets, config) => {
|
|
138731
|
+
if (!config.presets) {
|
|
138732
|
+
return;
|
|
138733
|
+
}
|
|
138734
|
+
const removeList = (0, import_ensureArray.ensureArray)(presets);
|
|
138735
|
+
config.presets = config.presets.filter((item) => {
|
|
138736
|
+
const name = getPluginItemName(item);
|
|
138737
|
+
if (name) {
|
|
138738
|
+
return !removeList.find((removeItem) => name.includes(removeItem));
|
|
138739
|
+
}
|
|
138740
|
+
return true;
|
|
138741
|
+
});
|
|
138742
|
+
};
|
|
138743
|
+
var modifyPresetOptions = (presetName, options, presets = []) => {
|
|
138744
|
+
presets.forEach((preset, index) => {
|
|
138745
|
+
if (Array.isArray(preset)) {
|
|
138746
|
+
if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
|
|
138747
|
+
preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
|
|
138748
|
+
}
|
|
138749
|
+
} else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
|
|
138750
|
+
presets[index] = [preset, options];
|
|
138751
|
+
}
|
|
138752
|
+
});
|
|
138753
|
+
};
|
|
138754
|
+
var getBabelUtils = (config) => {
|
|
138755
|
+
const noop = () => {
|
|
138756
|
+
};
|
|
138757
|
+
return {
|
|
138758
|
+
addPlugins: (plugins) => addPlugins(plugins, config),
|
|
138759
|
+
addPresets: (presets) => addPresets(presets, config),
|
|
138760
|
+
removePlugins: (plugins) => removePlugins(plugins, config),
|
|
138761
|
+
removePresets: (presets) => removePresets(presets, config),
|
|
138762
|
+
// `addIncludes` and `addExcludes` are noop functions by default,
|
|
138763
|
+
// It can be overridden by `extraBabelUtils`.
|
|
138764
|
+
addIncludes: noop,
|
|
138765
|
+
addExcludes: noop,
|
|
138766
|
+
// Compat `presetEnvOptions` and `presetReactOptions` in Eden.
|
|
138767
|
+
modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
|
|
138768
|
+
modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
|
|
138769
|
+
};
|
|
138770
|
+
};
|
|
138771
|
+
var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
|
|
138772
|
+
if (userBabelConfig) {
|
|
138773
|
+
const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
|
|
138774
|
+
return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
|
|
138775
|
+
}
|
|
138776
|
+
return defaultOptions;
|
|
138777
|
+
};
|
|
138778
|
+
}
|
|
138779
|
+
});
|
|
138780
|
+
|
|
138540
138781
|
// ../../../toolkit/utils/dist/index.js
|
|
138541
138782
|
var require_dist2 = __commonJS({
|
|
138542
138783
|
"../../../toolkit/utils/dist/index.js"(exports, module2) {
|
|
@@ -138558,7 +138799,6 @@ var require_dist2 = __commonJS({
|
|
|
138558
138799
|
module2.exports = __toCommonJS2(src_exports2);
|
|
138559
138800
|
__reExport(src_exports2, require_compiled2(), module2.exports);
|
|
138560
138801
|
__reExport(src_exports2, require_commands(), module2.exports);
|
|
138561
|
-
__reExport(src_exports2, require_format2(), module2.exports);
|
|
138562
138802
|
__reExport(src_exports2, require_FileSizeReporter2(), module2.exports);
|
|
138563
138803
|
__reExport(src_exports2, require_printBuildError2(), module2.exports);
|
|
138564
138804
|
__reExport(src_exports2, require_debug5(), module2.exports);
|
|
@@ -138590,7 +138830,7 @@ var require_dist2 = __commonJS({
|
|
|
138590
138830
|
__reExport(src_exports2, require_wait2(), module2.exports);
|
|
138591
138831
|
__reExport(src_exports2, require_emptyDir2(), module2.exports);
|
|
138592
138832
|
__reExport(src_exports2, require_getServerConfig2(), module2.exports);
|
|
138593
|
-
__reExport(src_exports2,
|
|
138833
|
+
__reExport(src_exports2, require_resolve(), module2.exports);
|
|
138594
138834
|
__reExport(src_exports2, require_analyzeProject2(), module2.exports);
|
|
138595
138835
|
__reExport(src_exports2, require_chainId2(), module2.exports);
|
|
138596
138836
|
__reExport(src_exports2, require_version2(), module2.exports);
|
|
@@ -138600,6 +138840,7 @@ var require_dist2 = __commonJS({
|
|
|
138600
138840
|
__reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
|
|
138601
138841
|
__reExport(src_exports2, require_react(), module2.exports);
|
|
138602
138842
|
__reExport(src_exports2, require_getTargetDir(), module2.exports);
|
|
138843
|
+
__reExport(src_exports2, require_babel(), module2.exports);
|
|
138603
138844
|
}
|
|
138604
138845
|
});
|
|
138605
138846
|
|
|
@@ -138687,6 +138928,7 @@ var ZH_LOCALE = {
|
|
|
138687
138928
|
self: "请选择你想创建的工程类型",
|
|
138688
138929
|
mwa: "Web 应用",
|
|
138689
138930
|
module: "Npm 模块",
|
|
138931
|
+
doc: "文档站",
|
|
138690
138932
|
monorepo: "Monorepo",
|
|
138691
138933
|
custom: "自定义",
|
|
138692
138934
|
default: "默认"
|
|
@@ -138783,6 +139025,7 @@ var EN_LOCALE = {
|
|
|
138783
139025
|
self: "Please select the solution you want to create",
|
|
138784
139026
|
mwa: "Web App",
|
|
138785
139027
|
module: "Npm Module",
|
|
139028
|
+
doc: "Doc Site",
|
|
138786
139029
|
monorepo: "Monorepo",
|
|
138787
139030
|
custom: "Custom Solution",
|
|
138788
139031
|
default: "Default"
|