@modern-js/repo-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.
Files changed (2) hide show
  1. package/dist/index.js +1186 -910
  2. package/package.json +14 -13
package/dist/index.js CHANGED
@@ -133442,55 +133442,58 @@ var require_recursive_readdir2 = __commonJS({
133442
133442
  var require_commander2 = __commonJS({
133443
133443
  "../../../toolkit/utils/compiled/commander/index.js"(exports, module2) {
133444
133444
  (() => {
133445
- var e = { 81: (e2) => {
133445
+ var t = { 81: (t2) => {
133446
133446
  "use strict";
133447
- e2.exports = require("child_process");
133448
- }, 361: (e2) => {
133447
+ t2.exports = require("child_process");
133448
+ }, 361: (t2) => {
133449
133449
  "use strict";
133450
- e2.exports = require("events");
133451
- }, 147: (e2) => {
133450
+ t2.exports = require("events");
133451
+ }, 147: (t2) => {
133452
133452
  "use strict";
133453
- e2.exports = require("fs");
133454
- }, 17: (e2) => {
133453
+ t2.exports = require("fs");
133454
+ }, 17: (t2) => {
133455
133455
  "use strict";
133456
- e2.exports = require("path");
133457
- }, 922: (e2, t2, i2) => {
133458
- const { Argument: n } = i2(969);
133459
- const { Command: s } = i2(694);
133460
- const { CommanderError: r, InvalidArgumentError: o } = i2(967);
133461
- const { Help: a } = i2(34);
133462
- const { Option: h } = i2(278);
133463
- t2 = e2.exports = new s();
133464
- t2.program = t2;
133465
- t2.Argument = n;
133466
- t2.Command = s;
133467
- t2.CommanderError = r;
133468
- t2.Help = a;
133469
- t2.InvalidArgumentError = o;
133470
- t2.InvalidOptionArgumentError = o;
133471
- t2.Option = h;
133472
- }, 969: (e2, t2, i2) => {
133473
- const { InvalidArgumentError: n } = i2(967);
133456
+ t2.exports = require("path");
133457
+ }, 282: (t2) => {
133458
+ "use strict";
133459
+ t2.exports = require("process");
133460
+ }, 632: (t2, e2, i2) => {
133461
+ const { Argument: n } = i2(535);
133462
+ const { Command: s } = i2(302);
133463
+ const { CommanderError: r, InvalidArgumentError: o } = i2(796);
133464
+ const { Help: a } = i2(519);
133465
+ const { Option: l } = i2(437);
133466
+ e2 = t2.exports = new s();
133467
+ e2.program = e2;
133468
+ e2.Argument = n;
133469
+ e2.Command = s;
133470
+ e2.CommanderError = r;
133471
+ e2.Help = a;
133472
+ e2.InvalidArgumentError = o;
133473
+ e2.InvalidOptionArgumentError = o;
133474
+ e2.Option = l;
133475
+ }, 535: (t2, e2, i2) => {
133476
+ const { InvalidArgumentError: n } = i2(796);
133474
133477
  class Argument {
133475
- constructor(e3, t3) {
133476
- this.description = t3 || "";
133478
+ constructor(t3, e3) {
133479
+ this.description = e3 || "";
133477
133480
  this.variadic = false;
133478
133481
  this.parseArg = void 0;
133479
133482
  this.defaultValue = void 0;
133480
133483
  this.defaultValueDescription = void 0;
133481
133484
  this.argChoices = void 0;
133482
- switch (e3[0]) {
133485
+ switch (t3[0]) {
133483
133486
  case "<":
133484
133487
  this.required = true;
133485
- this._name = e3.slice(1, -1);
133488
+ this._name = t3.slice(1, -1);
133486
133489
  break;
133487
133490
  case "[":
133488
133491
  this.required = false;
133489
- this._name = e3.slice(1, -1);
133492
+ this._name = t3.slice(1, -1);
133490
133493
  break;
133491
133494
  default:
133492
133495
  this.required = true;
133493
- this._name = e3;
133496
+ this._name = t3;
133494
133497
  break;
133495
133498
  }
133496
133499
  if (this._name.length > 3 && this._name.slice(-3) === "...") {
@@ -133501,31 +133504,31 @@ var require_commander2 = __commonJS({
133501
133504
  name() {
133502
133505
  return this._name;
133503
133506
  }
133504
- _concatValue(e3, t3) {
133505
- if (t3 === this.defaultValue || !Array.isArray(t3)) {
133506
- return [e3];
133507
+ _concatValue(t3, e3) {
133508
+ if (e3 === this.defaultValue || !Array.isArray(e3)) {
133509
+ return [t3];
133507
133510
  }
133508
- return t3.concat(e3);
133511
+ return e3.concat(t3);
133509
133512
  }
133510
- default(e3, t3) {
133511
- this.defaultValue = e3;
133512
- this.defaultValueDescription = t3;
133513
+ default(t3, e3) {
133514
+ this.defaultValue = t3;
133515
+ this.defaultValueDescription = e3;
133513
133516
  return this;
133514
133517
  }
133515
- argParser(e3) {
133516
- this.parseArg = e3;
133518
+ argParser(t3) {
133519
+ this.parseArg = t3;
133517
133520
  return this;
133518
133521
  }
133519
- choices(e3) {
133520
- this.argChoices = e3;
133521
- this.parseArg = (t3, i3) => {
133522
- if (!e3.includes(t3)) {
133523
- throw new n(`Allowed choices are ${e3.join(", ")}.`);
133522
+ choices(t3) {
133523
+ this.argChoices = t3.slice();
133524
+ this.parseArg = (t4, e3) => {
133525
+ if (!this.argChoices.includes(t4)) {
133526
+ throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
133524
133527
  }
133525
133528
  if (this.variadic) {
133526
- return this._concatValue(t3, i3);
133529
+ return this._concatValue(t4, e3);
133527
133530
  }
133528
- return t3;
133531
+ return t4;
133529
133532
  };
133530
133533
  return this;
133531
133534
  }
@@ -133538,24 +133541,25 @@ var require_commander2 = __commonJS({
133538
133541
  return this;
133539
133542
  }
133540
133543
  }
133541
- function humanReadableArgName(e3) {
133542
- const t3 = e3.name() + (e3.variadic === true ? "..." : "");
133543
- return e3.required ? "<" + t3 + ">" : "[" + t3 + "]";
133544
+ function humanReadableArgName(t3) {
133545
+ const e3 = t3.name() + (t3.variadic === true ? "..." : "");
133546
+ return t3.required ? "<" + e3 + ">" : "[" + e3 + "]";
133544
133547
  }
133545
- t2.Argument = Argument;
133546
- t2.humanReadableArgName = humanReadableArgName;
133547
- }, 694: (e2, t2, i2) => {
133548
+ e2.Argument = Argument;
133549
+ e2.humanReadableArgName = humanReadableArgName;
133550
+ }, 302: (t2, e2, i2) => {
133548
133551
  const n = i2(361).EventEmitter;
133549
133552
  const s = i2(81);
133550
133553
  const r = i2(17);
133551
133554
  const o = i2(147);
133552
- const { Argument: a, humanReadableArgName: h } = i2(969);
133553
- const { CommanderError: l } = i2(967);
133554
- const { Help: u } = i2(34);
133555
- const { Option: c, splitOptionFlags: p } = i2(278);
133556
- const { suggestSimilar: m } = i2(461);
133555
+ const a = i2(282);
133556
+ const { Argument: l, humanReadableArgName: h } = i2(535);
133557
+ const { CommanderError: u } = i2(796);
133558
+ const { Help: c } = i2(519);
133559
+ const { Option: p, splitOptionFlags: m, DualOptions: d } = i2(437);
133560
+ const { suggestSimilar: f } = i2(860);
133557
133561
  class Command2 extends n {
133558
- constructor(e3) {
133562
+ constructor(t3) {
133559
133563
  super();
133560
133564
  this.commands = [];
133561
133565
  this.options = [];
@@ -133567,25 +133571,27 @@ var require_commander2 = __commonJS({
133567
133571
  this.rawArgs = [];
133568
133572
  this.processedArgs = [];
133569
133573
  this._scriptPath = null;
133570
- this._name = e3 || "";
133574
+ this._name = t3 || "";
133571
133575
  this._optionValues = {};
133572
133576
  this._optionValueSources = {};
133573
133577
  this._storeOptionsAsProperties = false;
133574
133578
  this._actionHandler = null;
133575
133579
  this._executableHandler = false;
133576
133580
  this._executableFile = null;
133581
+ this._executableDir = null;
133577
133582
  this._defaultCommandName = null;
133578
133583
  this._exitCallback = null;
133579
133584
  this._aliases = [];
133580
133585
  this._combineFlagAndOptionalValue = true;
133581
133586
  this._description = "";
133587
+ this._summary = "";
133582
133588
  this._argsDescription = void 0;
133583
133589
  this._enablePositionalOptions = false;
133584
133590
  this._passThroughOptions = false;
133585
133591
  this._lifeCycleHooks = {};
133586
133592
  this._showHelpAfterError = false;
133587
- this._showSuggestionAfterError = false;
133588
- 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) };
133593
+ this._showSuggestionAfterError = true;
133594
+ 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) };
133589
133595
  this._hidden = false;
133590
133596
  this._hasHelpOption = true;
133591
133597
  this._helpFlags = "-h, --help";
@@ -133598,35 +133604,35 @@ var require_commander2 = __commonJS({
133598
133604
  this._helpCommandDescription = "display help for command";
133599
133605
  this._helpConfiguration = {};
133600
133606
  }
133601
- copyInheritedSettings(e3) {
133602
- this._outputConfiguration = e3._outputConfiguration;
133603
- this._hasHelpOption = e3._hasHelpOption;
133604
- this._helpFlags = e3._helpFlags;
133605
- this._helpDescription = e3._helpDescription;
133606
- this._helpShortFlag = e3._helpShortFlag;
133607
- this._helpLongFlag = e3._helpLongFlag;
133608
- this._helpCommandName = e3._helpCommandName;
133609
- this._helpCommandnameAndArgs = e3._helpCommandnameAndArgs;
133610
- this._helpCommandDescription = e3._helpCommandDescription;
133611
- this._helpConfiguration = e3._helpConfiguration;
133612
- this._exitCallback = e3._exitCallback;
133613
- this._storeOptionsAsProperties = e3._storeOptionsAsProperties;
133614
- this._combineFlagAndOptionalValue = e3._combineFlagAndOptionalValue;
133615
- this._allowExcessArguments = e3._allowExcessArguments;
133616
- this._enablePositionalOptions = e3._enablePositionalOptions;
133617
- this._showHelpAfterError = e3._showHelpAfterError;
133618
- this._showSuggestionAfterError = e3._showSuggestionAfterError;
133607
+ copyInheritedSettings(t3) {
133608
+ this._outputConfiguration = t3._outputConfiguration;
133609
+ this._hasHelpOption = t3._hasHelpOption;
133610
+ this._helpFlags = t3._helpFlags;
133611
+ this._helpDescription = t3._helpDescription;
133612
+ this._helpShortFlag = t3._helpShortFlag;
133613
+ this._helpLongFlag = t3._helpLongFlag;
133614
+ this._helpCommandName = t3._helpCommandName;
133615
+ this._helpCommandnameAndArgs = t3._helpCommandnameAndArgs;
133616
+ this._helpCommandDescription = t3._helpCommandDescription;
133617
+ this._helpConfiguration = t3._helpConfiguration;
133618
+ this._exitCallback = t3._exitCallback;
133619
+ this._storeOptionsAsProperties = t3._storeOptionsAsProperties;
133620
+ this._combineFlagAndOptionalValue = t3._combineFlagAndOptionalValue;
133621
+ this._allowExcessArguments = t3._allowExcessArguments;
133622
+ this._enablePositionalOptions = t3._enablePositionalOptions;
133623
+ this._showHelpAfterError = t3._showHelpAfterError;
133624
+ this._showSuggestionAfterError = t3._showSuggestionAfterError;
133619
133625
  return this;
133620
133626
  }
133621
- command(e3, t3, i3) {
133622
- let n2 = t3;
133627
+ command(t3, e3, i3) {
133628
+ let n2 = e3;
133623
133629
  let s2 = i3;
133624
133630
  if (typeof n2 === "object" && n2 !== null) {
133625
133631
  s2 = n2;
133626
133632
  n2 = null;
133627
133633
  }
133628
133634
  s2 = s2 || {};
133629
- const [, r2, o2] = e3.match(/([^ ]+) *(.*)/);
133635
+ const [, r2, o2] = t3.match(/([^ ]+) *(.*)/);
133630
133636
  const a2 = this.createCommand(r2);
133631
133637
  if (n2) {
133632
133638
  a2.description(n2);
@@ -133645,60 +133651,53 @@ var require_commander2 = __commonJS({
133645
133651
  return this;
133646
133652
  return a2;
133647
133653
  }
133648
- createCommand(e3) {
133649
- return new Command2(e3);
133654
+ createCommand(t3) {
133655
+ return new Command2(t3);
133650
133656
  }
133651
133657
  createHelp() {
133652
- return Object.assign(new u(), this.configureHelp());
133658
+ return Object.assign(new c(), this.configureHelp());
133653
133659
  }
133654
- configureHelp(e3) {
133655
- if (e3 === void 0)
133660
+ configureHelp(t3) {
133661
+ if (t3 === void 0)
133656
133662
  return this._helpConfiguration;
133657
- this._helpConfiguration = e3;
133663
+ this._helpConfiguration = t3;
133658
133664
  return this;
133659
133665
  }
133660
- configureOutput(e3) {
133661
- if (e3 === void 0)
133666
+ configureOutput(t3) {
133667
+ if (t3 === void 0)
133662
133668
  return this._outputConfiguration;
133663
- Object.assign(this._outputConfiguration, e3);
133669
+ Object.assign(this._outputConfiguration, t3);
133664
133670
  return this;
133665
133671
  }
133666
- showHelpAfterError(e3 = true) {
133667
- if (typeof e3 !== "string")
133668
- e3 = !!e3;
133669
- this._showHelpAfterError = e3;
133672
+ showHelpAfterError(t3 = true) {
133673
+ if (typeof t3 !== "string")
133674
+ t3 = !!t3;
133675
+ this._showHelpAfterError = t3;
133670
133676
  return this;
133671
133677
  }
133672
- showSuggestionAfterError(e3 = true) {
133673
- this._showSuggestionAfterError = !!e3;
133678
+ showSuggestionAfterError(t3 = true) {
133679
+ this._showSuggestionAfterError = !!t3;
133674
133680
  return this;
133675
133681
  }
133676
- addCommand(e3, t3) {
133677
- if (!e3._name)
133678
- throw new Error("Command passed to .addCommand() must have a name");
133679
- function checkExplicitNames(e4) {
133680
- e4.forEach((e5) => {
133681
- if (e5._executableHandler && !e5._executableFile) {
133682
- throw new Error(`Must specify executableFile for deeply nested executable: ${e5.name()}`);
133683
- }
133684
- checkExplicitNames(e5.commands);
133685
- });
133682
+ addCommand(t3, e3) {
133683
+ if (!t3._name) {
133684
+ throw new Error(`Command passed to .addCommand() must have a name
133685
+ - specify the name in Command constructor or using .name()`);
133686
133686
  }
133687
- checkExplicitNames(e3.commands);
133688
- t3 = t3 || {};
133689
- if (t3.isDefault)
133690
- this._defaultCommandName = e3._name;
133691
- if (t3.noHelp || t3.hidden)
133692
- e3._hidden = true;
133693
- this.commands.push(e3);
133694
- e3.parent = this;
133687
+ e3 = e3 || {};
133688
+ if (e3.isDefault)
133689
+ this._defaultCommandName = t3._name;
133690
+ if (e3.noHelp || e3.hidden)
133691
+ t3._hidden = true;
133692
+ this.commands.push(t3);
133693
+ t3.parent = this;
133695
133694
  return this;
133696
133695
  }
133697
- createArgument(e3, t3) {
133698
- return new a(e3, t3);
133696
+ createArgument(t3, e3) {
133697
+ return new l(t3, e3);
133699
133698
  }
133700
- argument(e3, t3, i3, n2) {
133701
- const s2 = this.createArgument(e3, t3);
133699
+ argument(t3, e3, i3, n2) {
133700
+ const s2 = this.createArgument(t3, e3);
133702
133701
  if (typeof i3 === "function") {
133703
133702
  s2.default(n2).argParser(i3);
133704
133703
  } else {
@@ -133707,33 +133706,33 @@ var require_commander2 = __commonJS({
133707
133706
  this.addArgument(s2);
133708
133707
  return this;
133709
133708
  }
133710
- arguments(e3) {
133711
- e3.split(/ +/).forEach((e4) => {
133712
- this.argument(e4);
133709
+ arguments(t3) {
133710
+ t3.split(/ +/).forEach((t4) => {
133711
+ this.argument(t4);
133713
133712
  });
133714
133713
  return this;
133715
133714
  }
133716
- addArgument(e3) {
133717
- const t3 = this._args.slice(-1)[0];
133718
- if (t3 && t3.variadic) {
133719
- throw new Error(`only the last argument can be variadic '${t3.name()}'`);
133715
+ addArgument(t3) {
133716
+ const e3 = this._args.slice(-1)[0];
133717
+ if (e3 && e3.variadic) {
133718
+ throw new Error(`only the last argument can be variadic '${e3.name()}'`);
133720
133719
  }
133721
- if (e3.required && e3.defaultValue !== void 0 && e3.parseArg === void 0) {
133722
- throw new Error(`a default value for a required argument is never used: '${e3.name()}'`);
133720
+ if (t3.required && t3.defaultValue !== void 0 && t3.parseArg === void 0) {
133721
+ throw new Error(`a default value for a required argument is never used: '${t3.name()}'`);
133723
133722
  }
133724
- this._args.push(e3);
133723
+ this._args.push(t3);
133725
133724
  return this;
133726
133725
  }
133727
- addHelpCommand(e3, t3) {
133728
- if (e3 === false) {
133726
+ addHelpCommand(t3, e3) {
133727
+ if (t3 === false) {
133729
133728
  this._addImplicitHelpCommand = false;
133730
133729
  } else {
133731
133730
  this._addImplicitHelpCommand = true;
133732
- if (typeof e3 === "string") {
133733
- this._helpCommandName = e3.split(" ")[0];
133734
- this._helpCommandnameAndArgs = e3;
133731
+ if (typeof t3 === "string") {
133732
+ this._helpCommandName = t3.split(" ")[0];
133733
+ this._helpCommandnameAndArgs = t3;
133735
133734
  }
133736
- this._helpCommandDescription = t3 || this._helpCommandDescription;
133735
+ this._helpCommandDescription = e3 || this._helpCommandDescription;
133737
133736
  }
133738
133737
  return this;
133739
133738
  }
@@ -133743,116 +133742,121 @@ var require_commander2 = __commonJS({
133743
133742
  }
133744
133743
  return this._addImplicitHelpCommand;
133745
133744
  }
133746
- hook(e3, t3) {
133747
- const i3 = ["preAction", "postAction"];
133748
- if (!i3.includes(e3)) {
133749
- throw new Error(`Unexpected value for event passed to hook : '${e3}'.
133745
+ hook(t3, e3) {
133746
+ const i3 = ["preSubcommand", "preAction", "postAction"];
133747
+ if (!i3.includes(t3)) {
133748
+ throw new Error(`Unexpected value for event passed to hook : '${t3}'.
133750
133749
  Expecting one of '${i3.join("', '")}'`);
133751
133750
  }
133752
- if (this._lifeCycleHooks[e3]) {
133753
- this._lifeCycleHooks[e3].push(t3);
133751
+ if (this._lifeCycleHooks[t3]) {
133752
+ this._lifeCycleHooks[t3].push(e3);
133754
133753
  } else {
133755
- this._lifeCycleHooks[e3] = [t3];
133754
+ this._lifeCycleHooks[t3] = [e3];
133756
133755
  }
133757
133756
  return this;
133758
133757
  }
133759
- exitOverride(e3) {
133760
- if (e3) {
133761
- this._exitCallback = e3;
133758
+ exitOverride(t3) {
133759
+ if (t3) {
133760
+ this._exitCallback = t3;
133762
133761
  } else {
133763
- this._exitCallback = (e4) => {
133764
- if (e4.code !== "commander.executeSubCommandAsync") {
133765
- throw e4;
133762
+ this._exitCallback = (t4) => {
133763
+ if (t4.code !== "commander.executeSubCommandAsync") {
133764
+ throw t4;
133766
133765
  } else {
133767
133766
  }
133768
133767
  };
133769
133768
  }
133770
133769
  return this;
133771
133770
  }
133772
- _exit(e3, t3, i3) {
133771
+ _exit(t3, e3, i3) {
133773
133772
  if (this._exitCallback) {
133774
- this._exitCallback(new l(e3, t3, i3));
133773
+ this._exitCallback(new u(t3, e3, i3));
133775
133774
  }
133776
- process.exit(e3);
133775
+ a.exit(t3);
133777
133776
  }
133778
- action(e3) {
133779
- const listener = (t3) => {
133777
+ action(t3) {
133778
+ const listener = (e3) => {
133780
133779
  const i3 = this._args.length;
133781
- const n2 = t3.slice(0, i3);
133780
+ const n2 = e3.slice(0, i3);
133782
133781
  if (this._storeOptionsAsProperties) {
133783
133782
  n2[i3] = this;
133784
133783
  } else {
133785
133784
  n2[i3] = this.opts();
133786
133785
  }
133787
133786
  n2.push(this);
133788
- return e3.apply(this, n2);
133787
+ return t3.apply(this, n2);
133789
133788
  };
133790
133789
  this._actionHandler = listener;
133791
133790
  return this;
133792
133791
  }
133793
- createOption(e3, t3) {
133794
- return new c(e3, t3);
133792
+ createOption(t3, e3) {
133793
+ return new p(t3, e3);
133795
133794
  }
133796
- addOption(e3) {
133797
- const t3 = e3.name();
133798
- const i3 = e3.attributeName();
133799
- let n2 = e3.defaultValue;
133800
- if (e3.negate || e3.optional || e3.required || typeof n2 === "boolean") {
133801
- if (e3.negate) {
133802
- const t4 = e3.long.replace(/^--no-/, "--");
133803
- n2 = this._findOption(t4) ? this.getOptionValue(i3) : true;
133804
- }
133805
- if (n2 !== void 0) {
133806
- this.setOptionValueWithSource(i3, n2, "default");
133795
+ addOption(t3) {
133796
+ const e3 = t3.name();
133797
+ const i3 = t3.attributeName();
133798
+ if (t3.negate) {
133799
+ const e4 = t3.long.replace(/^--no-/, "--");
133800
+ if (!this._findOption(e4)) {
133801
+ this.setOptionValueWithSource(i3, t3.defaultValue === void 0 ? true : t3.defaultValue, "default");
133807
133802
  }
133803
+ } else if (t3.defaultValue !== void 0) {
133804
+ this.setOptionValueWithSource(i3, t3.defaultValue, "default");
133808
133805
  }
133809
- this.options.push(e3);
133810
- const handleOptionValue = (t4, s2, r2) => {
133811
- const o2 = this.getOptionValue(i3);
133812
- if (t4 !== null && e3.parseArg) {
133806
+ this.options.push(t3);
133807
+ const handleOptionValue = (e4, n2, s2) => {
133808
+ if (e4 == null && t3.presetArg !== void 0) {
133809
+ e4 = t3.presetArg;
133810
+ }
133811
+ const r2 = this.getOptionValue(i3);
133812
+ if (e4 !== null && t3.parseArg) {
133813
133813
  try {
133814
- t4 = e3.parseArg(t4, o2 === void 0 ? n2 : o2);
133815
- } catch (e4) {
133816
- if (e4.code === "commander.invalidArgument") {
133817
- const t5 = `${s2} ${e4.message}`;
133818
- this._displayError(e4.exitCode, e4.code, t5);
133814
+ e4 = t3.parseArg(e4, r2);
133815
+ } catch (t4) {
133816
+ if (t4.code === "commander.invalidArgument") {
133817
+ const e5 = `${n2} ${t4.message}`;
133818
+ this.error(e5, { exitCode: t4.exitCode, code: t4.code });
133819
133819
  }
133820
- throw e4;
133820
+ throw t4;
133821
133821
  }
133822
- } else if (t4 !== null && e3.variadic) {
133823
- t4 = e3._concatValue(t4, o2);
133822
+ } else if (e4 !== null && t3.variadic) {
133823
+ e4 = t3._concatValue(e4, r2);
133824
133824
  }
133825
- if (typeof o2 === "boolean" || typeof o2 === "undefined") {
133826
- if (t4 == null) {
133827
- this.setOptionValueWithSource(i3, e3.negate ? false : n2 || true, r2);
133825
+ if (e4 == null) {
133826
+ if (t3.negate) {
133827
+ e4 = false;
133828
+ } else if (t3.isBoolean() || t3.optional) {
133829
+ e4 = true;
133828
133830
  } else {
133829
- this.setOptionValueWithSource(i3, t4, r2);
133831
+ e4 = "";
133830
133832
  }
133831
- } else if (t4 !== null) {
133832
- this.setOptionValueWithSource(i3, e3.negate ? false : t4, r2);
133833
133833
  }
133834
+ this.setOptionValueWithSource(i3, e4, s2);
133834
133835
  };
133835
- this.on("option:" + t3, (t4) => {
133836
- const i4 = `error: option '${e3.flags}' argument '${t4}' is invalid.`;
133837
- handleOptionValue(t4, i4, "cli");
133836
+ this.on("option:" + e3, (e4) => {
133837
+ const i4 = `error: option '${t3.flags}' argument '${e4}' is invalid.`;
133838
+ handleOptionValue(e4, i4, "cli");
133838
133839
  });
133839
- if (e3.envVar) {
133840
- this.on("optionEnv:" + t3, (t4) => {
133841
- const i4 = `error: option '${e3.flags}' value '${t4}' from env '${e3.envVar}' is invalid.`;
133842
- handleOptionValue(t4, i4, "env");
133840
+ if (t3.envVar) {
133841
+ this.on("optionEnv:" + e3, (e4) => {
133842
+ const i4 = `error: option '${t3.flags}' value '${e4}' from env '${t3.envVar}' is invalid.`;
133843
+ handleOptionValue(e4, i4, "env");
133843
133844
  });
133844
133845
  }
133845
133846
  return this;
133846
133847
  }
133847
- _optionEx(e3, t3, i3, n2, s2) {
133848
- const r2 = this.createOption(t3, i3);
133849
- r2.makeOptionMandatory(!!e3.mandatory);
133848
+ _optionEx(t3, e3, i3, n2, s2) {
133849
+ if (typeof e3 === "object" && e3 instanceof p) {
133850
+ throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
133851
+ }
133852
+ const r2 = this.createOption(e3, i3);
133853
+ r2.makeOptionMandatory(!!t3.mandatory);
133850
133854
  if (typeof n2 === "function") {
133851
133855
  r2.default(s2).argParser(n2);
133852
133856
  } else if (n2 instanceof RegExp) {
133853
- const e4 = n2;
133854
- n2 = (t4, i4) => {
133855
- const n3 = e4.exec(t4);
133857
+ const t4 = n2;
133858
+ n2 = (e4, i4) => {
133859
+ const n3 = t4.exec(e4);
133856
133860
  return n3 ? n3[0] : i4;
133857
133861
  };
133858
133862
  r2.default(s2).argParser(n2);
@@ -133861,209 +133865,233 @@ Expecting one of '${i3.join("', '")}'`);
133861
133865
  }
133862
133866
  return this.addOption(r2);
133863
133867
  }
133864
- option(e3, t3, i3, n2) {
133865
- return this._optionEx({}, e3, t3, i3, n2);
133868
+ option(t3, e3, i3, n2) {
133869
+ return this._optionEx({}, t3, e3, i3, n2);
133866
133870
  }
133867
- requiredOption(e3, t3, i3, n2) {
133868
- return this._optionEx({ mandatory: true }, e3, t3, i3, n2);
133871
+ requiredOption(t3, e3, i3, n2) {
133872
+ return this._optionEx({ mandatory: true }, t3, e3, i3, n2);
133869
133873
  }
133870
- combineFlagAndOptionalValue(e3 = true) {
133871
- this._combineFlagAndOptionalValue = !!e3;
133874
+ combineFlagAndOptionalValue(t3 = true) {
133875
+ this._combineFlagAndOptionalValue = !!t3;
133872
133876
  return this;
133873
133877
  }
133874
- allowUnknownOption(e3 = true) {
133875
- this._allowUnknownOption = !!e3;
133878
+ allowUnknownOption(t3 = true) {
133879
+ this._allowUnknownOption = !!t3;
133876
133880
  return this;
133877
133881
  }
133878
- allowExcessArguments(e3 = true) {
133879
- this._allowExcessArguments = !!e3;
133882
+ allowExcessArguments(t3 = true) {
133883
+ this._allowExcessArguments = !!t3;
133880
133884
  return this;
133881
133885
  }
133882
- enablePositionalOptions(e3 = true) {
133883
- this._enablePositionalOptions = !!e3;
133886
+ enablePositionalOptions(t3 = true) {
133887
+ this._enablePositionalOptions = !!t3;
133884
133888
  return this;
133885
133889
  }
133886
- passThroughOptions(e3 = true) {
133887
- this._passThroughOptions = !!e3;
133888
- if (!!this.parent && e3 && !this.parent._enablePositionalOptions) {
133890
+ passThroughOptions(t3 = true) {
133891
+ this._passThroughOptions = !!t3;
133892
+ if (!!this.parent && t3 && !this.parent._enablePositionalOptions) {
133889
133893
  throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
133890
133894
  }
133891
133895
  return this;
133892
133896
  }
133893
- storeOptionsAsProperties(e3 = true) {
133894
- this._storeOptionsAsProperties = !!e3;
133897
+ storeOptionsAsProperties(t3 = true) {
133898
+ this._storeOptionsAsProperties = !!t3;
133895
133899
  if (this.options.length) {
133896
133900
  throw new Error("call .storeOptionsAsProperties() before adding options");
133897
133901
  }
133898
133902
  return this;
133899
133903
  }
133900
- getOptionValue(e3) {
133904
+ getOptionValue(t3) {
133901
133905
  if (this._storeOptionsAsProperties) {
133902
- return this[e3];
133906
+ return this[t3];
133903
133907
  }
133904
- return this._optionValues[e3];
133908
+ return this._optionValues[t3];
133905
133909
  }
133906
- setOptionValue(e3, t3) {
133910
+ setOptionValue(t3, e3) {
133911
+ return this.setOptionValueWithSource(t3, e3, void 0);
133912
+ }
133913
+ setOptionValueWithSource(t3, e3, i3) {
133907
133914
  if (this._storeOptionsAsProperties) {
133908
- this[e3] = t3;
133915
+ this[t3] = e3;
133909
133916
  } else {
133910
- this._optionValues[e3] = t3;
133917
+ this._optionValues[t3] = e3;
133911
133918
  }
133919
+ this._optionValueSources[t3] = i3;
133912
133920
  return this;
133913
133921
  }
133914
- setOptionValueWithSource(e3, t3, i3) {
133915
- this.setOptionValue(e3, t3);
133916
- this._optionValueSources[e3] = i3;
133917
- return this;
133922
+ getOptionValueSource(t3) {
133923
+ return this._optionValueSources[t3];
133918
133924
  }
133919
- getOptionValueSource(e3) {
133920
- return this._optionValueSources[e3];
133925
+ getOptionValueSourceWithGlobals(t3) {
133926
+ let e3;
133927
+ getCommandAndParents(this).forEach((i3) => {
133928
+ if (i3.getOptionValueSource(t3) !== void 0) {
133929
+ e3 = i3.getOptionValueSource(t3);
133930
+ }
133931
+ });
133932
+ return e3;
133921
133933
  }
133922
- _prepareUserArgs(e3, t3) {
133923
- if (e3 !== void 0 && !Array.isArray(e3)) {
133934
+ _prepareUserArgs(t3, e3) {
133935
+ if (t3 !== void 0 && !Array.isArray(t3)) {
133924
133936
  throw new Error("first parameter to parse must be array or undefined");
133925
133937
  }
133926
- t3 = t3 || {};
133927
- if (e3 === void 0) {
133928
- e3 = process.argv;
133929
- if (process.versions && process.versions.electron) {
133930
- t3.from = "electron";
133938
+ e3 = e3 || {};
133939
+ if (t3 === void 0) {
133940
+ t3 = a.argv;
133941
+ if (a.versions && a.versions.electron) {
133942
+ e3.from = "electron";
133931
133943
  }
133932
133944
  }
133933
- this.rawArgs = e3.slice();
133945
+ this.rawArgs = t3.slice();
133934
133946
  let i3;
133935
- switch (t3.from) {
133947
+ switch (e3.from) {
133936
133948
  case void 0:
133937
133949
  case "node":
133938
- this._scriptPath = e3[1];
133939
- i3 = e3.slice(2);
133950
+ this._scriptPath = t3[1];
133951
+ i3 = t3.slice(2);
133940
133952
  break;
133941
133953
  case "electron":
133942
- if (process.defaultApp) {
133943
- this._scriptPath = e3[1];
133944
- i3 = e3.slice(2);
133954
+ if (a.defaultApp) {
133955
+ this._scriptPath = t3[1];
133956
+ i3 = t3.slice(2);
133945
133957
  } else {
133946
- i3 = e3.slice(1);
133958
+ i3 = t3.slice(1);
133947
133959
  }
133948
133960
  break;
133949
133961
  case "user":
133950
- i3 = e3.slice(0);
133962
+ i3 = t3.slice(0);
133951
133963
  break;
133952
133964
  default:
133953
- throw new Error(`unexpected parse option { from: '${t3.from}' }`);
133965
+ throw new Error(`unexpected parse option { from: '${e3.from}' }`);
133954
133966
  }
133955
- if (!this._scriptPath && require.main) {
133956
- this._scriptPath = require.main.filename;
133957
- }
133958
- this._name = this._name || this._scriptPath && r.basename(this._scriptPath, r.extname(this._scriptPath));
133967
+ if (!this._name && this._scriptPath)
133968
+ this.nameFromFilename(this._scriptPath);
133969
+ this._name = this._name || "program";
133959
133970
  return i3;
133960
133971
  }
133961
- parse(e3, t3) {
133962
- const i3 = this._prepareUserArgs(e3, t3);
133972
+ parse(t3, e3) {
133973
+ const i3 = this._prepareUserArgs(t3, e3);
133963
133974
  this._parseCommand([], i3);
133964
133975
  return this;
133965
133976
  }
133966
- parseAsync(e3, t3) {
133977
+ parseAsync(t3, e3) {
133967
133978
  return __async(this, null, function* () {
133968
- const i3 = this._prepareUserArgs(e3, t3);
133979
+ const i3 = this._prepareUserArgs(t3, e3);
133969
133980
  yield this._parseCommand([], i3);
133970
133981
  return this;
133971
133982
  });
133972
133983
  }
133973
- _executeSubCommand(e3, t3) {
133974
- t3 = t3.slice();
133984
+ _executeSubCommand(t3, e3) {
133985
+ e3 = e3.slice();
133975
133986
  let i3 = false;
133976
133987
  const n2 = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
133977
- this._checkForMissingMandatoryOptions();
133978
- let a2 = this._scriptPath;
133979
- if (!a2 && require.main) {
133980
- a2 = require.main.filename;
133981
- }
133982
- let h2;
133983
- try {
133984
- const e4 = o.realpathSync(a2);
133985
- h2 = r.dirname(e4);
133986
- } catch (e4) {
133987
- h2 = ".";
133988
+ function findFile(t4, e4) {
133989
+ const i4 = r.resolve(t4, e4);
133990
+ if (o.existsSync(i4))
133991
+ return i4;
133992
+ if (n2.includes(r.extname(e4)))
133993
+ return void 0;
133994
+ const s2 = n2.find((t5) => o.existsSync(`${i4}${t5}`));
133995
+ if (s2)
133996
+ return `${i4}${s2}`;
133997
+ return void 0;
133988
133998
  }
133989
- let u2 = r.basename(a2, r.extname(a2)) + "-" + e3._name;
133990
- if (e3._executableFile) {
133991
- u2 = e3._executableFile;
133999
+ this._checkForMissingMandatoryOptions();
134000
+ this._checkForConflictingOptions();
134001
+ let l2 = t3._executableFile || `${this._name}-${t3._name}`;
134002
+ let h2 = this._executableDir || "";
134003
+ if (this._scriptPath) {
134004
+ let t4;
134005
+ try {
134006
+ t4 = o.realpathSync(this._scriptPath);
134007
+ } catch (e4) {
134008
+ t4 = this._scriptPath;
134009
+ }
134010
+ h2 = r.resolve(r.dirname(t4), h2);
133992
134011
  }
133993
- const c2 = r.join(h2, u2);
133994
- if (o.existsSync(c2)) {
133995
- u2 = c2;
133996
- } else {
133997
- n2.forEach((e4) => {
133998
- if (o.existsSync(`${c2}${e4}`)) {
133999
- u2 = `${c2}${e4}`;
134012
+ if (h2) {
134013
+ let e4 = findFile(h2, l2);
134014
+ if (!e4 && !t3._executableFile && this._scriptPath) {
134015
+ const i4 = r.basename(this._scriptPath, r.extname(this._scriptPath));
134016
+ if (i4 !== this._name) {
134017
+ e4 = findFile(h2, `${i4}-${t3._name}`);
134000
134018
  }
134001
- });
134019
+ }
134020
+ l2 = e4 || l2;
134002
134021
  }
134003
- i3 = n2.includes(r.extname(u2));
134004
- let p2;
134005
- if (process.platform !== "win32") {
134022
+ i3 = n2.includes(r.extname(l2));
134023
+ let c2;
134024
+ if (a.platform !== "win32") {
134006
134025
  if (i3) {
134007
- t3.unshift(u2);
134008
- t3 = incrementNodeInspectorPort(process.execArgv).concat(t3);
134009
- p2 = s.spawn(process.argv[0], t3, { stdio: "inherit" });
134026
+ e3.unshift(l2);
134027
+ e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
134028
+ c2 = s.spawn(a.argv[0], e3, { stdio: "inherit" });
134010
134029
  } else {
134011
- p2 = s.spawn(u2, t3, { stdio: "inherit" });
134030
+ c2 = s.spawn(l2, e3, { stdio: "inherit" });
134012
134031
  }
134013
134032
  } else {
134014
- t3.unshift(u2);
134015
- t3 = incrementNodeInspectorPort(process.execArgv).concat(t3);
134016
- p2 = s.spawn(process.execPath, t3, { stdio: "inherit" });
134017
- }
134018
- const m2 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
134019
- m2.forEach((e4) => {
134020
- process.on(e4, () => {
134021
- if (p2.killed === false && p2.exitCode === null) {
134022
- p2.kill(e4);
134023
- }
134033
+ e3.unshift(l2);
134034
+ e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
134035
+ c2 = s.spawn(a.execPath, e3, { stdio: "inherit" });
134036
+ }
134037
+ if (!c2.killed) {
134038
+ const t4 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
134039
+ t4.forEach((t5) => {
134040
+ a.on(t5, () => {
134041
+ if (c2.killed === false && c2.exitCode === null) {
134042
+ c2.kill(t5);
134043
+ }
134044
+ });
134024
134045
  });
134025
- });
134026
- const d = this._exitCallback;
134027
- if (!d) {
134028
- p2.on("close", process.exit.bind(process));
134046
+ }
134047
+ const p2 = this._exitCallback;
134048
+ if (!p2) {
134049
+ c2.on("close", a.exit.bind(a));
134029
134050
  } else {
134030
- p2.on("close", () => {
134031
- d(new l(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
134051
+ c2.on("close", () => {
134052
+ p2(new u(a.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
134032
134053
  });
134033
134054
  }
134034
- p2.on("error", (t4) => {
134035
- if (t4.code === "ENOENT") {
134036
- const t5 = `'${u2}' does not exist
134037
- - if '${e3._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
134038
- - if the default executable name is not suitable, use the executableFile option to supply a custom name`;
134039
- throw new Error(t5);
134040
- } else if (t4.code === "EACCES") {
134041
- throw new Error(`'${u2}' not executable`);
134042
- }
134043
- if (!d) {
134044
- process.exit(1);
134055
+ c2.on("error", (e4) => {
134056
+ if (e4.code === "ENOENT") {
134057
+ 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";
134058
+ const i4 = `'${l2}' does not exist
134059
+ - if '${t3._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
134060
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
134061
+ - ${e5}`;
134062
+ throw new Error(i4);
134063
+ } else if (e4.code === "EACCES") {
134064
+ throw new Error(`'${l2}' not executable`);
134065
+ }
134066
+ if (!p2) {
134067
+ a.exit(1);
134045
134068
  } else {
134046
- const e4 = new l(1, "commander.executeSubCommandAsync", "(error)");
134047
- e4.nestedError = t4;
134048
- d(e4);
134069
+ const t4 = new u(1, "commander.executeSubCommandAsync", "(error)");
134070
+ t4.nestedError = e4;
134071
+ p2(t4);
134049
134072
  }
134050
134073
  });
134051
- this.runningCommand = p2;
134074
+ this.runningCommand = c2;
134052
134075
  }
134053
- _dispatchSubcommand(e3, t3, i3) {
134054
- const n2 = this._findCommand(e3);
134076
+ _dispatchSubcommand(t3, e3, i3) {
134077
+ const n2 = this._findCommand(t3);
134055
134078
  if (!n2)
134056
134079
  this.help({ error: true });
134057
- if (n2._executableHandler) {
134058
- this._executeSubCommand(n2, t3.concat(i3));
134059
- } else {
134060
- return n2._parseCommand(t3, i3);
134061
- }
134080
+ let s2;
134081
+ s2 = this._chainOrCallSubCommandHook(s2, n2, "preSubcommand");
134082
+ s2 = this._chainOrCall(s2, () => {
134083
+ if (n2._executableHandler) {
134084
+ this._executeSubCommand(n2, e3.concat(i3));
134085
+ } else {
134086
+ return n2._parseCommand(e3, i3);
134087
+ }
134088
+ });
134089
+ return s2;
134062
134090
  }
134063
134091
  _checkNumberOfArguments() {
134064
- this._args.forEach((e3, t3) => {
134065
- if (e3.required && this.args[t3] == null) {
134066
- this.missingArgument(e3.name());
134092
+ this._args.forEach((t3, e3) => {
134093
+ if (t3.required && this.args[e3] == null) {
134094
+ this.missingArgument(t3.name());
134067
134095
  }
134068
134096
  });
134069
134097
  if (this._args.length > 0 && this._args[this._args.length - 1].variadic) {
@@ -134074,15 +134102,15 @@ Expecting one of '${i3.join("', '")}'`);
134074
134102
  }
134075
134103
  }
134076
134104
  _processArguments() {
134077
- const myParseArg = (e4, t3, i3) => {
134078
- let n2 = t3;
134079
- if (t3 !== null && e4.parseArg) {
134105
+ const myParseArg = (t4, e3, i3) => {
134106
+ let n2 = e3;
134107
+ if (e3 !== null && t4.parseArg) {
134080
134108
  try {
134081
- n2 = e4.parseArg(t3, i3);
134109
+ n2 = t4.parseArg(e3, i3);
134082
134110
  } catch (i4) {
134083
134111
  if (i4.code === "commander.invalidArgument") {
134084
- const n3 = `error: command-argument value '${t3}' is invalid for argument '${e4.name()}'. ${i4.message}`;
134085
- this._displayError(i4.exitCode, i4.code, n3);
134112
+ const n3 = `error: command-argument value '${e3}' is invalid for argument '${t4.name()}'. ${i4.message}`;
134113
+ this.error(n3, { exitCode: i4.exitCode, code: i4.code });
134086
134114
  }
134087
134115
  throw i4;
134088
134116
  }
@@ -134090,74 +134118,85 @@ Expecting one of '${i3.join("', '")}'`);
134090
134118
  return n2;
134091
134119
  };
134092
134120
  this._checkNumberOfArguments();
134093
- const e3 = [];
134094
- this._args.forEach((t3, i3) => {
134095
- let n2 = t3.defaultValue;
134096
- if (t3.variadic) {
134121
+ const t3 = [];
134122
+ this._args.forEach((e3, i3) => {
134123
+ let n2 = e3.defaultValue;
134124
+ if (e3.variadic) {
134097
134125
  if (i3 < this.args.length) {
134098
134126
  n2 = this.args.slice(i3);
134099
- if (t3.parseArg) {
134100
- n2 = n2.reduce((e4, i4) => myParseArg(t3, i4, e4), t3.defaultValue);
134127
+ if (e3.parseArg) {
134128
+ n2 = n2.reduce((t4, i4) => myParseArg(e3, i4, t4), e3.defaultValue);
134101
134129
  }
134102
134130
  } else if (n2 === void 0) {
134103
134131
  n2 = [];
134104
134132
  }
134105
134133
  } else if (i3 < this.args.length) {
134106
134134
  n2 = this.args[i3];
134107
- if (t3.parseArg) {
134108
- n2 = myParseArg(t3, n2, t3.defaultValue);
134135
+ if (e3.parseArg) {
134136
+ n2 = myParseArg(e3, n2, e3.defaultValue);
134109
134137
  }
134110
134138
  }
134111
- e3[i3] = n2;
134139
+ t3[i3] = n2;
134112
134140
  });
134113
- this.processedArgs = e3;
134141
+ this.processedArgs = t3;
134114
134142
  }
134115
- _chainOrCall(e3, t3) {
134116
- if (e3 && e3.then && typeof e3.then === "function") {
134117
- return e3.then(() => t3());
134143
+ _chainOrCall(t3, e3) {
134144
+ if (t3 && t3.then && typeof t3.then === "function") {
134145
+ return t3.then(() => e3());
134118
134146
  }
134119
- return t3();
134147
+ return e3();
134120
134148
  }
134121
- _chainOrCallHooks(e3, t3) {
134122
- let i3 = e3;
134149
+ _chainOrCallHooks(t3, e3) {
134150
+ let i3 = t3;
134123
134151
  const n2 = [];
134124
- getCommandAndParents(this).reverse().filter((e4) => e4._lifeCycleHooks[t3] !== void 0).forEach((e4) => {
134125
- e4._lifeCycleHooks[t3].forEach((t4) => {
134126
- n2.push({ hookedCommand: e4, callback: t4 });
134152
+ getCommandAndParents(this).reverse().filter((t4) => t4._lifeCycleHooks[e3] !== void 0).forEach((t4) => {
134153
+ t4._lifeCycleHooks[e3].forEach((e4) => {
134154
+ n2.push({ hookedCommand: t4, callback: e4 });
134127
134155
  });
134128
134156
  });
134129
- if (t3 === "postAction") {
134157
+ if (e3 === "postAction") {
134130
134158
  n2.reverse();
134131
134159
  }
134132
- n2.forEach((e4) => {
134133
- i3 = this._chainOrCall(i3, () => e4.callback(e4.hookedCommand, this));
134160
+ n2.forEach((t4) => {
134161
+ i3 = this._chainOrCall(i3, () => t4.callback(t4.hookedCommand, this));
134134
134162
  });
134135
134163
  return i3;
134136
134164
  }
134137
- _parseCommand(e3, t3) {
134138
- const i3 = this.parseOptions(t3);
134139
- this._parseOptionsEnv();
134140
- e3 = e3.concat(i3.operands);
134141
- t3 = i3.unknown;
134142
- this.args = e3.concat(t3);
134143
- if (e3 && this._findCommand(e3[0])) {
134144
- return this._dispatchSubcommand(e3[0], e3.slice(1), t3);
134165
+ _chainOrCallSubCommandHook(t3, e3, i3) {
134166
+ let n2 = t3;
134167
+ if (this._lifeCycleHooks[i3] !== void 0) {
134168
+ this._lifeCycleHooks[i3].forEach((t4) => {
134169
+ n2 = this._chainOrCall(n2, () => t4(this, e3));
134170
+ });
134145
134171
  }
134146
- if (this._hasImplicitHelpCommand() && e3[0] === this._helpCommandName) {
134147
- if (e3.length === 1) {
134172
+ return n2;
134173
+ }
134174
+ _parseCommand(t3, e3) {
134175
+ const i3 = this.parseOptions(e3);
134176
+ this._parseOptionsEnv();
134177
+ this._parseOptionsImplied();
134178
+ t3 = t3.concat(i3.operands);
134179
+ e3 = i3.unknown;
134180
+ this.args = t3.concat(e3);
134181
+ if (t3 && this._findCommand(t3[0])) {
134182
+ return this._dispatchSubcommand(t3[0], t3.slice(1), e3);
134183
+ }
134184
+ if (this._hasImplicitHelpCommand() && t3[0] === this._helpCommandName) {
134185
+ if (t3.length === 1) {
134148
134186
  this.help();
134149
134187
  }
134150
- return this._dispatchSubcommand(e3[1], [], [this._helpLongFlag]);
134188
+ return this._dispatchSubcommand(t3[1], [], [this._helpLongFlag]);
134151
134189
  }
134152
134190
  if (this._defaultCommandName) {
134153
- outputHelpIfRequested(this, t3);
134154
- return this._dispatchSubcommand(this._defaultCommandName, e3, t3);
134191
+ outputHelpIfRequested(this, e3);
134192
+ return this._dispatchSubcommand(this._defaultCommandName, t3, e3);
134155
134193
  }
134156
134194
  if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
134157
134195
  this.help({ error: true });
134158
134196
  }
134159
134197
  outputHelpIfRequested(this, i3.unknown);
134160
134198
  this._checkForMissingMandatoryOptions();
134199
+ this._checkForConflictingOptions();
134161
134200
  const checkForUnknownOptions = () => {
134162
134201
  if (i3.unknown.length > 0) {
134163
134202
  this.unknownOption(i3.unknown[0]);
@@ -134170,21 +134209,24 @@ Expecting one of '${i3.join("', '")}'`);
134170
134209
  let i4;
134171
134210
  i4 = this._chainOrCallHooks(i4, "preAction");
134172
134211
  i4 = this._chainOrCall(i4, () => this._actionHandler(this.processedArgs));
134173
- if (this.parent)
134174
- this.parent.emit(n2, e3, t3);
134212
+ if (this.parent) {
134213
+ i4 = this._chainOrCall(i4, () => {
134214
+ this.parent.emit(n2, t3, e3);
134215
+ });
134216
+ }
134175
134217
  i4 = this._chainOrCallHooks(i4, "postAction");
134176
134218
  return i4;
134177
134219
  }
134178
134220
  if (this.parent && this.parent.listenerCount(n2)) {
134179
134221
  checkForUnknownOptions();
134180
134222
  this._processArguments();
134181
- this.parent.emit(n2, e3, t3);
134182
- } else if (e3.length) {
134223
+ this.parent.emit(n2, t3, e3);
134224
+ } else if (t3.length) {
134183
134225
  if (this._findCommand("*")) {
134184
- return this._dispatchSubcommand("*", e3, t3);
134226
+ return this._dispatchSubcommand("*", t3, e3);
134185
134227
  }
134186
134228
  if (this.listenerCount("command:*")) {
134187
- this.emit("command:*", e3, t3);
134229
+ this.emit("command:*", t3, e3);
134188
134230
  } else if (this.commands.length) {
134189
134231
  this.unknownCommand();
134190
134232
  } else {
@@ -134199,131 +134241,155 @@ Expecting one of '${i3.join("', '")}'`);
134199
134241
  this._processArguments();
134200
134242
  }
134201
134243
  }
134202
- _findCommand(e3) {
134203
- if (!e3)
134244
+ _findCommand(t3) {
134245
+ if (!t3)
134204
134246
  return void 0;
134205
- return this.commands.find((t3) => t3._name === e3 || t3._aliases.includes(e3));
134247
+ return this.commands.find((e3) => e3._name === t3 || e3._aliases.includes(t3));
134206
134248
  }
134207
- _findOption(e3) {
134208
- return this.options.find((t3) => t3.is(e3));
134249
+ _findOption(t3) {
134250
+ return this.options.find((e3) => e3.is(t3));
134209
134251
  }
134210
134252
  _checkForMissingMandatoryOptions() {
134211
- for (let e3 = this; e3; e3 = e3.parent) {
134212
- e3.options.forEach((t3) => {
134213
- if (t3.mandatory && e3.getOptionValue(t3.attributeName()) === void 0) {
134214
- e3.missingMandatoryOptionValue(t3);
134253
+ for (let t3 = this; t3; t3 = t3.parent) {
134254
+ t3.options.forEach((e3) => {
134255
+ if (e3.mandatory && t3.getOptionValue(e3.attributeName()) === void 0) {
134256
+ t3.missingMandatoryOptionValue(e3);
134215
134257
  }
134216
134258
  });
134217
134259
  }
134218
134260
  }
134219
- parseOptions(e3) {
134220
- const t3 = [];
134261
+ _checkForConflictingLocalOptions() {
134262
+ const t3 = this.options.filter((t4) => {
134263
+ const e4 = t4.attributeName();
134264
+ if (this.getOptionValue(e4) === void 0) {
134265
+ return false;
134266
+ }
134267
+ return this.getOptionValueSource(e4) !== "default";
134268
+ });
134269
+ const e3 = t3.filter((t4) => t4.conflictsWith.length > 0);
134270
+ e3.forEach((e4) => {
134271
+ const i3 = t3.find((t4) => e4.conflictsWith.includes(t4.attributeName()));
134272
+ if (i3) {
134273
+ this._conflictingOption(e4, i3);
134274
+ }
134275
+ });
134276
+ }
134277
+ _checkForConflictingOptions() {
134278
+ for (let t3 = this; t3; t3 = t3.parent) {
134279
+ t3._checkForConflictingLocalOptions();
134280
+ }
134281
+ }
134282
+ parseOptions(t3) {
134283
+ const e3 = [];
134221
134284
  const i3 = [];
134222
- let n2 = t3;
134223
- const s2 = e3.slice();
134224
- function maybeOption(e4) {
134225
- return e4.length > 1 && e4[0] === "-";
134285
+ let n2 = e3;
134286
+ const s2 = t3.slice();
134287
+ function maybeOption(t4) {
134288
+ return t4.length > 1 && t4[0] === "-";
134226
134289
  }
134227
134290
  let r2 = null;
134228
134291
  while (s2.length) {
134229
- const e4 = s2.shift();
134230
- if (e4 === "--") {
134292
+ const t4 = s2.shift();
134293
+ if (t4 === "--") {
134231
134294
  if (n2 === i3)
134232
- n2.push(e4);
134295
+ n2.push(t4);
134233
134296
  n2.push(...s2);
134234
134297
  break;
134235
134298
  }
134236
- if (r2 && !maybeOption(e4)) {
134237
- this.emit(`option:${r2.name()}`, e4);
134299
+ if (r2 && !maybeOption(t4)) {
134300
+ this.emit(`option:${r2.name()}`, t4);
134238
134301
  continue;
134239
134302
  }
134240
134303
  r2 = null;
134241
- if (maybeOption(e4)) {
134242
- const t4 = this._findOption(e4);
134243
- if (t4) {
134244
- if (t4.required) {
134245
- const e5 = s2.shift();
134246
- if (e5 === void 0)
134247
- this.optionMissingArgument(t4);
134248
- this.emit(`option:${t4.name()}`, e5);
134249
- } else if (t4.optional) {
134250
- let e5 = null;
134304
+ if (maybeOption(t4)) {
134305
+ const e4 = this._findOption(t4);
134306
+ if (e4) {
134307
+ if (e4.required) {
134308
+ const t5 = s2.shift();
134309
+ if (t5 === void 0)
134310
+ this.optionMissingArgument(e4);
134311
+ this.emit(`option:${e4.name()}`, t5);
134312
+ } else if (e4.optional) {
134313
+ let t5 = null;
134251
134314
  if (s2.length > 0 && !maybeOption(s2[0])) {
134252
- e5 = s2.shift();
134315
+ t5 = s2.shift();
134253
134316
  }
134254
- this.emit(`option:${t4.name()}`, e5);
134317
+ this.emit(`option:${e4.name()}`, t5);
134255
134318
  } else {
134256
- this.emit(`option:${t4.name()}`);
134319
+ this.emit(`option:${e4.name()}`);
134257
134320
  }
134258
- r2 = t4.variadic ? t4 : null;
134321
+ r2 = e4.variadic ? e4 : null;
134259
134322
  continue;
134260
134323
  }
134261
134324
  }
134262
- if (e4.length > 2 && e4[0] === "-" && e4[1] !== "-") {
134263
- const t4 = this._findOption(`-${e4[1]}`);
134264
- if (t4) {
134265
- if (t4.required || t4.optional && this._combineFlagAndOptionalValue) {
134266
- this.emit(`option:${t4.name()}`, e4.slice(2));
134325
+ if (t4.length > 2 && t4[0] === "-" && t4[1] !== "-") {
134326
+ const e4 = this._findOption(`-${t4[1]}`);
134327
+ if (e4) {
134328
+ if (e4.required || e4.optional && this._combineFlagAndOptionalValue) {
134329
+ this.emit(`option:${e4.name()}`, t4.slice(2));
134267
134330
  } else {
134268
- this.emit(`option:${t4.name()}`);
134269
- s2.unshift(`-${e4.slice(2)}`);
134331
+ this.emit(`option:${e4.name()}`);
134332
+ s2.unshift(`-${t4.slice(2)}`);
134270
134333
  }
134271
134334
  continue;
134272
134335
  }
134273
134336
  }
134274
- if (/^--[^=]+=/.test(e4)) {
134275
- const t4 = e4.indexOf("=");
134276
- const i4 = this._findOption(e4.slice(0, t4));
134337
+ if (/^--[^=]+=/.test(t4)) {
134338
+ const e4 = t4.indexOf("=");
134339
+ const i4 = this._findOption(t4.slice(0, e4));
134277
134340
  if (i4 && (i4.required || i4.optional)) {
134278
- this.emit(`option:${i4.name()}`, e4.slice(t4 + 1));
134341
+ this.emit(`option:${i4.name()}`, t4.slice(e4 + 1));
134279
134342
  continue;
134280
134343
  }
134281
134344
  }
134282
- if (maybeOption(e4)) {
134345
+ if (maybeOption(t4)) {
134283
134346
  n2 = i3;
134284
134347
  }
134285
- if ((this._enablePositionalOptions || this._passThroughOptions) && t3.length === 0 && i3.length === 0) {
134286
- if (this._findCommand(e4)) {
134287
- t3.push(e4);
134348
+ if ((this._enablePositionalOptions || this._passThroughOptions) && e3.length === 0 && i3.length === 0) {
134349
+ if (this._findCommand(t4)) {
134350
+ e3.push(t4);
134288
134351
  if (s2.length > 0)
134289
134352
  i3.push(...s2);
134290
134353
  break;
134291
- } else if (e4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
134292
- t3.push(e4);
134354
+ } else if (t4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
134355
+ e3.push(t4);
134293
134356
  if (s2.length > 0)
134294
- t3.push(...s2);
134357
+ e3.push(...s2);
134295
134358
  break;
134296
134359
  } else if (this._defaultCommandName) {
134297
- i3.push(e4);
134360
+ i3.push(t4);
134298
134361
  if (s2.length > 0)
134299
134362
  i3.push(...s2);
134300
134363
  break;
134301
134364
  }
134302
134365
  }
134303
134366
  if (this._passThroughOptions) {
134304
- n2.push(e4);
134367
+ n2.push(t4);
134305
134368
  if (s2.length > 0)
134306
134369
  n2.push(...s2);
134307
134370
  break;
134308
134371
  }
134309
- n2.push(e4);
134372
+ n2.push(t4);
134310
134373
  }
134311
- return { operands: t3, unknown: i3 };
134374
+ return { operands: e3, unknown: i3 };
134312
134375
  }
134313
134376
  opts() {
134314
134377
  if (this._storeOptionsAsProperties) {
134315
- const e3 = {};
134316
- const t3 = this.options.length;
134317
- for (let i3 = 0; i3 < t3; i3++) {
134318
- const t4 = this.options[i3].attributeName();
134319
- e3[t4] = t4 === this._versionOptionName ? this._version : this[t4];
134378
+ const t3 = {};
134379
+ const e3 = this.options.length;
134380
+ for (let i3 = 0; i3 < e3; i3++) {
134381
+ const e4 = this.options[i3].attributeName();
134382
+ t3[e4] = e4 === this._versionOptionName ? this._version : this[e4];
134320
134383
  }
134321
- return e3;
134384
+ return t3;
134322
134385
  }
134323
134386
  return this._optionValues;
134324
134387
  }
134325
- _displayError(e3, t3, i3) {
134326
- this._outputConfiguration.outputError(`${i3}
134388
+ optsWithGlobals() {
134389
+ return getCommandAndParents(this).reduce((t3, e3) => Object.assign(t3, e3.opts()), {});
134390
+ }
134391
+ error(t3, e3) {
134392
+ this._outputConfiguration.outputError(`${t3}
134327
134393
  `, this._outputConfiguration.writeErr);
134328
134394
  if (typeof this._showHelpAfterError === "string") {
134329
134395
  this._outputConfiguration.writeErr(`${this._showHelpAfterError}
@@ -134332,166 +134398,217 @@ Expecting one of '${i3.join("', '")}'`);
134332
134398
  this._outputConfiguration.writeErr("\n");
134333
134399
  this.outputHelp({ error: true });
134334
134400
  }
134335
- this._exit(e3, t3, i3);
134401
+ const i3 = e3 || {};
134402
+ const n2 = i3.exitCode || 1;
134403
+ const s2 = i3.code || "commander.error";
134404
+ this._exit(n2, s2, t3);
134336
134405
  }
134337
134406
  _parseOptionsEnv() {
134338
- this.options.forEach((e3) => {
134339
- if (e3.envVar && e3.envVar in process.env) {
134340
- const t3 = e3.attributeName();
134341
- if (this.getOptionValue(t3) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(t3))) {
134342
- if (e3.required || e3.optional) {
134343
- this.emit(`optionEnv:${e3.name()}`, process.env[e3.envVar]);
134407
+ this.options.forEach((t3) => {
134408
+ if (t3.envVar && t3.envVar in a.env) {
134409
+ const e3 = t3.attributeName();
134410
+ if (this.getOptionValue(e3) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(e3))) {
134411
+ if (t3.required || t3.optional) {
134412
+ this.emit(`optionEnv:${t3.name()}`, a.env[t3.envVar]);
134344
134413
  } else {
134345
- this.emit(`optionEnv:${e3.name()}`);
134414
+ this.emit(`optionEnv:${t3.name()}`);
134346
134415
  }
134347
134416
  }
134348
134417
  }
134349
134418
  });
134350
134419
  }
134351
- missingArgument(e3) {
134352
- const t3 = `error: missing required argument '${e3}'`;
134353
- this._displayError(1, "commander.missingArgument", t3);
134354
- }
134355
- optionMissingArgument(e3) {
134356
- const t3 = `error: option '${e3.flags}' argument missing`;
134357
- this._displayError(1, "commander.optionMissingArgument", t3);
134420
+ _parseOptionsImplied() {
134421
+ const t3 = new d(this.options);
134422
+ const hasCustomOptionValue = (t4) => this.getOptionValue(t4) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(t4));
134423
+ this.options.filter((e3) => e3.implied !== void 0 && hasCustomOptionValue(e3.attributeName()) && t3.valueFromOption(this.getOptionValue(e3.attributeName()), e3)).forEach((t4) => {
134424
+ Object.keys(t4.implied).filter((t5) => !hasCustomOptionValue(t5)).forEach((e3) => {
134425
+ this.setOptionValueWithSource(e3, t4.implied[e3], "implied");
134426
+ });
134427
+ });
134358
134428
  }
134359
- missingMandatoryOptionValue(e3) {
134360
- const t3 = `error: required option '${e3.flags}' not specified`;
134361
- this._displayError(1, "commander.missingMandatoryOptionValue", t3);
134429
+ missingArgument(t3) {
134430
+ const e3 = `error: missing required argument '${t3}'`;
134431
+ this.error(e3, { code: "commander.missingArgument" });
134432
+ }
134433
+ optionMissingArgument(t3) {
134434
+ const e3 = `error: option '${t3.flags}' argument missing`;
134435
+ this.error(e3, { code: "commander.optionMissingArgument" });
134436
+ }
134437
+ missingMandatoryOptionValue(t3) {
134438
+ const e3 = `error: required option '${t3.flags}' not specified`;
134439
+ this.error(e3, { code: "commander.missingMandatoryOptionValue" });
134440
+ }
134441
+ _conflictingOption(t3, e3) {
134442
+ const findBestOptionFromValue = (t4) => {
134443
+ const e4 = t4.attributeName();
134444
+ const i4 = this.getOptionValue(e4);
134445
+ const n2 = this.options.find((t5) => t5.negate && e4 === t5.attributeName());
134446
+ const s2 = this.options.find((t5) => !t5.negate && e4 === t5.attributeName());
134447
+ if (n2 && (n2.presetArg === void 0 && i4 === false || n2.presetArg !== void 0 && i4 === n2.presetArg)) {
134448
+ return n2;
134449
+ }
134450
+ return s2 || t4;
134451
+ };
134452
+ const getErrorMessage = (t4) => {
134453
+ const e4 = findBestOptionFromValue(t4);
134454
+ const i4 = e4.attributeName();
134455
+ const n2 = this.getOptionValueSource(i4);
134456
+ if (n2 === "env") {
134457
+ return `environment variable '${e4.envVar}'`;
134458
+ }
134459
+ return `option '${e4.flags}'`;
134460
+ };
134461
+ const i3 = `error: ${getErrorMessage(t3)} cannot be used with ${getErrorMessage(e3)}`;
134462
+ this.error(i3, { code: "commander.conflictingOption" });
134362
134463
  }
134363
- unknownOption(e3) {
134464
+ unknownOption(t3) {
134364
134465
  if (this._allowUnknownOption)
134365
134466
  return;
134366
- let t3 = "";
134367
- if (e3.startsWith("--") && this._showSuggestionAfterError) {
134467
+ let e3 = "";
134468
+ if (t3.startsWith("--") && this._showSuggestionAfterError) {
134368
134469
  let i4 = [];
134369
134470
  let n2 = this;
134370
134471
  do {
134371
- const e4 = n2.createHelp().visibleOptions(n2).filter((e5) => e5.long).map((e5) => e5.long);
134372
- i4 = i4.concat(e4);
134472
+ const t4 = n2.createHelp().visibleOptions(n2).filter((t5) => t5.long).map((t5) => t5.long);
134473
+ i4 = i4.concat(t4);
134373
134474
  n2 = n2.parent;
134374
134475
  } while (n2 && !n2._enablePositionalOptions);
134375
- t3 = m(e3, i4);
134476
+ e3 = f(t3, i4);
134376
134477
  }
134377
- const i3 = `error: unknown option '${e3}'${t3}`;
134378
- this._displayError(1, "commander.unknownOption", i3);
134478
+ const i3 = `error: unknown option '${t3}'${e3}`;
134479
+ this.error(i3, { code: "commander.unknownOption" });
134379
134480
  }
134380
- _excessArguments(e3) {
134481
+ _excessArguments(t3) {
134381
134482
  if (this._allowExcessArguments)
134382
134483
  return;
134383
- const t3 = this._args.length;
134384
- const i3 = t3 === 1 ? "" : "s";
134484
+ const e3 = this._args.length;
134485
+ const i3 = e3 === 1 ? "" : "s";
134385
134486
  const n2 = this.parent ? ` for '${this.name()}'` : "";
134386
- const s2 = `error: too many arguments${n2}. Expected ${t3} argument${i3} but got ${e3.length}.`;
134387
- this._displayError(1, "commander.excessArguments", s2);
134487
+ const s2 = `error: too many arguments${n2}. Expected ${e3} argument${i3} but got ${t3.length}.`;
134488
+ this.error(s2, { code: "commander.excessArguments" });
134388
134489
  }
134389
134490
  unknownCommand() {
134390
- const e3 = this.args[0];
134391
- let t3 = "";
134491
+ const t3 = this.args[0];
134492
+ let e3 = "";
134392
134493
  if (this._showSuggestionAfterError) {
134393
134494
  const i4 = [];
134394
- this.createHelp().visibleCommands(this).forEach((e4) => {
134395
- i4.push(e4.name());
134396
- if (e4.alias())
134397
- i4.push(e4.alias());
134495
+ this.createHelp().visibleCommands(this).forEach((t4) => {
134496
+ i4.push(t4.name());
134497
+ if (t4.alias())
134498
+ i4.push(t4.alias());
134398
134499
  });
134399
- t3 = m(e3, i4);
134500
+ e3 = f(t3, i4);
134400
134501
  }
134401
- const i3 = `error: unknown command '${e3}'${t3}`;
134402
- this._displayError(1, "commander.unknownCommand", i3);
134502
+ const i3 = `error: unknown command '${t3}'${e3}`;
134503
+ this.error(i3, { code: "commander.unknownCommand" });
134403
134504
  }
134404
- version(e3, t3, i3) {
134405
- if (e3 === void 0)
134505
+ version(t3, e3, i3) {
134506
+ if (t3 === void 0)
134406
134507
  return this._version;
134407
- this._version = e3;
134408
- t3 = t3 || "-V, --version";
134508
+ this._version = t3;
134509
+ e3 = e3 || "-V, --version";
134409
134510
  i3 = i3 || "output the version number";
134410
- const n2 = this.createOption(t3, i3);
134511
+ const n2 = this.createOption(e3, i3);
134411
134512
  this._versionOptionName = n2.attributeName();
134412
134513
  this.options.push(n2);
134413
134514
  this.on("option:" + n2.name(), () => {
134414
- this._outputConfiguration.writeOut(`${e3}
134515
+ this._outputConfiguration.writeOut(`${t3}
134415
134516
  `);
134416
- this._exit(0, "commander.version", e3);
134517
+ this._exit(0, "commander.version", t3);
134417
134518
  });
134418
134519
  return this;
134419
134520
  }
134420
- description(e3, t3) {
134421
- if (e3 === void 0 && t3 === void 0)
134521
+ description(t3, e3) {
134522
+ if (t3 === void 0 && e3 === void 0)
134422
134523
  return this._description;
134423
- this._description = e3;
134424
- if (t3) {
134425
- this._argsDescription = t3;
134524
+ this._description = t3;
134525
+ if (e3) {
134526
+ this._argsDescription = e3;
134426
134527
  }
134427
134528
  return this;
134428
134529
  }
134429
- alias(e3) {
134430
- if (e3 === void 0)
134530
+ summary(t3) {
134531
+ if (t3 === void 0)
134532
+ return this._summary;
134533
+ this._summary = t3;
134534
+ return this;
134535
+ }
134536
+ alias(t3) {
134537
+ if (t3 === void 0)
134431
134538
  return this._aliases[0];
134432
- let t3 = this;
134539
+ let e3 = this;
134433
134540
  if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
134434
- t3 = this.commands[this.commands.length - 1];
134541
+ e3 = this.commands[this.commands.length - 1];
134435
134542
  }
134436
- if (e3 === t3._name)
134543
+ if (t3 === e3._name)
134437
134544
  throw new Error("Command alias can't be the same as its name");
134438
- t3._aliases.push(e3);
134545
+ e3._aliases.push(t3);
134439
134546
  return this;
134440
134547
  }
134441
- aliases(e3) {
134442
- if (e3 === void 0)
134548
+ aliases(t3) {
134549
+ if (t3 === void 0)
134443
134550
  return this._aliases;
134444
- e3.forEach((e4) => this.alias(e4));
134551
+ t3.forEach((t4) => this.alias(t4));
134445
134552
  return this;
134446
134553
  }
134447
- usage(e3) {
134448
- if (e3 === void 0) {
134554
+ usage(t3) {
134555
+ if (t3 === void 0) {
134449
134556
  if (this._usage)
134450
134557
  return this._usage;
134451
- const e4 = this._args.map((e5) => h(e5));
134452
- return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? e4 : []).join(" ");
134558
+ const t4 = this._args.map((t5) => h(t5));
134559
+ return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? t4 : []).join(" ");
134453
134560
  }
134454
- this._usage = e3;
134561
+ this._usage = t3;
134455
134562
  return this;
134456
134563
  }
134457
- name(e3) {
134458
- if (e3 === void 0)
134564
+ name(t3) {
134565
+ if (t3 === void 0)
134459
134566
  return this._name;
134460
- this._name = e3;
134567
+ this._name = t3;
134461
134568
  return this;
134462
134569
  }
134463
- helpInformation(e3) {
134464
- const t3 = this.createHelp();
134465
- if (t3.helpWidth === void 0) {
134466
- t3.helpWidth = e3 && e3.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
134570
+ nameFromFilename(t3) {
134571
+ this._name = r.basename(t3, r.extname(t3));
134572
+ return this;
134573
+ }
134574
+ executableDir(t3) {
134575
+ if (t3 === void 0)
134576
+ return this._executableDir;
134577
+ this._executableDir = t3;
134578
+ return this;
134579
+ }
134580
+ helpInformation(t3) {
134581
+ const e3 = this.createHelp();
134582
+ if (e3.helpWidth === void 0) {
134583
+ e3.helpWidth = t3 && t3.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
134467
134584
  }
134468
- return t3.formatHelp(this, t3);
134585
+ return e3.formatHelp(this, e3);
134469
134586
  }
134470
- _getHelpContext(e3) {
134471
- e3 = e3 || {};
134472
- const t3 = { error: !!e3.error };
134587
+ _getHelpContext(t3) {
134588
+ t3 = t3 || {};
134589
+ const e3 = { error: !!t3.error };
134473
134590
  let i3;
134474
- if (t3.error) {
134475
- i3 = (e4) => this._outputConfiguration.writeErr(e4);
134591
+ if (e3.error) {
134592
+ i3 = (t4) => this._outputConfiguration.writeErr(t4);
134476
134593
  } else {
134477
- i3 = (e4) => this._outputConfiguration.writeOut(e4);
134594
+ i3 = (t4) => this._outputConfiguration.writeOut(t4);
134478
134595
  }
134479
- t3.write = e3.write || i3;
134480
- t3.command = this;
134481
- return t3;
134596
+ e3.write = t3.write || i3;
134597
+ e3.command = this;
134598
+ return e3;
134482
134599
  }
134483
- outputHelp(e3) {
134484
- let t3;
134485
- if (typeof e3 === "function") {
134486
- t3 = e3;
134487
- e3 = void 0;
134600
+ outputHelp(t3) {
134601
+ let e3;
134602
+ if (typeof t3 === "function") {
134603
+ e3 = t3;
134604
+ t3 = void 0;
134488
134605
  }
134489
- const i3 = this._getHelpContext(e3);
134490
- getCommandAndParents(this).reverse().forEach((e4) => e4.emit("beforeAllHelp", i3));
134606
+ const i3 = this._getHelpContext(t3);
134607
+ getCommandAndParents(this).reverse().forEach((t4) => t4.emit("beforeAllHelp", i3));
134491
134608
  this.emit("beforeHelp", i3);
134492
134609
  let n2 = this.helpInformation(i3);
134493
- if (t3) {
134494
- n2 = t3(n2);
134610
+ if (e3) {
134611
+ n2 = e3(n2);
134495
134612
  if (typeof n2 !== "string" && !Buffer.isBuffer(n2)) {
134496
134613
  throw new Error("outputHelp callback must return a string or a Buffer");
134497
134614
  }
@@ -134499,306 +134616,342 @@ Expecting one of '${i3.join("', '")}'`);
134499
134616
  i3.write(n2);
134500
134617
  this.emit(this._helpLongFlag);
134501
134618
  this.emit("afterHelp", i3);
134502
- getCommandAndParents(this).forEach((e4) => e4.emit("afterAllHelp", i3));
134619
+ getCommandAndParents(this).forEach((t4) => t4.emit("afterAllHelp", i3));
134503
134620
  }
134504
- helpOption(e3, t3) {
134505
- if (typeof e3 === "boolean") {
134506
- this._hasHelpOption = e3;
134621
+ helpOption(t3, e3) {
134622
+ if (typeof t3 === "boolean") {
134623
+ this._hasHelpOption = t3;
134507
134624
  return this;
134508
134625
  }
134509
- this._helpFlags = e3 || this._helpFlags;
134510
- this._helpDescription = t3 || this._helpDescription;
134511
- const i3 = p(this._helpFlags);
134626
+ this._helpFlags = t3 || this._helpFlags;
134627
+ this._helpDescription = e3 || this._helpDescription;
134628
+ const i3 = m(this._helpFlags);
134512
134629
  this._helpShortFlag = i3.shortFlag;
134513
134630
  this._helpLongFlag = i3.longFlag;
134514
134631
  return this;
134515
134632
  }
134516
- help(e3) {
134517
- this.outputHelp(e3);
134518
- let t3 = process.exitCode || 0;
134519
- if (t3 === 0 && e3 && typeof e3 !== "function" && e3.error) {
134520
- t3 = 1;
134633
+ help(t3) {
134634
+ this.outputHelp(t3);
134635
+ let e3 = a.exitCode || 0;
134636
+ if (e3 === 0 && t3 && typeof t3 !== "function" && t3.error) {
134637
+ e3 = 1;
134521
134638
  }
134522
- this._exit(t3, "commander.help", "(outputHelp)");
134639
+ this._exit(e3, "commander.help", "(outputHelp)");
134523
134640
  }
134524
- addHelpText(e3, t3) {
134641
+ addHelpText(t3, e3) {
134525
134642
  const i3 = ["beforeAll", "before", "after", "afterAll"];
134526
- if (!i3.includes(e3)) {
134643
+ if (!i3.includes(t3)) {
134527
134644
  throw new Error(`Unexpected value for position to addHelpText.
134528
134645
  Expecting one of '${i3.join("', '")}'`);
134529
134646
  }
134530
- const n2 = `${e3}Help`;
134531
- this.on(n2, (e4) => {
134647
+ const n2 = `${t3}Help`;
134648
+ this.on(n2, (t4) => {
134532
134649
  let i4;
134533
- if (typeof t3 === "function") {
134534
- i4 = t3({ error: e4.error, command: e4.command });
134650
+ if (typeof e3 === "function") {
134651
+ i4 = e3({ error: t4.error, command: t4.command });
134535
134652
  } else {
134536
- i4 = t3;
134653
+ i4 = e3;
134537
134654
  }
134538
134655
  if (i4) {
134539
- e4.write(`${i4}
134656
+ t4.write(`${i4}
134540
134657
  `);
134541
134658
  }
134542
134659
  });
134543
134660
  return this;
134544
134661
  }
134545
134662
  }
134546
- function outputHelpIfRequested(e3, t3) {
134547
- const i3 = e3._hasHelpOption && t3.find((t4) => t4 === e3._helpLongFlag || t4 === e3._helpShortFlag);
134663
+ function outputHelpIfRequested(t3, e3) {
134664
+ const i3 = t3._hasHelpOption && e3.find((e4) => e4 === t3._helpLongFlag || e4 === t3._helpShortFlag);
134548
134665
  if (i3) {
134549
- e3.outputHelp();
134550
- e3._exit(0, "commander.helpDisplayed", "(outputHelp)");
134666
+ t3.outputHelp();
134667
+ t3._exit(0, "commander.helpDisplayed", "(outputHelp)");
134551
134668
  }
134552
134669
  }
134553
- function incrementNodeInspectorPort(e3) {
134554
- return e3.map((e4) => {
134555
- if (!e4.startsWith("--inspect")) {
134556
- return e4;
134670
+ function incrementNodeInspectorPort(t3) {
134671
+ return t3.map((t4) => {
134672
+ if (!t4.startsWith("--inspect")) {
134673
+ return t4;
134557
134674
  }
134558
- let t3;
134675
+ let e3;
134559
134676
  let i3 = "127.0.0.1";
134560
134677
  let n2 = "9229";
134561
134678
  let s2;
134562
- if ((s2 = e4.match(/^(--inspect(-brk)?)$/)) !== null) {
134563
- t3 = s2[1];
134564
- } else if ((s2 = e4.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
134565
- t3 = s2[1];
134679
+ if ((s2 = t4.match(/^(--inspect(-brk)?)$/)) !== null) {
134680
+ e3 = s2[1];
134681
+ } else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
134682
+ e3 = s2[1];
134566
134683
  if (/^\d+$/.test(s2[3])) {
134567
134684
  n2 = s2[3];
134568
134685
  } else {
134569
134686
  i3 = s2[3];
134570
134687
  }
134571
- } else if ((s2 = e4.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
134572
- t3 = s2[1];
134688
+ } else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
134689
+ e3 = s2[1];
134573
134690
  i3 = s2[3];
134574
134691
  n2 = s2[4];
134575
134692
  }
134576
- if (t3 && n2 !== "0") {
134577
- return `${t3}=${i3}:${parseInt(n2) + 1}`;
134693
+ if (e3 && n2 !== "0") {
134694
+ return `${e3}=${i3}:${parseInt(n2) + 1}`;
134578
134695
  }
134579
- return e4;
134696
+ return t4;
134580
134697
  });
134581
134698
  }
134582
- function getCommandAndParents(e3) {
134583
- const t3 = [];
134584
- for (let i3 = e3; i3; i3 = i3.parent) {
134585
- t3.push(i3);
134699
+ function getCommandAndParents(t3) {
134700
+ const e3 = [];
134701
+ for (let i3 = t3; i3; i3 = i3.parent) {
134702
+ e3.push(i3);
134586
134703
  }
134587
- return t3;
134704
+ return e3;
134588
134705
  }
134589
- t2.Command = Command2;
134590
- }, 967: (e2, t2) => {
134706
+ e2.Command = Command2;
134707
+ }, 796: (t2, e2) => {
134591
134708
  class CommanderError extends Error {
134592
- constructor(e3, t3, i2) {
134709
+ constructor(t3, e3, i2) {
134593
134710
  super(i2);
134594
134711
  Error.captureStackTrace(this, this.constructor);
134595
134712
  this.name = this.constructor.name;
134596
- this.code = t3;
134597
- this.exitCode = e3;
134713
+ this.code = e3;
134714
+ this.exitCode = t3;
134598
134715
  this.nestedError = void 0;
134599
134716
  }
134600
134717
  }
134601
134718
  class InvalidArgumentError extends CommanderError {
134602
- constructor(e3) {
134603
- super(1, "commander.invalidArgument", e3);
134719
+ constructor(t3) {
134720
+ super(1, "commander.invalidArgument", t3);
134604
134721
  Error.captureStackTrace(this, this.constructor);
134605
134722
  this.name = this.constructor.name;
134606
134723
  }
134607
134724
  }
134608
- t2.CommanderError = CommanderError;
134609
- t2.InvalidArgumentError = InvalidArgumentError;
134610
- }, 34: (e2, t2, i2) => {
134611
- const { humanReadableArgName: n } = i2(969);
134725
+ e2.CommanderError = CommanderError;
134726
+ e2.InvalidArgumentError = InvalidArgumentError;
134727
+ }, 519: (t2, e2, i2) => {
134728
+ const { humanReadableArgName: n } = i2(535);
134612
134729
  class Help {
134613
134730
  constructor() {
134614
134731
  this.helpWidth = void 0;
134615
134732
  this.sortSubcommands = false;
134616
134733
  this.sortOptions = false;
134617
- }
134618
- visibleCommands(e3) {
134619
- const t3 = e3.commands.filter((e4) => !e4._hidden);
134620
- if (e3._hasImplicitHelpCommand()) {
134621
- const [, i3, n2] = e3._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
134622
- const s = e3.createCommand(i3).helpOption(false);
134623
- s.description(e3._helpCommandDescription);
134734
+ this.showGlobalOptions = false;
134735
+ }
134736
+ visibleCommands(t3) {
134737
+ const e3 = t3.commands.filter((t4) => !t4._hidden);
134738
+ if (t3._hasImplicitHelpCommand()) {
134739
+ const [, i3, n2] = t3._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
134740
+ const s = t3.createCommand(i3).helpOption(false);
134741
+ s.description(t3._helpCommandDescription);
134624
134742
  if (n2)
134625
134743
  s.arguments(n2);
134626
- t3.push(s);
134744
+ e3.push(s);
134627
134745
  }
134628
134746
  if (this.sortSubcommands) {
134629
- t3.sort((e4, t4) => e4.name().localeCompare(t4.name()));
134747
+ e3.sort((t4, e4) => t4.name().localeCompare(e4.name()));
134630
134748
  }
134631
- return t3;
134749
+ return e3;
134632
134750
  }
134633
- visibleOptions(e3) {
134634
- const t3 = e3.options.filter((e4) => !e4.hidden);
134635
- const i3 = e3._hasHelpOption && e3._helpShortFlag && !e3._findOption(e3._helpShortFlag);
134636
- const n2 = e3._hasHelpOption && !e3._findOption(e3._helpLongFlag);
134751
+ compareOptions(t3, e3) {
134752
+ const getSortKey = (t4) => t4.short ? t4.short.replace(/^-/, "") : t4.long.replace(/^--/, "");
134753
+ return getSortKey(t3).localeCompare(getSortKey(e3));
134754
+ }
134755
+ visibleOptions(t3) {
134756
+ const e3 = t3.options.filter((t4) => !t4.hidden);
134757
+ const i3 = t3._hasHelpOption && t3._helpShortFlag && !t3._findOption(t3._helpShortFlag);
134758
+ const n2 = t3._hasHelpOption && !t3._findOption(t3._helpLongFlag);
134637
134759
  if (i3 || n2) {
134638
134760
  let s;
134639
134761
  if (!i3) {
134640
- s = e3.createOption(e3._helpLongFlag, e3._helpDescription);
134762
+ s = t3.createOption(t3._helpLongFlag, t3._helpDescription);
134641
134763
  } else if (!n2) {
134642
- s = e3.createOption(e3._helpShortFlag, e3._helpDescription);
134764
+ s = t3.createOption(t3._helpShortFlag, t3._helpDescription);
134643
134765
  } else {
134644
- s = e3.createOption(e3._helpFlags, e3._helpDescription);
134766
+ s = t3.createOption(t3._helpFlags, t3._helpDescription);
134645
134767
  }
134646
- t3.push(s);
134768
+ e3.push(s);
134647
134769
  }
134648
134770
  if (this.sortOptions) {
134649
- const getSortKey = (e4) => e4.short ? e4.short.replace(/^-/, "") : e4.long.replace(/^--/, "");
134650
- t3.sort((e4, t4) => getSortKey(e4).localeCompare(getSortKey(t4)));
134771
+ e3.sort(this.compareOptions);
134651
134772
  }
134652
- return t3;
134773
+ return e3;
134653
134774
  }
134654
- visibleArguments(e3) {
134655
- if (e3._argsDescription) {
134656
- e3._args.forEach((t3) => {
134657
- t3.description = t3.description || e3._argsDescription[t3.name()] || "";
134775
+ visibleGlobalOptions(t3) {
134776
+ if (!this.showGlobalOptions)
134777
+ return [];
134778
+ const e3 = [];
134779
+ for (let i3 = t3.parent; i3; i3 = i3.parent) {
134780
+ const t4 = i3.options.filter((t5) => !t5.hidden);
134781
+ e3.push(...t4);
134782
+ }
134783
+ if (this.sortOptions) {
134784
+ e3.sort(this.compareOptions);
134785
+ }
134786
+ return e3;
134787
+ }
134788
+ visibleArguments(t3) {
134789
+ if (t3._argsDescription) {
134790
+ t3._args.forEach((e3) => {
134791
+ e3.description = e3.description || t3._argsDescription[e3.name()] || "";
134658
134792
  });
134659
134793
  }
134660
- if (e3._args.find((e4) => e4.description)) {
134661
- return e3._args;
134794
+ if (t3._args.find((t4) => t4.description)) {
134795
+ return t3._args;
134662
134796
  }
134663
134797
  return [];
134664
134798
  }
134665
- subcommandTerm(e3) {
134666
- const t3 = e3._args.map((e4) => n(e4)).join(" ");
134667
- return e3._name + (e3._aliases[0] ? "|" + e3._aliases[0] : "") + (e3.options.length ? " [options]" : "") + (t3 ? " " + t3 : "");
134799
+ subcommandTerm(t3) {
134800
+ const e3 = t3._args.map((t4) => n(t4)).join(" ");
134801
+ return t3._name + (t3._aliases[0] ? "|" + t3._aliases[0] : "") + (t3.options.length ? " [options]" : "") + (e3 ? " " + e3 : "");
134668
134802
  }
134669
- optionTerm(e3) {
134670
- return e3.flags;
134803
+ optionTerm(t3) {
134804
+ return t3.flags;
134671
134805
  }
134672
- argumentTerm(e3) {
134673
- return e3.name();
134806
+ argumentTerm(t3) {
134807
+ return t3.name();
134674
134808
  }
134675
- longestSubcommandTermLength(e3, t3) {
134676
- return t3.visibleCommands(e3).reduce((e4, i3) => Math.max(e4, t3.subcommandTerm(i3).length), 0);
134809
+ longestSubcommandTermLength(t3, e3) {
134810
+ return e3.visibleCommands(t3).reduce((t4, i3) => Math.max(t4, e3.subcommandTerm(i3).length), 0);
134677
134811
  }
134678
- longestOptionTermLength(e3, t3) {
134679
- return t3.visibleOptions(e3).reduce((e4, i3) => Math.max(e4, t3.optionTerm(i3).length), 0);
134812
+ longestOptionTermLength(t3, e3) {
134813
+ return e3.visibleOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
134680
134814
  }
134681
- longestArgumentTermLength(e3, t3) {
134682
- return t3.visibleArguments(e3).reduce((e4, i3) => Math.max(e4, t3.argumentTerm(i3).length), 0);
134815
+ longestGlobalOptionTermLength(t3, e3) {
134816
+ return e3.visibleGlobalOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
134683
134817
  }
134684
- commandUsage(e3) {
134685
- let t3 = e3._name;
134686
- if (e3._aliases[0]) {
134687
- t3 = t3 + "|" + e3._aliases[0];
134818
+ longestArgumentTermLength(t3, e3) {
134819
+ return e3.visibleArguments(t3).reduce((t4, i3) => Math.max(t4, e3.argumentTerm(i3).length), 0);
134820
+ }
134821
+ commandUsage(t3) {
134822
+ let e3 = t3._name;
134823
+ if (t3._aliases[0]) {
134824
+ e3 = e3 + "|" + t3._aliases[0];
134688
134825
  }
134689
134826
  let i3 = "";
134690
- for (let t4 = e3.parent; t4; t4 = t4.parent) {
134691
- i3 = t4.name() + " " + i3;
134827
+ for (let e4 = t3.parent; e4; e4 = e4.parent) {
134828
+ i3 = e4.name() + " " + i3;
134692
134829
  }
134693
- return i3 + t3 + " " + e3.usage();
134830
+ return i3 + e3 + " " + t3.usage();
134694
134831
  }
134695
- commandDescription(e3) {
134696
- return e3.description();
134832
+ commandDescription(t3) {
134833
+ return t3.description();
134697
134834
  }
134698
- subcommandDescription(e3) {
134699
- return e3.description();
134835
+ subcommandDescription(t3) {
134836
+ return t3.summary() || t3.description();
134700
134837
  }
134701
- optionDescription(e3) {
134702
- const t3 = [];
134703
- if (e3.argChoices && !e3.negate) {
134704
- t3.push(`choices: ${e3.argChoices.map((e4) => JSON.stringify(e4)).join(", ")}`);
134838
+ optionDescription(t3) {
134839
+ const e3 = [];
134840
+ if (t3.argChoices) {
134841
+ e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
134705
134842
  }
134706
- if (e3.defaultValue !== void 0 && !e3.negate) {
134707
- t3.push(`default: ${e3.defaultValueDescription || JSON.stringify(e3.defaultValue)}`);
134843
+ if (t3.defaultValue !== void 0) {
134844
+ const i3 = t3.required || t3.optional || t3.isBoolean() && typeof t3.defaultValue === "boolean";
134845
+ if (i3) {
134846
+ e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
134847
+ }
134708
134848
  }
134709
- if (e3.envVar !== void 0) {
134710
- t3.push(`env: ${e3.envVar}`);
134849
+ if (t3.presetArg !== void 0 && t3.optional) {
134850
+ e3.push(`preset: ${JSON.stringify(t3.presetArg)}`);
134711
134851
  }
134712
- if (t3.length > 0) {
134713
- return `${e3.description} (${t3.join(", ")})`;
134852
+ if (t3.envVar !== void 0) {
134853
+ e3.push(`env: ${t3.envVar}`);
134714
134854
  }
134715
- return e3.description;
134855
+ if (e3.length > 0) {
134856
+ return `${t3.description} (${e3.join(", ")})`;
134857
+ }
134858
+ return t3.description;
134716
134859
  }
134717
- argumentDescription(e3) {
134718
- const t3 = [];
134719
- if (e3.argChoices) {
134720
- t3.push(`choices: ${e3.argChoices.map((e4) => JSON.stringify(e4)).join(", ")}`);
134860
+ argumentDescription(t3) {
134861
+ const e3 = [];
134862
+ if (t3.argChoices) {
134863
+ e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
134721
134864
  }
134722
- if (e3.defaultValue !== void 0) {
134723
- t3.push(`default: ${e3.defaultValueDescription || JSON.stringify(e3.defaultValue)}`);
134865
+ if (t3.defaultValue !== void 0) {
134866
+ e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
134724
134867
  }
134725
- if (t3.length > 0) {
134726
- const i3 = `(${t3.join(", ")})`;
134727
- if (e3.description) {
134728
- return `${e3.description} ${i3}`;
134868
+ if (e3.length > 0) {
134869
+ const i3 = `(${e3.join(", ")})`;
134870
+ if (t3.description) {
134871
+ return `${t3.description} ${i3}`;
134729
134872
  }
134730
134873
  return i3;
134731
134874
  }
134732
- return e3.description;
134875
+ return t3.description;
134733
134876
  }
134734
- formatHelp(e3, t3) {
134735
- const i3 = t3.padWidth(e3, t3);
134736
- const n2 = t3.helpWidth || 80;
134877
+ formatHelp(t3, e3) {
134878
+ const i3 = e3.padWidth(t3, e3);
134879
+ const n2 = e3.helpWidth || 80;
134737
134880
  const s = 2;
134738
134881
  const r = 2;
134739
- function formatItem(e4, o2) {
134882
+ function formatItem(t4, o2) {
134740
134883
  if (o2) {
134741
- const a2 = `${e4.padEnd(i3 + r)}${o2}`;
134742
- return t3.wrap(a2, n2 - s, i3 + r);
134884
+ const a2 = `${t4.padEnd(i3 + r)}${o2}`;
134885
+ return e3.wrap(a2, n2 - s, i3 + r);
134743
134886
  }
134744
- return e4;
134887
+ return t4;
134745
134888
  }
134746
- function formatList(e4) {
134747
- return e4.join("\n").replace(/^/gm, " ".repeat(s));
134889
+ function formatList(t4) {
134890
+ return t4.join("\n").replace(/^/gm, " ".repeat(s));
134748
134891
  }
134749
- let o = [`Usage: ${t3.commandUsage(e3)}`, ""];
134750
- const a = t3.commandDescription(e3);
134892
+ let o = [`Usage: ${e3.commandUsage(t3)}`, ""];
134893
+ const a = e3.commandDescription(t3);
134751
134894
  if (a.length > 0) {
134752
- o = o.concat([a, ""]);
134895
+ o = o.concat([e3.wrap(a, n2, 0), ""]);
134753
134896
  }
134754
- const h = t3.visibleArguments(e3).map((e4) => formatItem(t3.argumentTerm(e4), t3.argumentDescription(e4)));
134897
+ const l = e3.visibleArguments(t3).map((t4) => formatItem(e3.argumentTerm(t4), e3.argumentDescription(t4)));
134898
+ if (l.length > 0) {
134899
+ o = o.concat(["Arguments:", formatList(l), ""]);
134900
+ }
134901
+ const h = e3.visibleOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
134755
134902
  if (h.length > 0) {
134756
- o = o.concat(["Arguments:", formatList(h), ""]);
134903
+ o = o.concat(["Options:", formatList(h), ""]);
134757
134904
  }
134758
- const l = t3.visibleOptions(e3).map((e4) => formatItem(t3.optionTerm(e4), t3.optionDescription(e4)));
134759
- if (l.length > 0) {
134760
- o = o.concat(["Options:", formatList(l), ""]);
134905
+ if (this.showGlobalOptions) {
134906
+ const i4 = e3.visibleGlobalOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
134907
+ if (i4.length > 0) {
134908
+ o = o.concat(["Global Options:", formatList(i4), ""]);
134909
+ }
134761
134910
  }
134762
- const u = t3.visibleCommands(e3).map((e4) => formatItem(t3.subcommandTerm(e4), t3.subcommandDescription(e4)));
134911
+ const u = e3.visibleCommands(t3).map((t4) => formatItem(e3.subcommandTerm(t4), e3.subcommandDescription(t4)));
134763
134912
  if (u.length > 0) {
134764
134913
  o = o.concat(["Commands:", formatList(u), ""]);
134765
134914
  }
134766
134915
  return o.join("\n");
134767
134916
  }
134768
- padWidth(e3, t3) {
134769
- return Math.max(t3.longestOptionTermLength(e3, t3), t3.longestSubcommandTermLength(e3, t3), t3.longestArgumentTermLength(e3, t3));
134917
+ padWidth(t3, e3) {
134918
+ return Math.max(e3.longestOptionTermLength(t3, e3), e3.longestGlobalOptionTermLength(t3, e3), e3.longestSubcommandTermLength(t3, e3), e3.longestArgumentTermLength(t3, e3));
134770
134919
  }
134771
- wrap(e3, t3, i3, n2 = 40) {
134772
- if (e3.match(/[\n]\s+/))
134773
- return e3;
134774
- const s = t3 - i3;
134775
- if (s < n2)
134776
- return e3;
134777
- const r = e3.substr(0, i3);
134778
- const o = e3.substr(i3);
134779
- const a = " ".repeat(i3);
134780
- const h = new RegExp(".{1," + (s - 1) + "}([\\s​]|$)|[^\\s​]+?([\\s​]|$)", "g");
134781
- const l = o.match(h) || [];
134782
- return r + l.map((e4, t4) => {
134783
- if (e4.slice(-1) === "\n") {
134784
- e4 = e4.slice(0, e4.length - 1);
134785
- }
134786
- return (t4 > 0 ? a : "") + e4.trimRight();
134920
+ wrap(t3, e3, i3, n2 = 40) {
134921
+ const s = " \\f\\t\\v   -    \uFEFF";
134922
+ const r = new RegExp(`[\\n][${s}]+`);
134923
+ if (t3.match(r))
134924
+ return t3;
134925
+ const o = e3 - i3;
134926
+ if (o < n2)
134927
+ return t3;
134928
+ const a = t3.slice(0, i3);
134929
+ const l = t3.slice(i3).replace("\r\n", "\n");
134930
+ const h = " ".repeat(i3);
134931
+ const u = "​";
134932
+ const c = `\\s${u}`;
134933
+ const p = new RegExp(`
134934
+ |.{1,${o - 1}}([${c}]|$)|[^${c}]+?([${c}]|$)`, "g");
134935
+ const m = l.match(p) || [];
134936
+ return a + m.map((t4, e4) => {
134937
+ if (t4 === "\n")
134938
+ return "";
134939
+ return (e4 > 0 ? h : "") + t4.trimEnd();
134787
134940
  }).join("\n");
134788
134941
  }
134789
134942
  }
134790
- t2.Help = Help;
134791
- }, 278: (e2, t2, i2) => {
134792
- const { InvalidArgumentError: n } = i2(967);
134943
+ e2.Help = Help;
134944
+ }, 437: (t2, e2, i2) => {
134945
+ const { InvalidArgumentError: n } = i2(796);
134793
134946
  class Option {
134794
- constructor(e3, t3) {
134795
- this.flags = e3;
134796
- this.description = t3 || "";
134797
- this.required = e3.includes("<");
134798
- this.optional = e3.includes("[");
134799
- this.variadic = /\w\.\.\.[>\]]$/.test(e3);
134947
+ constructor(t3, e3) {
134948
+ this.flags = t3;
134949
+ this.description = e3 || "";
134950
+ this.required = t3.includes("<");
134951
+ this.optional = t3.includes("[");
134952
+ this.variadic = /\w\.\.\.[>\]]$/.test(t3);
134800
134953
  this.mandatory = false;
134801
- const i3 = splitOptionFlags(e3);
134954
+ const i3 = splitOptionFlags(t3);
134802
134955
  this.short = i3.shortFlag;
134803
134956
  this.long = i3.longFlag;
134804
134957
  this.negate = false;
@@ -134807,48 +134960,63 @@ Expecting one of '${i3.join("', '")}'`);
134807
134960
  }
134808
134961
  this.defaultValue = void 0;
134809
134962
  this.defaultValueDescription = void 0;
134963
+ this.presetArg = void 0;
134810
134964
  this.envVar = void 0;
134811
134965
  this.parseArg = void 0;
134812
134966
  this.hidden = false;
134813
134967
  this.argChoices = void 0;
134968
+ this.conflictsWith = [];
134969
+ this.implied = void 0;
134814
134970
  }
134815
- default(e3, t3) {
134816
- this.defaultValue = e3;
134817
- this.defaultValueDescription = t3;
134971
+ default(t3, e3) {
134972
+ this.defaultValue = t3;
134973
+ this.defaultValueDescription = e3;
134818
134974
  return this;
134819
134975
  }
134820
- env(e3) {
134821
- this.envVar = e3;
134976
+ preset(t3) {
134977
+ this.presetArg = t3;
134822
134978
  return this;
134823
134979
  }
134824
- argParser(e3) {
134825
- this.parseArg = e3;
134980
+ conflicts(t3) {
134981
+ this.conflictsWith = this.conflictsWith.concat(t3);
134826
134982
  return this;
134827
134983
  }
134828
- makeOptionMandatory(e3 = true) {
134829
- this.mandatory = !!e3;
134984
+ implies(t3) {
134985
+ this.implied = Object.assign(this.implied || {}, t3);
134830
134986
  return this;
134831
134987
  }
134832
- hideHelp(e3 = true) {
134833
- this.hidden = !!e3;
134988
+ env(t3) {
134989
+ this.envVar = t3;
134834
134990
  return this;
134835
134991
  }
134836
- _concatValue(e3, t3) {
134837
- if (t3 === this.defaultValue || !Array.isArray(t3)) {
134838
- return [e3];
134992
+ argParser(t3) {
134993
+ this.parseArg = t3;
134994
+ return this;
134995
+ }
134996
+ makeOptionMandatory(t3 = true) {
134997
+ this.mandatory = !!t3;
134998
+ return this;
134999
+ }
135000
+ hideHelp(t3 = true) {
135001
+ this.hidden = !!t3;
135002
+ return this;
135003
+ }
135004
+ _concatValue(t3, e3) {
135005
+ if (e3 === this.defaultValue || !Array.isArray(e3)) {
135006
+ return [t3];
134839
135007
  }
134840
- return t3.concat(e3);
135008
+ return e3.concat(t3);
134841
135009
  }
134842
- choices(e3) {
134843
- this.argChoices = e3;
134844
- this.parseArg = (t3, i3) => {
134845
- if (!e3.includes(t3)) {
134846
- throw new n(`Allowed choices are ${e3.join(", ")}.`);
135010
+ choices(t3) {
135011
+ this.argChoices = t3.slice();
135012
+ this.parseArg = (t4, e3) => {
135013
+ if (!this.argChoices.includes(t4)) {
135014
+ throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
134847
135015
  }
134848
135016
  if (this.variadic) {
134849
- return this._concatValue(t3, i3);
135017
+ return this._concatValue(t4, e3);
134850
135018
  }
134851
- return t3;
135019
+ return t4;
134852
135020
  };
134853
135021
  return this;
134854
135022
  }
@@ -134861,86 +135029,117 @@ Expecting one of '${i3.join("', '")}'`);
134861
135029
  attributeName() {
134862
135030
  return camelcase(this.name().replace(/^no-/, ""));
134863
135031
  }
134864
- is(e3) {
134865
- return this.short === e3 || this.long === e3;
135032
+ is(t3) {
135033
+ return this.short === t3 || this.long === t3;
135034
+ }
135035
+ isBoolean() {
135036
+ return !this.required && !this.optional && !this.negate;
135037
+ }
135038
+ }
135039
+ class DualOptions {
135040
+ constructor(t3) {
135041
+ this.positiveOptions = /* @__PURE__ */ new Map();
135042
+ this.negativeOptions = /* @__PURE__ */ new Map();
135043
+ this.dualOptions = /* @__PURE__ */ new Set();
135044
+ t3.forEach((t4) => {
135045
+ if (t4.negate) {
135046
+ this.negativeOptions.set(t4.attributeName(), t4);
135047
+ } else {
135048
+ this.positiveOptions.set(t4.attributeName(), t4);
135049
+ }
135050
+ });
135051
+ this.negativeOptions.forEach((t4, e3) => {
135052
+ if (this.positiveOptions.has(e3)) {
135053
+ this.dualOptions.add(e3);
135054
+ }
135055
+ });
135056
+ }
135057
+ valueFromOption(t3, e3) {
135058
+ const i3 = e3.attributeName();
135059
+ if (!this.dualOptions.has(i3))
135060
+ return true;
135061
+ const n2 = this.negativeOptions.get(i3).presetArg;
135062
+ const s = n2 !== void 0 ? n2 : false;
135063
+ return e3.negate === (s === t3);
134866
135064
  }
134867
135065
  }
134868
- function camelcase(e3) {
134869
- return e3.split("-").reduce((e4, t3) => e4 + t3[0].toUpperCase() + t3.slice(1));
135066
+ function camelcase(t3) {
135067
+ return t3.split("-").reduce((t4, e3) => t4 + e3[0].toUpperCase() + e3.slice(1));
134870
135068
  }
134871
- function splitOptionFlags(e3) {
134872
- let t3;
135069
+ function splitOptionFlags(t3) {
135070
+ let e3;
134873
135071
  let i3;
134874
- const n2 = e3.split(/[ |,]+/);
135072
+ const n2 = t3.split(/[ |,]+/);
134875
135073
  if (n2.length > 1 && !/^[[<]/.test(n2[1]))
134876
- t3 = n2.shift();
135074
+ e3 = n2.shift();
134877
135075
  i3 = n2.shift();
134878
- if (!t3 && /^-[^-]$/.test(i3)) {
134879
- t3 = i3;
135076
+ if (!e3 && /^-[^-]$/.test(i3)) {
135077
+ e3 = i3;
134880
135078
  i3 = void 0;
134881
135079
  }
134882
- return { shortFlag: t3, longFlag: i3 };
135080
+ return { shortFlag: e3, longFlag: i3 };
134883
135081
  }
134884
- t2.Option = Option;
134885
- t2.splitOptionFlags = splitOptionFlags;
134886
- }, 461: (e2, t2) => {
135082
+ e2.Option = Option;
135083
+ e2.splitOptionFlags = splitOptionFlags;
135084
+ e2.DualOptions = DualOptions;
135085
+ }, 860: (t2, e2) => {
134887
135086
  const i2 = 3;
134888
- function editDistance(e3, t3) {
134889
- if (Math.abs(e3.length - t3.length) > i2)
134890
- return Math.max(e3.length, t3.length);
135087
+ function editDistance(t3, e3) {
135088
+ if (Math.abs(t3.length - e3.length) > i2)
135089
+ return Math.max(t3.length, e3.length);
134891
135090
  const n = [];
134892
- for (let t4 = 0; t4 <= e3.length; t4++) {
134893
- n[t4] = [t4];
134894
- }
134895
135091
  for (let e4 = 0; e4 <= t3.length; e4++) {
134896
- n[0][e4] = e4;
135092
+ n[e4] = [e4];
134897
135093
  }
134898
- for (let i3 = 1; i3 <= t3.length; i3++) {
134899
- for (let s = 1; s <= e3.length; s++) {
135094
+ for (let t4 = 0; t4 <= e3.length; t4++) {
135095
+ n[0][t4] = t4;
135096
+ }
135097
+ for (let i3 = 1; i3 <= e3.length; i3++) {
135098
+ for (let s = 1; s <= t3.length; s++) {
134900
135099
  let r = 1;
134901
- if (e3[s - 1] === t3[i3 - 1]) {
135100
+ if (t3[s - 1] === e3[i3 - 1]) {
134902
135101
  r = 0;
134903
135102
  } else {
134904
135103
  r = 1;
134905
135104
  }
134906
135105
  n[s][i3] = Math.min(n[s - 1][i3] + 1, n[s][i3 - 1] + 1, n[s - 1][i3 - 1] + r);
134907
- if (s > 1 && i3 > 1 && e3[s - 1] === t3[i3 - 2] && e3[s - 2] === t3[i3 - 1]) {
135106
+ if (s > 1 && i3 > 1 && t3[s - 1] === e3[i3 - 2] && t3[s - 2] === e3[i3 - 1]) {
134908
135107
  n[s][i3] = Math.min(n[s][i3], n[s - 2][i3 - 2] + 1);
134909
135108
  }
134910
135109
  }
134911
135110
  }
134912
- return n[e3.length][t3.length];
135111
+ return n[t3.length][e3.length];
134913
135112
  }
134914
- function suggestSimilar(e3, t3) {
134915
- if (!t3 || t3.length === 0)
135113
+ function suggestSimilar(t3, e3) {
135114
+ if (!e3 || e3.length === 0)
134916
135115
  return "";
134917
- t3 = Array.from(new Set(t3));
134918
- const n = e3.startsWith("--");
135116
+ e3 = Array.from(new Set(e3));
135117
+ const n = t3.startsWith("--");
134919
135118
  if (n) {
134920
- e3 = e3.slice(2);
134921
- t3 = t3.map((e4) => e4.slice(2));
135119
+ t3 = t3.slice(2);
135120
+ e3 = e3.map((t4) => t4.slice(2));
134922
135121
  }
134923
135122
  let s = [];
134924
135123
  let r = i2;
134925
135124
  const o = 0.4;
134926
- t3.forEach((t4) => {
134927
- if (t4.length <= 1)
135125
+ e3.forEach((e4) => {
135126
+ if (e4.length <= 1)
134928
135127
  return;
134929
- const i3 = editDistance(e3, t4);
134930
- const n2 = Math.max(e3.length, t4.length);
135128
+ const i3 = editDistance(t3, e4);
135129
+ const n2 = Math.max(t3.length, e4.length);
134931
135130
  const a = (n2 - i3) / n2;
134932
135131
  if (a > o) {
134933
135132
  if (i3 < r) {
134934
135133
  r = i3;
134935
- s = [t4];
135134
+ s = [e4];
134936
135135
  } else if (i3 === r) {
134937
- s.push(t4);
135136
+ s.push(e4);
134938
135137
  }
134939
135138
  }
134940
135139
  });
134941
- s.sort((e4, t4) => e4.localeCompare(t4));
135140
+ s.sort((t4, e4) => t4.localeCompare(e4));
134942
135141
  if (n) {
134943
- s = s.map((e4) => `--${e4}`);
135142
+ s = s.map((t4) => `--${t4}`);
134944
135143
  }
134945
135144
  if (s.length > 1) {
134946
135145
  return `
@@ -134952,28 +135151,28 @@ Expecting one of '${i3.join("', '")}'`);
134952
135151
  }
134953
135152
  return "";
134954
135153
  }
134955
- t2.suggestSimilar = suggestSimilar;
135154
+ e2.suggestSimilar = suggestSimilar;
134956
135155
  } };
134957
- var t = {};
135156
+ var e = {};
134958
135157
  function __nccwpck_require__(i2) {
134959
- var n = t[i2];
135158
+ var n = e[i2];
134960
135159
  if (n !== void 0) {
134961
135160
  return n.exports;
134962
135161
  }
134963
- var s = t[i2] = { exports: {} };
135162
+ var s = e[i2] = { exports: {} };
134964
135163
  var r = true;
134965
135164
  try {
134966
- e[i2](s, s.exports, __nccwpck_require__);
135165
+ t[i2](s, s.exports, __nccwpck_require__);
134967
135166
  r = false;
134968
135167
  } finally {
134969
135168
  if (r)
134970
- delete t[i2];
135169
+ delete e[i2];
134971
135170
  }
134972
135171
  return s.exports;
134973
135172
  }
134974
135173
  if (typeof __nccwpck_require__ !== "undefined")
134975
135174
  __nccwpck_require__.ab = __dirname + "/";
134976
- var i = __nccwpck_require__(922);
135175
+ var i = __nccwpck_require__(632);
134977
135176
  module2.exports = i;
134978
135177
  })();
134979
135178
  }
@@ -135113,12 +135312,17 @@ var require_commands = __commonJS({
135113
135312
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
135114
135313
  var commands_exports = {};
135115
135314
  __export2(commands_exports, {
135315
+ getArgv: () => getArgv,
135116
135316
  getCommand: () => getCommand,
135117
135317
  isDevCommand: () => isDevCommand
135118
135318
  });
135119
135319
  module2.exports = __toCommonJS2(commands_exports);
135320
+ var getArgv = () => {
135321
+ var _a2;
135322
+ return (((_a2 = process.env.MODERN_ARGV) == null ? void 0 : _a2.split(" ")) || process.argv).slice(2);
135323
+ };
135120
135324
  var getCommand = () => {
135121
- const args = process.argv.slice(2);
135325
+ const args = getArgv();
135122
135326
  const command = args[0];
135123
135327
  return command;
135124
135328
  };
@@ -135129,108 +135333,6 @@ var require_commands = __commonJS({
135129
135333
  }
135130
135334
  });
135131
135335
 
135132
- // ../../../toolkit/utils/dist/format.js
135133
- var require_format2 = __commonJS({
135134
- "../../../toolkit/utils/dist/format.js"(exports, module2) {
135135
- var __defProp2 = Object.defineProperty;
135136
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
135137
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
135138
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
135139
- var __export2 = (target, all) => {
135140
- for (var name in all)
135141
- __defProp2(target, name, { get: all[name], enumerable: true });
135142
- };
135143
- var __copyProps2 = (to, from, except, desc) => {
135144
- if (from && typeof from === "object" || typeof from === "function") {
135145
- for (let key of __getOwnPropNames2(from))
135146
- if (!__hasOwnProp2.call(to, key) && key !== except)
135147
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
135148
- }
135149
- return to;
135150
- };
135151
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
135152
- var format_exports = {};
135153
- __export2(format_exports, {
135154
- formatWebpackMessages: () => formatWebpackMessages
135155
- });
135156
- module2.exports = __toCommonJS2(format_exports);
135157
- var friendlySyntaxErrorLabel = "SyntaxError:";
135158
- function isLikelyASyntaxError(message) {
135159
- return message.includes(friendlySyntaxErrorLabel);
135160
- }
135161
- function formatMessage(stats) {
135162
- let lines = [];
135163
- let message;
135164
- if (typeof stats === "object") {
135165
- const fileName = stats.moduleName ? `File: ${stats.moduleName}
135166
- ` : "";
135167
- const mainMessage = stats.message;
135168
- const details = stats.details ? `
135169
- Details: ${stats.details}
135170
- ` : "";
135171
- const stack = stats.stack ? `
135172
- ${stats.stack}` : "";
135173
- message = `${fileName}${mainMessage}${details}${stack}`;
135174
- } else {
135175
- message = stats;
135176
- }
135177
- lines = message.split("\n");
135178
- lines = lines.map((line) => {
135179
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
135180
- line
135181
- );
135182
- if (!parsingError) {
135183
- return line;
135184
- }
135185
- const [, errorLine, errorColumn, errorMessage] = parsingError;
135186
- return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
135187
- });
135188
- message = lines.join("\n");
135189
- message = message.replace(
135190
- /SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
135191
- `${friendlySyntaxErrorLabel} $3 ($1:$2)
135192
- `
135193
- );
135194
- lines = message.split("\n");
135195
- if (lines.length > 2 && lines[1].trim() === "") {
135196
- lines.splice(1, 1);
135197
- }
135198
- lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
135199
- if (lines[1] && lines[1].indexOf("Module not found:") !== -1) {
135200
- lines[1] = lines[1].replace("Error: ", "");
135201
- }
135202
- message = lines.join("\n");
135203
- message = message.replace(
135204
- /^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
135205
- ""
135206
- );
135207
- message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
135208
- lines = message.split("\n");
135209
- lines = lines.filter(
135210
- (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
135211
- );
135212
- message = lines.join("\n");
135213
- return message.trim();
135214
- }
135215
- function formatWebpackMessages(json) {
135216
- var _a2, _b, _c;
135217
- const formattedErrors = (_a2 = json == null ? void 0 : json.errors) == null ? void 0 : _a2.map(formatMessage);
135218
- const formattedWarnings = (_b = json == null ? void 0 : json.warnings) == null ? void 0 : _b.map(formatMessage);
135219
- const result = {
135220
- errors: formattedErrors || [],
135221
- warnings: formattedWarnings || []
135222
- };
135223
- if ((_c = result.errors) == null ? void 0 : _c.some(isLikelyASyntaxError)) {
135224
- result.errors = result.errors.filter(isLikelyASyntaxError);
135225
- }
135226
- if (result.errors.length > 1) {
135227
- result.errors.length = 1;
135228
- }
135229
- return result;
135230
- }
135231
- }
135232
- });
135233
-
135234
135336
  // ../../../toolkit/utils/dist/logger.js
135235
135337
  var require_logger4 = __commonJS({
135236
135338
  "../../../toolkit/utils/dist/logger.js"(exports, module2) {
@@ -136015,10 +136117,10 @@ var require_constants6 = __commonJS({
136015
136117
  API_DIR: () => API_DIR,
136016
136118
  CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
136017
136119
  CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
136120
+ DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
136018
136121
  DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
136019
136122
  DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
136020
136123
  ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
136021
- HMR_SOCK_PATH: () => HMR_SOCK_PATH,
136022
136124
  INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
136023
136125
  INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
136024
136126
  INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
@@ -136032,8 +136134,7 @@ var require_constants6 = __commonJS({
136032
136134
  MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
136033
136135
  OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
136034
136136
  PLUGIN_SCHEMAS: () => PLUGIN_SCHEMAS,
136035
- ROUTE_MANIFEST: () => ROUTE_MANIFEST,
136036
- ROUTE_MINIFEST_FILE: () => ROUTE_MINIFEST_FILE,
136137
+ ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
136037
136138
  ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
136038
136139
  SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
136039
136140
  SERVER_DIR: () => SERVER_DIR,
@@ -136049,7 +136150,6 @@ var require_constants6 = __commonJS({
136049
136150
  SHARED_DIR: () => SHARED_DIR
136050
136151
  });
136051
136152
  module2.exports = __toCommonJS2(constants_exports);
136052
- var HMR_SOCK_PATH = "/webpack-hmr";
136053
136153
  var ROUTE_SPEC_FILE = "route.json";
136054
136154
  var MAIN_ENTRY_NAME = "main";
136055
136155
  var LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
@@ -136065,8 +136165,7 @@ var require_constants6 = __commonJS({
136065
136165
  var CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
136066
136166
  var OUTPUT_CONFIG_FILE = "modern.config.json";
136067
136167
  var DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
136068
- var ROUTE_MINIFEST_FILE = "routes-manifest.json";
136069
- var ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
136168
+ var ROUTE_MANIFEST_FILE = "routes-manifest.json";
136070
136169
  var LOADER_ROUTES_DIR = `loader-routes`;
136071
136170
  var DEFAULT_DEV_HOST = "0.0.0.0";
136072
136171
  var INTERNAL_APP_TOOLS_PLUGINS = {
@@ -136270,6 +136369,15 @@ var require_constants6 = __commonJS({
136270
136369
  ],
136271
136370
  "@modern-js/plugin-nocode": []
136272
136371
  };
136372
+ var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
136373
+ allowNamespaces: true,
136374
+ allExtensions: true,
136375
+ allowDeclareFields: true,
136376
+ // aligns Babel's behavior with TypeScript's default behavior.
136377
+ // https://babeljs.io/docs/en/babel-preset-typescript#optimizeconstenums
136378
+ optimizeConstEnums: true,
136379
+ isTSX: true
136380
+ };
136273
136381
  }
136274
136382
  });
136275
136383
 
@@ -137791,9 +137899,9 @@ var require_getServerConfig2 = __commonJS({
137791
137899
  }
137792
137900
  });
137793
137901
 
137794
- // ../../../toolkit/utils/dist/tryResolve.js
137795
- var require_tryResolve2 = __commonJS({
137796
- "../../../toolkit/utils/dist/tryResolve.js"(exports, module2) {
137902
+ // ../../../toolkit/utils/dist/resolve.js
137903
+ var require_resolve = __commonJS({
137904
+ "../../../toolkit/utils/dist/resolve.js"(exports, module2) {
137797
137905
  var __defProp2 = Object.defineProperty;
137798
137906
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
137799
137907
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
@@ -137811,12 +137919,13 @@ var require_tryResolve2 = __commonJS({
137811
137919
  return to;
137812
137920
  };
137813
137921
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
137814
- var tryResolve_exports = {};
137815
- __export2(tryResolve_exports, {
137922
+ var resolve_exports = {};
137923
+ __export2(resolve_exports, {
137924
+ getAntdMajorVersion: () => getAntdMajorVersion,
137816
137925
  isPackageInstalled: () => isPackageInstalled,
137817
137926
  tryResolve: () => tryResolve
137818
137927
  });
137819
- module2.exports = __toCommonJS2(tryResolve_exports);
137928
+ module2.exports = __toCommonJS2(resolve_exports);
137820
137929
  var import_ensureArray = require_ensureArray2();
137821
137930
  var tryResolve = (name, resolvePath) => {
137822
137931
  let filePath = "";
@@ -137839,6 +137948,17 @@ var require_tryResolve2 = __commonJS({
137839
137948
  return false;
137840
137949
  }
137841
137950
  };
137951
+ var getAntdMajorVersion = (appDirectory) => {
137952
+ try {
137953
+ const pkgJsonPath = require.resolve("antd/package.json", {
137954
+ paths: [appDirectory]
137955
+ });
137956
+ const { version } = require(pkgJsonPath);
137957
+ return Number(version.split(".")[0]);
137958
+ } catch (err) {
137959
+ return null;
137960
+ }
137961
+ };
137842
137962
  }
137843
137963
  });
137844
137964
 
@@ -137899,15 +138019,16 @@ var require_analyzeProject2 = __commonJS({
137899
138019
  });
137900
138020
  module2.exports = __toCommonJS2(analyzeProject_exports);
137901
138021
  var path9 = __toESM2(require("path"));
138022
+ var import_commands = require_commands();
137902
138023
  var import_compiled = require_compiled2();
137903
138024
  var isApiOnly = (appDirectory, entryDir) => __async2(void 0, null, function* () {
137904
138025
  const srcDir = path9.join(appDirectory, entryDir != null ? entryDir : "src");
137905
138026
  const existSrc = yield import_compiled.fs.pathExists(srcDir);
137906
- const options = (0, import_compiled.minimist)(process.argv.slice(2));
138027
+ const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
137907
138028
  return !existSrc || Boolean(options["api-only"]);
137908
138029
  });
137909
138030
  var isWebOnly = () => __async2(void 0, null, function* () {
137910
- const options = (0, import_compiled.minimist)(process.argv.slice(2));
138031
+ const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
137911
138032
  return Boolean(options["web-only"]);
137912
138033
  });
137913
138034
  }
@@ -137978,27 +138099,10 @@ var require_chainId2 = __commonJS({
137978
138099
  },
137979
138100
  /** Predefined rule groups */
137980
138101
  ONE_OF: {
137981
- JS: "js",
137982
- TS: "ts",
137983
- CSS: "css",
137984
- LESS: "less",
137985
- SASS: "sass",
137986
- YAML: "yml",
137987
- TOML: "toml",
137988
- FALLBACK: "fallback",
137989
- MARKDOWN: "markdown",
137990
- BFF_CLIENT: "bff-client",
137991
- CSS_MODULES: "css-modules",
137992
- LESS_MODULES: "less-modules",
137993
- SASS_MODULES: "sass-modules",
137994
138102
  SVG: "svg",
137995
138103
  SVG_URL: "svg-url",
137996
138104
  SVG_ASSET: "svg-asset",
137997
- SVG_INLINE: "svg-inline",
137998
- ASSETS: "assets",
137999
- ASSETS_URL: "assets-url",
138000
- ASSETS_INLINE: "assets-inline",
138001
- IMAGE_COMPRESS: "image-compress"
138105
+ SVG_INLINE: "svg-inline"
138002
138106
  },
138003
138107
  /** Predefined loaders */
138004
138108
  USE: {
@@ -138525,6 +138629,143 @@ var require_getTargetDir = __commonJS({
138525
138629
  }
138526
138630
  });
138527
138631
 
138632
+ // ../../../toolkit/utils/dist/babel.js
138633
+ var require_babel = __commonJS({
138634
+ "../../../toolkit/utils/dist/babel.js"(exports, module2) {
138635
+ var __defProp2 = Object.defineProperty;
138636
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
138637
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
138638
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
138639
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
138640
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
138641
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138642
+ var __spreadValues2 = (a, b) => {
138643
+ for (var prop in b || (b = {}))
138644
+ if (__hasOwnProp2.call(b, prop))
138645
+ __defNormalProp2(a, prop, b[prop]);
138646
+ if (__getOwnPropSymbols2)
138647
+ for (var prop of __getOwnPropSymbols2(b)) {
138648
+ if (__propIsEnum2.call(b, prop))
138649
+ __defNormalProp2(a, prop, b[prop]);
138650
+ }
138651
+ return a;
138652
+ };
138653
+ var __export2 = (target, all) => {
138654
+ for (var name in all)
138655
+ __defProp2(target, name, { get: all[name], enumerable: true });
138656
+ };
138657
+ var __copyProps2 = (to, from, except, desc) => {
138658
+ if (from && typeof from === "object" || typeof from === "function") {
138659
+ for (let key of __getOwnPropNames2(from))
138660
+ if (!__hasOwnProp2.call(to, key) && key !== except)
138661
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
138662
+ }
138663
+ return to;
138664
+ };
138665
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
138666
+ var babel_exports = {};
138667
+ __export2(babel_exports, {
138668
+ applyUserBabelConfig: () => applyUserBabelConfig,
138669
+ getBabelUtils: () => getBabelUtils
138670
+ });
138671
+ module2.exports = __toCommonJS2(babel_exports);
138672
+ var import_path10 = require("path");
138673
+ var import_applyOptionsChain = require_applyOptionsChain2();
138674
+ var import_ensureArray = require_ensureArray2();
138675
+ var import_path22 = require_path2();
138676
+ var formatPath = (originPath) => {
138677
+ if ((0, import_path10.isAbsolute)(originPath)) {
138678
+ return originPath.split(import_path10.sep).join("/");
138679
+ }
138680
+ return originPath;
138681
+ };
138682
+ var getPluginItemName = (item) => {
138683
+ if (typeof item === "string") {
138684
+ return formatPath(item);
138685
+ }
138686
+ if (Array.isArray(item) && typeof item[0] === "string") {
138687
+ return formatPath(item[0]);
138688
+ }
138689
+ return null;
138690
+ };
138691
+ var addPlugins = (plugins, config) => {
138692
+ if (config.plugins) {
138693
+ config.plugins.push(...plugins);
138694
+ } else {
138695
+ config.plugins = plugins;
138696
+ }
138697
+ };
138698
+ var addPresets = (presets, config) => {
138699
+ if (config.presets) {
138700
+ config.presets.push(...presets);
138701
+ } else {
138702
+ config.presets = presets;
138703
+ }
138704
+ };
138705
+ var removePlugins = (plugins, config) => {
138706
+ if (!config.plugins) {
138707
+ return;
138708
+ }
138709
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
138710
+ config.plugins = config.plugins.filter((item) => {
138711
+ const name = getPluginItemName(item);
138712
+ if (name) {
138713
+ return !removeList.find((removeItem) => name.includes(removeItem));
138714
+ }
138715
+ return true;
138716
+ });
138717
+ };
138718
+ var removePresets = (presets, config) => {
138719
+ if (!config.presets) {
138720
+ return;
138721
+ }
138722
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
138723
+ config.presets = config.presets.filter((item) => {
138724
+ const name = getPluginItemName(item);
138725
+ if (name) {
138726
+ return !removeList.find((removeItem) => name.includes(removeItem));
138727
+ }
138728
+ return true;
138729
+ });
138730
+ };
138731
+ var modifyPresetOptions = (presetName, options, presets = []) => {
138732
+ presets.forEach((preset, index) => {
138733
+ if (Array.isArray(preset)) {
138734
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
138735
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
138736
+ }
138737
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
138738
+ presets[index] = [preset, options];
138739
+ }
138740
+ });
138741
+ };
138742
+ var getBabelUtils = (config) => {
138743
+ const noop = () => {
138744
+ };
138745
+ return {
138746
+ addPlugins: (plugins) => addPlugins(plugins, config),
138747
+ addPresets: (presets) => addPresets(presets, config),
138748
+ removePlugins: (plugins) => removePlugins(plugins, config),
138749
+ removePresets: (presets) => removePresets(presets, config),
138750
+ // `addIncludes` and `addExcludes` are noop functions by default,
138751
+ // It can be overridden by `extraBabelUtils`.
138752
+ addIncludes: noop,
138753
+ addExcludes: noop,
138754
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
138755
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
138756
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
138757
+ };
138758
+ };
138759
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
138760
+ if (userBabelConfig) {
138761
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
138762
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
138763
+ }
138764
+ return defaultOptions;
138765
+ };
138766
+ }
138767
+ });
138768
+
138528
138769
  // ../../../toolkit/utils/dist/index.js
138529
138770
  var require_dist2 = __commonJS({
138530
138771
  "../../../toolkit/utils/dist/index.js"(exports, module2) {
@@ -138546,7 +138787,6 @@ var require_dist2 = __commonJS({
138546
138787
  module2.exports = __toCommonJS2(src_exports2);
138547
138788
  __reExport(src_exports2, require_compiled2(), module2.exports);
138548
138789
  __reExport(src_exports2, require_commands(), module2.exports);
138549
- __reExport(src_exports2, require_format2(), module2.exports);
138550
138790
  __reExport(src_exports2, require_FileSizeReporter2(), module2.exports);
138551
138791
  __reExport(src_exports2, require_printBuildError2(), module2.exports);
138552
138792
  __reExport(src_exports2, require_debug5(), module2.exports);
@@ -138578,7 +138818,7 @@ var require_dist2 = __commonJS({
138578
138818
  __reExport(src_exports2, require_wait2(), module2.exports);
138579
138819
  __reExport(src_exports2, require_emptyDir2(), module2.exports);
138580
138820
  __reExport(src_exports2, require_getServerConfig2(), module2.exports);
138581
- __reExport(src_exports2, require_tryResolve2(), module2.exports);
138821
+ __reExport(src_exports2, require_resolve(), module2.exports);
138582
138822
  __reExport(src_exports2, require_analyzeProject2(), module2.exports);
138583
138823
  __reExport(src_exports2, require_chainId2(), module2.exports);
138584
138824
  __reExport(src_exports2, require_version2(), module2.exports);
@@ -138588,6 +138828,7 @@ var require_dist2 = __commonJS({
138588
138828
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
138589
138829
  __reExport(src_exports2, require_react(), module2.exports);
138590
138830
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
138831
+ __reExport(src_exports2, require_babel(), module2.exports);
138591
138832
  }
138592
138833
  });
138593
138834
 
@@ -139668,6 +139909,7 @@ var ZH_LOCALE = {
139668
139909
  self: "请选择你想创建的工程类型",
139669
139910
  mwa: "Web 应用",
139670
139911
  module: "Npm 模块",
139912
+ doc: "文档站",
139671
139913
  monorepo: "Monorepo",
139672
139914
  custom: "自定义",
139673
139915
  default: "默认"
@@ -139764,6 +140006,7 @@ var EN_LOCALE = {
139764
140006
  self: "Please select the solution you want to create",
139765
140007
  mwa: "Web App",
139766
140008
  module: "Npm Module",
140009
+ doc: "Doc Site",
139767
140010
  monorepo: "Monorepo",
139768
140011
  custom: "Custom Solution",
139769
140012
  default: "Default"
@@ -139870,6 +140113,7 @@ var BooleanConfig = /* @__PURE__ */ ((BooleanConfig2) => {
139870
140113
  var Solution = /* @__PURE__ */ ((Solution22) => {
139871
140114
  Solution22["MWA"] = "mwa";
139872
140115
  Solution22["Module"] = "module";
140116
+ Solution22["Doc"] = "doc";
139873
140117
  Solution22["Monorepo"] = "monorepo";
139874
140118
  return Solution22;
139875
140119
  })(Solution || {});
@@ -139889,6 +140133,10 @@ var SolutionText = {
139889
140133
  "module"
139890
140134
  /* Module */
139891
140135
  ]: () => i18n.t(localeKeys.solution.module),
140136
+ [
140137
+ "doc"
140138
+ /* Doc */
140139
+ ]: () => i18n.t(localeKeys.solution.doc),
139892
140140
  [
139893
140141
  "monorepo"
139894
140142
  /* Monorepo */
@@ -139921,6 +140169,10 @@ var SolutionToolsMap = {
139921
140169
  "module"
139922
140170
  /* Module */
139923
140171
  ]: "@modern-js/module-tools",
140172
+ [
140173
+ "doc"
140174
+ /* Doc */
140175
+ ]: "@modern-js/doc-tools",
139924
140176
  [
139925
140177
  "monorepo"
139926
140178
  /* Monorepo */
@@ -140001,6 +140253,10 @@ var SolutionGenerator = {
140001
140253
  "module"
140002
140254
  /* Module */
140003
140255
  ]: "@modern-js/module-generator",
140256
+ [
140257
+ "doc"
140258
+ /* Doc */
140259
+ ]: "@modern-js/doc-generator",
140004
140260
  [
140005
140261
  "monorepo"
140006
140262
  /* Monorepo */
@@ -140106,7 +140362,7 @@ var getPackageNameSchema = (extra = {}) => {
140106
140362
  dependencies: [],
140107
140363
  fulfill: {
140108
140364
  state: {
140109
- visible: Boolean(extra == null ? void 0 : extra.isMonorepoSubProject) || !(extra == null ? void 0 : extra.isMwa)
140365
+ visible: Boolean(extra == null ? void 0 : extra.isMonorepoSubProject) || !(extra == null ? void 0 : extra.isMwa) && !(extra == null ? void 0 : extra.isDoc)
140110
140366
  }
140111
140367
  }
140112
140368
  }
@@ -140164,6 +140420,24 @@ var BaseDefaultConfig = {
140164
140420
  packageManager: PackageManager.Pnpm
140165
140421
  };
140166
140422
 
140423
+ // ../../generator-common/dist/esm-node/doc/project.js
140424
+ var getDocSchemaProperties = (extra) => {
140425
+ return {
140426
+ packageName: getPackageNameSchema(extra),
140427
+ packagePath: getPackagePathSchema(extra),
140428
+ packageManager: getPackageManagerSchema(extra)
140429
+ };
140430
+ };
140431
+ var getDocSchema = (extra = {}) => {
140432
+ return {
140433
+ type: "object",
140434
+ properties: getDocSchemaProperties(extra)
140435
+ };
140436
+ };
140437
+ var DocDefaultConfig = {
140438
+ packageManager: PackageManager.Pnpm
140439
+ };
140440
+
140167
140441
  // ../../generator-common/dist/esm-node/module/project.js
140168
140442
  var getModuleSchemaProperties = (extra) => {
140169
140443
  return {
@@ -140663,11 +140937,13 @@ var MonorepoNewActionConfig = {
140663
140937
  var SolutionDefaultConfig = {
140664
140938
  [Solution.MWA]: MWADefaultConfig,
140665
140939
  [Solution.Module]: ModuleDefaultConfig,
140940
+ [Solution.Doc]: DocDefaultConfig,
140666
140941
  [Solution.Monorepo]: MonorepoDefaultConfig
140667
140942
  };
140668
140943
  var SolutionSchemas = {
140669
140944
  [Solution.MWA]: getMWASchema,
140670
140945
  [Solution.Module]: getModuleSchema,
140946
+ [Solution.Doc]: getDocSchema,
140671
140947
  [Solution.Monorepo]: getMonorepoSchema,
140672
140948
  custom: getBaseSchema
140673
140949
  };