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