@modern-js/monorepo-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 CHANGED
@@ -134446,55 +134446,58 @@ var require_recursive_readdir2 = __commonJS({
134446
134446
  var require_commander2 = __commonJS({
134447
134447
  "../../../toolkit/utils/compiled/commander/index.js"(exports, module2) {
134448
134448
  (() => {
134449
- var e = { 81: (e2) => {
134449
+ var t = { 81: (t2) => {
134450
134450
  "use strict";
134451
- e2.exports = require("child_process");
134452
- }, 361: (e2) => {
134451
+ t2.exports = require("child_process");
134452
+ }, 361: (t2) => {
134453
134453
  "use strict";
134454
- e2.exports = require("events");
134455
- }, 147: (e2) => {
134454
+ t2.exports = require("events");
134455
+ }, 147: (t2) => {
134456
134456
  "use strict";
134457
- e2.exports = require("fs");
134458
- }, 17: (e2) => {
134457
+ t2.exports = require("fs");
134458
+ }, 17: (t2) => {
134459
134459
  "use strict";
134460
- e2.exports = require("path");
134461
- }, 922: (e2, t2, i2) => {
134462
- const { Argument: n } = i2(969);
134463
- const { Command: s } = i2(694);
134464
- const { CommanderError: r, InvalidArgumentError: o } = i2(967);
134465
- const { Help: a } = i2(34);
134466
- const { Option: h } = i2(278);
134467
- t2 = e2.exports = new s();
134468
- t2.program = t2;
134469
- t2.Argument = n;
134470
- t2.Command = s;
134471
- t2.CommanderError = r;
134472
- t2.Help = a;
134473
- t2.InvalidArgumentError = o;
134474
- t2.InvalidOptionArgumentError = o;
134475
- t2.Option = h;
134476
- }, 969: (e2, t2, i2) => {
134477
- const { InvalidArgumentError: n } = i2(967);
134460
+ t2.exports = require("path");
134461
+ }, 282: (t2) => {
134462
+ "use strict";
134463
+ t2.exports = require("process");
134464
+ }, 632: (t2, e2, i2) => {
134465
+ const { Argument: n } = i2(535);
134466
+ const { Command: s } = i2(302);
134467
+ const { CommanderError: r, InvalidArgumentError: o } = i2(796);
134468
+ const { Help: a } = i2(519);
134469
+ const { Option: l } = i2(437);
134470
+ e2 = t2.exports = new s();
134471
+ e2.program = e2;
134472
+ e2.Argument = n;
134473
+ e2.Command = s;
134474
+ e2.CommanderError = r;
134475
+ e2.Help = a;
134476
+ e2.InvalidArgumentError = o;
134477
+ e2.InvalidOptionArgumentError = o;
134478
+ e2.Option = l;
134479
+ }, 535: (t2, e2, i2) => {
134480
+ const { InvalidArgumentError: n } = i2(796);
134478
134481
  class Argument {
134479
- constructor(e3, t3) {
134480
- this.description = t3 || "";
134482
+ constructor(t3, e3) {
134483
+ this.description = e3 || "";
134481
134484
  this.variadic = false;
134482
134485
  this.parseArg = void 0;
134483
134486
  this.defaultValue = void 0;
134484
134487
  this.defaultValueDescription = void 0;
134485
134488
  this.argChoices = void 0;
134486
- switch (e3[0]) {
134489
+ switch (t3[0]) {
134487
134490
  case "<":
134488
134491
  this.required = true;
134489
- this._name = e3.slice(1, -1);
134492
+ this._name = t3.slice(1, -1);
134490
134493
  break;
134491
134494
  case "[":
134492
134495
  this.required = false;
134493
- this._name = e3.slice(1, -1);
134496
+ this._name = t3.slice(1, -1);
134494
134497
  break;
134495
134498
  default:
134496
134499
  this.required = true;
134497
- this._name = e3;
134500
+ this._name = t3;
134498
134501
  break;
134499
134502
  }
134500
134503
  if (this._name.length > 3 && this._name.slice(-3) === "...") {
@@ -134505,31 +134508,31 @@ var require_commander2 = __commonJS({
134505
134508
  name() {
134506
134509
  return this._name;
134507
134510
  }
134508
- _concatValue(e3, t3) {
134509
- if (t3 === this.defaultValue || !Array.isArray(t3)) {
134510
- return [e3];
134511
+ _concatValue(t3, e3) {
134512
+ if (e3 === this.defaultValue || !Array.isArray(e3)) {
134513
+ return [t3];
134511
134514
  }
134512
- return t3.concat(e3);
134515
+ return e3.concat(t3);
134513
134516
  }
134514
- default(e3, t3) {
134515
- this.defaultValue = e3;
134516
- this.defaultValueDescription = t3;
134517
+ default(t3, e3) {
134518
+ this.defaultValue = t3;
134519
+ this.defaultValueDescription = e3;
134517
134520
  return this;
134518
134521
  }
134519
- argParser(e3) {
134520
- this.parseArg = e3;
134522
+ argParser(t3) {
134523
+ this.parseArg = t3;
134521
134524
  return this;
134522
134525
  }
134523
- choices(e3) {
134524
- this.argChoices = e3;
134525
- this.parseArg = (t3, i3) => {
134526
- if (!e3.includes(t3)) {
134527
- throw new n(`Allowed choices are ${e3.join(", ")}.`);
134526
+ choices(t3) {
134527
+ this.argChoices = t3.slice();
134528
+ this.parseArg = (t4, e3) => {
134529
+ if (!this.argChoices.includes(t4)) {
134530
+ throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
134528
134531
  }
134529
134532
  if (this.variadic) {
134530
- return this._concatValue(t3, i3);
134533
+ return this._concatValue(t4, e3);
134531
134534
  }
134532
- return t3;
134535
+ return t4;
134533
134536
  };
134534
134537
  return this;
134535
134538
  }
@@ -134542,24 +134545,25 @@ var require_commander2 = __commonJS({
134542
134545
  return this;
134543
134546
  }
134544
134547
  }
134545
- function humanReadableArgName(e3) {
134546
- const t3 = e3.name() + (e3.variadic === true ? "..." : "");
134547
- return e3.required ? "<" + t3 + ">" : "[" + t3 + "]";
134548
+ function humanReadableArgName(t3) {
134549
+ const e3 = t3.name() + (t3.variadic === true ? "..." : "");
134550
+ return t3.required ? "<" + e3 + ">" : "[" + e3 + "]";
134548
134551
  }
134549
- t2.Argument = Argument;
134550
- t2.humanReadableArgName = humanReadableArgName;
134551
- }, 694: (e2, t2, i2) => {
134552
+ e2.Argument = Argument;
134553
+ e2.humanReadableArgName = humanReadableArgName;
134554
+ }, 302: (t2, e2, i2) => {
134552
134555
  const n = i2(361).EventEmitter;
134553
134556
  const s = i2(81);
134554
134557
  const r = i2(17);
134555
134558
  const o = i2(147);
134556
- const { Argument: a, humanReadableArgName: h } = i2(969);
134557
- const { CommanderError: l } = i2(967);
134558
- const { Help: u } = i2(34);
134559
- const { Option: c, splitOptionFlags: p } = i2(278);
134560
- const { suggestSimilar: m } = i2(461);
134559
+ const a = i2(282);
134560
+ const { Argument: l, humanReadableArgName: h } = i2(535);
134561
+ const { CommanderError: u } = i2(796);
134562
+ const { Help: c } = i2(519);
134563
+ const { Option: p, splitOptionFlags: m, DualOptions: d } = i2(437);
134564
+ const { suggestSimilar: f } = i2(860);
134561
134565
  class Command2 extends n {
134562
- constructor(e3) {
134566
+ constructor(t3) {
134563
134567
  super();
134564
134568
  this.commands = [];
134565
134569
  this.options = [];
@@ -134571,25 +134575,27 @@ var require_commander2 = __commonJS({
134571
134575
  this.rawArgs = [];
134572
134576
  this.processedArgs = [];
134573
134577
  this._scriptPath = null;
134574
- this._name = e3 || "";
134578
+ this._name = t3 || "";
134575
134579
  this._optionValues = {};
134576
134580
  this._optionValueSources = {};
134577
134581
  this._storeOptionsAsProperties = false;
134578
134582
  this._actionHandler = null;
134579
134583
  this._executableHandler = false;
134580
134584
  this._executableFile = null;
134585
+ this._executableDir = null;
134581
134586
  this._defaultCommandName = null;
134582
134587
  this._exitCallback = null;
134583
134588
  this._aliases = [];
134584
134589
  this._combineFlagAndOptionalValue = true;
134585
134590
  this._description = "";
134591
+ this._summary = "";
134586
134592
  this._argsDescription = void 0;
134587
134593
  this._enablePositionalOptions = false;
134588
134594
  this._passThroughOptions = false;
134589
134595
  this._lifeCycleHooks = {};
134590
134596
  this._showHelpAfterError = false;
134591
- this._showSuggestionAfterError = false;
134592
- this._outputConfiguration = { writeOut: (e4) => process.stdout.write(e4), writeErr: (e4) => process.stderr.write(e4), getOutHelpWidth: () => process.stdout.isTTY ? process.stdout.columns : void 0, getErrHelpWidth: () => process.stderr.isTTY ? process.stderr.columns : void 0, outputError: (e4, t3) => t3(e4) };
134597
+ this._showSuggestionAfterError = true;
134598
+ 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) };
134593
134599
  this._hidden = false;
134594
134600
  this._hasHelpOption = true;
134595
134601
  this._helpFlags = "-h, --help";
@@ -134602,35 +134608,35 @@ var require_commander2 = __commonJS({
134602
134608
  this._helpCommandDescription = "display help for command";
134603
134609
  this._helpConfiguration = {};
134604
134610
  }
134605
- copyInheritedSettings(e3) {
134606
- this._outputConfiguration = e3._outputConfiguration;
134607
- this._hasHelpOption = e3._hasHelpOption;
134608
- this._helpFlags = e3._helpFlags;
134609
- this._helpDescription = e3._helpDescription;
134610
- this._helpShortFlag = e3._helpShortFlag;
134611
- this._helpLongFlag = e3._helpLongFlag;
134612
- this._helpCommandName = e3._helpCommandName;
134613
- this._helpCommandnameAndArgs = e3._helpCommandnameAndArgs;
134614
- this._helpCommandDescription = e3._helpCommandDescription;
134615
- this._helpConfiguration = e3._helpConfiguration;
134616
- this._exitCallback = e3._exitCallback;
134617
- this._storeOptionsAsProperties = e3._storeOptionsAsProperties;
134618
- this._combineFlagAndOptionalValue = e3._combineFlagAndOptionalValue;
134619
- this._allowExcessArguments = e3._allowExcessArguments;
134620
- this._enablePositionalOptions = e3._enablePositionalOptions;
134621
- this._showHelpAfterError = e3._showHelpAfterError;
134622
- this._showSuggestionAfterError = e3._showSuggestionAfterError;
134611
+ copyInheritedSettings(t3) {
134612
+ this._outputConfiguration = t3._outputConfiguration;
134613
+ this._hasHelpOption = t3._hasHelpOption;
134614
+ this._helpFlags = t3._helpFlags;
134615
+ this._helpDescription = t3._helpDescription;
134616
+ this._helpShortFlag = t3._helpShortFlag;
134617
+ this._helpLongFlag = t3._helpLongFlag;
134618
+ this._helpCommandName = t3._helpCommandName;
134619
+ this._helpCommandnameAndArgs = t3._helpCommandnameAndArgs;
134620
+ this._helpCommandDescription = t3._helpCommandDescription;
134621
+ this._helpConfiguration = t3._helpConfiguration;
134622
+ this._exitCallback = t3._exitCallback;
134623
+ this._storeOptionsAsProperties = t3._storeOptionsAsProperties;
134624
+ this._combineFlagAndOptionalValue = t3._combineFlagAndOptionalValue;
134625
+ this._allowExcessArguments = t3._allowExcessArguments;
134626
+ this._enablePositionalOptions = t3._enablePositionalOptions;
134627
+ this._showHelpAfterError = t3._showHelpAfterError;
134628
+ this._showSuggestionAfterError = t3._showSuggestionAfterError;
134623
134629
  return this;
134624
134630
  }
134625
- command(e3, t3, i3) {
134626
- let n2 = t3;
134631
+ command(t3, e3, i3) {
134632
+ let n2 = e3;
134627
134633
  let s2 = i3;
134628
134634
  if (typeof n2 === "object" && n2 !== null) {
134629
134635
  s2 = n2;
134630
134636
  n2 = null;
134631
134637
  }
134632
134638
  s2 = s2 || {};
134633
- const [, r2, o2] = e3.match(/([^ ]+) *(.*)/);
134639
+ const [, r2, o2] = t3.match(/([^ ]+) *(.*)/);
134634
134640
  const a2 = this.createCommand(r2);
134635
134641
  if (n2) {
134636
134642
  a2.description(n2);
@@ -134649,60 +134655,53 @@ var require_commander2 = __commonJS({
134649
134655
  return this;
134650
134656
  return a2;
134651
134657
  }
134652
- createCommand(e3) {
134653
- return new Command2(e3);
134658
+ createCommand(t3) {
134659
+ return new Command2(t3);
134654
134660
  }
134655
134661
  createHelp() {
134656
- return Object.assign(new u(), this.configureHelp());
134662
+ return Object.assign(new c(), this.configureHelp());
134657
134663
  }
134658
- configureHelp(e3) {
134659
- if (e3 === void 0)
134664
+ configureHelp(t3) {
134665
+ if (t3 === void 0)
134660
134666
  return this._helpConfiguration;
134661
- this._helpConfiguration = e3;
134667
+ this._helpConfiguration = t3;
134662
134668
  return this;
134663
134669
  }
134664
- configureOutput(e3) {
134665
- if (e3 === void 0)
134670
+ configureOutput(t3) {
134671
+ if (t3 === void 0)
134666
134672
  return this._outputConfiguration;
134667
- Object.assign(this._outputConfiguration, e3);
134673
+ Object.assign(this._outputConfiguration, t3);
134668
134674
  return this;
134669
134675
  }
134670
- showHelpAfterError(e3 = true) {
134671
- if (typeof e3 !== "string")
134672
- e3 = !!e3;
134673
- this._showHelpAfterError = e3;
134676
+ showHelpAfterError(t3 = true) {
134677
+ if (typeof t3 !== "string")
134678
+ t3 = !!t3;
134679
+ this._showHelpAfterError = t3;
134674
134680
  return this;
134675
134681
  }
134676
- showSuggestionAfterError(e3 = true) {
134677
- this._showSuggestionAfterError = !!e3;
134682
+ showSuggestionAfterError(t3 = true) {
134683
+ this._showSuggestionAfterError = !!t3;
134678
134684
  return this;
134679
134685
  }
134680
- addCommand(e3, t3) {
134681
- if (!e3._name)
134682
- throw new Error("Command passed to .addCommand() must have a name");
134683
- function checkExplicitNames(e4) {
134684
- e4.forEach((e5) => {
134685
- if (e5._executableHandler && !e5._executableFile) {
134686
- throw new Error(`Must specify executableFile for deeply nested executable: ${e5.name()}`);
134687
- }
134688
- checkExplicitNames(e5.commands);
134689
- });
134686
+ addCommand(t3, e3) {
134687
+ if (!t3._name) {
134688
+ throw new Error(`Command passed to .addCommand() must have a name
134689
+ - specify the name in Command constructor or using .name()`);
134690
134690
  }
134691
- checkExplicitNames(e3.commands);
134692
- t3 = t3 || {};
134693
- if (t3.isDefault)
134694
- this._defaultCommandName = e3._name;
134695
- if (t3.noHelp || t3.hidden)
134696
- e3._hidden = true;
134697
- this.commands.push(e3);
134698
- e3.parent = this;
134691
+ e3 = e3 || {};
134692
+ if (e3.isDefault)
134693
+ this._defaultCommandName = t3._name;
134694
+ if (e3.noHelp || e3.hidden)
134695
+ t3._hidden = true;
134696
+ this.commands.push(t3);
134697
+ t3.parent = this;
134699
134698
  return this;
134700
134699
  }
134701
- createArgument(e3, t3) {
134702
- return new a(e3, t3);
134700
+ createArgument(t3, e3) {
134701
+ return new l(t3, e3);
134703
134702
  }
134704
- argument(e3, t3, i3, n2) {
134705
- const s2 = this.createArgument(e3, t3);
134703
+ argument(t3, e3, i3, n2) {
134704
+ const s2 = this.createArgument(t3, e3);
134706
134705
  if (typeof i3 === "function") {
134707
134706
  s2.default(n2).argParser(i3);
134708
134707
  } else {
@@ -134711,33 +134710,33 @@ var require_commander2 = __commonJS({
134711
134710
  this.addArgument(s2);
134712
134711
  return this;
134713
134712
  }
134714
- arguments(e3) {
134715
- e3.split(/ +/).forEach((e4) => {
134716
- this.argument(e4);
134713
+ arguments(t3) {
134714
+ t3.split(/ +/).forEach((t4) => {
134715
+ this.argument(t4);
134717
134716
  });
134718
134717
  return this;
134719
134718
  }
134720
- addArgument(e3) {
134721
- const t3 = this._args.slice(-1)[0];
134722
- if (t3 && t3.variadic) {
134723
- throw new Error(`only the last argument can be variadic '${t3.name()}'`);
134719
+ addArgument(t3) {
134720
+ const e3 = this._args.slice(-1)[0];
134721
+ if (e3 && e3.variadic) {
134722
+ throw new Error(`only the last argument can be variadic '${e3.name()}'`);
134724
134723
  }
134725
- if (e3.required && e3.defaultValue !== void 0 && e3.parseArg === void 0) {
134726
- throw new Error(`a default value for a required argument is never used: '${e3.name()}'`);
134724
+ if (t3.required && t3.defaultValue !== void 0 && t3.parseArg === void 0) {
134725
+ throw new Error(`a default value for a required argument is never used: '${t3.name()}'`);
134727
134726
  }
134728
- this._args.push(e3);
134727
+ this._args.push(t3);
134729
134728
  return this;
134730
134729
  }
134731
- addHelpCommand(e3, t3) {
134732
- if (e3 === false) {
134730
+ addHelpCommand(t3, e3) {
134731
+ if (t3 === false) {
134733
134732
  this._addImplicitHelpCommand = false;
134734
134733
  } else {
134735
134734
  this._addImplicitHelpCommand = true;
134736
- if (typeof e3 === "string") {
134737
- this._helpCommandName = e3.split(" ")[0];
134738
- this._helpCommandnameAndArgs = e3;
134735
+ if (typeof t3 === "string") {
134736
+ this._helpCommandName = t3.split(" ")[0];
134737
+ this._helpCommandnameAndArgs = t3;
134739
134738
  }
134740
- this._helpCommandDescription = t3 || this._helpCommandDescription;
134739
+ this._helpCommandDescription = e3 || this._helpCommandDescription;
134741
134740
  }
134742
134741
  return this;
134743
134742
  }
@@ -134747,116 +134746,121 @@ var require_commander2 = __commonJS({
134747
134746
  }
134748
134747
  return this._addImplicitHelpCommand;
134749
134748
  }
134750
- hook(e3, t3) {
134751
- const i3 = ["preAction", "postAction"];
134752
- if (!i3.includes(e3)) {
134753
- throw new Error(`Unexpected value for event passed to hook : '${e3}'.
134749
+ hook(t3, e3) {
134750
+ const i3 = ["preSubcommand", "preAction", "postAction"];
134751
+ if (!i3.includes(t3)) {
134752
+ throw new Error(`Unexpected value for event passed to hook : '${t3}'.
134754
134753
  Expecting one of '${i3.join("', '")}'`);
134755
134754
  }
134756
- if (this._lifeCycleHooks[e3]) {
134757
- this._lifeCycleHooks[e3].push(t3);
134755
+ if (this._lifeCycleHooks[t3]) {
134756
+ this._lifeCycleHooks[t3].push(e3);
134758
134757
  } else {
134759
- this._lifeCycleHooks[e3] = [t3];
134758
+ this._lifeCycleHooks[t3] = [e3];
134760
134759
  }
134761
134760
  return this;
134762
134761
  }
134763
- exitOverride(e3) {
134764
- if (e3) {
134765
- this._exitCallback = e3;
134762
+ exitOverride(t3) {
134763
+ if (t3) {
134764
+ this._exitCallback = t3;
134766
134765
  } else {
134767
- this._exitCallback = (e4) => {
134768
- if (e4.code !== "commander.executeSubCommandAsync") {
134769
- throw e4;
134766
+ this._exitCallback = (t4) => {
134767
+ if (t4.code !== "commander.executeSubCommandAsync") {
134768
+ throw t4;
134770
134769
  } else {
134771
134770
  }
134772
134771
  };
134773
134772
  }
134774
134773
  return this;
134775
134774
  }
134776
- _exit(e3, t3, i3) {
134775
+ _exit(t3, e3, i3) {
134777
134776
  if (this._exitCallback) {
134778
- this._exitCallback(new l(e3, t3, i3));
134777
+ this._exitCallback(new u(t3, e3, i3));
134779
134778
  }
134780
- process.exit(e3);
134779
+ a.exit(t3);
134781
134780
  }
134782
- action(e3) {
134783
- const listener = (t3) => {
134781
+ action(t3) {
134782
+ const listener = (e3) => {
134784
134783
  const i3 = this._args.length;
134785
- const n2 = t3.slice(0, i3);
134784
+ const n2 = e3.slice(0, i3);
134786
134785
  if (this._storeOptionsAsProperties) {
134787
134786
  n2[i3] = this;
134788
134787
  } else {
134789
134788
  n2[i3] = this.opts();
134790
134789
  }
134791
134790
  n2.push(this);
134792
- return e3.apply(this, n2);
134791
+ return t3.apply(this, n2);
134793
134792
  };
134794
134793
  this._actionHandler = listener;
134795
134794
  return this;
134796
134795
  }
134797
- createOption(e3, t3) {
134798
- return new c(e3, t3);
134796
+ createOption(t3, e3) {
134797
+ return new p(t3, e3);
134799
134798
  }
134800
- addOption(e3) {
134801
- const t3 = e3.name();
134802
- const i3 = e3.attributeName();
134803
- let n2 = e3.defaultValue;
134804
- if (e3.negate || e3.optional || e3.required || typeof n2 === "boolean") {
134805
- if (e3.negate) {
134806
- const t4 = e3.long.replace(/^--no-/, "--");
134807
- n2 = this._findOption(t4) ? this.getOptionValue(i3) : true;
134808
- }
134809
- if (n2 !== void 0) {
134810
- this.setOptionValueWithSource(i3, n2, "default");
134799
+ addOption(t3) {
134800
+ const e3 = t3.name();
134801
+ const i3 = t3.attributeName();
134802
+ if (t3.negate) {
134803
+ const e4 = t3.long.replace(/^--no-/, "--");
134804
+ if (!this._findOption(e4)) {
134805
+ this.setOptionValueWithSource(i3, t3.defaultValue === void 0 ? true : t3.defaultValue, "default");
134811
134806
  }
134807
+ } else if (t3.defaultValue !== void 0) {
134808
+ this.setOptionValueWithSource(i3, t3.defaultValue, "default");
134812
134809
  }
134813
- this.options.push(e3);
134814
- const handleOptionValue = (t4, s2, r2) => {
134815
- const o2 = this.getOptionValue(i3);
134816
- if (t4 !== null && e3.parseArg) {
134810
+ this.options.push(t3);
134811
+ const handleOptionValue = (e4, n2, s2) => {
134812
+ if (e4 == null && t3.presetArg !== void 0) {
134813
+ e4 = t3.presetArg;
134814
+ }
134815
+ const r2 = this.getOptionValue(i3);
134816
+ if (e4 !== null && t3.parseArg) {
134817
134817
  try {
134818
- t4 = e3.parseArg(t4, o2 === void 0 ? n2 : o2);
134819
- } catch (e4) {
134820
- if (e4.code === "commander.invalidArgument") {
134821
- const t5 = `${s2} ${e4.message}`;
134822
- this._displayError(e4.exitCode, e4.code, t5);
134818
+ e4 = t3.parseArg(e4, r2);
134819
+ } catch (t4) {
134820
+ if (t4.code === "commander.invalidArgument") {
134821
+ const e5 = `${n2} ${t4.message}`;
134822
+ this.error(e5, { exitCode: t4.exitCode, code: t4.code });
134823
134823
  }
134824
- throw e4;
134824
+ throw t4;
134825
134825
  }
134826
- } else if (t4 !== null && e3.variadic) {
134827
- t4 = e3._concatValue(t4, o2);
134826
+ } else if (e4 !== null && t3.variadic) {
134827
+ e4 = t3._concatValue(e4, r2);
134828
134828
  }
134829
- if (typeof o2 === "boolean" || typeof o2 === "undefined") {
134830
- if (t4 == null) {
134831
- this.setOptionValueWithSource(i3, e3.negate ? false : n2 || true, r2);
134829
+ if (e4 == null) {
134830
+ if (t3.negate) {
134831
+ e4 = false;
134832
+ } else if (t3.isBoolean() || t3.optional) {
134833
+ e4 = true;
134832
134834
  } else {
134833
- this.setOptionValueWithSource(i3, t4, r2);
134835
+ e4 = "";
134834
134836
  }
134835
- } else if (t4 !== null) {
134836
- this.setOptionValueWithSource(i3, e3.negate ? false : t4, r2);
134837
134837
  }
134838
+ this.setOptionValueWithSource(i3, e4, s2);
134838
134839
  };
134839
- this.on("option:" + t3, (t4) => {
134840
- const i4 = `error: option '${e3.flags}' argument '${t4}' is invalid.`;
134841
- handleOptionValue(t4, i4, "cli");
134840
+ this.on("option:" + e3, (e4) => {
134841
+ const i4 = `error: option '${t3.flags}' argument '${e4}' is invalid.`;
134842
+ handleOptionValue(e4, i4, "cli");
134842
134843
  });
134843
- if (e3.envVar) {
134844
- this.on("optionEnv:" + t3, (t4) => {
134845
- const i4 = `error: option '${e3.flags}' value '${t4}' from env '${e3.envVar}' is invalid.`;
134846
- handleOptionValue(t4, i4, "env");
134844
+ if (t3.envVar) {
134845
+ this.on("optionEnv:" + e3, (e4) => {
134846
+ const i4 = `error: option '${t3.flags}' value '${e4}' from env '${t3.envVar}' is invalid.`;
134847
+ handleOptionValue(e4, i4, "env");
134847
134848
  });
134848
134849
  }
134849
134850
  return this;
134850
134851
  }
134851
- _optionEx(e3, t3, i3, n2, s2) {
134852
- const r2 = this.createOption(t3, i3);
134853
- r2.makeOptionMandatory(!!e3.mandatory);
134852
+ _optionEx(t3, e3, i3, n2, s2) {
134853
+ if (typeof e3 === "object" && e3 instanceof p) {
134854
+ throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
134855
+ }
134856
+ const r2 = this.createOption(e3, i3);
134857
+ r2.makeOptionMandatory(!!t3.mandatory);
134854
134858
  if (typeof n2 === "function") {
134855
134859
  r2.default(s2).argParser(n2);
134856
134860
  } else if (n2 instanceof RegExp) {
134857
- const e4 = n2;
134858
- n2 = (t4, i4) => {
134859
- const n3 = e4.exec(t4);
134861
+ const t4 = n2;
134862
+ n2 = (e4, i4) => {
134863
+ const n3 = t4.exec(e4);
134860
134864
  return n3 ? n3[0] : i4;
134861
134865
  };
134862
134866
  r2.default(s2).argParser(n2);
@@ -134865,209 +134869,233 @@ Expecting one of '${i3.join("', '")}'`);
134865
134869
  }
134866
134870
  return this.addOption(r2);
134867
134871
  }
134868
- option(e3, t3, i3, n2) {
134869
- return this._optionEx({}, e3, t3, i3, n2);
134872
+ option(t3, e3, i3, n2) {
134873
+ return this._optionEx({}, t3, e3, i3, n2);
134870
134874
  }
134871
- requiredOption(e3, t3, i3, n2) {
134872
- return this._optionEx({ mandatory: true }, e3, t3, i3, n2);
134875
+ requiredOption(t3, e3, i3, n2) {
134876
+ return this._optionEx({ mandatory: true }, t3, e3, i3, n2);
134873
134877
  }
134874
- combineFlagAndOptionalValue(e3 = true) {
134875
- this._combineFlagAndOptionalValue = !!e3;
134878
+ combineFlagAndOptionalValue(t3 = true) {
134879
+ this._combineFlagAndOptionalValue = !!t3;
134876
134880
  return this;
134877
134881
  }
134878
- allowUnknownOption(e3 = true) {
134879
- this._allowUnknownOption = !!e3;
134882
+ allowUnknownOption(t3 = true) {
134883
+ this._allowUnknownOption = !!t3;
134880
134884
  return this;
134881
134885
  }
134882
- allowExcessArguments(e3 = true) {
134883
- this._allowExcessArguments = !!e3;
134886
+ allowExcessArguments(t3 = true) {
134887
+ this._allowExcessArguments = !!t3;
134884
134888
  return this;
134885
134889
  }
134886
- enablePositionalOptions(e3 = true) {
134887
- this._enablePositionalOptions = !!e3;
134890
+ enablePositionalOptions(t3 = true) {
134891
+ this._enablePositionalOptions = !!t3;
134888
134892
  return this;
134889
134893
  }
134890
- passThroughOptions(e3 = true) {
134891
- this._passThroughOptions = !!e3;
134892
- if (!!this.parent && e3 && !this.parent._enablePositionalOptions) {
134894
+ passThroughOptions(t3 = true) {
134895
+ this._passThroughOptions = !!t3;
134896
+ if (!!this.parent && t3 && !this.parent._enablePositionalOptions) {
134893
134897
  throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
134894
134898
  }
134895
134899
  return this;
134896
134900
  }
134897
- storeOptionsAsProperties(e3 = true) {
134898
- this._storeOptionsAsProperties = !!e3;
134901
+ storeOptionsAsProperties(t3 = true) {
134902
+ this._storeOptionsAsProperties = !!t3;
134899
134903
  if (this.options.length) {
134900
134904
  throw new Error("call .storeOptionsAsProperties() before adding options");
134901
134905
  }
134902
134906
  return this;
134903
134907
  }
134904
- getOptionValue(e3) {
134908
+ getOptionValue(t3) {
134905
134909
  if (this._storeOptionsAsProperties) {
134906
- return this[e3];
134910
+ return this[t3];
134907
134911
  }
134908
- return this._optionValues[e3];
134912
+ return this._optionValues[t3];
134909
134913
  }
134910
- setOptionValue(e3, t3) {
134914
+ setOptionValue(t3, e3) {
134915
+ return this.setOptionValueWithSource(t3, e3, void 0);
134916
+ }
134917
+ setOptionValueWithSource(t3, e3, i3) {
134911
134918
  if (this._storeOptionsAsProperties) {
134912
- this[e3] = t3;
134919
+ this[t3] = e3;
134913
134920
  } else {
134914
- this._optionValues[e3] = t3;
134921
+ this._optionValues[t3] = e3;
134915
134922
  }
134923
+ this._optionValueSources[t3] = i3;
134916
134924
  return this;
134917
134925
  }
134918
- setOptionValueWithSource(e3, t3, i3) {
134919
- this.setOptionValue(e3, t3);
134920
- this._optionValueSources[e3] = i3;
134921
- return this;
134926
+ getOptionValueSource(t3) {
134927
+ return this._optionValueSources[t3];
134922
134928
  }
134923
- getOptionValueSource(e3) {
134924
- return this._optionValueSources[e3];
134929
+ getOptionValueSourceWithGlobals(t3) {
134930
+ let e3;
134931
+ getCommandAndParents(this).forEach((i3) => {
134932
+ if (i3.getOptionValueSource(t3) !== void 0) {
134933
+ e3 = i3.getOptionValueSource(t3);
134934
+ }
134935
+ });
134936
+ return e3;
134925
134937
  }
134926
- _prepareUserArgs(e3, t3) {
134927
- if (e3 !== void 0 && !Array.isArray(e3)) {
134938
+ _prepareUserArgs(t3, e3) {
134939
+ if (t3 !== void 0 && !Array.isArray(t3)) {
134928
134940
  throw new Error("first parameter to parse must be array or undefined");
134929
134941
  }
134930
- t3 = t3 || {};
134931
- if (e3 === void 0) {
134932
- e3 = process.argv;
134933
- if (process.versions && process.versions.electron) {
134934
- t3.from = "electron";
134942
+ e3 = e3 || {};
134943
+ if (t3 === void 0) {
134944
+ t3 = a.argv;
134945
+ if (a.versions && a.versions.electron) {
134946
+ e3.from = "electron";
134935
134947
  }
134936
134948
  }
134937
- this.rawArgs = e3.slice();
134949
+ this.rawArgs = t3.slice();
134938
134950
  let i3;
134939
- switch (t3.from) {
134951
+ switch (e3.from) {
134940
134952
  case void 0:
134941
134953
  case "node":
134942
- this._scriptPath = e3[1];
134943
- i3 = e3.slice(2);
134954
+ this._scriptPath = t3[1];
134955
+ i3 = t3.slice(2);
134944
134956
  break;
134945
134957
  case "electron":
134946
- if (process.defaultApp) {
134947
- this._scriptPath = e3[1];
134948
- i3 = e3.slice(2);
134958
+ if (a.defaultApp) {
134959
+ this._scriptPath = t3[1];
134960
+ i3 = t3.slice(2);
134949
134961
  } else {
134950
- i3 = e3.slice(1);
134962
+ i3 = t3.slice(1);
134951
134963
  }
134952
134964
  break;
134953
134965
  case "user":
134954
- i3 = e3.slice(0);
134966
+ i3 = t3.slice(0);
134955
134967
  break;
134956
134968
  default:
134957
- throw new Error(`unexpected parse option { from: '${t3.from}' }`);
134969
+ throw new Error(`unexpected parse option { from: '${e3.from}' }`);
134958
134970
  }
134959
- if (!this._scriptPath && require.main) {
134960
- this._scriptPath = require.main.filename;
134961
- }
134962
- this._name = this._name || this._scriptPath && r.basename(this._scriptPath, r.extname(this._scriptPath));
134971
+ if (!this._name && this._scriptPath)
134972
+ this.nameFromFilename(this._scriptPath);
134973
+ this._name = this._name || "program";
134963
134974
  return i3;
134964
134975
  }
134965
- parse(e3, t3) {
134966
- const i3 = this._prepareUserArgs(e3, t3);
134976
+ parse(t3, e3) {
134977
+ const i3 = this._prepareUserArgs(t3, e3);
134967
134978
  this._parseCommand([], i3);
134968
134979
  return this;
134969
134980
  }
134970
- parseAsync(e3, t3) {
134981
+ parseAsync(t3, e3) {
134971
134982
  return __async(this, null, function* () {
134972
- const i3 = this._prepareUserArgs(e3, t3);
134983
+ const i3 = this._prepareUserArgs(t3, e3);
134973
134984
  yield this._parseCommand([], i3);
134974
134985
  return this;
134975
134986
  });
134976
134987
  }
134977
- _executeSubCommand(e3, t3) {
134978
- t3 = t3.slice();
134988
+ _executeSubCommand(t3, e3) {
134989
+ e3 = e3.slice();
134979
134990
  let i3 = false;
134980
134991
  const n2 = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
134981
- this._checkForMissingMandatoryOptions();
134982
- let a2 = this._scriptPath;
134983
- if (!a2 && require.main) {
134984
- a2 = require.main.filename;
134985
- }
134986
- let h2;
134987
- try {
134988
- const e4 = o.realpathSync(a2);
134989
- h2 = r.dirname(e4);
134990
- } catch (e4) {
134991
- h2 = ".";
134992
+ function findFile(t4, e4) {
134993
+ const i4 = r.resolve(t4, e4);
134994
+ if (o.existsSync(i4))
134995
+ return i4;
134996
+ if (n2.includes(r.extname(e4)))
134997
+ return void 0;
134998
+ const s2 = n2.find((t5) => o.existsSync(`${i4}${t5}`));
134999
+ if (s2)
135000
+ return `${i4}${s2}`;
135001
+ return void 0;
134992
135002
  }
134993
- let u2 = r.basename(a2, r.extname(a2)) + "-" + e3._name;
134994
- if (e3._executableFile) {
134995
- u2 = e3._executableFile;
135003
+ this._checkForMissingMandatoryOptions();
135004
+ this._checkForConflictingOptions();
135005
+ let l2 = t3._executableFile || `${this._name}-${t3._name}`;
135006
+ let h2 = this._executableDir || "";
135007
+ if (this._scriptPath) {
135008
+ let t4;
135009
+ try {
135010
+ t4 = o.realpathSync(this._scriptPath);
135011
+ } catch (e4) {
135012
+ t4 = this._scriptPath;
135013
+ }
135014
+ h2 = r.resolve(r.dirname(t4), h2);
134996
135015
  }
134997
- const c2 = r.join(h2, u2);
134998
- if (o.existsSync(c2)) {
134999
- u2 = c2;
135000
- } else {
135001
- n2.forEach((e4) => {
135002
- if (o.existsSync(`${c2}${e4}`)) {
135003
- u2 = `${c2}${e4}`;
135016
+ if (h2) {
135017
+ let e4 = findFile(h2, l2);
135018
+ if (!e4 && !t3._executableFile && this._scriptPath) {
135019
+ const i4 = r.basename(this._scriptPath, r.extname(this._scriptPath));
135020
+ if (i4 !== this._name) {
135021
+ e4 = findFile(h2, `${i4}-${t3._name}`);
135004
135022
  }
135005
- });
135023
+ }
135024
+ l2 = e4 || l2;
135006
135025
  }
135007
- i3 = n2.includes(r.extname(u2));
135008
- let p2;
135009
- if (process.platform !== "win32") {
135026
+ i3 = n2.includes(r.extname(l2));
135027
+ let c2;
135028
+ if (a.platform !== "win32") {
135010
135029
  if (i3) {
135011
- t3.unshift(u2);
135012
- t3 = incrementNodeInspectorPort(process.execArgv).concat(t3);
135013
- p2 = s.spawn(process.argv[0], t3, { stdio: "inherit" });
135030
+ e3.unshift(l2);
135031
+ e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
135032
+ c2 = s.spawn(a.argv[0], e3, { stdio: "inherit" });
135014
135033
  } else {
135015
- p2 = s.spawn(u2, t3, { stdio: "inherit" });
135034
+ c2 = s.spawn(l2, e3, { stdio: "inherit" });
135016
135035
  }
135017
135036
  } else {
135018
- t3.unshift(u2);
135019
- t3 = incrementNodeInspectorPort(process.execArgv).concat(t3);
135020
- p2 = s.spawn(process.execPath, t3, { stdio: "inherit" });
135021
- }
135022
- const m2 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
135023
- m2.forEach((e4) => {
135024
- process.on(e4, () => {
135025
- if (p2.killed === false && p2.exitCode === null) {
135026
- p2.kill(e4);
135027
- }
135037
+ e3.unshift(l2);
135038
+ e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
135039
+ c2 = s.spawn(a.execPath, e3, { stdio: "inherit" });
135040
+ }
135041
+ if (!c2.killed) {
135042
+ const t4 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
135043
+ t4.forEach((t5) => {
135044
+ a.on(t5, () => {
135045
+ if (c2.killed === false && c2.exitCode === null) {
135046
+ c2.kill(t5);
135047
+ }
135048
+ });
135028
135049
  });
135029
- });
135030
- const d = this._exitCallback;
135031
- if (!d) {
135032
- p2.on("close", process.exit.bind(process));
135050
+ }
135051
+ const p2 = this._exitCallback;
135052
+ if (!p2) {
135053
+ c2.on("close", a.exit.bind(a));
135033
135054
  } else {
135034
- p2.on("close", () => {
135035
- d(new l(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
135055
+ c2.on("close", () => {
135056
+ p2(new u(a.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
135036
135057
  });
135037
135058
  }
135038
- p2.on("error", (t4) => {
135039
- if (t4.code === "ENOENT") {
135040
- const t5 = `'${u2}' does not exist
135041
- - if '${e3._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
135042
- - if the default executable name is not suitable, use the executableFile option to supply a custom name`;
135043
- throw new Error(t5);
135044
- } else if (t4.code === "EACCES") {
135045
- throw new Error(`'${u2}' not executable`);
135046
- }
135047
- if (!d) {
135048
- process.exit(1);
135059
+ c2.on("error", (e4) => {
135060
+ if (e4.code === "ENOENT") {
135061
+ 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";
135062
+ const i4 = `'${l2}' does not exist
135063
+ - if '${t3._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
135064
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
135065
+ - ${e5}`;
135066
+ throw new Error(i4);
135067
+ } else if (e4.code === "EACCES") {
135068
+ throw new Error(`'${l2}' not executable`);
135069
+ }
135070
+ if (!p2) {
135071
+ a.exit(1);
135049
135072
  } else {
135050
- const e4 = new l(1, "commander.executeSubCommandAsync", "(error)");
135051
- e4.nestedError = t4;
135052
- d(e4);
135073
+ const t4 = new u(1, "commander.executeSubCommandAsync", "(error)");
135074
+ t4.nestedError = e4;
135075
+ p2(t4);
135053
135076
  }
135054
135077
  });
135055
- this.runningCommand = p2;
135078
+ this.runningCommand = c2;
135056
135079
  }
135057
- _dispatchSubcommand(e3, t3, i3) {
135058
- const n2 = this._findCommand(e3);
135080
+ _dispatchSubcommand(t3, e3, i3) {
135081
+ const n2 = this._findCommand(t3);
135059
135082
  if (!n2)
135060
135083
  this.help({ error: true });
135061
- if (n2._executableHandler) {
135062
- this._executeSubCommand(n2, t3.concat(i3));
135063
- } else {
135064
- return n2._parseCommand(t3, i3);
135065
- }
135084
+ let s2;
135085
+ s2 = this._chainOrCallSubCommandHook(s2, n2, "preSubcommand");
135086
+ s2 = this._chainOrCall(s2, () => {
135087
+ if (n2._executableHandler) {
135088
+ this._executeSubCommand(n2, e3.concat(i3));
135089
+ } else {
135090
+ return n2._parseCommand(e3, i3);
135091
+ }
135092
+ });
135093
+ return s2;
135066
135094
  }
135067
135095
  _checkNumberOfArguments() {
135068
- this._args.forEach((e3, t3) => {
135069
- if (e3.required && this.args[t3] == null) {
135070
- this.missingArgument(e3.name());
135096
+ this._args.forEach((t3, e3) => {
135097
+ if (t3.required && this.args[e3] == null) {
135098
+ this.missingArgument(t3.name());
135071
135099
  }
135072
135100
  });
135073
135101
  if (this._args.length > 0 && this._args[this._args.length - 1].variadic) {
@@ -135078,15 +135106,15 @@ Expecting one of '${i3.join("', '")}'`);
135078
135106
  }
135079
135107
  }
135080
135108
  _processArguments() {
135081
- const myParseArg = (e4, t3, i3) => {
135082
- let n2 = t3;
135083
- if (t3 !== null && e4.parseArg) {
135109
+ const myParseArg = (t4, e3, i3) => {
135110
+ let n2 = e3;
135111
+ if (e3 !== null && t4.parseArg) {
135084
135112
  try {
135085
- n2 = e4.parseArg(t3, i3);
135113
+ n2 = t4.parseArg(e3, i3);
135086
135114
  } catch (i4) {
135087
135115
  if (i4.code === "commander.invalidArgument") {
135088
- const n3 = `error: command-argument value '${t3}' is invalid for argument '${e4.name()}'. ${i4.message}`;
135089
- this._displayError(i4.exitCode, i4.code, n3);
135116
+ const n3 = `error: command-argument value '${e3}' is invalid for argument '${t4.name()}'. ${i4.message}`;
135117
+ this.error(n3, { exitCode: i4.exitCode, code: i4.code });
135090
135118
  }
135091
135119
  throw i4;
135092
135120
  }
@@ -135094,74 +135122,85 @@ Expecting one of '${i3.join("', '")}'`);
135094
135122
  return n2;
135095
135123
  };
135096
135124
  this._checkNumberOfArguments();
135097
- const e3 = [];
135098
- this._args.forEach((t3, i3) => {
135099
- let n2 = t3.defaultValue;
135100
- if (t3.variadic) {
135125
+ const t3 = [];
135126
+ this._args.forEach((e3, i3) => {
135127
+ let n2 = e3.defaultValue;
135128
+ if (e3.variadic) {
135101
135129
  if (i3 < this.args.length) {
135102
135130
  n2 = this.args.slice(i3);
135103
- if (t3.parseArg) {
135104
- n2 = n2.reduce((e4, i4) => myParseArg(t3, i4, e4), t3.defaultValue);
135131
+ if (e3.parseArg) {
135132
+ n2 = n2.reduce((t4, i4) => myParseArg(e3, i4, t4), e3.defaultValue);
135105
135133
  }
135106
135134
  } else if (n2 === void 0) {
135107
135135
  n2 = [];
135108
135136
  }
135109
135137
  } else if (i3 < this.args.length) {
135110
135138
  n2 = this.args[i3];
135111
- if (t3.parseArg) {
135112
- n2 = myParseArg(t3, n2, t3.defaultValue);
135139
+ if (e3.parseArg) {
135140
+ n2 = myParseArg(e3, n2, e3.defaultValue);
135113
135141
  }
135114
135142
  }
135115
- e3[i3] = n2;
135143
+ t3[i3] = n2;
135116
135144
  });
135117
- this.processedArgs = e3;
135145
+ this.processedArgs = t3;
135118
135146
  }
135119
- _chainOrCall(e3, t3) {
135120
- if (e3 && e3.then && typeof e3.then === "function") {
135121
- return e3.then(() => t3());
135147
+ _chainOrCall(t3, e3) {
135148
+ if (t3 && t3.then && typeof t3.then === "function") {
135149
+ return t3.then(() => e3());
135122
135150
  }
135123
- return t3();
135151
+ return e3();
135124
135152
  }
135125
- _chainOrCallHooks(e3, t3) {
135126
- let i3 = e3;
135153
+ _chainOrCallHooks(t3, e3) {
135154
+ let i3 = t3;
135127
135155
  const n2 = [];
135128
- getCommandAndParents(this).reverse().filter((e4) => e4._lifeCycleHooks[t3] !== void 0).forEach((e4) => {
135129
- e4._lifeCycleHooks[t3].forEach((t4) => {
135130
- n2.push({ hookedCommand: e4, callback: t4 });
135156
+ getCommandAndParents(this).reverse().filter((t4) => t4._lifeCycleHooks[e3] !== void 0).forEach((t4) => {
135157
+ t4._lifeCycleHooks[e3].forEach((e4) => {
135158
+ n2.push({ hookedCommand: t4, callback: e4 });
135131
135159
  });
135132
135160
  });
135133
- if (t3 === "postAction") {
135161
+ if (e3 === "postAction") {
135134
135162
  n2.reverse();
135135
135163
  }
135136
- n2.forEach((e4) => {
135137
- i3 = this._chainOrCall(i3, () => e4.callback(e4.hookedCommand, this));
135164
+ n2.forEach((t4) => {
135165
+ i3 = this._chainOrCall(i3, () => t4.callback(t4.hookedCommand, this));
135138
135166
  });
135139
135167
  return i3;
135140
135168
  }
135141
- _parseCommand(e3, t3) {
135142
- const i3 = this.parseOptions(t3);
135143
- this._parseOptionsEnv();
135144
- e3 = e3.concat(i3.operands);
135145
- t3 = i3.unknown;
135146
- this.args = e3.concat(t3);
135147
- if (e3 && this._findCommand(e3[0])) {
135148
- return this._dispatchSubcommand(e3[0], e3.slice(1), t3);
135169
+ _chainOrCallSubCommandHook(t3, e3, i3) {
135170
+ let n2 = t3;
135171
+ if (this._lifeCycleHooks[i3] !== void 0) {
135172
+ this._lifeCycleHooks[i3].forEach((t4) => {
135173
+ n2 = this._chainOrCall(n2, () => t4(this, e3));
135174
+ });
135149
135175
  }
135150
- if (this._hasImplicitHelpCommand() && e3[0] === this._helpCommandName) {
135151
- if (e3.length === 1) {
135176
+ return n2;
135177
+ }
135178
+ _parseCommand(t3, e3) {
135179
+ const i3 = this.parseOptions(e3);
135180
+ this._parseOptionsEnv();
135181
+ this._parseOptionsImplied();
135182
+ t3 = t3.concat(i3.operands);
135183
+ e3 = i3.unknown;
135184
+ this.args = t3.concat(e3);
135185
+ if (t3 && this._findCommand(t3[0])) {
135186
+ return this._dispatchSubcommand(t3[0], t3.slice(1), e3);
135187
+ }
135188
+ if (this._hasImplicitHelpCommand() && t3[0] === this._helpCommandName) {
135189
+ if (t3.length === 1) {
135152
135190
  this.help();
135153
135191
  }
135154
- return this._dispatchSubcommand(e3[1], [], [this._helpLongFlag]);
135192
+ return this._dispatchSubcommand(t3[1], [], [this._helpLongFlag]);
135155
135193
  }
135156
135194
  if (this._defaultCommandName) {
135157
- outputHelpIfRequested(this, t3);
135158
- return this._dispatchSubcommand(this._defaultCommandName, e3, t3);
135195
+ outputHelpIfRequested(this, e3);
135196
+ return this._dispatchSubcommand(this._defaultCommandName, t3, e3);
135159
135197
  }
135160
135198
  if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
135161
135199
  this.help({ error: true });
135162
135200
  }
135163
135201
  outputHelpIfRequested(this, i3.unknown);
135164
135202
  this._checkForMissingMandatoryOptions();
135203
+ this._checkForConflictingOptions();
135165
135204
  const checkForUnknownOptions = () => {
135166
135205
  if (i3.unknown.length > 0) {
135167
135206
  this.unknownOption(i3.unknown[0]);
@@ -135174,21 +135213,24 @@ Expecting one of '${i3.join("', '")}'`);
135174
135213
  let i4;
135175
135214
  i4 = this._chainOrCallHooks(i4, "preAction");
135176
135215
  i4 = this._chainOrCall(i4, () => this._actionHandler(this.processedArgs));
135177
- if (this.parent)
135178
- this.parent.emit(n2, e3, t3);
135216
+ if (this.parent) {
135217
+ i4 = this._chainOrCall(i4, () => {
135218
+ this.parent.emit(n2, t3, e3);
135219
+ });
135220
+ }
135179
135221
  i4 = this._chainOrCallHooks(i4, "postAction");
135180
135222
  return i4;
135181
135223
  }
135182
135224
  if (this.parent && this.parent.listenerCount(n2)) {
135183
135225
  checkForUnknownOptions();
135184
135226
  this._processArguments();
135185
- this.parent.emit(n2, e3, t3);
135186
- } else if (e3.length) {
135227
+ this.parent.emit(n2, t3, e3);
135228
+ } else if (t3.length) {
135187
135229
  if (this._findCommand("*")) {
135188
- return this._dispatchSubcommand("*", e3, t3);
135230
+ return this._dispatchSubcommand("*", t3, e3);
135189
135231
  }
135190
135232
  if (this.listenerCount("command:*")) {
135191
- this.emit("command:*", e3, t3);
135233
+ this.emit("command:*", t3, e3);
135192
135234
  } else if (this.commands.length) {
135193
135235
  this.unknownCommand();
135194
135236
  } else {
@@ -135203,131 +135245,155 @@ Expecting one of '${i3.join("', '")}'`);
135203
135245
  this._processArguments();
135204
135246
  }
135205
135247
  }
135206
- _findCommand(e3) {
135207
- if (!e3)
135248
+ _findCommand(t3) {
135249
+ if (!t3)
135208
135250
  return void 0;
135209
- return this.commands.find((t3) => t3._name === e3 || t3._aliases.includes(e3));
135251
+ return this.commands.find((e3) => e3._name === t3 || e3._aliases.includes(t3));
135210
135252
  }
135211
- _findOption(e3) {
135212
- return this.options.find((t3) => t3.is(e3));
135253
+ _findOption(t3) {
135254
+ return this.options.find((e3) => e3.is(t3));
135213
135255
  }
135214
135256
  _checkForMissingMandatoryOptions() {
135215
- for (let e3 = this; e3; e3 = e3.parent) {
135216
- e3.options.forEach((t3) => {
135217
- if (t3.mandatory && e3.getOptionValue(t3.attributeName()) === void 0) {
135218
- e3.missingMandatoryOptionValue(t3);
135257
+ for (let t3 = this; t3; t3 = t3.parent) {
135258
+ t3.options.forEach((e3) => {
135259
+ if (e3.mandatory && t3.getOptionValue(e3.attributeName()) === void 0) {
135260
+ t3.missingMandatoryOptionValue(e3);
135219
135261
  }
135220
135262
  });
135221
135263
  }
135222
135264
  }
135223
- parseOptions(e3) {
135224
- const t3 = [];
135265
+ _checkForConflictingLocalOptions() {
135266
+ const t3 = this.options.filter((t4) => {
135267
+ const e4 = t4.attributeName();
135268
+ if (this.getOptionValue(e4) === void 0) {
135269
+ return false;
135270
+ }
135271
+ return this.getOptionValueSource(e4) !== "default";
135272
+ });
135273
+ const e3 = t3.filter((t4) => t4.conflictsWith.length > 0);
135274
+ e3.forEach((e4) => {
135275
+ const i3 = t3.find((t4) => e4.conflictsWith.includes(t4.attributeName()));
135276
+ if (i3) {
135277
+ this._conflictingOption(e4, i3);
135278
+ }
135279
+ });
135280
+ }
135281
+ _checkForConflictingOptions() {
135282
+ for (let t3 = this; t3; t3 = t3.parent) {
135283
+ t3._checkForConflictingLocalOptions();
135284
+ }
135285
+ }
135286
+ parseOptions(t3) {
135287
+ const e3 = [];
135225
135288
  const i3 = [];
135226
- let n2 = t3;
135227
- const s2 = e3.slice();
135228
- function maybeOption(e4) {
135229
- return e4.length > 1 && e4[0] === "-";
135289
+ let n2 = e3;
135290
+ const s2 = t3.slice();
135291
+ function maybeOption(t4) {
135292
+ return t4.length > 1 && t4[0] === "-";
135230
135293
  }
135231
135294
  let r2 = null;
135232
135295
  while (s2.length) {
135233
- const e4 = s2.shift();
135234
- if (e4 === "--") {
135296
+ const t4 = s2.shift();
135297
+ if (t4 === "--") {
135235
135298
  if (n2 === i3)
135236
- n2.push(e4);
135299
+ n2.push(t4);
135237
135300
  n2.push(...s2);
135238
135301
  break;
135239
135302
  }
135240
- if (r2 && !maybeOption(e4)) {
135241
- this.emit(`option:${r2.name()}`, e4);
135303
+ if (r2 && !maybeOption(t4)) {
135304
+ this.emit(`option:${r2.name()}`, t4);
135242
135305
  continue;
135243
135306
  }
135244
135307
  r2 = null;
135245
- if (maybeOption(e4)) {
135246
- const t4 = this._findOption(e4);
135247
- if (t4) {
135248
- if (t4.required) {
135249
- const e5 = s2.shift();
135250
- if (e5 === void 0)
135251
- this.optionMissingArgument(t4);
135252
- this.emit(`option:${t4.name()}`, e5);
135253
- } else if (t4.optional) {
135254
- let e5 = null;
135308
+ if (maybeOption(t4)) {
135309
+ const e4 = this._findOption(t4);
135310
+ if (e4) {
135311
+ if (e4.required) {
135312
+ const t5 = s2.shift();
135313
+ if (t5 === void 0)
135314
+ this.optionMissingArgument(e4);
135315
+ this.emit(`option:${e4.name()}`, t5);
135316
+ } else if (e4.optional) {
135317
+ let t5 = null;
135255
135318
  if (s2.length > 0 && !maybeOption(s2[0])) {
135256
- e5 = s2.shift();
135319
+ t5 = s2.shift();
135257
135320
  }
135258
- this.emit(`option:${t4.name()}`, e5);
135321
+ this.emit(`option:${e4.name()}`, t5);
135259
135322
  } else {
135260
- this.emit(`option:${t4.name()}`);
135323
+ this.emit(`option:${e4.name()}`);
135261
135324
  }
135262
- r2 = t4.variadic ? t4 : null;
135325
+ r2 = e4.variadic ? e4 : null;
135263
135326
  continue;
135264
135327
  }
135265
135328
  }
135266
- if (e4.length > 2 && e4[0] === "-" && e4[1] !== "-") {
135267
- const t4 = this._findOption(`-${e4[1]}`);
135268
- if (t4) {
135269
- if (t4.required || t4.optional && this._combineFlagAndOptionalValue) {
135270
- this.emit(`option:${t4.name()}`, e4.slice(2));
135329
+ if (t4.length > 2 && t4[0] === "-" && t4[1] !== "-") {
135330
+ const e4 = this._findOption(`-${t4[1]}`);
135331
+ if (e4) {
135332
+ if (e4.required || e4.optional && this._combineFlagAndOptionalValue) {
135333
+ this.emit(`option:${e4.name()}`, t4.slice(2));
135271
135334
  } else {
135272
- this.emit(`option:${t4.name()}`);
135273
- s2.unshift(`-${e4.slice(2)}`);
135335
+ this.emit(`option:${e4.name()}`);
135336
+ s2.unshift(`-${t4.slice(2)}`);
135274
135337
  }
135275
135338
  continue;
135276
135339
  }
135277
135340
  }
135278
- if (/^--[^=]+=/.test(e4)) {
135279
- const t4 = e4.indexOf("=");
135280
- const i4 = this._findOption(e4.slice(0, t4));
135341
+ if (/^--[^=]+=/.test(t4)) {
135342
+ const e4 = t4.indexOf("=");
135343
+ const i4 = this._findOption(t4.slice(0, e4));
135281
135344
  if (i4 && (i4.required || i4.optional)) {
135282
- this.emit(`option:${i4.name()}`, e4.slice(t4 + 1));
135345
+ this.emit(`option:${i4.name()}`, t4.slice(e4 + 1));
135283
135346
  continue;
135284
135347
  }
135285
135348
  }
135286
- if (maybeOption(e4)) {
135349
+ if (maybeOption(t4)) {
135287
135350
  n2 = i3;
135288
135351
  }
135289
- if ((this._enablePositionalOptions || this._passThroughOptions) && t3.length === 0 && i3.length === 0) {
135290
- if (this._findCommand(e4)) {
135291
- t3.push(e4);
135352
+ if ((this._enablePositionalOptions || this._passThroughOptions) && e3.length === 0 && i3.length === 0) {
135353
+ if (this._findCommand(t4)) {
135354
+ e3.push(t4);
135292
135355
  if (s2.length > 0)
135293
135356
  i3.push(...s2);
135294
135357
  break;
135295
- } else if (e4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
135296
- t3.push(e4);
135358
+ } else if (t4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
135359
+ e3.push(t4);
135297
135360
  if (s2.length > 0)
135298
- t3.push(...s2);
135361
+ e3.push(...s2);
135299
135362
  break;
135300
135363
  } else if (this._defaultCommandName) {
135301
- i3.push(e4);
135364
+ i3.push(t4);
135302
135365
  if (s2.length > 0)
135303
135366
  i3.push(...s2);
135304
135367
  break;
135305
135368
  }
135306
135369
  }
135307
135370
  if (this._passThroughOptions) {
135308
- n2.push(e4);
135371
+ n2.push(t4);
135309
135372
  if (s2.length > 0)
135310
135373
  n2.push(...s2);
135311
135374
  break;
135312
135375
  }
135313
- n2.push(e4);
135376
+ n2.push(t4);
135314
135377
  }
135315
- return { operands: t3, unknown: i3 };
135378
+ return { operands: e3, unknown: i3 };
135316
135379
  }
135317
135380
  opts() {
135318
135381
  if (this._storeOptionsAsProperties) {
135319
- const e3 = {};
135320
- const t3 = this.options.length;
135321
- for (let i3 = 0; i3 < t3; i3++) {
135322
- const t4 = this.options[i3].attributeName();
135323
- e3[t4] = t4 === this._versionOptionName ? this._version : this[t4];
135382
+ const t3 = {};
135383
+ const e3 = this.options.length;
135384
+ for (let i3 = 0; i3 < e3; i3++) {
135385
+ const e4 = this.options[i3].attributeName();
135386
+ t3[e4] = e4 === this._versionOptionName ? this._version : this[e4];
135324
135387
  }
135325
- return e3;
135388
+ return t3;
135326
135389
  }
135327
135390
  return this._optionValues;
135328
135391
  }
135329
- _displayError(e3, t3, i3) {
135330
- this._outputConfiguration.outputError(`${i3}
135392
+ optsWithGlobals() {
135393
+ return getCommandAndParents(this).reduce((t3, e3) => Object.assign(t3, e3.opts()), {});
135394
+ }
135395
+ error(t3, e3) {
135396
+ this._outputConfiguration.outputError(`${t3}
135331
135397
  `, this._outputConfiguration.writeErr);
135332
135398
  if (typeof this._showHelpAfterError === "string") {
135333
135399
  this._outputConfiguration.writeErr(`${this._showHelpAfterError}
@@ -135336,166 +135402,217 @@ Expecting one of '${i3.join("', '")}'`);
135336
135402
  this._outputConfiguration.writeErr("\n");
135337
135403
  this.outputHelp({ error: true });
135338
135404
  }
135339
- this._exit(e3, t3, i3);
135405
+ const i3 = e3 || {};
135406
+ const n2 = i3.exitCode || 1;
135407
+ const s2 = i3.code || "commander.error";
135408
+ this._exit(n2, s2, t3);
135340
135409
  }
135341
135410
  _parseOptionsEnv() {
135342
- this.options.forEach((e3) => {
135343
- if (e3.envVar && e3.envVar in process.env) {
135344
- const t3 = e3.attributeName();
135345
- if (this.getOptionValue(t3) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(t3))) {
135346
- if (e3.required || e3.optional) {
135347
- this.emit(`optionEnv:${e3.name()}`, process.env[e3.envVar]);
135411
+ this.options.forEach((t3) => {
135412
+ if (t3.envVar && t3.envVar in a.env) {
135413
+ const e3 = t3.attributeName();
135414
+ if (this.getOptionValue(e3) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(e3))) {
135415
+ if (t3.required || t3.optional) {
135416
+ this.emit(`optionEnv:${t3.name()}`, a.env[t3.envVar]);
135348
135417
  } else {
135349
- this.emit(`optionEnv:${e3.name()}`);
135418
+ this.emit(`optionEnv:${t3.name()}`);
135350
135419
  }
135351
135420
  }
135352
135421
  }
135353
135422
  });
135354
135423
  }
135355
- missingArgument(e3) {
135356
- const t3 = `error: missing required argument '${e3}'`;
135357
- this._displayError(1, "commander.missingArgument", t3);
135358
- }
135359
- optionMissingArgument(e3) {
135360
- const t3 = `error: option '${e3.flags}' argument missing`;
135361
- this._displayError(1, "commander.optionMissingArgument", t3);
135424
+ _parseOptionsImplied() {
135425
+ const t3 = new d(this.options);
135426
+ const hasCustomOptionValue = (t4) => this.getOptionValue(t4) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(t4));
135427
+ this.options.filter((e3) => e3.implied !== void 0 && hasCustomOptionValue(e3.attributeName()) && t3.valueFromOption(this.getOptionValue(e3.attributeName()), e3)).forEach((t4) => {
135428
+ Object.keys(t4.implied).filter((t5) => !hasCustomOptionValue(t5)).forEach((e3) => {
135429
+ this.setOptionValueWithSource(e3, t4.implied[e3], "implied");
135430
+ });
135431
+ });
135362
135432
  }
135363
- missingMandatoryOptionValue(e3) {
135364
- const t3 = `error: required option '${e3.flags}' not specified`;
135365
- this._displayError(1, "commander.missingMandatoryOptionValue", t3);
135433
+ missingArgument(t3) {
135434
+ const e3 = `error: missing required argument '${t3}'`;
135435
+ this.error(e3, { code: "commander.missingArgument" });
135436
+ }
135437
+ optionMissingArgument(t3) {
135438
+ const e3 = `error: option '${t3.flags}' argument missing`;
135439
+ this.error(e3, { code: "commander.optionMissingArgument" });
135440
+ }
135441
+ missingMandatoryOptionValue(t3) {
135442
+ const e3 = `error: required option '${t3.flags}' not specified`;
135443
+ this.error(e3, { code: "commander.missingMandatoryOptionValue" });
135444
+ }
135445
+ _conflictingOption(t3, e3) {
135446
+ const findBestOptionFromValue = (t4) => {
135447
+ const e4 = t4.attributeName();
135448
+ const i4 = this.getOptionValue(e4);
135449
+ const n2 = this.options.find((t5) => t5.negate && e4 === t5.attributeName());
135450
+ const s2 = this.options.find((t5) => !t5.negate && e4 === t5.attributeName());
135451
+ if (n2 && (n2.presetArg === void 0 && i4 === false || n2.presetArg !== void 0 && i4 === n2.presetArg)) {
135452
+ return n2;
135453
+ }
135454
+ return s2 || t4;
135455
+ };
135456
+ const getErrorMessage = (t4) => {
135457
+ const e4 = findBestOptionFromValue(t4);
135458
+ const i4 = e4.attributeName();
135459
+ const n2 = this.getOptionValueSource(i4);
135460
+ if (n2 === "env") {
135461
+ return `environment variable '${e4.envVar}'`;
135462
+ }
135463
+ return `option '${e4.flags}'`;
135464
+ };
135465
+ const i3 = `error: ${getErrorMessage(t3)} cannot be used with ${getErrorMessage(e3)}`;
135466
+ this.error(i3, { code: "commander.conflictingOption" });
135366
135467
  }
135367
- unknownOption(e3) {
135468
+ unknownOption(t3) {
135368
135469
  if (this._allowUnknownOption)
135369
135470
  return;
135370
- let t3 = "";
135371
- if (e3.startsWith("--") && this._showSuggestionAfterError) {
135471
+ let e3 = "";
135472
+ if (t3.startsWith("--") && this._showSuggestionAfterError) {
135372
135473
  let i4 = [];
135373
135474
  let n2 = this;
135374
135475
  do {
135375
- const e4 = n2.createHelp().visibleOptions(n2).filter((e5) => e5.long).map((e5) => e5.long);
135376
- i4 = i4.concat(e4);
135476
+ const t4 = n2.createHelp().visibleOptions(n2).filter((t5) => t5.long).map((t5) => t5.long);
135477
+ i4 = i4.concat(t4);
135377
135478
  n2 = n2.parent;
135378
135479
  } while (n2 && !n2._enablePositionalOptions);
135379
- t3 = m(e3, i4);
135480
+ e3 = f(t3, i4);
135380
135481
  }
135381
- const i3 = `error: unknown option '${e3}'${t3}`;
135382
- this._displayError(1, "commander.unknownOption", i3);
135482
+ const i3 = `error: unknown option '${t3}'${e3}`;
135483
+ this.error(i3, { code: "commander.unknownOption" });
135383
135484
  }
135384
- _excessArguments(e3) {
135485
+ _excessArguments(t3) {
135385
135486
  if (this._allowExcessArguments)
135386
135487
  return;
135387
- const t3 = this._args.length;
135388
- const i3 = t3 === 1 ? "" : "s";
135488
+ const e3 = this._args.length;
135489
+ const i3 = e3 === 1 ? "" : "s";
135389
135490
  const n2 = this.parent ? ` for '${this.name()}'` : "";
135390
- const s2 = `error: too many arguments${n2}. Expected ${t3} argument${i3} but got ${e3.length}.`;
135391
- this._displayError(1, "commander.excessArguments", s2);
135491
+ const s2 = `error: too many arguments${n2}. Expected ${e3} argument${i3} but got ${t3.length}.`;
135492
+ this.error(s2, { code: "commander.excessArguments" });
135392
135493
  }
135393
135494
  unknownCommand() {
135394
- const e3 = this.args[0];
135395
- let t3 = "";
135495
+ const t3 = this.args[0];
135496
+ let e3 = "";
135396
135497
  if (this._showSuggestionAfterError) {
135397
135498
  const i4 = [];
135398
- this.createHelp().visibleCommands(this).forEach((e4) => {
135399
- i4.push(e4.name());
135400
- if (e4.alias())
135401
- i4.push(e4.alias());
135499
+ this.createHelp().visibleCommands(this).forEach((t4) => {
135500
+ i4.push(t4.name());
135501
+ if (t4.alias())
135502
+ i4.push(t4.alias());
135402
135503
  });
135403
- t3 = m(e3, i4);
135504
+ e3 = f(t3, i4);
135404
135505
  }
135405
- const i3 = `error: unknown command '${e3}'${t3}`;
135406
- this._displayError(1, "commander.unknownCommand", i3);
135506
+ const i3 = `error: unknown command '${t3}'${e3}`;
135507
+ this.error(i3, { code: "commander.unknownCommand" });
135407
135508
  }
135408
- version(e3, t3, i3) {
135409
- if (e3 === void 0)
135509
+ version(t3, e3, i3) {
135510
+ if (t3 === void 0)
135410
135511
  return this._version;
135411
- this._version = e3;
135412
- t3 = t3 || "-V, --version";
135512
+ this._version = t3;
135513
+ e3 = e3 || "-V, --version";
135413
135514
  i3 = i3 || "output the version number";
135414
- const n2 = this.createOption(t3, i3);
135515
+ const n2 = this.createOption(e3, i3);
135415
135516
  this._versionOptionName = n2.attributeName();
135416
135517
  this.options.push(n2);
135417
135518
  this.on("option:" + n2.name(), () => {
135418
- this._outputConfiguration.writeOut(`${e3}
135519
+ this._outputConfiguration.writeOut(`${t3}
135419
135520
  `);
135420
- this._exit(0, "commander.version", e3);
135521
+ this._exit(0, "commander.version", t3);
135421
135522
  });
135422
135523
  return this;
135423
135524
  }
135424
- description(e3, t3) {
135425
- if (e3 === void 0 && t3 === void 0)
135525
+ description(t3, e3) {
135526
+ if (t3 === void 0 && e3 === void 0)
135426
135527
  return this._description;
135427
- this._description = e3;
135428
- if (t3) {
135429
- this._argsDescription = t3;
135528
+ this._description = t3;
135529
+ if (e3) {
135530
+ this._argsDescription = e3;
135430
135531
  }
135431
135532
  return this;
135432
135533
  }
135433
- alias(e3) {
135434
- if (e3 === void 0)
135534
+ summary(t3) {
135535
+ if (t3 === void 0)
135536
+ return this._summary;
135537
+ this._summary = t3;
135538
+ return this;
135539
+ }
135540
+ alias(t3) {
135541
+ if (t3 === void 0)
135435
135542
  return this._aliases[0];
135436
- let t3 = this;
135543
+ let e3 = this;
135437
135544
  if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
135438
- t3 = this.commands[this.commands.length - 1];
135545
+ e3 = this.commands[this.commands.length - 1];
135439
135546
  }
135440
- if (e3 === t3._name)
135547
+ if (t3 === e3._name)
135441
135548
  throw new Error("Command alias can't be the same as its name");
135442
- t3._aliases.push(e3);
135549
+ e3._aliases.push(t3);
135443
135550
  return this;
135444
135551
  }
135445
- aliases(e3) {
135446
- if (e3 === void 0)
135552
+ aliases(t3) {
135553
+ if (t3 === void 0)
135447
135554
  return this._aliases;
135448
- e3.forEach((e4) => this.alias(e4));
135555
+ t3.forEach((t4) => this.alias(t4));
135449
135556
  return this;
135450
135557
  }
135451
- usage(e3) {
135452
- if (e3 === void 0) {
135558
+ usage(t3) {
135559
+ if (t3 === void 0) {
135453
135560
  if (this._usage)
135454
135561
  return this._usage;
135455
- const e4 = this._args.map((e5) => h(e5));
135456
- return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? e4 : []).join(" ");
135562
+ const t4 = this._args.map((t5) => h(t5));
135563
+ return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? t4 : []).join(" ");
135457
135564
  }
135458
- this._usage = e3;
135565
+ this._usage = t3;
135459
135566
  return this;
135460
135567
  }
135461
- name(e3) {
135462
- if (e3 === void 0)
135568
+ name(t3) {
135569
+ if (t3 === void 0)
135463
135570
  return this._name;
135464
- this._name = e3;
135571
+ this._name = t3;
135465
135572
  return this;
135466
135573
  }
135467
- helpInformation(e3) {
135468
- const t3 = this.createHelp();
135469
- if (t3.helpWidth === void 0) {
135470
- t3.helpWidth = e3 && e3.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
135574
+ nameFromFilename(t3) {
135575
+ this._name = r.basename(t3, r.extname(t3));
135576
+ return this;
135577
+ }
135578
+ executableDir(t3) {
135579
+ if (t3 === void 0)
135580
+ return this._executableDir;
135581
+ this._executableDir = t3;
135582
+ return this;
135583
+ }
135584
+ helpInformation(t3) {
135585
+ const e3 = this.createHelp();
135586
+ if (e3.helpWidth === void 0) {
135587
+ e3.helpWidth = t3 && t3.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
135471
135588
  }
135472
- return t3.formatHelp(this, t3);
135589
+ return e3.formatHelp(this, e3);
135473
135590
  }
135474
- _getHelpContext(e3) {
135475
- e3 = e3 || {};
135476
- const t3 = { error: !!e3.error };
135591
+ _getHelpContext(t3) {
135592
+ t3 = t3 || {};
135593
+ const e3 = { error: !!t3.error };
135477
135594
  let i3;
135478
- if (t3.error) {
135479
- i3 = (e4) => this._outputConfiguration.writeErr(e4);
135595
+ if (e3.error) {
135596
+ i3 = (t4) => this._outputConfiguration.writeErr(t4);
135480
135597
  } else {
135481
- i3 = (e4) => this._outputConfiguration.writeOut(e4);
135598
+ i3 = (t4) => this._outputConfiguration.writeOut(t4);
135482
135599
  }
135483
- t3.write = e3.write || i3;
135484
- t3.command = this;
135485
- return t3;
135600
+ e3.write = t3.write || i3;
135601
+ e3.command = this;
135602
+ return e3;
135486
135603
  }
135487
- outputHelp(e3) {
135488
- let t3;
135489
- if (typeof e3 === "function") {
135490
- t3 = e3;
135491
- e3 = void 0;
135604
+ outputHelp(t3) {
135605
+ let e3;
135606
+ if (typeof t3 === "function") {
135607
+ e3 = t3;
135608
+ t3 = void 0;
135492
135609
  }
135493
- const i3 = this._getHelpContext(e3);
135494
- getCommandAndParents(this).reverse().forEach((e4) => e4.emit("beforeAllHelp", i3));
135610
+ const i3 = this._getHelpContext(t3);
135611
+ getCommandAndParents(this).reverse().forEach((t4) => t4.emit("beforeAllHelp", i3));
135495
135612
  this.emit("beforeHelp", i3);
135496
135613
  let n2 = this.helpInformation(i3);
135497
- if (t3) {
135498
- n2 = t3(n2);
135614
+ if (e3) {
135615
+ n2 = e3(n2);
135499
135616
  if (typeof n2 !== "string" && !Buffer.isBuffer(n2)) {
135500
135617
  throw new Error("outputHelp callback must return a string or a Buffer");
135501
135618
  }
@@ -135503,306 +135620,342 @@ Expecting one of '${i3.join("', '")}'`);
135503
135620
  i3.write(n2);
135504
135621
  this.emit(this._helpLongFlag);
135505
135622
  this.emit("afterHelp", i3);
135506
- getCommandAndParents(this).forEach((e4) => e4.emit("afterAllHelp", i3));
135623
+ getCommandAndParents(this).forEach((t4) => t4.emit("afterAllHelp", i3));
135507
135624
  }
135508
- helpOption(e3, t3) {
135509
- if (typeof e3 === "boolean") {
135510
- this._hasHelpOption = e3;
135625
+ helpOption(t3, e3) {
135626
+ if (typeof t3 === "boolean") {
135627
+ this._hasHelpOption = t3;
135511
135628
  return this;
135512
135629
  }
135513
- this._helpFlags = e3 || this._helpFlags;
135514
- this._helpDescription = t3 || this._helpDescription;
135515
- const i3 = p(this._helpFlags);
135630
+ this._helpFlags = t3 || this._helpFlags;
135631
+ this._helpDescription = e3 || this._helpDescription;
135632
+ const i3 = m(this._helpFlags);
135516
135633
  this._helpShortFlag = i3.shortFlag;
135517
135634
  this._helpLongFlag = i3.longFlag;
135518
135635
  return this;
135519
135636
  }
135520
- help(e3) {
135521
- this.outputHelp(e3);
135522
- let t3 = process.exitCode || 0;
135523
- if (t3 === 0 && e3 && typeof e3 !== "function" && e3.error) {
135524
- t3 = 1;
135637
+ help(t3) {
135638
+ this.outputHelp(t3);
135639
+ let e3 = a.exitCode || 0;
135640
+ if (e3 === 0 && t3 && typeof t3 !== "function" && t3.error) {
135641
+ e3 = 1;
135525
135642
  }
135526
- this._exit(t3, "commander.help", "(outputHelp)");
135643
+ this._exit(e3, "commander.help", "(outputHelp)");
135527
135644
  }
135528
- addHelpText(e3, t3) {
135645
+ addHelpText(t3, e3) {
135529
135646
  const i3 = ["beforeAll", "before", "after", "afterAll"];
135530
- if (!i3.includes(e3)) {
135647
+ if (!i3.includes(t3)) {
135531
135648
  throw new Error(`Unexpected value for position to addHelpText.
135532
135649
  Expecting one of '${i3.join("', '")}'`);
135533
135650
  }
135534
- const n2 = `${e3}Help`;
135535
- this.on(n2, (e4) => {
135651
+ const n2 = `${t3}Help`;
135652
+ this.on(n2, (t4) => {
135536
135653
  let i4;
135537
- if (typeof t3 === "function") {
135538
- i4 = t3({ error: e4.error, command: e4.command });
135654
+ if (typeof e3 === "function") {
135655
+ i4 = e3({ error: t4.error, command: t4.command });
135539
135656
  } else {
135540
- i4 = t3;
135657
+ i4 = e3;
135541
135658
  }
135542
135659
  if (i4) {
135543
- e4.write(`${i4}
135660
+ t4.write(`${i4}
135544
135661
  `);
135545
135662
  }
135546
135663
  });
135547
135664
  return this;
135548
135665
  }
135549
135666
  }
135550
- function outputHelpIfRequested(e3, t3) {
135551
- const i3 = e3._hasHelpOption && t3.find((t4) => t4 === e3._helpLongFlag || t4 === e3._helpShortFlag);
135667
+ function outputHelpIfRequested(t3, e3) {
135668
+ const i3 = t3._hasHelpOption && e3.find((e4) => e4 === t3._helpLongFlag || e4 === t3._helpShortFlag);
135552
135669
  if (i3) {
135553
- e3.outputHelp();
135554
- e3._exit(0, "commander.helpDisplayed", "(outputHelp)");
135670
+ t3.outputHelp();
135671
+ t3._exit(0, "commander.helpDisplayed", "(outputHelp)");
135555
135672
  }
135556
135673
  }
135557
- function incrementNodeInspectorPort(e3) {
135558
- return e3.map((e4) => {
135559
- if (!e4.startsWith("--inspect")) {
135560
- return e4;
135674
+ function incrementNodeInspectorPort(t3) {
135675
+ return t3.map((t4) => {
135676
+ if (!t4.startsWith("--inspect")) {
135677
+ return t4;
135561
135678
  }
135562
- let t3;
135679
+ let e3;
135563
135680
  let i3 = "127.0.0.1";
135564
135681
  let n2 = "9229";
135565
135682
  let s2;
135566
- if ((s2 = e4.match(/^(--inspect(-brk)?)$/)) !== null) {
135567
- t3 = s2[1];
135568
- } else if ((s2 = e4.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
135569
- t3 = s2[1];
135683
+ if ((s2 = t4.match(/^(--inspect(-brk)?)$/)) !== null) {
135684
+ e3 = s2[1];
135685
+ } else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
135686
+ e3 = s2[1];
135570
135687
  if (/^\d+$/.test(s2[3])) {
135571
135688
  n2 = s2[3];
135572
135689
  } else {
135573
135690
  i3 = s2[3];
135574
135691
  }
135575
- } else if ((s2 = e4.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
135576
- t3 = s2[1];
135692
+ } else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
135693
+ e3 = s2[1];
135577
135694
  i3 = s2[3];
135578
135695
  n2 = s2[4];
135579
135696
  }
135580
- if (t3 && n2 !== "0") {
135581
- return `${t3}=${i3}:${parseInt(n2) + 1}`;
135697
+ if (e3 && n2 !== "0") {
135698
+ return `${e3}=${i3}:${parseInt(n2) + 1}`;
135582
135699
  }
135583
- return e4;
135700
+ return t4;
135584
135701
  });
135585
135702
  }
135586
- function getCommandAndParents(e3) {
135587
- const t3 = [];
135588
- for (let i3 = e3; i3; i3 = i3.parent) {
135589
- t3.push(i3);
135703
+ function getCommandAndParents(t3) {
135704
+ const e3 = [];
135705
+ for (let i3 = t3; i3; i3 = i3.parent) {
135706
+ e3.push(i3);
135590
135707
  }
135591
- return t3;
135708
+ return e3;
135592
135709
  }
135593
- t2.Command = Command2;
135594
- }, 967: (e2, t2) => {
135710
+ e2.Command = Command2;
135711
+ }, 796: (t2, e2) => {
135595
135712
  class CommanderError extends Error {
135596
- constructor(e3, t3, i2) {
135713
+ constructor(t3, e3, i2) {
135597
135714
  super(i2);
135598
135715
  Error.captureStackTrace(this, this.constructor);
135599
135716
  this.name = this.constructor.name;
135600
- this.code = t3;
135601
- this.exitCode = e3;
135717
+ this.code = e3;
135718
+ this.exitCode = t3;
135602
135719
  this.nestedError = void 0;
135603
135720
  }
135604
135721
  }
135605
135722
  class InvalidArgumentError extends CommanderError {
135606
- constructor(e3) {
135607
- super(1, "commander.invalidArgument", e3);
135723
+ constructor(t3) {
135724
+ super(1, "commander.invalidArgument", t3);
135608
135725
  Error.captureStackTrace(this, this.constructor);
135609
135726
  this.name = this.constructor.name;
135610
135727
  }
135611
135728
  }
135612
- t2.CommanderError = CommanderError;
135613
- t2.InvalidArgumentError = InvalidArgumentError;
135614
- }, 34: (e2, t2, i2) => {
135615
- const { humanReadableArgName: n } = i2(969);
135729
+ e2.CommanderError = CommanderError;
135730
+ e2.InvalidArgumentError = InvalidArgumentError;
135731
+ }, 519: (t2, e2, i2) => {
135732
+ const { humanReadableArgName: n } = i2(535);
135616
135733
  class Help {
135617
135734
  constructor() {
135618
135735
  this.helpWidth = void 0;
135619
135736
  this.sortSubcommands = false;
135620
135737
  this.sortOptions = false;
135621
- }
135622
- visibleCommands(e3) {
135623
- const t3 = e3.commands.filter((e4) => !e4._hidden);
135624
- if (e3._hasImplicitHelpCommand()) {
135625
- const [, i3, n2] = e3._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
135626
- const s = e3.createCommand(i3).helpOption(false);
135627
- s.description(e3._helpCommandDescription);
135738
+ this.showGlobalOptions = false;
135739
+ }
135740
+ visibleCommands(t3) {
135741
+ const e3 = t3.commands.filter((t4) => !t4._hidden);
135742
+ if (t3._hasImplicitHelpCommand()) {
135743
+ const [, i3, n2] = t3._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
135744
+ const s = t3.createCommand(i3).helpOption(false);
135745
+ s.description(t3._helpCommandDescription);
135628
135746
  if (n2)
135629
135747
  s.arguments(n2);
135630
- t3.push(s);
135748
+ e3.push(s);
135631
135749
  }
135632
135750
  if (this.sortSubcommands) {
135633
- t3.sort((e4, t4) => e4.name().localeCompare(t4.name()));
135751
+ e3.sort((t4, e4) => t4.name().localeCompare(e4.name()));
135634
135752
  }
135635
- return t3;
135753
+ return e3;
135636
135754
  }
135637
- visibleOptions(e3) {
135638
- const t3 = e3.options.filter((e4) => !e4.hidden);
135639
- const i3 = e3._hasHelpOption && e3._helpShortFlag && !e3._findOption(e3._helpShortFlag);
135640
- const n2 = e3._hasHelpOption && !e3._findOption(e3._helpLongFlag);
135755
+ compareOptions(t3, e3) {
135756
+ const getSortKey = (t4) => t4.short ? t4.short.replace(/^-/, "") : t4.long.replace(/^--/, "");
135757
+ return getSortKey(t3).localeCompare(getSortKey(e3));
135758
+ }
135759
+ visibleOptions(t3) {
135760
+ const e3 = t3.options.filter((t4) => !t4.hidden);
135761
+ const i3 = t3._hasHelpOption && t3._helpShortFlag && !t3._findOption(t3._helpShortFlag);
135762
+ const n2 = t3._hasHelpOption && !t3._findOption(t3._helpLongFlag);
135641
135763
  if (i3 || n2) {
135642
135764
  let s;
135643
135765
  if (!i3) {
135644
- s = e3.createOption(e3._helpLongFlag, e3._helpDescription);
135766
+ s = t3.createOption(t3._helpLongFlag, t3._helpDescription);
135645
135767
  } else if (!n2) {
135646
- s = e3.createOption(e3._helpShortFlag, e3._helpDescription);
135768
+ s = t3.createOption(t3._helpShortFlag, t3._helpDescription);
135647
135769
  } else {
135648
- s = e3.createOption(e3._helpFlags, e3._helpDescription);
135770
+ s = t3.createOption(t3._helpFlags, t3._helpDescription);
135649
135771
  }
135650
- t3.push(s);
135772
+ e3.push(s);
135651
135773
  }
135652
135774
  if (this.sortOptions) {
135653
- const getSortKey = (e4) => e4.short ? e4.short.replace(/^-/, "") : e4.long.replace(/^--/, "");
135654
- t3.sort((e4, t4) => getSortKey(e4).localeCompare(getSortKey(t4)));
135775
+ e3.sort(this.compareOptions);
135655
135776
  }
135656
- return t3;
135777
+ return e3;
135657
135778
  }
135658
- visibleArguments(e3) {
135659
- if (e3._argsDescription) {
135660
- e3._args.forEach((t3) => {
135661
- t3.description = t3.description || e3._argsDescription[t3.name()] || "";
135779
+ visibleGlobalOptions(t3) {
135780
+ if (!this.showGlobalOptions)
135781
+ return [];
135782
+ const e3 = [];
135783
+ for (let i3 = t3.parent; i3; i3 = i3.parent) {
135784
+ const t4 = i3.options.filter((t5) => !t5.hidden);
135785
+ e3.push(...t4);
135786
+ }
135787
+ if (this.sortOptions) {
135788
+ e3.sort(this.compareOptions);
135789
+ }
135790
+ return e3;
135791
+ }
135792
+ visibleArguments(t3) {
135793
+ if (t3._argsDescription) {
135794
+ t3._args.forEach((e3) => {
135795
+ e3.description = e3.description || t3._argsDescription[e3.name()] || "";
135662
135796
  });
135663
135797
  }
135664
- if (e3._args.find((e4) => e4.description)) {
135665
- return e3._args;
135798
+ if (t3._args.find((t4) => t4.description)) {
135799
+ return t3._args;
135666
135800
  }
135667
135801
  return [];
135668
135802
  }
135669
- subcommandTerm(e3) {
135670
- const t3 = e3._args.map((e4) => n(e4)).join(" ");
135671
- return e3._name + (e3._aliases[0] ? "|" + e3._aliases[0] : "") + (e3.options.length ? " [options]" : "") + (t3 ? " " + t3 : "");
135803
+ subcommandTerm(t3) {
135804
+ const e3 = t3._args.map((t4) => n(t4)).join(" ");
135805
+ return t3._name + (t3._aliases[0] ? "|" + t3._aliases[0] : "") + (t3.options.length ? " [options]" : "") + (e3 ? " " + e3 : "");
135672
135806
  }
135673
- optionTerm(e3) {
135674
- return e3.flags;
135807
+ optionTerm(t3) {
135808
+ return t3.flags;
135675
135809
  }
135676
- argumentTerm(e3) {
135677
- return e3.name();
135810
+ argumentTerm(t3) {
135811
+ return t3.name();
135678
135812
  }
135679
- longestSubcommandTermLength(e3, t3) {
135680
- return t3.visibleCommands(e3).reduce((e4, i3) => Math.max(e4, t3.subcommandTerm(i3).length), 0);
135813
+ longestSubcommandTermLength(t3, e3) {
135814
+ return e3.visibleCommands(t3).reduce((t4, i3) => Math.max(t4, e3.subcommandTerm(i3).length), 0);
135681
135815
  }
135682
- longestOptionTermLength(e3, t3) {
135683
- return t3.visibleOptions(e3).reduce((e4, i3) => Math.max(e4, t3.optionTerm(i3).length), 0);
135816
+ longestOptionTermLength(t3, e3) {
135817
+ return e3.visibleOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
135684
135818
  }
135685
- longestArgumentTermLength(e3, t3) {
135686
- return t3.visibleArguments(e3).reduce((e4, i3) => Math.max(e4, t3.argumentTerm(i3).length), 0);
135819
+ longestGlobalOptionTermLength(t3, e3) {
135820
+ return e3.visibleGlobalOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
135687
135821
  }
135688
- commandUsage(e3) {
135689
- let t3 = e3._name;
135690
- if (e3._aliases[0]) {
135691
- t3 = t3 + "|" + e3._aliases[0];
135822
+ longestArgumentTermLength(t3, e3) {
135823
+ return e3.visibleArguments(t3).reduce((t4, i3) => Math.max(t4, e3.argumentTerm(i3).length), 0);
135824
+ }
135825
+ commandUsage(t3) {
135826
+ let e3 = t3._name;
135827
+ if (t3._aliases[0]) {
135828
+ e3 = e3 + "|" + t3._aliases[0];
135692
135829
  }
135693
135830
  let i3 = "";
135694
- for (let t4 = e3.parent; t4; t4 = t4.parent) {
135695
- i3 = t4.name() + " " + i3;
135831
+ for (let e4 = t3.parent; e4; e4 = e4.parent) {
135832
+ i3 = e4.name() + " " + i3;
135696
135833
  }
135697
- return i3 + t3 + " " + e3.usage();
135834
+ return i3 + e3 + " " + t3.usage();
135698
135835
  }
135699
- commandDescription(e3) {
135700
- return e3.description();
135836
+ commandDescription(t3) {
135837
+ return t3.description();
135701
135838
  }
135702
- subcommandDescription(e3) {
135703
- return e3.description();
135839
+ subcommandDescription(t3) {
135840
+ return t3.summary() || t3.description();
135704
135841
  }
135705
- optionDescription(e3) {
135706
- const t3 = [];
135707
- if (e3.argChoices && !e3.negate) {
135708
- t3.push(`choices: ${e3.argChoices.map((e4) => JSON.stringify(e4)).join(", ")}`);
135842
+ optionDescription(t3) {
135843
+ const e3 = [];
135844
+ if (t3.argChoices) {
135845
+ e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
135709
135846
  }
135710
- if (e3.defaultValue !== void 0 && !e3.negate) {
135711
- t3.push(`default: ${e3.defaultValueDescription || JSON.stringify(e3.defaultValue)}`);
135847
+ if (t3.defaultValue !== void 0) {
135848
+ const i3 = t3.required || t3.optional || t3.isBoolean() && typeof t3.defaultValue === "boolean";
135849
+ if (i3) {
135850
+ e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
135851
+ }
135712
135852
  }
135713
- if (e3.envVar !== void 0) {
135714
- t3.push(`env: ${e3.envVar}`);
135853
+ if (t3.presetArg !== void 0 && t3.optional) {
135854
+ e3.push(`preset: ${JSON.stringify(t3.presetArg)}`);
135715
135855
  }
135716
- if (t3.length > 0) {
135717
- return `${e3.description} (${t3.join(", ")})`;
135856
+ if (t3.envVar !== void 0) {
135857
+ e3.push(`env: ${t3.envVar}`);
135718
135858
  }
135719
- return e3.description;
135859
+ if (e3.length > 0) {
135860
+ return `${t3.description} (${e3.join(", ")})`;
135861
+ }
135862
+ return t3.description;
135720
135863
  }
135721
- argumentDescription(e3) {
135722
- const t3 = [];
135723
- if (e3.argChoices) {
135724
- t3.push(`choices: ${e3.argChoices.map((e4) => JSON.stringify(e4)).join(", ")}`);
135864
+ argumentDescription(t3) {
135865
+ const e3 = [];
135866
+ if (t3.argChoices) {
135867
+ e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
135725
135868
  }
135726
- if (e3.defaultValue !== void 0) {
135727
- t3.push(`default: ${e3.defaultValueDescription || JSON.stringify(e3.defaultValue)}`);
135869
+ if (t3.defaultValue !== void 0) {
135870
+ e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
135728
135871
  }
135729
- if (t3.length > 0) {
135730
- const i3 = `(${t3.join(", ")})`;
135731
- if (e3.description) {
135732
- return `${e3.description} ${i3}`;
135872
+ if (e3.length > 0) {
135873
+ const i3 = `(${e3.join(", ")})`;
135874
+ if (t3.description) {
135875
+ return `${t3.description} ${i3}`;
135733
135876
  }
135734
135877
  return i3;
135735
135878
  }
135736
- return e3.description;
135879
+ return t3.description;
135737
135880
  }
135738
- formatHelp(e3, t3) {
135739
- const i3 = t3.padWidth(e3, t3);
135740
- const n2 = t3.helpWidth || 80;
135881
+ formatHelp(t3, e3) {
135882
+ const i3 = e3.padWidth(t3, e3);
135883
+ const n2 = e3.helpWidth || 80;
135741
135884
  const s = 2;
135742
135885
  const r = 2;
135743
- function formatItem(e4, o2) {
135886
+ function formatItem(t4, o2) {
135744
135887
  if (o2) {
135745
- const a2 = `${e4.padEnd(i3 + r)}${o2}`;
135746
- return t3.wrap(a2, n2 - s, i3 + r);
135888
+ const a2 = `${t4.padEnd(i3 + r)}${o2}`;
135889
+ return e3.wrap(a2, n2 - s, i3 + r);
135747
135890
  }
135748
- return e4;
135891
+ return t4;
135749
135892
  }
135750
- function formatList(e4) {
135751
- return e4.join("\n").replace(/^/gm, " ".repeat(s));
135893
+ function formatList(t4) {
135894
+ return t4.join("\n").replace(/^/gm, " ".repeat(s));
135752
135895
  }
135753
- let o = [`Usage: ${t3.commandUsage(e3)}`, ""];
135754
- const a = t3.commandDescription(e3);
135896
+ let o = [`Usage: ${e3.commandUsage(t3)}`, ""];
135897
+ const a = e3.commandDescription(t3);
135755
135898
  if (a.length > 0) {
135756
- o = o.concat([a, ""]);
135899
+ o = o.concat([e3.wrap(a, n2, 0), ""]);
135757
135900
  }
135758
- const h = t3.visibleArguments(e3).map((e4) => formatItem(t3.argumentTerm(e4), t3.argumentDescription(e4)));
135901
+ const l = e3.visibleArguments(t3).map((t4) => formatItem(e3.argumentTerm(t4), e3.argumentDescription(t4)));
135902
+ if (l.length > 0) {
135903
+ o = o.concat(["Arguments:", formatList(l), ""]);
135904
+ }
135905
+ const h = e3.visibleOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
135759
135906
  if (h.length > 0) {
135760
- o = o.concat(["Arguments:", formatList(h), ""]);
135907
+ o = o.concat(["Options:", formatList(h), ""]);
135761
135908
  }
135762
- const l = t3.visibleOptions(e3).map((e4) => formatItem(t3.optionTerm(e4), t3.optionDescription(e4)));
135763
- if (l.length > 0) {
135764
- o = o.concat(["Options:", formatList(l), ""]);
135909
+ if (this.showGlobalOptions) {
135910
+ const i4 = e3.visibleGlobalOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
135911
+ if (i4.length > 0) {
135912
+ o = o.concat(["Global Options:", formatList(i4), ""]);
135913
+ }
135765
135914
  }
135766
- const u = t3.visibleCommands(e3).map((e4) => formatItem(t3.subcommandTerm(e4), t3.subcommandDescription(e4)));
135915
+ const u = e3.visibleCommands(t3).map((t4) => formatItem(e3.subcommandTerm(t4), e3.subcommandDescription(t4)));
135767
135916
  if (u.length > 0) {
135768
135917
  o = o.concat(["Commands:", formatList(u), ""]);
135769
135918
  }
135770
135919
  return o.join("\n");
135771
135920
  }
135772
- padWidth(e3, t3) {
135773
- return Math.max(t3.longestOptionTermLength(e3, t3), t3.longestSubcommandTermLength(e3, t3), t3.longestArgumentTermLength(e3, t3));
135921
+ padWidth(t3, e3) {
135922
+ return Math.max(e3.longestOptionTermLength(t3, e3), e3.longestGlobalOptionTermLength(t3, e3), e3.longestSubcommandTermLength(t3, e3), e3.longestArgumentTermLength(t3, e3));
135774
135923
  }
135775
- wrap(e3, t3, i3, n2 = 40) {
135776
- if (e3.match(/[\n]\s+/))
135777
- return e3;
135778
- const s = t3 - i3;
135779
- if (s < n2)
135780
- return e3;
135781
- const r = e3.substr(0, i3);
135782
- const o = e3.substr(i3);
135783
- const a = " ".repeat(i3);
135784
- const h = new RegExp(".{1," + (s - 1) + "}([\\s​]|$)|[^\\s​]+?([\\s​]|$)", "g");
135785
- const l = o.match(h) || [];
135786
- return r + l.map((e4, t4) => {
135787
- if (e4.slice(-1) === "\n") {
135788
- e4 = e4.slice(0, e4.length - 1);
135789
- }
135790
- return (t4 > 0 ? a : "") + e4.trimRight();
135924
+ wrap(t3, e3, i3, n2 = 40) {
135925
+ const s = " \\f\\t\\v   -    \uFEFF";
135926
+ const r = new RegExp(`[\\n][${s}]+`);
135927
+ if (t3.match(r))
135928
+ return t3;
135929
+ const o = e3 - i3;
135930
+ if (o < n2)
135931
+ return t3;
135932
+ const a = t3.slice(0, i3);
135933
+ const l = t3.slice(i3).replace("\r\n", "\n");
135934
+ const h = " ".repeat(i3);
135935
+ const u = "​";
135936
+ const c = `\\s${u}`;
135937
+ const p = new RegExp(`
135938
+ |.{1,${o - 1}}([${c}]|$)|[^${c}]+?([${c}]|$)`, "g");
135939
+ const m = l.match(p) || [];
135940
+ return a + m.map((t4, e4) => {
135941
+ if (t4 === "\n")
135942
+ return "";
135943
+ return (e4 > 0 ? h : "") + t4.trimEnd();
135791
135944
  }).join("\n");
135792
135945
  }
135793
135946
  }
135794
- t2.Help = Help;
135795
- }, 278: (e2, t2, i2) => {
135796
- const { InvalidArgumentError: n } = i2(967);
135947
+ e2.Help = Help;
135948
+ }, 437: (t2, e2, i2) => {
135949
+ const { InvalidArgumentError: n } = i2(796);
135797
135950
  class Option {
135798
- constructor(e3, t3) {
135799
- this.flags = e3;
135800
- this.description = t3 || "";
135801
- this.required = e3.includes("<");
135802
- this.optional = e3.includes("[");
135803
- this.variadic = /\w\.\.\.[>\]]$/.test(e3);
135951
+ constructor(t3, e3) {
135952
+ this.flags = t3;
135953
+ this.description = e3 || "";
135954
+ this.required = t3.includes("<");
135955
+ this.optional = t3.includes("[");
135956
+ this.variadic = /\w\.\.\.[>\]]$/.test(t3);
135804
135957
  this.mandatory = false;
135805
- const i3 = splitOptionFlags(e3);
135958
+ const i3 = splitOptionFlags(t3);
135806
135959
  this.short = i3.shortFlag;
135807
135960
  this.long = i3.longFlag;
135808
135961
  this.negate = false;
@@ -135811,48 +135964,63 @@ Expecting one of '${i3.join("', '")}'`);
135811
135964
  }
135812
135965
  this.defaultValue = void 0;
135813
135966
  this.defaultValueDescription = void 0;
135967
+ this.presetArg = void 0;
135814
135968
  this.envVar = void 0;
135815
135969
  this.parseArg = void 0;
135816
135970
  this.hidden = false;
135817
135971
  this.argChoices = void 0;
135972
+ this.conflictsWith = [];
135973
+ this.implied = void 0;
135818
135974
  }
135819
- default(e3, t3) {
135820
- this.defaultValue = e3;
135821
- this.defaultValueDescription = t3;
135975
+ default(t3, e3) {
135976
+ this.defaultValue = t3;
135977
+ this.defaultValueDescription = e3;
135822
135978
  return this;
135823
135979
  }
135824
- env(e3) {
135825
- this.envVar = e3;
135980
+ preset(t3) {
135981
+ this.presetArg = t3;
135826
135982
  return this;
135827
135983
  }
135828
- argParser(e3) {
135829
- this.parseArg = e3;
135984
+ conflicts(t3) {
135985
+ this.conflictsWith = this.conflictsWith.concat(t3);
135830
135986
  return this;
135831
135987
  }
135832
- makeOptionMandatory(e3 = true) {
135833
- this.mandatory = !!e3;
135988
+ implies(t3) {
135989
+ this.implied = Object.assign(this.implied || {}, t3);
135834
135990
  return this;
135835
135991
  }
135836
- hideHelp(e3 = true) {
135837
- this.hidden = !!e3;
135992
+ env(t3) {
135993
+ this.envVar = t3;
135838
135994
  return this;
135839
135995
  }
135840
- _concatValue(e3, t3) {
135841
- if (t3 === this.defaultValue || !Array.isArray(t3)) {
135842
- return [e3];
135996
+ argParser(t3) {
135997
+ this.parseArg = t3;
135998
+ return this;
135999
+ }
136000
+ makeOptionMandatory(t3 = true) {
136001
+ this.mandatory = !!t3;
136002
+ return this;
136003
+ }
136004
+ hideHelp(t3 = true) {
136005
+ this.hidden = !!t3;
136006
+ return this;
136007
+ }
136008
+ _concatValue(t3, e3) {
136009
+ if (e3 === this.defaultValue || !Array.isArray(e3)) {
136010
+ return [t3];
135843
136011
  }
135844
- return t3.concat(e3);
136012
+ return e3.concat(t3);
135845
136013
  }
135846
- choices(e3) {
135847
- this.argChoices = e3;
135848
- this.parseArg = (t3, i3) => {
135849
- if (!e3.includes(t3)) {
135850
- throw new n(`Allowed choices are ${e3.join(", ")}.`);
136014
+ choices(t3) {
136015
+ this.argChoices = t3.slice();
136016
+ this.parseArg = (t4, e3) => {
136017
+ if (!this.argChoices.includes(t4)) {
136018
+ throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
135851
136019
  }
135852
136020
  if (this.variadic) {
135853
- return this._concatValue(t3, i3);
136021
+ return this._concatValue(t4, e3);
135854
136022
  }
135855
- return t3;
136023
+ return t4;
135856
136024
  };
135857
136025
  return this;
135858
136026
  }
@@ -135865,86 +136033,117 @@ Expecting one of '${i3.join("', '")}'`);
135865
136033
  attributeName() {
135866
136034
  return camelcase(this.name().replace(/^no-/, ""));
135867
136035
  }
135868
- is(e3) {
135869
- return this.short === e3 || this.long === e3;
136036
+ is(t3) {
136037
+ return this.short === t3 || this.long === t3;
136038
+ }
136039
+ isBoolean() {
136040
+ return !this.required && !this.optional && !this.negate;
135870
136041
  }
135871
136042
  }
135872
- function camelcase(e3) {
135873
- return e3.split("-").reduce((e4, t3) => e4 + t3[0].toUpperCase() + t3.slice(1));
136043
+ class DualOptions {
136044
+ constructor(t3) {
136045
+ this.positiveOptions = /* @__PURE__ */ new Map();
136046
+ this.negativeOptions = /* @__PURE__ */ new Map();
136047
+ this.dualOptions = /* @__PURE__ */ new Set();
136048
+ t3.forEach((t4) => {
136049
+ if (t4.negate) {
136050
+ this.negativeOptions.set(t4.attributeName(), t4);
136051
+ } else {
136052
+ this.positiveOptions.set(t4.attributeName(), t4);
136053
+ }
136054
+ });
136055
+ this.negativeOptions.forEach((t4, e3) => {
136056
+ if (this.positiveOptions.has(e3)) {
136057
+ this.dualOptions.add(e3);
136058
+ }
136059
+ });
136060
+ }
136061
+ valueFromOption(t3, e3) {
136062
+ const i3 = e3.attributeName();
136063
+ if (!this.dualOptions.has(i3))
136064
+ return true;
136065
+ const n2 = this.negativeOptions.get(i3).presetArg;
136066
+ const s = n2 !== void 0 ? n2 : false;
136067
+ return e3.negate === (s === t3);
136068
+ }
135874
136069
  }
135875
- function splitOptionFlags(e3) {
135876
- let t3;
136070
+ function camelcase(t3) {
136071
+ return t3.split("-").reduce((t4, e3) => t4 + e3[0].toUpperCase() + e3.slice(1));
136072
+ }
136073
+ function splitOptionFlags(t3) {
136074
+ let e3;
135877
136075
  let i3;
135878
- const n2 = e3.split(/[ |,]+/);
136076
+ const n2 = t3.split(/[ |,]+/);
135879
136077
  if (n2.length > 1 && !/^[[<]/.test(n2[1]))
135880
- t3 = n2.shift();
136078
+ e3 = n2.shift();
135881
136079
  i3 = n2.shift();
135882
- if (!t3 && /^-[^-]$/.test(i3)) {
135883
- t3 = i3;
136080
+ if (!e3 && /^-[^-]$/.test(i3)) {
136081
+ e3 = i3;
135884
136082
  i3 = void 0;
135885
136083
  }
135886
- return { shortFlag: t3, longFlag: i3 };
136084
+ return { shortFlag: e3, longFlag: i3 };
135887
136085
  }
135888
- t2.Option = Option;
135889
- t2.splitOptionFlags = splitOptionFlags;
135890
- }, 461: (e2, t2) => {
136086
+ e2.Option = Option;
136087
+ e2.splitOptionFlags = splitOptionFlags;
136088
+ e2.DualOptions = DualOptions;
136089
+ }, 860: (t2, e2) => {
135891
136090
  const i2 = 3;
135892
- function editDistance(e3, t3) {
135893
- if (Math.abs(e3.length - t3.length) > i2)
135894
- return Math.max(e3.length, t3.length);
136091
+ function editDistance(t3, e3) {
136092
+ if (Math.abs(t3.length - e3.length) > i2)
136093
+ return Math.max(t3.length, e3.length);
135895
136094
  const n = [];
135896
- for (let t4 = 0; t4 <= e3.length; t4++) {
135897
- n[t4] = [t4];
135898
- }
135899
136095
  for (let e4 = 0; e4 <= t3.length; e4++) {
135900
- n[0][e4] = e4;
136096
+ n[e4] = [e4];
135901
136097
  }
135902
- for (let i3 = 1; i3 <= t3.length; i3++) {
135903
- for (let s = 1; s <= e3.length; s++) {
136098
+ for (let t4 = 0; t4 <= e3.length; t4++) {
136099
+ n[0][t4] = t4;
136100
+ }
136101
+ for (let i3 = 1; i3 <= e3.length; i3++) {
136102
+ for (let s = 1; s <= t3.length; s++) {
135904
136103
  let r = 1;
135905
- if (e3[s - 1] === t3[i3 - 1]) {
136104
+ if (t3[s - 1] === e3[i3 - 1]) {
135906
136105
  r = 0;
135907
136106
  } else {
135908
136107
  r = 1;
135909
136108
  }
135910
136109
  n[s][i3] = Math.min(n[s - 1][i3] + 1, n[s][i3 - 1] + 1, n[s - 1][i3 - 1] + r);
135911
- if (s > 1 && i3 > 1 && e3[s - 1] === t3[i3 - 2] && e3[s - 2] === t3[i3 - 1]) {
136110
+ if (s > 1 && i3 > 1 && t3[s - 1] === e3[i3 - 2] && t3[s - 2] === e3[i3 - 1]) {
135912
136111
  n[s][i3] = Math.min(n[s][i3], n[s - 2][i3 - 2] + 1);
135913
136112
  }
135914
136113
  }
135915
136114
  }
135916
- return n[e3.length][t3.length];
136115
+ return n[t3.length][e3.length];
135917
136116
  }
135918
- function suggestSimilar(e3, t3) {
135919
- if (!t3 || t3.length === 0)
136117
+ function suggestSimilar(t3, e3) {
136118
+ if (!e3 || e3.length === 0)
135920
136119
  return "";
135921
- t3 = Array.from(new Set(t3));
135922
- const n = e3.startsWith("--");
136120
+ e3 = Array.from(new Set(e3));
136121
+ const n = t3.startsWith("--");
135923
136122
  if (n) {
135924
- e3 = e3.slice(2);
135925
- t3 = t3.map((e4) => e4.slice(2));
136123
+ t3 = t3.slice(2);
136124
+ e3 = e3.map((t4) => t4.slice(2));
135926
136125
  }
135927
136126
  let s = [];
135928
136127
  let r = i2;
135929
136128
  const o = 0.4;
135930
- t3.forEach((t4) => {
135931
- if (t4.length <= 1)
136129
+ e3.forEach((e4) => {
136130
+ if (e4.length <= 1)
135932
136131
  return;
135933
- const i3 = editDistance(e3, t4);
135934
- const n2 = Math.max(e3.length, t4.length);
136132
+ const i3 = editDistance(t3, e4);
136133
+ const n2 = Math.max(t3.length, e4.length);
135935
136134
  const a = (n2 - i3) / n2;
135936
136135
  if (a > o) {
135937
136136
  if (i3 < r) {
135938
136137
  r = i3;
135939
- s = [t4];
136138
+ s = [e4];
135940
136139
  } else if (i3 === r) {
135941
- s.push(t4);
136140
+ s.push(e4);
135942
136141
  }
135943
136142
  }
135944
136143
  });
135945
- s.sort((e4, t4) => e4.localeCompare(t4));
136144
+ s.sort((t4, e4) => t4.localeCompare(e4));
135946
136145
  if (n) {
135947
- s = s.map((e4) => `--${e4}`);
136146
+ s = s.map((t4) => `--${t4}`);
135948
136147
  }
135949
136148
  if (s.length > 1) {
135950
136149
  return `
@@ -135956,28 +136155,28 @@ Expecting one of '${i3.join("', '")}'`);
135956
136155
  }
135957
136156
  return "";
135958
136157
  }
135959
- t2.suggestSimilar = suggestSimilar;
136158
+ e2.suggestSimilar = suggestSimilar;
135960
136159
  } };
135961
- var t = {};
136160
+ var e = {};
135962
136161
  function __nccwpck_require__(i2) {
135963
- var n = t[i2];
136162
+ var n = e[i2];
135964
136163
  if (n !== void 0) {
135965
136164
  return n.exports;
135966
136165
  }
135967
- var s = t[i2] = { exports: {} };
136166
+ var s = e[i2] = { exports: {} };
135968
136167
  var r = true;
135969
136168
  try {
135970
- e[i2](s, s.exports, __nccwpck_require__);
136169
+ t[i2](s, s.exports, __nccwpck_require__);
135971
136170
  r = false;
135972
136171
  } finally {
135973
136172
  if (r)
135974
- delete t[i2];
136173
+ delete e[i2];
135975
136174
  }
135976
136175
  return s.exports;
135977
136176
  }
135978
136177
  if (typeof __nccwpck_require__ !== "undefined")
135979
136178
  __nccwpck_require__.ab = __dirname + "/";
135980
- var i = __nccwpck_require__(922);
136179
+ var i = __nccwpck_require__(632);
135981
136180
  module2.exports = i;
135982
136181
  })();
135983
136182
  }
@@ -136117,12 +136316,17 @@ var require_commands = __commonJS({
136117
136316
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
136118
136317
  var commands_exports = {};
136119
136318
  __export2(commands_exports, {
136319
+ getArgv: () => getArgv,
136120
136320
  getCommand: () => getCommand,
136121
136321
  isDevCommand: () => isDevCommand
136122
136322
  });
136123
136323
  module2.exports = __toCommonJS2(commands_exports);
136324
+ var getArgv = () => {
136325
+ var _a2;
136326
+ return (((_a2 = process.env.MODERN_ARGV) == null ? void 0 : _a2.split(" ")) || process.argv).slice(2);
136327
+ };
136124
136328
  var getCommand = () => {
136125
- const args = process.argv.slice(2);
136329
+ const args = getArgv();
136126
136330
  const command = args[0];
136127
136331
  return command;
136128
136332
  };
@@ -136133,108 +136337,6 @@ var require_commands = __commonJS({
136133
136337
  }
136134
136338
  });
136135
136339
 
136136
- // ../../../toolkit/utils/dist/format.js
136137
- var require_format2 = __commonJS({
136138
- "../../../toolkit/utils/dist/format.js"(exports, module2) {
136139
- var __defProp2 = Object.defineProperty;
136140
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
136141
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
136142
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
136143
- var __export2 = (target, all) => {
136144
- for (var name in all)
136145
- __defProp2(target, name, { get: all[name], enumerable: true });
136146
- };
136147
- var __copyProps2 = (to, from, except, desc) => {
136148
- if (from && typeof from === "object" || typeof from === "function") {
136149
- for (let key of __getOwnPropNames2(from))
136150
- if (!__hasOwnProp2.call(to, key) && key !== except)
136151
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
136152
- }
136153
- return to;
136154
- };
136155
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
136156
- var format_exports = {};
136157
- __export2(format_exports, {
136158
- formatWebpackMessages: () => formatWebpackMessages
136159
- });
136160
- module2.exports = __toCommonJS2(format_exports);
136161
- var friendlySyntaxErrorLabel = "SyntaxError:";
136162
- function isLikelyASyntaxError(message) {
136163
- return message.includes(friendlySyntaxErrorLabel);
136164
- }
136165
- function formatMessage(stats) {
136166
- let lines = [];
136167
- let message;
136168
- if (typeof stats === "object") {
136169
- const fileName = stats.moduleName ? `File: ${stats.moduleName}
136170
- ` : "";
136171
- const mainMessage = stats.message;
136172
- const details = stats.details ? `
136173
- Details: ${stats.details}
136174
- ` : "";
136175
- const stack = stats.stack ? `
136176
- ${stats.stack}` : "";
136177
- message = `${fileName}${mainMessage}${details}${stack}`;
136178
- } else {
136179
- message = stats;
136180
- }
136181
- lines = message.split("\n");
136182
- lines = lines.map((line) => {
136183
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
136184
- line
136185
- );
136186
- if (!parsingError) {
136187
- return line;
136188
- }
136189
- const [, errorLine, errorColumn, errorMessage] = parsingError;
136190
- return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
136191
- });
136192
- message = lines.join("\n");
136193
- message = message.replace(
136194
- /SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
136195
- `${friendlySyntaxErrorLabel} $3 ($1:$2)
136196
- `
136197
- );
136198
- lines = message.split("\n");
136199
- if (lines.length > 2 && lines[1].trim() === "") {
136200
- lines.splice(1, 1);
136201
- }
136202
- lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
136203
- if (lines[1] && lines[1].indexOf("Module not found:") !== -1) {
136204
- lines[1] = lines[1].replace("Error: ", "");
136205
- }
136206
- message = lines.join("\n");
136207
- message = message.replace(
136208
- /^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
136209
- ""
136210
- );
136211
- message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
136212
- lines = message.split("\n");
136213
- lines = lines.filter(
136214
- (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
136215
- );
136216
- message = lines.join("\n");
136217
- return message.trim();
136218
- }
136219
- function formatWebpackMessages(json) {
136220
- var _a2, _b, _c;
136221
- const formattedErrors = (_a2 = json == null ? void 0 : json.errors) == null ? void 0 : _a2.map(formatMessage);
136222
- const formattedWarnings = (_b = json == null ? void 0 : json.warnings) == null ? void 0 : _b.map(formatMessage);
136223
- const result = {
136224
- errors: formattedErrors || [],
136225
- warnings: formattedWarnings || []
136226
- };
136227
- if ((_c = result.errors) == null ? void 0 : _c.some(isLikelyASyntaxError)) {
136228
- result.errors = result.errors.filter(isLikelyASyntaxError);
136229
- }
136230
- if (result.errors.length > 1) {
136231
- result.errors.length = 1;
136232
- }
136233
- return result;
136234
- }
136235
- }
136236
- });
136237
-
136238
136340
  // ../../../toolkit/utils/dist/logger.js
136239
136341
  var require_logger4 = __commonJS({
136240
136342
  "../../../toolkit/utils/dist/logger.js"(exports, module2) {
@@ -137019,10 +137121,10 @@ var require_constants6 = __commonJS({
137019
137121
  API_DIR: () => API_DIR,
137020
137122
  CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
137021
137123
  CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
137124
+ DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
137022
137125
  DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
137023
137126
  DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
137024
137127
  ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
137025
- HMR_SOCK_PATH: () => HMR_SOCK_PATH,
137026
137128
  INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
137027
137129
  INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
137028
137130
  INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
@@ -137036,8 +137138,7 @@ var require_constants6 = __commonJS({
137036
137138
  MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
137037
137139
  OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
137038
137140
  PLUGIN_SCHEMAS: () => PLUGIN_SCHEMAS,
137039
- ROUTE_MANIFEST: () => ROUTE_MANIFEST,
137040
- ROUTE_MINIFEST_FILE: () => ROUTE_MINIFEST_FILE,
137141
+ ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
137041
137142
  ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
137042
137143
  SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
137043
137144
  SERVER_DIR: () => SERVER_DIR,
@@ -137053,7 +137154,6 @@ var require_constants6 = __commonJS({
137053
137154
  SHARED_DIR: () => SHARED_DIR
137054
137155
  });
137055
137156
  module2.exports = __toCommonJS2(constants_exports);
137056
- var HMR_SOCK_PATH = "/webpack-hmr";
137057
137157
  var ROUTE_SPEC_FILE = "route.json";
137058
137158
  var MAIN_ENTRY_NAME = "main";
137059
137159
  var LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
@@ -137069,8 +137169,7 @@ var require_constants6 = __commonJS({
137069
137169
  var CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
137070
137170
  var OUTPUT_CONFIG_FILE = "modern.config.json";
137071
137171
  var DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
137072
- var ROUTE_MINIFEST_FILE = "routes-manifest.json";
137073
- var ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
137172
+ var ROUTE_MANIFEST_FILE = "routes-manifest.json";
137074
137173
  var LOADER_ROUTES_DIR = `loader-routes`;
137075
137174
  var DEFAULT_DEV_HOST = "0.0.0.0";
137076
137175
  var INTERNAL_APP_TOOLS_PLUGINS = {
@@ -137274,6 +137373,15 @@ var require_constants6 = __commonJS({
137274
137373
  ],
137275
137374
  "@modern-js/plugin-nocode": []
137276
137375
  };
137376
+ var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
137377
+ allowNamespaces: true,
137378
+ allExtensions: true,
137379
+ allowDeclareFields: true,
137380
+ // aligns Babel's behavior with TypeScript's default behavior.
137381
+ // https://babeljs.io/docs/en/babel-preset-typescript#optimizeconstenums
137382
+ optimizeConstEnums: true,
137383
+ isTSX: true
137384
+ };
137277
137385
  }
137278
137386
  });
137279
137387
 
@@ -138795,9 +138903,9 @@ var require_getServerConfig2 = __commonJS({
138795
138903
  }
138796
138904
  });
138797
138905
 
138798
- // ../../../toolkit/utils/dist/tryResolve.js
138799
- var require_tryResolve2 = __commonJS({
138800
- "../../../toolkit/utils/dist/tryResolve.js"(exports, module2) {
138906
+ // ../../../toolkit/utils/dist/resolve.js
138907
+ var require_resolve = __commonJS({
138908
+ "../../../toolkit/utils/dist/resolve.js"(exports, module2) {
138801
138909
  var __defProp2 = Object.defineProperty;
138802
138910
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
138803
138911
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
@@ -138815,12 +138923,13 @@ var require_tryResolve2 = __commonJS({
138815
138923
  return to;
138816
138924
  };
138817
138925
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
138818
- var tryResolve_exports = {};
138819
- __export2(tryResolve_exports, {
138926
+ var resolve_exports = {};
138927
+ __export2(resolve_exports, {
138928
+ getAntdMajorVersion: () => getAntdMajorVersion,
138820
138929
  isPackageInstalled: () => isPackageInstalled,
138821
138930
  tryResolve: () => tryResolve
138822
138931
  });
138823
- module2.exports = __toCommonJS2(tryResolve_exports);
138932
+ module2.exports = __toCommonJS2(resolve_exports);
138824
138933
  var import_ensureArray = require_ensureArray2();
138825
138934
  var tryResolve = (name, resolvePath) => {
138826
138935
  let filePath = "";
@@ -138843,6 +138952,17 @@ var require_tryResolve2 = __commonJS({
138843
138952
  return false;
138844
138953
  }
138845
138954
  };
138955
+ var getAntdMajorVersion = (appDirectory) => {
138956
+ try {
138957
+ const pkgJsonPath = require.resolve("antd/package.json", {
138958
+ paths: [appDirectory]
138959
+ });
138960
+ const { version } = require(pkgJsonPath);
138961
+ return Number(version.split(".")[0]);
138962
+ } catch (err) {
138963
+ return null;
138964
+ }
138965
+ };
138846
138966
  }
138847
138967
  });
138848
138968
 
@@ -138903,15 +139023,16 @@ var require_analyzeProject2 = __commonJS({
138903
139023
  });
138904
139024
  module2.exports = __toCommonJS2(analyzeProject_exports);
138905
139025
  var path3 = __toESM2(require("path"));
139026
+ var import_commands = require_commands();
138906
139027
  var import_compiled = require_compiled2();
138907
139028
  var isApiOnly = (appDirectory, entryDir) => __async2(void 0, null, function* () {
138908
139029
  const srcDir = path3.join(appDirectory, entryDir != null ? entryDir : "src");
138909
139030
  const existSrc = yield import_compiled.fs.pathExists(srcDir);
138910
- const options = (0, import_compiled.minimist)(process.argv.slice(2));
139031
+ const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
138911
139032
  return !existSrc || Boolean(options["api-only"]);
138912
139033
  });
138913
139034
  var isWebOnly = () => __async2(void 0, null, function* () {
138914
- const options = (0, import_compiled.minimist)(process.argv.slice(2));
139035
+ const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
138915
139036
  return Boolean(options["web-only"]);
138916
139037
  });
138917
139038
  }
@@ -138982,27 +139103,10 @@ var require_chainId2 = __commonJS({
138982
139103
  },
138983
139104
  /** Predefined rule groups */
138984
139105
  ONE_OF: {
138985
- JS: "js",
138986
- TS: "ts",
138987
- CSS: "css",
138988
- LESS: "less",
138989
- SASS: "sass",
138990
- YAML: "yml",
138991
- TOML: "toml",
138992
- FALLBACK: "fallback",
138993
- MARKDOWN: "markdown",
138994
- BFF_CLIENT: "bff-client",
138995
- CSS_MODULES: "css-modules",
138996
- LESS_MODULES: "less-modules",
138997
- SASS_MODULES: "sass-modules",
138998
139106
  SVG: "svg",
138999
139107
  SVG_URL: "svg-url",
139000
139108
  SVG_ASSET: "svg-asset",
139001
- SVG_INLINE: "svg-inline",
139002
- ASSETS: "assets",
139003
- ASSETS_URL: "assets-url",
139004
- ASSETS_INLINE: "assets-inline",
139005
- IMAGE_COMPRESS: "image-compress"
139109
+ SVG_INLINE: "svg-inline"
139006
139110
  },
139007
139111
  /** Predefined loaders */
139008
139112
  USE: {
@@ -139529,6 +139633,143 @@ var require_getTargetDir = __commonJS({
139529
139633
  }
139530
139634
  });
139531
139635
 
139636
+ // ../../../toolkit/utils/dist/babel.js
139637
+ var require_babel = __commonJS({
139638
+ "../../../toolkit/utils/dist/babel.js"(exports, module2) {
139639
+ var __defProp2 = Object.defineProperty;
139640
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
139641
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
139642
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
139643
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
139644
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
139645
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
139646
+ var __spreadValues2 = (a, b) => {
139647
+ for (var prop in b || (b = {}))
139648
+ if (__hasOwnProp2.call(b, prop))
139649
+ __defNormalProp2(a, prop, b[prop]);
139650
+ if (__getOwnPropSymbols2)
139651
+ for (var prop of __getOwnPropSymbols2(b)) {
139652
+ if (__propIsEnum2.call(b, prop))
139653
+ __defNormalProp2(a, prop, b[prop]);
139654
+ }
139655
+ return a;
139656
+ };
139657
+ var __export2 = (target, all) => {
139658
+ for (var name in all)
139659
+ __defProp2(target, name, { get: all[name], enumerable: true });
139660
+ };
139661
+ var __copyProps2 = (to, from, except, desc) => {
139662
+ if (from && typeof from === "object" || typeof from === "function") {
139663
+ for (let key of __getOwnPropNames2(from))
139664
+ if (!__hasOwnProp2.call(to, key) && key !== except)
139665
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
139666
+ }
139667
+ return to;
139668
+ };
139669
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
139670
+ var babel_exports = {};
139671
+ __export2(babel_exports, {
139672
+ applyUserBabelConfig: () => applyUserBabelConfig,
139673
+ getBabelUtils: () => getBabelUtils
139674
+ });
139675
+ module2.exports = __toCommonJS2(babel_exports);
139676
+ var import_path4 = require("path");
139677
+ var import_applyOptionsChain = require_applyOptionsChain2();
139678
+ var import_ensureArray = require_ensureArray2();
139679
+ var import_path22 = require_path2();
139680
+ var formatPath = (originPath) => {
139681
+ if ((0, import_path4.isAbsolute)(originPath)) {
139682
+ return originPath.split(import_path4.sep).join("/");
139683
+ }
139684
+ return originPath;
139685
+ };
139686
+ var getPluginItemName = (item) => {
139687
+ if (typeof item === "string") {
139688
+ return formatPath(item);
139689
+ }
139690
+ if (Array.isArray(item) && typeof item[0] === "string") {
139691
+ return formatPath(item[0]);
139692
+ }
139693
+ return null;
139694
+ };
139695
+ var addPlugins = (plugins, config) => {
139696
+ if (config.plugins) {
139697
+ config.plugins.push(...plugins);
139698
+ } else {
139699
+ config.plugins = plugins;
139700
+ }
139701
+ };
139702
+ var addPresets = (presets, config) => {
139703
+ if (config.presets) {
139704
+ config.presets.push(...presets);
139705
+ } else {
139706
+ config.presets = presets;
139707
+ }
139708
+ };
139709
+ var removePlugins = (plugins, config) => {
139710
+ if (!config.plugins) {
139711
+ return;
139712
+ }
139713
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
139714
+ config.plugins = config.plugins.filter((item) => {
139715
+ const name = getPluginItemName(item);
139716
+ if (name) {
139717
+ return !removeList.find((removeItem) => name.includes(removeItem));
139718
+ }
139719
+ return true;
139720
+ });
139721
+ };
139722
+ var removePresets = (presets, config) => {
139723
+ if (!config.presets) {
139724
+ return;
139725
+ }
139726
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
139727
+ config.presets = config.presets.filter((item) => {
139728
+ const name = getPluginItemName(item);
139729
+ if (name) {
139730
+ return !removeList.find((removeItem) => name.includes(removeItem));
139731
+ }
139732
+ return true;
139733
+ });
139734
+ };
139735
+ var modifyPresetOptions = (presetName, options, presets = []) => {
139736
+ presets.forEach((preset, index) => {
139737
+ if (Array.isArray(preset)) {
139738
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
139739
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
139740
+ }
139741
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
139742
+ presets[index] = [preset, options];
139743
+ }
139744
+ });
139745
+ };
139746
+ var getBabelUtils = (config) => {
139747
+ const noop = () => {
139748
+ };
139749
+ return {
139750
+ addPlugins: (plugins) => addPlugins(plugins, config),
139751
+ addPresets: (presets) => addPresets(presets, config),
139752
+ removePlugins: (plugins) => removePlugins(plugins, config),
139753
+ removePresets: (presets) => removePresets(presets, config),
139754
+ // `addIncludes` and `addExcludes` are noop functions by default,
139755
+ // It can be overridden by `extraBabelUtils`.
139756
+ addIncludes: noop,
139757
+ addExcludes: noop,
139758
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
139759
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
139760
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
139761
+ };
139762
+ };
139763
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
139764
+ if (userBabelConfig) {
139765
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
139766
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
139767
+ }
139768
+ return defaultOptions;
139769
+ };
139770
+ }
139771
+ });
139772
+
139532
139773
  // ../../../toolkit/utils/dist/index.js
139533
139774
  var require_dist3 = __commonJS({
139534
139775
  "../../../toolkit/utils/dist/index.js"(exports, module2) {
@@ -139550,7 +139791,6 @@ var require_dist3 = __commonJS({
139550
139791
  module2.exports = __toCommonJS2(src_exports2);
139551
139792
  __reExport(src_exports2, require_compiled2(), module2.exports);
139552
139793
  __reExport(src_exports2, require_commands(), module2.exports);
139553
- __reExport(src_exports2, require_format2(), module2.exports);
139554
139794
  __reExport(src_exports2, require_FileSizeReporter2(), module2.exports);
139555
139795
  __reExport(src_exports2, require_printBuildError2(), module2.exports);
139556
139796
  __reExport(src_exports2, require_debug5(), module2.exports);
@@ -139582,7 +139822,7 @@ var require_dist3 = __commonJS({
139582
139822
  __reExport(src_exports2, require_wait2(), module2.exports);
139583
139823
  __reExport(src_exports2, require_emptyDir2(), module2.exports);
139584
139824
  __reExport(src_exports2, require_getServerConfig2(), module2.exports);
139585
- __reExport(src_exports2, require_tryResolve2(), module2.exports);
139825
+ __reExport(src_exports2, require_resolve(), module2.exports);
139586
139826
  __reExport(src_exports2, require_analyzeProject2(), module2.exports);
139587
139827
  __reExport(src_exports2, require_chainId2(), module2.exports);
139588
139828
  __reExport(src_exports2, require_version2(), module2.exports);
@@ -139592,6 +139832,7 @@ var require_dist3 = __commonJS({
139592
139832
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
139593
139833
  __reExport(src_exports2, require_react(), module2.exports);
139594
139834
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
139835
+ __reExport(src_exports2, require_babel(), module2.exports);
139595
139836
  }
139596
139837
  });
139597
139838
 
@@ -139682,6 +139923,7 @@ var ZH_LOCALE = {
139682
139923
  self: "请选择你想创建的工程类型",
139683
139924
  mwa: "Web 应用",
139684
139925
  module: "Npm 模块",
139926
+ doc: "文档站",
139685
139927
  monorepo: "Monorepo",
139686
139928
  custom: "自定义",
139687
139929
  default: "默认"
@@ -139778,6 +140020,7 @@ var EN_LOCALE = {
139778
140020
  self: "Please select the solution you want to create",
139779
140021
  mwa: "Web App",
139780
140022
  module: "Npm Module",
140023
+ doc: "Doc Site",
139781
140024
  monorepo: "Monorepo",
139782
140025
  custom: "Custom Solution",
139783
140026
  default: "Default"
@@ -139877,6 +140120,7 @@ var localeKeys = i18n.init("zh", { zh: ZH_LOCALE, en: EN_LOCALE });
139877
140120
  var Solution = /* @__PURE__ */ ((Solution2) => {
139878
140121
  Solution2["MWA"] = "mwa";
139879
140122
  Solution2["Module"] = "module";
140123
+ Solution2["Doc"] = "doc";
139880
140124
  Solution2["Monorepo"] = "monorepo";
139881
140125
  return Solution2;
139882
140126
  })(Solution || {});
@@ -139889,6 +140133,10 @@ var SolutionToolsMap = {
139889
140133
  "module"
139890
140134
  /* Module */
139891
140135
  ]: "@modern-js/module-tools",
140136
+ [
140137
+ "doc"
140138
+ /* Doc */
140139
+ ]: "@modern-js/doc-tools",
139892
140140
  [
139893
140141
  "monorepo"
139894
140142
  /* Monorepo */