@modern-js/packages-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
@@ -135876,55 +135876,58 @@ var require_recursive_readdir2 = __commonJS({
135876
135876
  var require_commander2 = __commonJS({
135877
135877
  "../../../toolkit/utils/compiled/commander/index.js"(exports, module2) {
135878
135878
  (() => {
135879
- var e = { 81: (e2) => {
135879
+ var t = { 81: (t2) => {
135880
135880
  "use strict";
135881
- e2.exports = require("child_process");
135882
- }, 361: (e2) => {
135881
+ t2.exports = require("child_process");
135882
+ }, 361: (t2) => {
135883
135883
  "use strict";
135884
- e2.exports = require("events");
135885
- }, 147: (e2) => {
135884
+ t2.exports = require("events");
135885
+ }, 147: (t2) => {
135886
135886
  "use strict";
135887
- e2.exports = require("fs");
135888
- }, 17: (e2) => {
135887
+ t2.exports = require("fs");
135888
+ }, 17: (t2) => {
135889
135889
  "use strict";
135890
- e2.exports = require("path");
135891
- }, 922: (e2, t2, i2) => {
135892
- const { Argument: n } = i2(969);
135893
- const { Command: s } = i2(694);
135894
- const { CommanderError: r, InvalidArgumentError: o } = i2(967);
135895
- const { Help: a } = i2(34);
135896
- const { Option: h } = i2(278);
135897
- t2 = e2.exports = new s();
135898
- t2.program = t2;
135899
- t2.Argument = n;
135900
- t2.Command = s;
135901
- t2.CommanderError = r;
135902
- t2.Help = a;
135903
- t2.InvalidArgumentError = o;
135904
- t2.InvalidOptionArgumentError = o;
135905
- t2.Option = h;
135906
- }, 969: (e2, t2, i2) => {
135907
- const { InvalidArgumentError: n } = i2(967);
135890
+ t2.exports = require("path");
135891
+ }, 282: (t2) => {
135892
+ "use strict";
135893
+ t2.exports = require("process");
135894
+ }, 632: (t2, e2, i2) => {
135895
+ const { Argument: n } = i2(535);
135896
+ const { Command: s } = i2(302);
135897
+ const { CommanderError: r, InvalidArgumentError: o } = i2(796);
135898
+ const { Help: a } = i2(519);
135899
+ const { Option: l } = i2(437);
135900
+ e2 = t2.exports = new s();
135901
+ e2.program = e2;
135902
+ e2.Argument = n;
135903
+ e2.Command = s;
135904
+ e2.CommanderError = r;
135905
+ e2.Help = a;
135906
+ e2.InvalidArgumentError = o;
135907
+ e2.InvalidOptionArgumentError = o;
135908
+ e2.Option = l;
135909
+ }, 535: (t2, e2, i2) => {
135910
+ const { InvalidArgumentError: n } = i2(796);
135908
135911
  class Argument {
135909
- constructor(e3, t3) {
135910
- this.description = t3 || "";
135912
+ constructor(t3, e3) {
135913
+ this.description = e3 || "";
135911
135914
  this.variadic = false;
135912
135915
  this.parseArg = void 0;
135913
135916
  this.defaultValue = void 0;
135914
135917
  this.defaultValueDescription = void 0;
135915
135918
  this.argChoices = void 0;
135916
- switch (e3[0]) {
135919
+ switch (t3[0]) {
135917
135920
  case "<":
135918
135921
  this.required = true;
135919
- this._name = e3.slice(1, -1);
135922
+ this._name = t3.slice(1, -1);
135920
135923
  break;
135921
135924
  case "[":
135922
135925
  this.required = false;
135923
- this._name = e3.slice(1, -1);
135926
+ this._name = t3.slice(1, -1);
135924
135927
  break;
135925
135928
  default:
135926
135929
  this.required = true;
135927
- this._name = e3;
135930
+ this._name = t3;
135928
135931
  break;
135929
135932
  }
135930
135933
  if (this._name.length > 3 && this._name.slice(-3) === "...") {
@@ -135935,31 +135938,31 @@ var require_commander2 = __commonJS({
135935
135938
  name() {
135936
135939
  return this._name;
135937
135940
  }
135938
- _concatValue(e3, t3) {
135939
- if (t3 === this.defaultValue || !Array.isArray(t3)) {
135940
- return [e3];
135941
+ _concatValue(t3, e3) {
135942
+ if (e3 === this.defaultValue || !Array.isArray(e3)) {
135943
+ return [t3];
135941
135944
  }
135942
- return t3.concat(e3);
135945
+ return e3.concat(t3);
135943
135946
  }
135944
- default(e3, t3) {
135945
- this.defaultValue = e3;
135946
- this.defaultValueDescription = t3;
135947
+ default(t3, e3) {
135948
+ this.defaultValue = t3;
135949
+ this.defaultValueDescription = e3;
135947
135950
  return this;
135948
135951
  }
135949
- argParser(e3) {
135950
- this.parseArg = e3;
135952
+ argParser(t3) {
135953
+ this.parseArg = t3;
135951
135954
  return this;
135952
135955
  }
135953
- choices(e3) {
135954
- this.argChoices = e3;
135955
- this.parseArg = (t3, i3) => {
135956
- if (!e3.includes(t3)) {
135957
- throw new n(`Allowed choices are ${e3.join(", ")}.`);
135956
+ choices(t3) {
135957
+ this.argChoices = t3.slice();
135958
+ this.parseArg = (t4, e3) => {
135959
+ if (!this.argChoices.includes(t4)) {
135960
+ throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
135958
135961
  }
135959
135962
  if (this.variadic) {
135960
- return this._concatValue(t3, i3);
135963
+ return this._concatValue(t4, e3);
135961
135964
  }
135962
- return t3;
135965
+ return t4;
135963
135966
  };
135964
135967
  return this;
135965
135968
  }
@@ -135972,24 +135975,25 @@ var require_commander2 = __commonJS({
135972
135975
  return this;
135973
135976
  }
135974
135977
  }
135975
- function humanReadableArgName(e3) {
135976
- const t3 = e3.name() + (e3.variadic === true ? "..." : "");
135977
- return e3.required ? "<" + t3 + ">" : "[" + t3 + "]";
135978
+ function humanReadableArgName(t3) {
135979
+ const e3 = t3.name() + (t3.variadic === true ? "..." : "");
135980
+ return t3.required ? "<" + e3 + ">" : "[" + e3 + "]";
135978
135981
  }
135979
- t2.Argument = Argument;
135980
- t2.humanReadableArgName = humanReadableArgName;
135981
- }, 694: (e2, t2, i2) => {
135982
+ e2.Argument = Argument;
135983
+ e2.humanReadableArgName = humanReadableArgName;
135984
+ }, 302: (t2, e2, i2) => {
135982
135985
  const n = i2(361).EventEmitter;
135983
135986
  const s = i2(81);
135984
135987
  const r = i2(17);
135985
135988
  const o = i2(147);
135986
- const { Argument: a, humanReadableArgName: h } = i2(969);
135987
- const { CommanderError: l } = i2(967);
135988
- const { Help: u } = i2(34);
135989
- const { Option: c, splitOptionFlags: p } = i2(278);
135990
- const { suggestSimilar: m } = i2(461);
135989
+ const a = i2(282);
135990
+ const { Argument: l, humanReadableArgName: h } = i2(535);
135991
+ const { CommanderError: u } = i2(796);
135992
+ const { Help: c } = i2(519);
135993
+ const { Option: p, splitOptionFlags: m, DualOptions: d } = i2(437);
135994
+ const { suggestSimilar: f } = i2(860);
135991
135995
  class Command2 extends n {
135992
- constructor(e3) {
135996
+ constructor(t3) {
135993
135997
  super();
135994
135998
  this.commands = [];
135995
135999
  this.options = [];
@@ -136001,25 +136005,27 @@ var require_commander2 = __commonJS({
136001
136005
  this.rawArgs = [];
136002
136006
  this.processedArgs = [];
136003
136007
  this._scriptPath = null;
136004
- this._name = e3 || "";
136008
+ this._name = t3 || "";
136005
136009
  this._optionValues = {};
136006
136010
  this._optionValueSources = {};
136007
136011
  this._storeOptionsAsProperties = false;
136008
136012
  this._actionHandler = null;
136009
136013
  this._executableHandler = false;
136010
136014
  this._executableFile = null;
136015
+ this._executableDir = null;
136011
136016
  this._defaultCommandName = null;
136012
136017
  this._exitCallback = null;
136013
136018
  this._aliases = [];
136014
136019
  this._combineFlagAndOptionalValue = true;
136015
136020
  this._description = "";
136021
+ this._summary = "";
136016
136022
  this._argsDescription = void 0;
136017
136023
  this._enablePositionalOptions = false;
136018
136024
  this._passThroughOptions = false;
136019
136025
  this._lifeCycleHooks = {};
136020
136026
  this._showHelpAfterError = false;
136021
- this._showSuggestionAfterError = false;
136022
- 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) };
136027
+ this._showSuggestionAfterError = true;
136028
+ 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) };
136023
136029
  this._hidden = false;
136024
136030
  this._hasHelpOption = true;
136025
136031
  this._helpFlags = "-h, --help";
@@ -136032,35 +136038,35 @@ var require_commander2 = __commonJS({
136032
136038
  this._helpCommandDescription = "display help for command";
136033
136039
  this._helpConfiguration = {};
136034
136040
  }
136035
- copyInheritedSettings(e3) {
136036
- this._outputConfiguration = e3._outputConfiguration;
136037
- this._hasHelpOption = e3._hasHelpOption;
136038
- this._helpFlags = e3._helpFlags;
136039
- this._helpDescription = e3._helpDescription;
136040
- this._helpShortFlag = e3._helpShortFlag;
136041
- this._helpLongFlag = e3._helpLongFlag;
136042
- this._helpCommandName = e3._helpCommandName;
136043
- this._helpCommandnameAndArgs = e3._helpCommandnameAndArgs;
136044
- this._helpCommandDescription = e3._helpCommandDescription;
136045
- this._helpConfiguration = e3._helpConfiguration;
136046
- this._exitCallback = e3._exitCallback;
136047
- this._storeOptionsAsProperties = e3._storeOptionsAsProperties;
136048
- this._combineFlagAndOptionalValue = e3._combineFlagAndOptionalValue;
136049
- this._allowExcessArguments = e3._allowExcessArguments;
136050
- this._enablePositionalOptions = e3._enablePositionalOptions;
136051
- this._showHelpAfterError = e3._showHelpAfterError;
136052
- this._showSuggestionAfterError = e3._showSuggestionAfterError;
136041
+ copyInheritedSettings(t3) {
136042
+ this._outputConfiguration = t3._outputConfiguration;
136043
+ this._hasHelpOption = t3._hasHelpOption;
136044
+ this._helpFlags = t3._helpFlags;
136045
+ this._helpDescription = t3._helpDescription;
136046
+ this._helpShortFlag = t3._helpShortFlag;
136047
+ this._helpLongFlag = t3._helpLongFlag;
136048
+ this._helpCommandName = t3._helpCommandName;
136049
+ this._helpCommandnameAndArgs = t3._helpCommandnameAndArgs;
136050
+ this._helpCommandDescription = t3._helpCommandDescription;
136051
+ this._helpConfiguration = t3._helpConfiguration;
136052
+ this._exitCallback = t3._exitCallback;
136053
+ this._storeOptionsAsProperties = t3._storeOptionsAsProperties;
136054
+ this._combineFlagAndOptionalValue = t3._combineFlagAndOptionalValue;
136055
+ this._allowExcessArguments = t3._allowExcessArguments;
136056
+ this._enablePositionalOptions = t3._enablePositionalOptions;
136057
+ this._showHelpAfterError = t3._showHelpAfterError;
136058
+ this._showSuggestionAfterError = t3._showSuggestionAfterError;
136053
136059
  return this;
136054
136060
  }
136055
- command(e3, t3, i3) {
136056
- let n2 = t3;
136061
+ command(t3, e3, i3) {
136062
+ let n2 = e3;
136057
136063
  let s2 = i3;
136058
136064
  if (typeof n2 === "object" && n2 !== null) {
136059
136065
  s2 = n2;
136060
136066
  n2 = null;
136061
136067
  }
136062
136068
  s2 = s2 || {};
136063
- const [, r2, o2] = e3.match(/([^ ]+) *(.*)/);
136069
+ const [, r2, o2] = t3.match(/([^ ]+) *(.*)/);
136064
136070
  const a2 = this.createCommand(r2);
136065
136071
  if (n2) {
136066
136072
  a2.description(n2);
@@ -136079,60 +136085,53 @@ var require_commander2 = __commonJS({
136079
136085
  return this;
136080
136086
  return a2;
136081
136087
  }
136082
- createCommand(e3) {
136083
- return new Command2(e3);
136088
+ createCommand(t3) {
136089
+ return new Command2(t3);
136084
136090
  }
136085
136091
  createHelp() {
136086
- return Object.assign(new u(), this.configureHelp());
136092
+ return Object.assign(new c(), this.configureHelp());
136087
136093
  }
136088
- configureHelp(e3) {
136089
- if (e3 === void 0)
136094
+ configureHelp(t3) {
136095
+ if (t3 === void 0)
136090
136096
  return this._helpConfiguration;
136091
- this._helpConfiguration = e3;
136097
+ this._helpConfiguration = t3;
136092
136098
  return this;
136093
136099
  }
136094
- configureOutput(e3) {
136095
- if (e3 === void 0)
136100
+ configureOutput(t3) {
136101
+ if (t3 === void 0)
136096
136102
  return this._outputConfiguration;
136097
- Object.assign(this._outputConfiguration, e3);
136103
+ Object.assign(this._outputConfiguration, t3);
136098
136104
  return this;
136099
136105
  }
136100
- showHelpAfterError(e3 = true) {
136101
- if (typeof e3 !== "string")
136102
- e3 = !!e3;
136103
- this._showHelpAfterError = e3;
136106
+ showHelpAfterError(t3 = true) {
136107
+ if (typeof t3 !== "string")
136108
+ t3 = !!t3;
136109
+ this._showHelpAfterError = t3;
136104
136110
  return this;
136105
136111
  }
136106
- showSuggestionAfterError(e3 = true) {
136107
- this._showSuggestionAfterError = !!e3;
136112
+ showSuggestionAfterError(t3 = true) {
136113
+ this._showSuggestionAfterError = !!t3;
136108
136114
  return this;
136109
136115
  }
136110
- addCommand(e3, t3) {
136111
- if (!e3._name)
136112
- throw new Error("Command passed to .addCommand() must have a name");
136113
- function checkExplicitNames(e4) {
136114
- e4.forEach((e5) => {
136115
- if (e5._executableHandler && !e5._executableFile) {
136116
- throw new Error(`Must specify executableFile for deeply nested executable: ${e5.name()}`);
136117
- }
136118
- checkExplicitNames(e5.commands);
136119
- });
136116
+ addCommand(t3, e3) {
136117
+ if (!t3._name) {
136118
+ throw new Error(`Command passed to .addCommand() must have a name
136119
+ - specify the name in Command constructor or using .name()`);
136120
136120
  }
136121
- checkExplicitNames(e3.commands);
136122
- t3 = t3 || {};
136123
- if (t3.isDefault)
136124
- this._defaultCommandName = e3._name;
136125
- if (t3.noHelp || t3.hidden)
136126
- e3._hidden = true;
136127
- this.commands.push(e3);
136128
- e3.parent = this;
136121
+ e3 = e3 || {};
136122
+ if (e3.isDefault)
136123
+ this._defaultCommandName = t3._name;
136124
+ if (e3.noHelp || e3.hidden)
136125
+ t3._hidden = true;
136126
+ this.commands.push(t3);
136127
+ t3.parent = this;
136129
136128
  return this;
136130
136129
  }
136131
- createArgument(e3, t3) {
136132
- return new a(e3, t3);
136130
+ createArgument(t3, e3) {
136131
+ return new l(t3, e3);
136133
136132
  }
136134
- argument(e3, t3, i3, n2) {
136135
- const s2 = this.createArgument(e3, t3);
136133
+ argument(t3, e3, i3, n2) {
136134
+ const s2 = this.createArgument(t3, e3);
136136
136135
  if (typeof i3 === "function") {
136137
136136
  s2.default(n2).argParser(i3);
136138
136137
  } else {
@@ -136141,33 +136140,33 @@ var require_commander2 = __commonJS({
136141
136140
  this.addArgument(s2);
136142
136141
  return this;
136143
136142
  }
136144
- arguments(e3) {
136145
- e3.split(/ +/).forEach((e4) => {
136146
- this.argument(e4);
136143
+ arguments(t3) {
136144
+ t3.split(/ +/).forEach((t4) => {
136145
+ this.argument(t4);
136147
136146
  });
136148
136147
  return this;
136149
136148
  }
136150
- addArgument(e3) {
136151
- const t3 = this._args.slice(-1)[0];
136152
- if (t3 && t3.variadic) {
136153
- throw new Error(`only the last argument can be variadic '${t3.name()}'`);
136149
+ addArgument(t3) {
136150
+ const e3 = this._args.slice(-1)[0];
136151
+ if (e3 && e3.variadic) {
136152
+ throw new Error(`only the last argument can be variadic '${e3.name()}'`);
136154
136153
  }
136155
- if (e3.required && e3.defaultValue !== void 0 && e3.parseArg === void 0) {
136156
- throw new Error(`a default value for a required argument is never used: '${e3.name()}'`);
136154
+ if (t3.required && t3.defaultValue !== void 0 && t3.parseArg === void 0) {
136155
+ throw new Error(`a default value for a required argument is never used: '${t3.name()}'`);
136157
136156
  }
136158
- this._args.push(e3);
136157
+ this._args.push(t3);
136159
136158
  return this;
136160
136159
  }
136161
- addHelpCommand(e3, t3) {
136162
- if (e3 === false) {
136160
+ addHelpCommand(t3, e3) {
136161
+ if (t3 === false) {
136163
136162
  this._addImplicitHelpCommand = false;
136164
136163
  } else {
136165
136164
  this._addImplicitHelpCommand = true;
136166
- if (typeof e3 === "string") {
136167
- this._helpCommandName = e3.split(" ")[0];
136168
- this._helpCommandnameAndArgs = e3;
136165
+ if (typeof t3 === "string") {
136166
+ this._helpCommandName = t3.split(" ")[0];
136167
+ this._helpCommandnameAndArgs = t3;
136169
136168
  }
136170
- this._helpCommandDescription = t3 || this._helpCommandDescription;
136169
+ this._helpCommandDescription = e3 || this._helpCommandDescription;
136171
136170
  }
136172
136171
  return this;
136173
136172
  }
@@ -136177,116 +136176,121 @@ var require_commander2 = __commonJS({
136177
136176
  }
136178
136177
  return this._addImplicitHelpCommand;
136179
136178
  }
136180
- hook(e3, t3) {
136181
- const i3 = ["preAction", "postAction"];
136182
- if (!i3.includes(e3)) {
136183
- throw new Error(`Unexpected value for event passed to hook : '${e3}'.
136179
+ hook(t3, e3) {
136180
+ const i3 = ["preSubcommand", "preAction", "postAction"];
136181
+ if (!i3.includes(t3)) {
136182
+ throw new Error(`Unexpected value for event passed to hook : '${t3}'.
136184
136183
  Expecting one of '${i3.join("', '")}'`);
136185
136184
  }
136186
- if (this._lifeCycleHooks[e3]) {
136187
- this._lifeCycleHooks[e3].push(t3);
136185
+ if (this._lifeCycleHooks[t3]) {
136186
+ this._lifeCycleHooks[t3].push(e3);
136188
136187
  } else {
136189
- this._lifeCycleHooks[e3] = [t3];
136188
+ this._lifeCycleHooks[t3] = [e3];
136190
136189
  }
136191
136190
  return this;
136192
136191
  }
136193
- exitOverride(e3) {
136194
- if (e3) {
136195
- this._exitCallback = e3;
136192
+ exitOverride(t3) {
136193
+ if (t3) {
136194
+ this._exitCallback = t3;
136196
136195
  } else {
136197
- this._exitCallback = (e4) => {
136198
- if (e4.code !== "commander.executeSubCommandAsync") {
136199
- throw e4;
136196
+ this._exitCallback = (t4) => {
136197
+ if (t4.code !== "commander.executeSubCommandAsync") {
136198
+ throw t4;
136200
136199
  } else {
136201
136200
  }
136202
136201
  };
136203
136202
  }
136204
136203
  return this;
136205
136204
  }
136206
- _exit(e3, t3, i3) {
136205
+ _exit(t3, e3, i3) {
136207
136206
  if (this._exitCallback) {
136208
- this._exitCallback(new l(e3, t3, i3));
136207
+ this._exitCallback(new u(t3, e3, i3));
136209
136208
  }
136210
- process.exit(e3);
136209
+ a.exit(t3);
136211
136210
  }
136212
- action(e3) {
136213
- const listener = (t3) => {
136211
+ action(t3) {
136212
+ const listener = (e3) => {
136214
136213
  const i3 = this._args.length;
136215
- const n2 = t3.slice(0, i3);
136214
+ const n2 = e3.slice(0, i3);
136216
136215
  if (this._storeOptionsAsProperties) {
136217
136216
  n2[i3] = this;
136218
136217
  } else {
136219
136218
  n2[i3] = this.opts();
136220
136219
  }
136221
136220
  n2.push(this);
136222
- return e3.apply(this, n2);
136221
+ return t3.apply(this, n2);
136223
136222
  };
136224
136223
  this._actionHandler = listener;
136225
136224
  return this;
136226
136225
  }
136227
- createOption(e3, t3) {
136228
- return new c(e3, t3);
136226
+ createOption(t3, e3) {
136227
+ return new p(t3, e3);
136229
136228
  }
136230
- addOption(e3) {
136231
- const t3 = e3.name();
136232
- const i3 = e3.attributeName();
136233
- let n2 = e3.defaultValue;
136234
- if (e3.negate || e3.optional || e3.required || typeof n2 === "boolean") {
136235
- if (e3.negate) {
136236
- const t4 = e3.long.replace(/^--no-/, "--");
136237
- n2 = this._findOption(t4) ? this.getOptionValue(i3) : true;
136238
- }
136239
- if (n2 !== void 0) {
136240
- this.setOptionValueWithSource(i3, n2, "default");
136229
+ addOption(t3) {
136230
+ const e3 = t3.name();
136231
+ const i3 = t3.attributeName();
136232
+ if (t3.negate) {
136233
+ const e4 = t3.long.replace(/^--no-/, "--");
136234
+ if (!this._findOption(e4)) {
136235
+ this.setOptionValueWithSource(i3, t3.defaultValue === void 0 ? true : t3.defaultValue, "default");
136241
136236
  }
136237
+ } else if (t3.defaultValue !== void 0) {
136238
+ this.setOptionValueWithSource(i3, t3.defaultValue, "default");
136242
136239
  }
136243
- this.options.push(e3);
136244
- const handleOptionValue = (t4, s2, r2) => {
136245
- const o2 = this.getOptionValue(i3);
136246
- if (t4 !== null && e3.parseArg) {
136240
+ this.options.push(t3);
136241
+ const handleOptionValue = (e4, n2, s2) => {
136242
+ if (e4 == null && t3.presetArg !== void 0) {
136243
+ e4 = t3.presetArg;
136244
+ }
136245
+ const r2 = this.getOptionValue(i3);
136246
+ if (e4 !== null && t3.parseArg) {
136247
136247
  try {
136248
- t4 = e3.parseArg(t4, o2 === void 0 ? n2 : o2);
136249
- } catch (e4) {
136250
- if (e4.code === "commander.invalidArgument") {
136251
- const t5 = `${s2} ${e4.message}`;
136252
- this._displayError(e4.exitCode, e4.code, t5);
136248
+ e4 = t3.parseArg(e4, r2);
136249
+ } catch (t4) {
136250
+ if (t4.code === "commander.invalidArgument") {
136251
+ const e5 = `${n2} ${t4.message}`;
136252
+ this.error(e5, { exitCode: t4.exitCode, code: t4.code });
136253
136253
  }
136254
- throw e4;
136254
+ throw t4;
136255
136255
  }
136256
- } else if (t4 !== null && e3.variadic) {
136257
- t4 = e3._concatValue(t4, o2);
136256
+ } else if (e4 !== null && t3.variadic) {
136257
+ e4 = t3._concatValue(e4, r2);
136258
136258
  }
136259
- if (typeof o2 === "boolean" || typeof o2 === "undefined") {
136260
- if (t4 == null) {
136261
- this.setOptionValueWithSource(i3, e3.negate ? false : n2 || true, r2);
136259
+ if (e4 == null) {
136260
+ if (t3.negate) {
136261
+ e4 = false;
136262
+ } else if (t3.isBoolean() || t3.optional) {
136263
+ e4 = true;
136262
136264
  } else {
136263
- this.setOptionValueWithSource(i3, t4, r2);
136265
+ e4 = "";
136264
136266
  }
136265
- } else if (t4 !== null) {
136266
- this.setOptionValueWithSource(i3, e3.negate ? false : t4, r2);
136267
136267
  }
136268
+ this.setOptionValueWithSource(i3, e4, s2);
136268
136269
  };
136269
- this.on("option:" + t3, (t4) => {
136270
- const i4 = `error: option '${e3.flags}' argument '${t4}' is invalid.`;
136271
- handleOptionValue(t4, i4, "cli");
136270
+ this.on("option:" + e3, (e4) => {
136271
+ const i4 = `error: option '${t3.flags}' argument '${e4}' is invalid.`;
136272
+ handleOptionValue(e4, i4, "cli");
136272
136273
  });
136273
- if (e3.envVar) {
136274
- this.on("optionEnv:" + t3, (t4) => {
136275
- const i4 = `error: option '${e3.flags}' value '${t4}' from env '${e3.envVar}' is invalid.`;
136276
- handleOptionValue(t4, i4, "env");
136274
+ if (t3.envVar) {
136275
+ this.on("optionEnv:" + e3, (e4) => {
136276
+ const i4 = `error: option '${t3.flags}' value '${e4}' from env '${t3.envVar}' is invalid.`;
136277
+ handleOptionValue(e4, i4, "env");
136277
136278
  });
136278
136279
  }
136279
136280
  return this;
136280
136281
  }
136281
- _optionEx(e3, t3, i3, n2, s2) {
136282
- const r2 = this.createOption(t3, i3);
136283
- r2.makeOptionMandatory(!!e3.mandatory);
136282
+ _optionEx(t3, e3, i3, n2, s2) {
136283
+ if (typeof e3 === "object" && e3 instanceof p) {
136284
+ throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
136285
+ }
136286
+ const r2 = this.createOption(e3, i3);
136287
+ r2.makeOptionMandatory(!!t3.mandatory);
136284
136288
  if (typeof n2 === "function") {
136285
136289
  r2.default(s2).argParser(n2);
136286
136290
  } else if (n2 instanceof RegExp) {
136287
- const e4 = n2;
136288
- n2 = (t4, i4) => {
136289
- const n3 = e4.exec(t4);
136291
+ const t4 = n2;
136292
+ n2 = (e4, i4) => {
136293
+ const n3 = t4.exec(e4);
136290
136294
  return n3 ? n3[0] : i4;
136291
136295
  };
136292
136296
  r2.default(s2).argParser(n2);
@@ -136295,209 +136299,233 @@ Expecting one of '${i3.join("', '")}'`);
136295
136299
  }
136296
136300
  return this.addOption(r2);
136297
136301
  }
136298
- option(e3, t3, i3, n2) {
136299
- return this._optionEx({}, e3, t3, i3, n2);
136302
+ option(t3, e3, i3, n2) {
136303
+ return this._optionEx({}, t3, e3, i3, n2);
136300
136304
  }
136301
- requiredOption(e3, t3, i3, n2) {
136302
- return this._optionEx({ mandatory: true }, e3, t3, i3, n2);
136305
+ requiredOption(t3, e3, i3, n2) {
136306
+ return this._optionEx({ mandatory: true }, t3, e3, i3, n2);
136303
136307
  }
136304
- combineFlagAndOptionalValue(e3 = true) {
136305
- this._combineFlagAndOptionalValue = !!e3;
136308
+ combineFlagAndOptionalValue(t3 = true) {
136309
+ this._combineFlagAndOptionalValue = !!t3;
136306
136310
  return this;
136307
136311
  }
136308
- allowUnknownOption(e3 = true) {
136309
- this._allowUnknownOption = !!e3;
136312
+ allowUnknownOption(t3 = true) {
136313
+ this._allowUnknownOption = !!t3;
136310
136314
  return this;
136311
136315
  }
136312
- allowExcessArguments(e3 = true) {
136313
- this._allowExcessArguments = !!e3;
136316
+ allowExcessArguments(t3 = true) {
136317
+ this._allowExcessArguments = !!t3;
136314
136318
  return this;
136315
136319
  }
136316
- enablePositionalOptions(e3 = true) {
136317
- this._enablePositionalOptions = !!e3;
136320
+ enablePositionalOptions(t3 = true) {
136321
+ this._enablePositionalOptions = !!t3;
136318
136322
  return this;
136319
136323
  }
136320
- passThroughOptions(e3 = true) {
136321
- this._passThroughOptions = !!e3;
136322
- if (!!this.parent && e3 && !this.parent._enablePositionalOptions) {
136324
+ passThroughOptions(t3 = true) {
136325
+ this._passThroughOptions = !!t3;
136326
+ if (!!this.parent && t3 && !this.parent._enablePositionalOptions) {
136323
136327
  throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
136324
136328
  }
136325
136329
  return this;
136326
136330
  }
136327
- storeOptionsAsProperties(e3 = true) {
136328
- this._storeOptionsAsProperties = !!e3;
136331
+ storeOptionsAsProperties(t3 = true) {
136332
+ this._storeOptionsAsProperties = !!t3;
136329
136333
  if (this.options.length) {
136330
136334
  throw new Error("call .storeOptionsAsProperties() before adding options");
136331
136335
  }
136332
136336
  return this;
136333
136337
  }
136334
- getOptionValue(e3) {
136338
+ getOptionValue(t3) {
136335
136339
  if (this._storeOptionsAsProperties) {
136336
- return this[e3];
136340
+ return this[t3];
136337
136341
  }
136338
- return this._optionValues[e3];
136342
+ return this._optionValues[t3];
136339
136343
  }
136340
- setOptionValue(e3, t3) {
136344
+ setOptionValue(t3, e3) {
136345
+ return this.setOptionValueWithSource(t3, e3, void 0);
136346
+ }
136347
+ setOptionValueWithSource(t3, e3, i3) {
136341
136348
  if (this._storeOptionsAsProperties) {
136342
- this[e3] = t3;
136349
+ this[t3] = e3;
136343
136350
  } else {
136344
- this._optionValues[e3] = t3;
136351
+ this._optionValues[t3] = e3;
136345
136352
  }
136353
+ this._optionValueSources[t3] = i3;
136346
136354
  return this;
136347
136355
  }
136348
- setOptionValueWithSource(e3, t3, i3) {
136349
- this.setOptionValue(e3, t3);
136350
- this._optionValueSources[e3] = i3;
136351
- return this;
136356
+ getOptionValueSource(t3) {
136357
+ return this._optionValueSources[t3];
136352
136358
  }
136353
- getOptionValueSource(e3) {
136354
- return this._optionValueSources[e3];
136359
+ getOptionValueSourceWithGlobals(t3) {
136360
+ let e3;
136361
+ getCommandAndParents(this).forEach((i3) => {
136362
+ if (i3.getOptionValueSource(t3) !== void 0) {
136363
+ e3 = i3.getOptionValueSource(t3);
136364
+ }
136365
+ });
136366
+ return e3;
136355
136367
  }
136356
- _prepareUserArgs(e3, t3) {
136357
- if (e3 !== void 0 && !Array.isArray(e3)) {
136368
+ _prepareUserArgs(t3, e3) {
136369
+ if (t3 !== void 0 && !Array.isArray(t3)) {
136358
136370
  throw new Error("first parameter to parse must be array or undefined");
136359
136371
  }
136360
- t3 = t3 || {};
136361
- if (e3 === void 0) {
136362
- e3 = process.argv;
136363
- if (process.versions && process.versions.electron) {
136364
- t3.from = "electron";
136372
+ e3 = e3 || {};
136373
+ if (t3 === void 0) {
136374
+ t3 = a.argv;
136375
+ if (a.versions && a.versions.electron) {
136376
+ e3.from = "electron";
136365
136377
  }
136366
136378
  }
136367
- this.rawArgs = e3.slice();
136379
+ this.rawArgs = t3.slice();
136368
136380
  let i3;
136369
- switch (t3.from) {
136381
+ switch (e3.from) {
136370
136382
  case void 0:
136371
136383
  case "node":
136372
- this._scriptPath = e3[1];
136373
- i3 = e3.slice(2);
136384
+ this._scriptPath = t3[1];
136385
+ i3 = t3.slice(2);
136374
136386
  break;
136375
136387
  case "electron":
136376
- if (process.defaultApp) {
136377
- this._scriptPath = e3[1];
136378
- i3 = e3.slice(2);
136388
+ if (a.defaultApp) {
136389
+ this._scriptPath = t3[1];
136390
+ i3 = t3.slice(2);
136379
136391
  } else {
136380
- i3 = e3.slice(1);
136392
+ i3 = t3.slice(1);
136381
136393
  }
136382
136394
  break;
136383
136395
  case "user":
136384
- i3 = e3.slice(0);
136396
+ i3 = t3.slice(0);
136385
136397
  break;
136386
136398
  default:
136387
- throw new Error(`unexpected parse option { from: '${t3.from}' }`);
136399
+ throw new Error(`unexpected parse option { from: '${e3.from}' }`);
136388
136400
  }
136389
- if (!this._scriptPath && require.main) {
136390
- this._scriptPath = require.main.filename;
136391
- }
136392
- this._name = this._name || this._scriptPath && r.basename(this._scriptPath, r.extname(this._scriptPath));
136401
+ if (!this._name && this._scriptPath)
136402
+ this.nameFromFilename(this._scriptPath);
136403
+ this._name = this._name || "program";
136393
136404
  return i3;
136394
136405
  }
136395
- parse(e3, t3) {
136396
- const i3 = this._prepareUserArgs(e3, t3);
136406
+ parse(t3, e3) {
136407
+ const i3 = this._prepareUserArgs(t3, e3);
136397
136408
  this._parseCommand([], i3);
136398
136409
  return this;
136399
136410
  }
136400
- parseAsync(e3, t3) {
136411
+ parseAsync(t3, e3) {
136401
136412
  return __async(this, null, function* () {
136402
- const i3 = this._prepareUserArgs(e3, t3);
136413
+ const i3 = this._prepareUserArgs(t3, e3);
136403
136414
  yield this._parseCommand([], i3);
136404
136415
  return this;
136405
136416
  });
136406
136417
  }
136407
- _executeSubCommand(e3, t3) {
136408
- t3 = t3.slice();
136418
+ _executeSubCommand(t3, e3) {
136419
+ e3 = e3.slice();
136409
136420
  let i3 = false;
136410
136421
  const n2 = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
136411
- this._checkForMissingMandatoryOptions();
136412
- let a2 = this._scriptPath;
136413
- if (!a2 && require.main) {
136414
- a2 = require.main.filename;
136415
- }
136416
- let h2;
136417
- try {
136418
- const e4 = o.realpathSync(a2);
136419
- h2 = r.dirname(e4);
136420
- } catch (e4) {
136421
- h2 = ".";
136422
+ function findFile(t4, e4) {
136423
+ const i4 = r.resolve(t4, e4);
136424
+ if (o.existsSync(i4))
136425
+ return i4;
136426
+ if (n2.includes(r.extname(e4)))
136427
+ return void 0;
136428
+ const s2 = n2.find((t5) => o.existsSync(`${i4}${t5}`));
136429
+ if (s2)
136430
+ return `${i4}${s2}`;
136431
+ return void 0;
136422
136432
  }
136423
- let u2 = r.basename(a2, r.extname(a2)) + "-" + e3._name;
136424
- if (e3._executableFile) {
136425
- u2 = e3._executableFile;
136433
+ this._checkForMissingMandatoryOptions();
136434
+ this._checkForConflictingOptions();
136435
+ let l2 = t3._executableFile || `${this._name}-${t3._name}`;
136436
+ let h2 = this._executableDir || "";
136437
+ if (this._scriptPath) {
136438
+ let t4;
136439
+ try {
136440
+ t4 = o.realpathSync(this._scriptPath);
136441
+ } catch (e4) {
136442
+ t4 = this._scriptPath;
136443
+ }
136444
+ h2 = r.resolve(r.dirname(t4), h2);
136426
136445
  }
136427
- const c2 = r.join(h2, u2);
136428
- if (o.existsSync(c2)) {
136429
- u2 = c2;
136430
- } else {
136431
- n2.forEach((e4) => {
136432
- if (o.existsSync(`${c2}${e4}`)) {
136433
- u2 = `${c2}${e4}`;
136446
+ if (h2) {
136447
+ let e4 = findFile(h2, l2);
136448
+ if (!e4 && !t3._executableFile && this._scriptPath) {
136449
+ const i4 = r.basename(this._scriptPath, r.extname(this._scriptPath));
136450
+ if (i4 !== this._name) {
136451
+ e4 = findFile(h2, `${i4}-${t3._name}`);
136434
136452
  }
136435
- });
136453
+ }
136454
+ l2 = e4 || l2;
136436
136455
  }
136437
- i3 = n2.includes(r.extname(u2));
136438
- let p2;
136439
- if (process.platform !== "win32") {
136456
+ i3 = n2.includes(r.extname(l2));
136457
+ let c2;
136458
+ if (a.platform !== "win32") {
136440
136459
  if (i3) {
136441
- t3.unshift(u2);
136442
- t3 = incrementNodeInspectorPort(process.execArgv).concat(t3);
136443
- p2 = s.spawn(process.argv[0], t3, { stdio: "inherit" });
136460
+ e3.unshift(l2);
136461
+ e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
136462
+ c2 = s.spawn(a.argv[0], e3, { stdio: "inherit" });
136444
136463
  } else {
136445
- p2 = s.spawn(u2, t3, { stdio: "inherit" });
136464
+ c2 = s.spawn(l2, e3, { stdio: "inherit" });
136446
136465
  }
136447
136466
  } else {
136448
- t3.unshift(u2);
136449
- t3 = incrementNodeInspectorPort(process.execArgv).concat(t3);
136450
- p2 = s.spawn(process.execPath, t3, { stdio: "inherit" });
136451
- }
136452
- const m2 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
136453
- m2.forEach((e4) => {
136454
- process.on(e4, () => {
136455
- if (p2.killed === false && p2.exitCode === null) {
136456
- p2.kill(e4);
136457
- }
136467
+ e3.unshift(l2);
136468
+ e3 = incrementNodeInspectorPort(a.execArgv).concat(e3);
136469
+ c2 = s.spawn(a.execPath, e3, { stdio: "inherit" });
136470
+ }
136471
+ if (!c2.killed) {
136472
+ const t4 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
136473
+ t4.forEach((t5) => {
136474
+ a.on(t5, () => {
136475
+ if (c2.killed === false && c2.exitCode === null) {
136476
+ c2.kill(t5);
136477
+ }
136478
+ });
136458
136479
  });
136459
- });
136460
- const d = this._exitCallback;
136461
- if (!d) {
136462
- p2.on("close", process.exit.bind(process));
136480
+ }
136481
+ const p2 = this._exitCallback;
136482
+ if (!p2) {
136483
+ c2.on("close", a.exit.bind(a));
136463
136484
  } else {
136464
- p2.on("close", () => {
136465
- d(new l(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
136485
+ c2.on("close", () => {
136486
+ p2(new u(a.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
136466
136487
  });
136467
136488
  }
136468
- p2.on("error", (t4) => {
136469
- if (t4.code === "ENOENT") {
136470
- const t5 = `'${u2}' does not exist
136471
- - if '${e3._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
136472
- - if the default executable name is not suitable, use the executableFile option to supply a custom name`;
136473
- throw new Error(t5);
136474
- } else if (t4.code === "EACCES") {
136475
- throw new Error(`'${u2}' not executable`);
136476
- }
136477
- if (!d) {
136478
- process.exit(1);
136489
+ c2.on("error", (e4) => {
136490
+ if (e4.code === "ENOENT") {
136491
+ 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";
136492
+ const i4 = `'${l2}' does not exist
136493
+ - if '${t3._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
136494
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
136495
+ - ${e5}`;
136496
+ throw new Error(i4);
136497
+ } else if (e4.code === "EACCES") {
136498
+ throw new Error(`'${l2}' not executable`);
136499
+ }
136500
+ if (!p2) {
136501
+ a.exit(1);
136479
136502
  } else {
136480
- const e4 = new l(1, "commander.executeSubCommandAsync", "(error)");
136481
- e4.nestedError = t4;
136482
- d(e4);
136503
+ const t4 = new u(1, "commander.executeSubCommandAsync", "(error)");
136504
+ t4.nestedError = e4;
136505
+ p2(t4);
136483
136506
  }
136484
136507
  });
136485
- this.runningCommand = p2;
136508
+ this.runningCommand = c2;
136486
136509
  }
136487
- _dispatchSubcommand(e3, t3, i3) {
136488
- const n2 = this._findCommand(e3);
136510
+ _dispatchSubcommand(t3, e3, i3) {
136511
+ const n2 = this._findCommand(t3);
136489
136512
  if (!n2)
136490
136513
  this.help({ error: true });
136491
- if (n2._executableHandler) {
136492
- this._executeSubCommand(n2, t3.concat(i3));
136493
- } else {
136494
- return n2._parseCommand(t3, i3);
136495
- }
136514
+ let s2;
136515
+ s2 = this._chainOrCallSubCommandHook(s2, n2, "preSubcommand");
136516
+ s2 = this._chainOrCall(s2, () => {
136517
+ if (n2._executableHandler) {
136518
+ this._executeSubCommand(n2, e3.concat(i3));
136519
+ } else {
136520
+ return n2._parseCommand(e3, i3);
136521
+ }
136522
+ });
136523
+ return s2;
136496
136524
  }
136497
136525
  _checkNumberOfArguments() {
136498
- this._args.forEach((e3, t3) => {
136499
- if (e3.required && this.args[t3] == null) {
136500
- this.missingArgument(e3.name());
136526
+ this._args.forEach((t3, e3) => {
136527
+ if (t3.required && this.args[e3] == null) {
136528
+ this.missingArgument(t3.name());
136501
136529
  }
136502
136530
  });
136503
136531
  if (this._args.length > 0 && this._args[this._args.length - 1].variadic) {
@@ -136508,15 +136536,15 @@ Expecting one of '${i3.join("', '")}'`);
136508
136536
  }
136509
136537
  }
136510
136538
  _processArguments() {
136511
- const myParseArg = (e4, t3, i3) => {
136512
- let n2 = t3;
136513
- if (t3 !== null && e4.parseArg) {
136539
+ const myParseArg = (t4, e3, i3) => {
136540
+ let n2 = e3;
136541
+ if (e3 !== null && t4.parseArg) {
136514
136542
  try {
136515
- n2 = e4.parseArg(t3, i3);
136543
+ n2 = t4.parseArg(e3, i3);
136516
136544
  } catch (i4) {
136517
136545
  if (i4.code === "commander.invalidArgument") {
136518
- const n3 = `error: command-argument value '${t3}' is invalid for argument '${e4.name()}'. ${i4.message}`;
136519
- this._displayError(i4.exitCode, i4.code, n3);
136546
+ const n3 = `error: command-argument value '${e3}' is invalid for argument '${t4.name()}'. ${i4.message}`;
136547
+ this.error(n3, { exitCode: i4.exitCode, code: i4.code });
136520
136548
  }
136521
136549
  throw i4;
136522
136550
  }
@@ -136524,74 +136552,85 @@ Expecting one of '${i3.join("', '")}'`);
136524
136552
  return n2;
136525
136553
  };
136526
136554
  this._checkNumberOfArguments();
136527
- const e3 = [];
136528
- this._args.forEach((t3, i3) => {
136529
- let n2 = t3.defaultValue;
136530
- if (t3.variadic) {
136555
+ const t3 = [];
136556
+ this._args.forEach((e3, i3) => {
136557
+ let n2 = e3.defaultValue;
136558
+ if (e3.variadic) {
136531
136559
  if (i3 < this.args.length) {
136532
136560
  n2 = this.args.slice(i3);
136533
- if (t3.parseArg) {
136534
- n2 = n2.reduce((e4, i4) => myParseArg(t3, i4, e4), t3.defaultValue);
136561
+ if (e3.parseArg) {
136562
+ n2 = n2.reduce((t4, i4) => myParseArg(e3, i4, t4), e3.defaultValue);
136535
136563
  }
136536
136564
  } else if (n2 === void 0) {
136537
136565
  n2 = [];
136538
136566
  }
136539
136567
  } else if (i3 < this.args.length) {
136540
136568
  n2 = this.args[i3];
136541
- if (t3.parseArg) {
136542
- n2 = myParseArg(t3, n2, t3.defaultValue);
136569
+ if (e3.parseArg) {
136570
+ n2 = myParseArg(e3, n2, e3.defaultValue);
136543
136571
  }
136544
136572
  }
136545
- e3[i3] = n2;
136573
+ t3[i3] = n2;
136546
136574
  });
136547
- this.processedArgs = e3;
136575
+ this.processedArgs = t3;
136548
136576
  }
136549
- _chainOrCall(e3, t3) {
136550
- if (e3 && e3.then && typeof e3.then === "function") {
136551
- return e3.then(() => t3());
136577
+ _chainOrCall(t3, e3) {
136578
+ if (t3 && t3.then && typeof t3.then === "function") {
136579
+ return t3.then(() => e3());
136552
136580
  }
136553
- return t3();
136581
+ return e3();
136554
136582
  }
136555
- _chainOrCallHooks(e3, t3) {
136556
- let i3 = e3;
136583
+ _chainOrCallHooks(t3, e3) {
136584
+ let i3 = t3;
136557
136585
  const n2 = [];
136558
- getCommandAndParents(this).reverse().filter((e4) => e4._lifeCycleHooks[t3] !== void 0).forEach((e4) => {
136559
- e4._lifeCycleHooks[t3].forEach((t4) => {
136560
- n2.push({ hookedCommand: e4, callback: t4 });
136586
+ getCommandAndParents(this).reverse().filter((t4) => t4._lifeCycleHooks[e3] !== void 0).forEach((t4) => {
136587
+ t4._lifeCycleHooks[e3].forEach((e4) => {
136588
+ n2.push({ hookedCommand: t4, callback: e4 });
136561
136589
  });
136562
136590
  });
136563
- if (t3 === "postAction") {
136591
+ if (e3 === "postAction") {
136564
136592
  n2.reverse();
136565
136593
  }
136566
- n2.forEach((e4) => {
136567
- i3 = this._chainOrCall(i3, () => e4.callback(e4.hookedCommand, this));
136594
+ n2.forEach((t4) => {
136595
+ i3 = this._chainOrCall(i3, () => t4.callback(t4.hookedCommand, this));
136568
136596
  });
136569
136597
  return i3;
136570
136598
  }
136571
- _parseCommand(e3, t3) {
136572
- const i3 = this.parseOptions(t3);
136573
- this._parseOptionsEnv();
136574
- e3 = e3.concat(i3.operands);
136575
- t3 = i3.unknown;
136576
- this.args = e3.concat(t3);
136577
- if (e3 && this._findCommand(e3[0])) {
136578
- return this._dispatchSubcommand(e3[0], e3.slice(1), t3);
136599
+ _chainOrCallSubCommandHook(t3, e3, i3) {
136600
+ let n2 = t3;
136601
+ if (this._lifeCycleHooks[i3] !== void 0) {
136602
+ this._lifeCycleHooks[i3].forEach((t4) => {
136603
+ n2 = this._chainOrCall(n2, () => t4(this, e3));
136604
+ });
136579
136605
  }
136580
- if (this._hasImplicitHelpCommand() && e3[0] === this._helpCommandName) {
136581
- if (e3.length === 1) {
136606
+ return n2;
136607
+ }
136608
+ _parseCommand(t3, e3) {
136609
+ const i3 = this.parseOptions(e3);
136610
+ this._parseOptionsEnv();
136611
+ this._parseOptionsImplied();
136612
+ t3 = t3.concat(i3.operands);
136613
+ e3 = i3.unknown;
136614
+ this.args = t3.concat(e3);
136615
+ if (t3 && this._findCommand(t3[0])) {
136616
+ return this._dispatchSubcommand(t3[0], t3.slice(1), e3);
136617
+ }
136618
+ if (this._hasImplicitHelpCommand() && t3[0] === this._helpCommandName) {
136619
+ if (t3.length === 1) {
136582
136620
  this.help();
136583
136621
  }
136584
- return this._dispatchSubcommand(e3[1], [], [this._helpLongFlag]);
136622
+ return this._dispatchSubcommand(t3[1], [], [this._helpLongFlag]);
136585
136623
  }
136586
136624
  if (this._defaultCommandName) {
136587
- outputHelpIfRequested(this, t3);
136588
- return this._dispatchSubcommand(this._defaultCommandName, e3, t3);
136625
+ outputHelpIfRequested(this, e3);
136626
+ return this._dispatchSubcommand(this._defaultCommandName, t3, e3);
136589
136627
  }
136590
136628
  if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
136591
136629
  this.help({ error: true });
136592
136630
  }
136593
136631
  outputHelpIfRequested(this, i3.unknown);
136594
136632
  this._checkForMissingMandatoryOptions();
136633
+ this._checkForConflictingOptions();
136595
136634
  const checkForUnknownOptions = () => {
136596
136635
  if (i3.unknown.length > 0) {
136597
136636
  this.unknownOption(i3.unknown[0]);
@@ -136604,21 +136643,24 @@ Expecting one of '${i3.join("', '")}'`);
136604
136643
  let i4;
136605
136644
  i4 = this._chainOrCallHooks(i4, "preAction");
136606
136645
  i4 = this._chainOrCall(i4, () => this._actionHandler(this.processedArgs));
136607
- if (this.parent)
136608
- this.parent.emit(n2, e3, t3);
136646
+ if (this.parent) {
136647
+ i4 = this._chainOrCall(i4, () => {
136648
+ this.parent.emit(n2, t3, e3);
136649
+ });
136650
+ }
136609
136651
  i4 = this._chainOrCallHooks(i4, "postAction");
136610
136652
  return i4;
136611
136653
  }
136612
136654
  if (this.parent && this.parent.listenerCount(n2)) {
136613
136655
  checkForUnknownOptions();
136614
136656
  this._processArguments();
136615
- this.parent.emit(n2, e3, t3);
136616
- } else if (e3.length) {
136657
+ this.parent.emit(n2, t3, e3);
136658
+ } else if (t3.length) {
136617
136659
  if (this._findCommand("*")) {
136618
- return this._dispatchSubcommand("*", e3, t3);
136660
+ return this._dispatchSubcommand("*", t3, e3);
136619
136661
  }
136620
136662
  if (this.listenerCount("command:*")) {
136621
- this.emit("command:*", e3, t3);
136663
+ this.emit("command:*", t3, e3);
136622
136664
  } else if (this.commands.length) {
136623
136665
  this.unknownCommand();
136624
136666
  } else {
@@ -136633,131 +136675,155 @@ Expecting one of '${i3.join("', '")}'`);
136633
136675
  this._processArguments();
136634
136676
  }
136635
136677
  }
136636
- _findCommand(e3) {
136637
- if (!e3)
136678
+ _findCommand(t3) {
136679
+ if (!t3)
136638
136680
  return void 0;
136639
- return this.commands.find((t3) => t3._name === e3 || t3._aliases.includes(e3));
136681
+ return this.commands.find((e3) => e3._name === t3 || e3._aliases.includes(t3));
136640
136682
  }
136641
- _findOption(e3) {
136642
- return this.options.find((t3) => t3.is(e3));
136683
+ _findOption(t3) {
136684
+ return this.options.find((e3) => e3.is(t3));
136643
136685
  }
136644
136686
  _checkForMissingMandatoryOptions() {
136645
- for (let e3 = this; e3; e3 = e3.parent) {
136646
- e3.options.forEach((t3) => {
136647
- if (t3.mandatory && e3.getOptionValue(t3.attributeName()) === void 0) {
136648
- e3.missingMandatoryOptionValue(t3);
136687
+ for (let t3 = this; t3; t3 = t3.parent) {
136688
+ t3.options.forEach((e3) => {
136689
+ if (e3.mandatory && t3.getOptionValue(e3.attributeName()) === void 0) {
136690
+ t3.missingMandatoryOptionValue(e3);
136649
136691
  }
136650
136692
  });
136651
136693
  }
136652
136694
  }
136653
- parseOptions(e3) {
136654
- const t3 = [];
136695
+ _checkForConflictingLocalOptions() {
136696
+ const t3 = this.options.filter((t4) => {
136697
+ const e4 = t4.attributeName();
136698
+ if (this.getOptionValue(e4) === void 0) {
136699
+ return false;
136700
+ }
136701
+ return this.getOptionValueSource(e4) !== "default";
136702
+ });
136703
+ const e3 = t3.filter((t4) => t4.conflictsWith.length > 0);
136704
+ e3.forEach((e4) => {
136705
+ const i3 = t3.find((t4) => e4.conflictsWith.includes(t4.attributeName()));
136706
+ if (i3) {
136707
+ this._conflictingOption(e4, i3);
136708
+ }
136709
+ });
136710
+ }
136711
+ _checkForConflictingOptions() {
136712
+ for (let t3 = this; t3; t3 = t3.parent) {
136713
+ t3._checkForConflictingLocalOptions();
136714
+ }
136715
+ }
136716
+ parseOptions(t3) {
136717
+ const e3 = [];
136655
136718
  const i3 = [];
136656
- let n2 = t3;
136657
- const s2 = e3.slice();
136658
- function maybeOption(e4) {
136659
- return e4.length > 1 && e4[0] === "-";
136719
+ let n2 = e3;
136720
+ const s2 = t3.slice();
136721
+ function maybeOption(t4) {
136722
+ return t4.length > 1 && t4[0] === "-";
136660
136723
  }
136661
136724
  let r2 = null;
136662
136725
  while (s2.length) {
136663
- const e4 = s2.shift();
136664
- if (e4 === "--") {
136726
+ const t4 = s2.shift();
136727
+ if (t4 === "--") {
136665
136728
  if (n2 === i3)
136666
- n2.push(e4);
136729
+ n2.push(t4);
136667
136730
  n2.push(...s2);
136668
136731
  break;
136669
136732
  }
136670
- if (r2 && !maybeOption(e4)) {
136671
- this.emit(`option:${r2.name()}`, e4);
136733
+ if (r2 && !maybeOption(t4)) {
136734
+ this.emit(`option:${r2.name()}`, t4);
136672
136735
  continue;
136673
136736
  }
136674
136737
  r2 = null;
136675
- if (maybeOption(e4)) {
136676
- const t4 = this._findOption(e4);
136677
- if (t4) {
136678
- if (t4.required) {
136679
- const e5 = s2.shift();
136680
- if (e5 === void 0)
136681
- this.optionMissingArgument(t4);
136682
- this.emit(`option:${t4.name()}`, e5);
136683
- } else if (t4.optional) {
136684
- let e5 = null;
136738
+ if (maybeOption(t4)) {
136739
+ const e4 = this._findOption(t4);
136740
+ if (e4) {
136741
+ if (e4.required) {
136742
+ const t5 = s2.shift();
136743
+ if (t5 === void 0)
136744
+ this.optionMissingArgument(e4);
136745
+ this.emit(`option:${e4.name()}`, t5);
136746
+ } else if (e4.optional) {
136747
+ let t5 = null;
136685
136748
  if (s2.length > 0 && !maybeOption(s2[0])) {
136686
- e5 = s2.shift();
136749
+ t5 = s2.shift();
136687
136750
  }
136688
- this.emit(`option:${t4.name()}`, e5);
136751
+ this.emit(`option:${e4.name()}`, t5);
136689
136752
  } else {
136690
- this.emit(`option:${t4.name()}`);
136753
+ this.emit(`option:${e4.name()}`);
136691
136754
  }
136692
- r2 = t4.variadic ? t4 : null;
136755
+ r2 = e4.variadic ? e4 : null;
136693
136756
  continue;
136694
136757
  }
136695
136758
  }
136696
- if (e4.length > 2 && e4[0] === "-" && e4[1] !== "-") {
136697
- const t4 = this._findOption(`-${e4[1]}`);
136698
- if (t4) {
136699
- if (t4.required || t4.optional && this._combineFlagAndOptionalValue) {
136700
- this.emit(`option:${t4.name()}`, e4.slice(2));
136759
+ if (t4.length > 2 && t4[0] === "-" && t4[1] !== "-") {
136760
+ const e4 = this._findOption(`-${t4[1]}`);
136761
+ if (e4) {
136762
+ if (e4.required || e4.optional && this._combineFlagAndOptionalValue) {
136763
+ this.emit(`option:${e4.name()}`, t4.slice(2));
136701
136764
  } else {
136702
- this.emit(`option:${t4.name()}`);
136703
- s2.unshift(`-${e4.slice(2)}`);
136765
+ this.emit(`option:${e4.name()}`);
136766
+ s2.unshift(`-${t4.slice(2)}`);
136704
136767
  }
136705
136768
  continue;
136706
136769
  }
136707
136770
  }
136708
- if (/^--[^=]+=/.test(e4)) {
136709
- const t4 = e4.indexOf("=");
136710
- const i4 = this._findOption(e4.slice(0, t4));
136771
+ if (/^--[^=]+=/.test(t4)) {
136772
+ const e4 = t4.indexOf("=");
136773
+ const i4 = this._findOption(t4.slice(0, e4));
136711
136774
  if (i4 && (i4.required || i4.optional)) {
136712
- this.emit(`option:${i4.name()}`, e4.slice(t4 + 1));
136775
+ this.emit(`option:${i4.name()}`, t4.slice(e4 + 1));
136713
136776
  continue;
136714
136777
  }
136715
136778
  }
136716
- if (maybeOption(e4)) {
136779
+ if (maybeOption(t4)) {
136717
136780
  n2 = i3;
136718
136781
  }
136719
- if ((this._enablePositionalOptions || this._passThroughOptions) && t3.length === 0 && i3.length === 0) {
136720
- if (this._findCommand(e4)) {
136721
- t3.push(e4);
136782
+ if ((this._enablePositionalOptions || this._passThroughOptions) && e3.length === 0 && i3.length === 0) {
136783
+ if (this._findCommand(t4)) {
136784
+ e3.push(t4);
136722
136785
  if (s2.length > 0)
136723
136786
  i3.push(...s2);
136724
136787
  break;
136725
- } else if (e4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
136726
- t3.push(e4);
136788
+ } else if (t4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
136789
+ e3.push(t4);
136727
136790
  if (s2.length > 0)
136728
- t3.push(...s2);
136791
+ e3.push(...s2);
136729
136792
  break;
136730
136793
  } else if (this._defaultCommandName) {
136731
- i3.push(e4);
136794
+ i3.push(t4);
136732
136795
  if (s2.length > 0)
136733
136796
  i3.push(...s2);
136734
136797
  break;
136735
136798
  }
136736
136799
  }
136737
136800
  if (this._passThroughOptions) {
136738
- n2.push(e4);
136801
+ n2.push(t4);
136739
136802
  if (s2.length > 0)
136740
136803
  n2.push(...s2);
136741
136804
  break;
136742
136805
  }
136743
- n2.push(e4);
136806
+ n2.push(t4);
136744
136807
  }
136745
- return { operands: t3, unknown: i3 };
136808
+ return { operands: e3, unknown: i3 };
136746
136809
  }
136747
136810
  opts() {
136748
136811
  if (this._storeOptionsAsProperties) {
136749
- const e3 = {};
136750
- const t3 = this.options.length;
136751
- for (let i3 = 0; i3 < t3; i3++) {
136752
- const t4 = this.options[i3].attributeName();
136753
- e3[t4] = t4 === this._versionOptionName ? this._version : this[t4];
136812
+ const t3 = {};
136813
+ const e3 = this.options.length;
136814
+ for (let i3 = 0; i3 < e3; i3++) {
136815
+ const e4 = this.options[i3].attributeName();
136816
+ t3[e4] = e4 === this._versionOptionName ? this._version : this[e4];
136754
136817
  }
136755
- return e3;
136818
+ return t3;
136756
136819
  }
136757
136820
  return this._optionValues;
136758
136821
  }
136759
- _displayError(e3, t3, i3) {
136760
- this._outputConfiguration.outputError(`${i3}
136822
+ optsWithGlobals() {
136823
+ return getCommandAndParents(this).reduce((t3, e3) => Object.assign(t3, e3.opts()), {});
136824
+ }
136825
+ error(t3, e3) {
136826
+ this._outputConfiguration.outputError(`${t3}
136761
136827
  `, this._outputConfiguration.writeErr);
136762
136828
  if (typeof this._showHelpAfterError === "string") {
136763
136829
  this._outputConfiguration.writeErr(`${this._showHelpAfterError}
@@ -136766,166 +136832,217 @@ Expecting one of '${i3.join("', '")}'`);
136766
136832
  this._outputConfiguration.writeErr("\n");
136767
136833
  this.outputHelp({ error: true });
136768
136834
  }
136769
- this._exit(e3, t3, i3);
136835
+ const i3 = e3 || {};
136836
+ const n2 = i3.exitCode || 1;
136837
+ const s2 = i3.code || "commander.error";
136838
+ this._exit(n2, s2, t3);
136770
136839
  }
136771
136840
  _parseOptionsEnv() {
136772
- this.options.forEach((e3) => {
136773
- if (e3.envVar && e3.envVar in process.env) {
136774
- const t3 = e3.attributeName();
136775
- if (this.getOptionValue(t3) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(t3))) {
136776
- if (e3.required || e3.optional) {
136777
- this.emit(`optionEnv:${e3.name()}`, process.env[e3.envVar]);
136841
+ this.options.forEach((t3) => {
136842
+ if (t3.envVar && t3.envVar in a.env) {
136843
+ const e3 = t3.attributeName();
136844
+ if (this.getOptionValue(e3) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(e3))) {
136845
+ if (t3.required || t3.optional) {
136846
+ this.emit(`optionEnv:${t3.name()}`, a.env[t3.envVar]);
136778
136847
  } else {
136779
- this.emit(`optionEnv:${e3.name()}`);
136848
+ this.emit(`optionEnv:${t3.name()}`);
136780
136849
  }
136781
136850
  }
136782
136851
  }
136783
136852
  });
136784
136853
  }
136785
- missingArgument(e3) {
136786
- const t3 = `error: missing required argument '${e3}'`;
136787
- this._displayError(1, "commander.missingArgument", t3);
136788
- }
136789
- optionMissingArgument(e3) {
136790
- const t3 = `error: option '${e3.flags}' argument missing`;
136791
- this._displayError(1, "commander.optionMissingArgument", t3);
136854
+ _parseOptionsImplied() {
136855
+ const t3 = new d(this.options);
136856
+ const hasCustomOptionValue = (t4) => this.getOptionValue(t4) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(t4));
136857
+ this.options.filter((e3) => e3.implied !== void 0 && hasCustomOptionValue(e3.attributeName()) && t3.valueFromOption(this.getOptionValue(e3.attributeName()), e3)).forEach((t4) => {
136858
+ Object.keys(t4.implied).filter((t5) => !hasCustomOptionValue(t5)).forEach((e3) => {
136859
+ this.setOptionValueWithSource(e3, t4.implied[e3], "implied");
136860
+ });
136861
+ });
136792
136862
  }
136793
- missingMandatoryOptionValue(e3) {
136794
- const t3 = `error: required option '${e3.flags}' not specified`;
136795
- this._displayError(1, "commander.missingMandatoryOptionValue", t3);
136863
+ missingArgument(t3) {
136864
+ const e3 = `error: missing required argument '${t3}'`;
136865
+ this.error(e3, { code: "commander.missingArgument" });
136866
+ }
136867
+ optionMissingArgument(t3) {
136868
+ const e3 = `error: option '${t3.flags}' argument missing`;
136869
+ this.error(e3, { code: "commander.optionMissingArgument" });
136870
+ }
136871
+ missingMandatoryOptionValue(t3) {
136872
+ const e3 = `error: required option '${t3.flags}' not specified`;
136873
+ this.error(e3, { code: "commander.missingMandatoryOptionValue" });
136874
+ }
136875
+ _conflictingOption(t3, e3) {
136876
+ const findBestOptionFromValue = (t4) => {
136877
+ const e4 = t4.attributeName();
136878
+ const i4 = this.getOptionValue(e4);
136879
+ const n2 = this.options.find((t5) => t5.negate && e4 === t5.attributeName());
136880
+ const s2 = this.options.find((t5) => !t5.negate && e4 === t5.attributeName());
136881
+ if (n2 && (n2.presetArg === void 0 && i4 === false || n2.presetArg !== void 0 && i4 === n2.presetArg)) {
136882
+ return n2;
136883
+ }
136884
+ return s2 || t4;
136885
+ };
136886
+ const getErrorMessage = (t4) => {
136887
+ const e4 = findBestOptionFromValue(t4);
136888
+ const i4 = e4.attributeName();
136889
+ const n2 = this.getOptionValueSource(i4);
136890
+ if (n2 === "env") {
136891
+ return `environment variable '${e4.envVar}'`;
136892
+ }
136893
+ return `option '${e4.flags}'`;
136894
+ };
136895
+ const i3 = `error: ${getErrorMessage(t3)} cannot be used with ${getErrorMessage(e3)}`;
136896
+ this.error(i3, { code: "commander.conflictingOption" });
136796
136897
  }
136797
- unknownOption(e3) {
136898
+ unknownOption(t3) {
136798
136899
  if (this._allowUnknownOption)
136799
136900
  return;
136800
- let t3 = "";
136801
- if (e3.startsWith("--") && this._showSuggestionAfterError) {
136901
+ let e3 = "";
136902
+ if (t3.startsWith("--") && this._showSuggestionAfterError) {
136802
136903
  let i4 = [];
136803
136904
  let n2 = this;
136804
136905
  do {
136805
- const e4 = n2.createHelp().visibleOptions(n2).filter((e5) => e5.long).map((e5) => e5.long);
136806
- i4 = i4.concat(e4);
136906
+ const t4 = n2.createHelp().visibleOptions(n2).filter((t5) => t5.long).map((t5) => t5.long);
136907
+ i4 = i4.concat(t4);
136807
136908
  n2 = n2.parent;
136808
136909
  } while (n2 && !n2._enablePositionalOptions);
136809
- t3 = m(e3, i4);
136910
+ e3 = f(t3, i4);
136810
136911
  }
136811
- const i3 = `error: unknown option '${e3}'${t3}`;
136812
- this._displayError(1, "commander.unknownOption", i3);
136912
+ const i3 = `error: unknown option '${t3}'${e3}`;
136913
+ this.error(i3, { code: "commander.unknownOption" });
136813
136914
  }
136814
- _excessArguments(e3) {
136915
+ _excessArguments(t3) {
136815
136916
  if (this._allowExcessArguments)
136816
136917
  return;
136817
- const t3 = this._args.length;
136818
- const i3 = t3 === 1 ? "" : "s";
136918
+ const e3 = this._args.length;
136919
+ const i3 = e3 === 1 ? "" : "s";
136819
136920
  const n2 = this.parent ? ` for '${this.name()}'` : "";
136820
- const s2 = `error: too many arguments${n2}. Expected ${t3} argument${i3} but got ${e3.length}.`;
136821
- this._displayError(1, "commander.excessArguments", s2);
136921
+ const s2 = `error: too many arguments${n2}. Expected ${e3} argument${i3} but got ${t3.length}.`;
136922
+ this.error(s2, { code: "commander.excessArguments" });
136822
136923
  }
136823
136924
  unknownCommand() {
136824
- const e3 = this.args[0];
136825
- let t3 = "";
136925
+ const t3 = this.args[0];
136926
+ let e3 = "";
136826
136927
  if (this._showSuggestionAfterError) {
136827
136928
  const i4 = [];
136828
- this.createHelp().visibleCommands(this).forEach((e4) => {
136829
- i4.push(e4.name());
136830
- if (e4.alias())
136831
- i4.push(e4.alias());
136929
+ this.createHelp().visibleCommands(this).forEach((t4) => {
136930
+ i4.push(t4.name());
136931
+ if (t4.alias())
136932
+ i4.push(t4.alias());
136832
136933
  });
136833
- t3 = m(e3, i4);
136934
+ e3 = f(t3, i4);
136834
136935
  }
136835
- const i3 = `error: unknown command '${e3}'${t3}`;
136836
- this._displayError(1, "commander.unknownCommand", i3);
136936
+ const i3 = `error: unknown command '${t3}'${e3}`;
136937
+ this.error(i3, { code: "commander.unknownCommand" });
136837
136938
  }
136838
- version(e3, t3, i3) {
136839
- if (e3 === void 0)
136939
+ version(t3, e3, i3) {
136940
+ if (t3 === void 0)
136840
136941
  return this._version;
136841
- this._version = e3;
136842
- t3 = t3 || "-V, --version";
136942
+ this._version = t3;
136943
+ e3 = e3 || "-V, --version";
136843
136944
  i3 = i3 || "output the version number";
136844
- const n2 = this.createOption(t3, i3);
136945
+ const n2 = this.createOption(e3, i3);
136845
136946
  this._versionOptionName = n2.attributeName();
136846
136947
  this.options.push(n2);
136847
136948
  this.on("option:" + n2.name(), () => {
136848
- this._outputConfiguration.writeOut(`${e3}
136949
+ this._outputConfiguration.writeOut(`${t3}
136849
136950
  `);
136850
- this._exit(0, "commander.version", e3);
136951
+ this._exit(0, "commander.version", t3);
136851
136952
  });
136852
136953
  return this;
136853
136954
  }
136854
- description(e3, t3) {
136855
- if (e3 === void 0 && t3 === void 0)
136955
+ description(t3, e3) {
136956
+ if (t3 === void 0 && e3 === void 0)
136856
136957
  return this._description;
136857
- this._description = e3;
136858
- if (t3) {
136859
- this._argsDescription = t3;
136958
+ this._description = t3;
136959
+ if (e3) {
136960
+ this._argsDescription = e3;
136860
136961
  }
136861
136962
  return this;
136862
136963
  }
136863
- alias(e3) {
136864
- if (e3 === void 0)
136964
+ summary(t3) {
136965
+ if (t3 === void 0)
136966
+ return this._summary;
136967
+ this._summary = t3;
136968
+ return this;
136969
+ }
136970
+ alias(t3) {
136971
+ if (t3 === void 0)
136865
136972
  return this._aliases[0];
136866
- let t3 = this;
136973
+ let e3 = this;
136867
136974
  if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
136868
- t3 = this.commands[this.commands.length - 1];
136975
+ e3 = this.commands[this.commands.length - 1];
136869
136976
  }
136870
- if (e3 === t3._name)
136977
+ if (t3 === e3._name)
136871
136978
  throw new Error("Command alias can't be the same as its name");
136872
- t3._aliases.push(e3);
136979
+ e3._aliases.push(t3);
136873
136980
  return this;
136874
136981
  }
136875
- aliases(e3) {
136876
- if (e3 === void 0)
136982
+ aliases(t3) {
136983
+ if (t3 === void 0)
136877
136984
  return this._aliases;
136878
- e3.forEach((e4) => this.alias(e4));
136985
+ t3.forEach((t4) => this.alias(t4));
136879
136986
  return this;
136880
136987
  }
136881
- usage(e3) {
136882
- if (e3 === void 0) {
136988
+ usage(t3) {
136989
+ if (t3 === void 0) {
136883
136990
  if (this._usage)
136884
136991
  return this._usage;
136885
- const e4 = this._args.map((e5) => h(e5));
136886
- return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? e4 : []).join(" ");
136992
+ const t4 = this._args.map((t5) => h(t5));
136993
+ return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? t4 : []).join(" ");
136887
136994
  }
136888
- this._usage = e3;
136995
+ this._usage = t3;
136889
136996
  return this;
136890
136997
  }
136891
- name(e3) {
136892
- if (e3 === void 0)
136998
+ name(t3) {
136999
+ if (t3 === void 0)
136893
137000
  return this._name;
136894
- this._name = e3;
137001
+ this._name = t3;
136895
137002
  return this;
136896
137003
  }
136897
- helpInformation(e3) {
136898
- const t3 = this.createHelp();
136899
- if (t3.helpWidth === void 0) {
136900
- t3.helpWidth = e3 && e3.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
137004
+ nameFromFilename(t3) {
137005
+ this._name = r.basename(t3, r.extname(t3));
137006
+ return this;
137007
+ }
137008
+ executableDir(t3) {
137009
+ if (t3 === void 0)
137010
+ return this._executableDir;
137011
+ this._executableDir = t3;
137012
+ return this;
137013
+ }
137014
+ helpInformation(t3) {
137015
+ const e3 = this.createHelp();
137016
+ if (e3.helpWidth === void 0) {
137017
+ e3.helpWidth = t3 && t3.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
136901
137018
  }
136902
- return t3.formatHelp(this, t3);
137019
+ return e3.formatHelp(this, e3);
136903
137020
  }
136904
- _getHelpContext(e3) {
136905
- e3 = e3 || {};
136906
- const t3 = { error: !!e3.error };
137021
+ _getHelpContext(t3) {
137022
+ t3 = t3 || {};
137023
+ const e3 = { error: !!t3.error };
136907
137024
  let i3;
136908
- if (t3.error) {
136909
- i3 = (e4) => this._outputConfiguration.writeErr(e4);
137025
+ if (e3.error) {
137026
+ i3 = (t4) => this._outputConfiguration.writeErr(t4);
136910
137027
  } else {
136911
- i3 = (e4) => this._outputConfiguration.writeOut(e4);
137028
+ i3 = (t4) => this._outputConfiguration.writeOut(t4);
136912
137029
  }
136913
- t3.write = e3.write || i3;
136914
- t3.command = this;
136915
- return t3;
137030
+ e3.write = t3.write || i3;
137031
+ e3.command = this;
137032
+ return e3;
136916
137033
  }
136917
- outputHelp(e3) {
136918
- let t3;
136919
- if (typeof e3 === "function") {
136920
- t3 = e3;
136921
- e3 = void 0;
137034
+ outputHelp(t3) {
137035
+ let e3;
137036
+ if (typeof t3 === "function") {
137037
+ e3 = t3;
137038
+ t3 = void 0;
136922
137039
  }
136923
- const i3 = this._getHelpContext(e3);
136924
- getCommandAndParents(this).reverse().forEach((e4) => e4.emit("beforeAllHelp", i3));
137040
+ const i3 = this._getHelpContext(t3);
137041
+ getCommandAndParents(this).reverse().forEach((t4) => t4.emit("beforeAllHelp", i3));
136925
137042
  this.emit("beforeHelp", i3);
136926
137043
  let n2 = this.helpInformation(i3);
136927
- if (t3) {
136928
- n2 = t3(n2);
137044
+ if (e3) {
137045
+ n2 = e3(n2);
136929
137046
  if (typeof n2 !== "string" && !Buffer.isBuffer(n2)) {
136930
137047
  throw new Error("outputHelp callback must return a string or a Buffer");
136931
137048
  }
@@ -136933,306 +137050,342 @@ Expecting one of '${i3.join("', '")}'`);
136933
137050
  i3.write(n2);
136934
137051
  this.emit(this._helpLongFlag);
136935
137052
  this.emit("afterHelp", i3);
136936
- getCommandAndParents(this).forEach((e4) => e4.emit("afterAllHelp", i3));
137053
+ getCommandAndParents(this).forEach((t4) => t4.emit("afterAllHelp", i3));
136937
137054
  }
136938
- helpOption(e3, t3) {
136939
- if (typeof e3 === "boolean") {
136940
- this._hasHelpOption = e3;
137055
+ helpOption(t3, e3) {
137056
+ if (typeof t3 === "boolean") {
137057
+ this._hasHelpOption = t3;
136941
137058
  return this;
136942
137059
  }
136943
- this._helpFlags = e3 || this._helpFlags;
136944
- this._helpDescription = t3 || this._helpDescription;
136945
- const i3 = p(this._helpFlags);
137060
+ this._helpFlags = t3 || this._helpFlags;
137061
+ this._helpDescription = e3 || this._helpDescription;
137062
+ const i3 = m(this._helpFlags);
136946
137063
  this._helpShortFlag = i3.shortFlag;
136947
137064
  this._helpLongFlag = i3.longFlag;
136948
137065
  return this;
136949
137066
  }
136950
- help(e3) {
136951
- this.outputHelp(e3);
136952
- let t3 = process.exitCode || 0;
136953
- if (t3 === 0 && e3 && typeof e3 !== "function" && e3.error) {
136954
- t3 = 1;
137067
+ help(t3) {
137068
+ this.outputHelp(t3);
137069
+ let e3 = a.exitCode || 0;
137070
+ if (e3 === 0 && t3 && typeof t3 !== "function" && t3.error) {
137071
+ e3 = 1;
136955
137072
  }
136956
- this._exit(t3, "commander.help", "(outputHelp)");
137073
+ this._exit(e3, "commander.help", "(outputHelp)");
136957
137074
  }
136958
- addHelpText(e3, t3) {
137075
+ addHelpText(t3, e3) {
136959
137076
  const i3 = ["beforeAll", "before", "after", "afterAll"];
136960
- if (!i3.includes(e3)) {
137077
+ if (!i3.includes(t3)) {
136961
137078
  throw new Error(`Unexpected value for position to addHelpText.
136962
137079
  Expecting one of '${i3.join("', '")}'`);
136963
137080
  }
136964
- const n2 = `${e3}Help`;
136965
- this.on(n2, (e4) => {
137081
+ const n2 = `${t3}Help`;
137082
+ this.on(n2, (t4) => {
136966
137083
  let i4;
136967
- if (typeof t3 === "function") {
136968
- i4 = t3({ error: e4.error, command: e4.command });
137084
+ if (typeof e3 === "function") {
137085
+ i4 = e3({ error: t4.error, command: t4.command });
136969
137086
  } else {
136970
- i4 = t3;
137087
+ i4 = e3;
136971
137088
  }
136972
137089
  if (i4) {
136973
- e4.write(`${i4}
137090
+ t4.write(`${i4}
136974
137091
  `);
136975
137092
  }
136976
137093
  });
136977
137094
  return this;
136978
137095
  }
136979
137096
  }
136980
- function outputHelpIfRequested(e3, t3) {
136981
- const i3 = e3._hasHelpOption && t3.find((t4) => t4 === e3._helpLongFlag || t4 === e3._helpShortFlag);
137097
+ function outputHelpIfRequested(t3, e3) {
137098
+ const i3 = t3._hasHelpOption && e3.find((e4) => e4 === t3._helpLongFlag || e4 === t3._helpShortFlag);
136982
137099
  if (i3) {
136983
- e3.outputHelp();
136984
- e3._exit(0, "commander.helpDisplayed", "(outputHelp)");
137100
+ t3.outputHelp();
137101
+ t3._exit(0, "commander.helpDisplayed", "(outputHelp)");
136985
137102
  }
136986
137103
  }
136987
- function incrementNodeInspectorPort(e3) {
136988
- return e3.map((e4) => {
136989
- if (!e4.startsWith("--inspect")) {
136990
- return e4;
137104
+ function incrementNodeInspectorPort(t3) {
137105
+ return t3.map((t4) => {
137106
+ if (!t4.startsWith("--inspect")) {
137107
+ return t4;
136991
137108
  }
136992
- let t3;
137109
+ let e3;
136993
137110
  let i3 = "127.0.0.1";
136994
137111
  let n2 = "9229";
136995
137112
  let s2;
136996
- if ((s2 = e4.match(/^(--inspect(-brk)?)$/)) !== null) {
136997
- t3 = s2[1];
136998
- } else if ((s2 = e4.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
136999
- t3 = s2[1];
137113
+ if ((s2 = t4.match(/^(--inspect(-brk)?)$/)) !== null) {
137114
+ e3 = s2[1];
137115
+ } else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
137116
+ e3 = s2[1];
137000
137117
  if (/^\d+$/.test(s2[3])) {
137001
137118
  n2 = s2[3];
137002
137119
  } else {
137003
137120
  i3 = s2[3];
137004
137121
  }
137005
- } else if ((s2 = e4.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
137006
- t3 = s2[1];
137122
+ } else if ((s2 = t4.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
137123
+ e3 = s2[1];
137007
137124
  i3 = s2[3];
137008
137125
  n2 = s2[4];
137009
137126
  }
137010
- if (t3 && n2 !== "0") {
137011
- return `${t3}=${i3}:${parseInt(n2) + 1}`;
137127
+ if (e3 && n2 !== "0") {
137128
+ return `${e3}=${i3}:${parseInt(n2) + 1}`;
137012
137129
  }
137013
- return e4;
137130
+ return t4;
137014
137131
  });
137015
137132
  }
137016
- function getCommandAndParents(e3) {
137017
- const t3 = [];
137018
- for (let i3 = e3; i3; i3 = i3.parent) {
137019
- t3.push(i3);
137133
+ function getCommandAndParents(t3) {
137134
+ const e3 = [];
137135
+ for (let i3 = t3; i3; i3 = i3.parent) {
137136
+ e3.push(i3);
137020
137137
  }
137021
- return t3;
137138
+ return e3;
137022
137139
  }
137023
- t2.Command = Command2;
137024
- }, 967: (e2, t2) => {
137140
+ e2.Command = Command2;
137141
+ }, 796: (t2, e2) => {
137025
137142
  class CommanderError extends Error {
137026
- constructor(e3, t3, i2) {
137143
+ constructor(t3, e3, i2) {
137027
137144
  super(i2);
137028
137145
  Error.captureStackTrace(this, this.constructor);
137029
137146
  this.name = this.constructor.name;
137030
- this.code = t3;
137031
- this.exitCode = e3;
137147
+ this.code = e3;
137148
+ this.exitCode = t3;
137032
137149
  this.nestedError = void 0;
137033
137150
  }
137034
137151
  }
137035
137152
  class InvalidArgumentError extends CommanderError {
137036
- constructor(e3) {
137037
- super(1, "commander.invalidArgument", e3);
137153
+ constructor(t3) {
137154
+ super(1, "commander.invalidArgument", t3);
137038
137155
  Error.captureStackTrace(this, this.constructor);
137039
137156
  this.name = this.constructor.name;
137040
137157
  }
137041
137158
  }
137042
- t2.CommanderError = CommanderError;
137043
- t2.InvalidArgumentError = InvalidArgumentError;
137044
- }, 34: (e2, t2, i2) => {
137045
- const { humanReadableArgName: n } = i2(969);
137159
+ e2.CommanderError = CommanderError;
137160
+ e2.InvalidArgumentError = InvalidArgumentError;
137161
+ }, 519: (t2, e2, i2) => {
137162
+ const { humanReadableArgName: n } = i2(535);
137046
137163
  class Help {
137047
137164
  constructor() {
137048
137165
  this.helpWidth = void 0;
137049
137166
  this.sortSubcommands = false;
137050
137167
  this.sortOptions = false;
137051
- }
137052
- visibleCommands(e3) {
137053
- const t3 = e3.commands.filter((e4) => !e4._hidden);
137054
- if (e3._hasImplicitHelpCommand()) {
137055
- const [, i3, n2] = e3._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
137056
- const s = e3.createCommand(i3).helpOption(false);
137057
- s.description(e3._helpCommandDescription);
137168
+ this.showGlobalOptions = false;
137169
+ }
137170
+ visibleCommands(t3) {
137171
+ const e3 = t3.commands.filter((t4) => !t4._hidden);
137172
+ if (t3._hasImplicitHelpCommand()) {
137173
+ const [, i3, n2] = t3._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
137174
+ const s = t3.createCommand(i3).helpOption(false);
137175
+ s.description(t3._helpCommandDescription);
137058
137176
  if (n2)
137059
137177
  s.arguments(n2);
137060
- t3.push(s);
137178
+ e3.push(s);
137061
137179
  }
137062
137180
  if (this.sortSubcommands) {
137063
- t3.sort((e4, t4) => e4.name().localeCompare(t4.name()));
137181
+ e3.sort((t4, e4) => t4.name().localeCompare(e4.name()));
137064
137182
  }
137065
- return t3;
137183
+ return e3;
137066
137184
  }
137067
- visibleOptions(e3) {
137068
- const t3 = e3.options.filter((e4) => !e4.hidden);
137069
- const i3 = e3._hasHelpOption && e3._helpShortFlag && !e3._findOption(e3._helpShortFlag);
137070
- const n2 = e3._hasHelpOption && !e3._findOption(e3._helpLongFlag);
137185
+ compareOptions(t3, e3) {
137186
+ const getSortKey = (t4) => t4.short ? t4.short.replace(/^-/, "") : t4.long.replace(/^--/, "");
137187
+ return getSortKey(t3).localeCompare(getSortKey(e3));
137188
+ }
137189
+ visibleOptions(t3) {
137190
+ const e3 = t3.options.filter((t4) => !t4.hidden);
137191
+ const i3 = t3._hasHelpOption && t3._helpShortFlag && !t3._findOption(t3._helpShortFlag);
137192
+ const n2 = t3._hasHelpOption && !t3._findOption(t3._helpLongFlag);
137071
137193
  if (i3 || n2) {
137072
137194
  let s;
137073
137195
  if (!i3) {
137074
- s = e3.createOption(e3._helpLongFlag, e3._helpDescription);
137196
+ s = t3.createOption(t3._helpLongFlag, t3._helpDescription);
137075
137197
  } else if (!n2) {
137076
- s = e3.createOption(e3._helpShortFlag, e3._helpDescription);
137198
+ s = t3.createOption(t3._helpShortFlag, t3._helpDescription);
137077
137199
  } else {
137078
- s = e3.createOption(e3._helpFlags, e3._helpDescription);
137200
+ s = t3.createOption(t3._helpFlags, t3._helpDescription);
137079
137201
  }
137080
- t3.push(s);
137202
+ e3.push(s);
137081
137203
  }
137082
137204
  if (this.sortOptions) {
137083
- const getSortKey = (e4) => e4.short ? e4.short.replace(/^-/, "") : e4.long.replace(/^--/, "");
137084
- t3.sort((e4, t4) => getSortKey(e4).localeCompare(getSortKey(t4)));
137205
+ e3.sort(this.compareOptions);
137085
137206
  }
137086
- return t3;
137207
+ return e3;
137087
137208
  }
137088
- visibleArguments(e3) {
137089
- if (e3._argsDescription) {
137090
- e3._args.forEach((t3) => {
137091
- t3.description = t3.description || e3._argsDescription[t3.name()] || "";
137209
+ visibleGlobalOptions(t3) {
137210
+ if (!this.showGlobalOptions)
137211
+ return [];
137212
+ const e3 = [];
137213
+ for (let i3 = t3.parent; i3; i3 = i3.parent) {
137214
+ const t4 = i3.options.filter((t5) => !t5.hidden);
137215
+ e3.push(...t4);
137216
+ }
137217
+ if (this.sortOptions) {
137218
+ e3.sort(this.compareOptions);
137219
+ }
137220
+ return e3;
137221
+ }
137222
+ visibleArguments(t3) {
137223
+ if (t3._argsDescription) {
137224
+ t3._args.forEach((e3) => {
137225
+ e3.description = e3.description || t3._argsDescription[e3.name()] || "";
137092
137226
  });
137093
137227
  }
137094
- if (e3._args.find((e4) => e4.description)) {
137095
- return e3._args;
137228
+ if (t3._args.find((t4) => t4.description)) {
137229
+ return t3._args;
137096
137230
  }
137097
137231
  return [];
137098
137232
  }
137099
- subcommandTerm(e3) {
137100
- const t3 = e3._args.map((e4) => n(e4)).join(" ");
137101
- return e3._name + (e3._aliases[0] ? "|" + e3._aliases[0] : "") + (e3.options.length ? " [options]" : "") + (t3 ? " " + t3 : "");
137233
+ subcommandTerm(t3) {
137234
+ const e3 = t3._args.map((t4) => n(t4)).join(" ");
137235
+ return t3._name + (t3._aliases[0] ? "|" + t3._aliases[0] : "") + (t3.options.length ? " [options]" : "") + (e3 ? " " + e3 : "");
137102
137236
  }
137103
- optionTerm(e3) {
137104
- return e3.flags;
137237
+ optionTerm(t3) {
137238
+ return t3.flags;
137105
137239
  }
137106
- argumentTerm(e3) {
137107
- return e3.name();
137240
+ argumentTerm(t3) {
137241
+ return t3.name();
137108
137242
  }
137109
- longestSubcommandTermLength(e3, t3) {
137110
- return t3.visibleCommands(e3).reduce((e4, i3) => Math.max(e4, t3.subcommandTerm(i3).length), 0);
137243
+ longestSubcommandTermLength(t3, e3) {
137244
+ return e3.visibleCommands(t3).reduce((t4, i3) => Math.max(t4, e3.subcommandTerm(i3).length), 0);
137111
137245
  }
137112
- longestOptionTermLength(e3, t3) {
137113
- return t3.visibleOptions(e3).reduce((e4, i3) => Math.max(e4, t3.optionTerm(i3).length), 0);
137246
+ longestOptionTermLength(t3, e3) {
137247
+ return e3.visibleOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
137114
137248
  }
137115
- longestArgumentTermLength(e3, t3) {
137116
- return t3.visibleArguments(e3).reduce((e4, i3) => Math.max(e4, t3.argumentTerm(i3).length), 0);
137249
+ longestGlobalOptionTermLength(t3, e3) {
137250
+ return e3.visibleGlobalOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
137117
137251
  }
137118
- commandUsage(e3) {
137119
- let t3 = e3._name;
137120
- if (e3._aliases[0]) {
137121
- t3 = t3 + "|" + e3._aliases[0];
137252
+ longestArgumentTermLength(t3, e3) {
137253
+ return e3.visibleArguments(t3).reduce((t4, i3) => Math.max(t4, e3.argumentTerm(i3).length), 0);
137254
+ }
137255
+ commandUsage(t3) {
137256
+ let e3 = t3._name;
137257
+ if (t3._aliases[0]) {
137258
+ e3 = e3 + "|" + t3._aliases[0];
137122
137259
  }
137123
137260
  let i3 = "";
137124
- for (let t4 = e3.parent; t4; t4 = t4.parent) {
137125
- i3 = t4.name() + " " + i3;
137261
+ for (let e4 = t3.parent; e4; e4 = e4.parent) {
137262
+ i3 = e4.name() + " " + i3;
137126
137263
  }
137127
- return i3 + t3 + " " + e3.usage();
137264
+ return i3 + e3 + " " + t3.usage();
137128
137265
  }
137129
- commandDescription(e3) {
137130
- return e3.description();
137266
+ commandDescription(t3) {
137267
+ return t3.description();
137131
137268
  }
137132
- subcommandDescription(e3) {
137133
- return e3.description();
137269
+ subcommandDescription(t3) {
137270
+ return t3.summary() || t3.description();
137134
137271
  }
137135
- optionDescription(e3) {
137136
- const t3 = [];
137137
- if (e3.argChoices && !e3.negate) {
137138
- t3.push(`choices: ${e3.argChoices.map((e4) => JSON.stringify(e4)).join(", ")}`);
137272
+ optionDescription(t3) {
137273
+ const e3 = [];
137274
+ if (t3.argChoices) {
137275
+ e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
137139
137276
  }
137140
- if (e3.defaultValue !== void 0 && !e3.negate) {
137141
- t3.push(`default: ${e3.defaultValueDescription || JSON.stringify(e3.defaultValue)}`);
137277
+ if (t3.defaultValue !== void 0) {
137278
+ const i3 = t3.required || t3.optional || t3.isBoolean() && typeof t3.defaultValue === "boolean";
137279
+ if (i3) {
137280
+ e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
137281
+ }
137142
137282
  }
137143
- if (e3.envVar !== void 0) {
137144
- t3.push(`env: ${e3.envVar}`);
137283
+ if (t3.presetArg !== void 0 && t3.optional) {
137284
+ e3.push(`preset: ${JSON.stringify(t3.presetArg)}`);
137145
137285
  }
137146
- if (t3.length > 0) {
137147
- return `${e3.description} (${t3.join(", ")})`;
137286
+ if (t3.envVar !== void 0) {
137287
+ e3.push(`env: ${t3.envVar}`);
137148
137288
  }
137149
- return e3.description;
137150
- }
137151
- argumentDescription(e3) {
137152
- const t3 = [];
137153
- if (e3.argChoices) {
137154
- t3.push(`choices: ${e3.argChoices.map((e4) => JSON.stringify(e4)).join(", ")}`);
137289
+ if (e3.length > 0) {
137290
+ return `${t3.description} (${e3.join(", ")})`;
137155
137291
  }
137156
- if (e3.defaultValue !== void 0) {
137157
- t3.push(`default: ${e3.defaultValueDescription || JSON.stringify(e3.defaultValue)}`);
137158
- }
137159
- if (t3.length > 0) {
137160
- const i3 = `(${t3.join(", ")})`;
137161
- if (e3.description) {
137162
- return `${e3.description} ${i3}`;
137292
+ return t3.description;
137293
+ }
137294
+ argumentDescription(t3) {
137295
+ const e3 = [];
137296
+ if (t3.argChoices) {
137297
+ e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
137298
+ }
137299
+ if (t3.defaultValue !== void 0) {
137300
+ e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
137301
+ }
137302
+ if (e3.length > 0) {
137303
+ const i3 = `(${e3.join(", ")})`;
137304
+ if (t3.description) {
137305
+ return `${t3.description} ${i3}`;
137163
137306
  }
137164
137307
  return i3;
137165
137308
  }
137166
- return e3.description;
137309
+ return t3.description;
137167
137310
  }
137168
- formatHelp(e3, t3) {
137169
- const i3 = t3.padWidth(e3, t3);
137170
- const n2 = t3.helpWidth || 80;
137311
+ formatHelp(t3, e3) {
137312
+ const i3 = e3.padWidth(t3, e3);
137313
+ const n2 = e3.helpWidth || 80;
137171
137314
  const s = 2;
137172
137315
  const r = 2;
137173
- function formatItem(e4, o2) {
137316
+ function formatItem(t4, o2) {
137174
137317
  if (o2) {
137175
- const a2 = `${e4.padEnd(i3 + r)}${o2}`;
137176
- return t3.wrap(a2, n2 - s, i3 + r);
137318
+ const a2 = `${t4.padEnd(i3 + r)}${o2}`;
137319
+ return e3.wrap(a2, n2 - s, i3 + r);
137177
137320
  }
137178
- return e4;
137321
+ return t4;
137179
137322
  }
137180
- function formatList(e4) {
137181
- return e4.join("\n").replace(/^/gm, " ".repeat(s));
137323
+ function formatList(t4) {
137324
+ return t4.join("\n").replace(/^/gm, " ".repeat(s));
137182
137325
  }
137183
- let o = [`Usage: ${t3.commandUsage(e3)}`, ""];
137184
- const a = t3.commandDescription(e3);
137326
+ let o = [`Usage: ${e3.commandUsage(t3)}`, ""];
137327
+ const a = e3.commandDescription(t3);
137185
137328
  if (a.length > 0) {
137186
- o = o.concat([a, ""]);
137329
+ o = o.concat([e3.wrap(a, n2, 0), ""]);
137187
137330
  }
137188
- const h = t3.visibleArguments(e3).map((e4) => formatItem(t3.argumentTerm(e4), t3.argumentDescription(e4)));
137331
+ const l = e3.visibleArguments(t3).map((t4) => formatItem(e3.argumentTerm(t4), e3.argumentDescription(t4)));
137332
+ if (l.length > 0) {
137333
+ o = o.concat(["Arguments:", formatList(l), ""]);
137334
+ }
137335
+ const h = e3.visibleOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
137189
137336
  if (h.length > 0) {
137190
- o = o.concat(["Arguments:", formatList(h), ""]);
137337
+ o = o.concat(["Options:", formatList(h), ""]);
137191
137338
  }
137192
- const l = t3.visibleOptions(e3).map((e4) => formatItem(t3.optionTerm(e4), t3.optionDescription(e4)));
137193
- if (l.length > 0) {
137194
- o = o.concat(["Options:", formatList(l), ""]);
137339
+ if (this.showGlobalOptions) {
137340
+ const i4 = e3.visibleGlobalOptions(t3).map((t4) => formatItem(e3.optionTerm(t4), e3.optionDescription(t4)));
137341
+ if (i4.length > 0) {
137342
+ o = o.concat(["Global Options:", formatList(i4), ""]);
137343
+ }
137195
137344
  }
137196
- const u = t3.visibleCommands(e3).map((e4) => formatItem(t3.subcommandTerm(e4), t3.subcommandDescription(e4)));
137345
+ const u = e3.visibleCommands(t3).map((t4) => formatItem(e3.subcommandTerm(t4), e3.subcommandDescription(t4)));
137197
137346
  if (u.length > 0) {
137198
137347
  o = o.concat(["Commands:", formatList(u), ""]);
137199
137348
  }
137200
137349
  return o.join("\n");
137201
137350
  }
137202
- padWidth(e3, t3) {
137203
- return Math.max(t3.longestOptionTermLength(e3, t3), t3.longestSubcommandTermLength(e3, t3), t3.longestArgumentTermLength(e3, t3));
137351
+ padWidth(t3, e3) {
137352
+ return Math.max(e3.longestOptionTermLength(t3, e3), e3.longestGlobalOptionTermLength(t3, e3), e3.longestSubcommandTermLength(t3, e3), e3.longestArgumentTermLength(t3, e3));
137204
137353
  }
137205
- wrap(e3, t3, i3, n2 = 40) {
137206
- if (e3.match(/[\n]\s+/))
137207
- return e3;
137208
- const s = t3 - i3;
137209
- if (s < n2)
137210
- return e3;
137211
- const r = e3.substr(0, i3);
137212
- const o = e3.substr(i3);
137213
- const a = " ".repeat(i3);
137214
- const h = new RegExp(".{1," + (s - 1) + "}([\\s​]|$)|[^\\s​]+?([\\s​]|$)", "g");
137215
- const l = o.match(h) || [];
137216
- return r + l.map((e4, t4) => {
137217
- if (e4.slice(-1) === "\n") {
137218
- e4 = e4.slice(0, e4.length - 1);
137219
- }
137220
- return (t4 > 0 ? a : "") + e4.trimRight();
137354
+ wrap(t3, e3, i3, n2 = 40) {
137355
+ const s = " \\f\\t\\v   -    \uFEFF";
137356
+ const r = new RegExp(`[\\n][${s}]+`);
137357
+ if (t3.match(r))
137358
+ return t3;
137359
+ const o = e3 - i3;
137360
+ if (o < n2)
137361
+ return t3;
137362
+ const a = t3.slice(0, i3);
137363
+ const l = t3.slice(i3).replace("\r\n", "\n");
137364
+ const h = " ".repeat(i3);
137365
+ const u = "​";
137366
+ const c = `\\s${u}`;
137367
+ const p = new RegExp(`
137368
+ |.{1,${o - 1}}([${c}]|$)|[^${c}]+?([${c}]|$)`, "g");
137369
+ const m = l.match(p) || [];
137370
+ return a + m.map((t4, e4) => {
137371
+ if (t4 === "\n")
137372
+ return "";
137373
+ return (e4 > 0 ? h : "") + t4.trimEnd();
137221
137374
  }).join("\n");
137222
137375
  }
137223
137376
  }
137224
- t2.Help = Help;
137225
- }, 278: (e2, t2, i2) => {
137226
- const { InvalidArgumentError: n } = i2(967);
137377
+ e2.Help = Help;
137378
+ }, 437: (t2, e2, i2) => {
137379
+ const { InvalidArgumentError: n } = i2(796);
137227
137380
  class Option {
137228
- constructor(e3, t3) {
137229
- this.flags = e3;
137230
- this.description = t3 || "";
137231
- this.required = e3.includes("<");
137232
- this.optional = e3.includes("[");
137233
- this.variadic = /\w\.\.\.[>\]]$/.test(e3);
137381
+ constructor(t3, e3) {
137382
+ this.flags = t3;
137383
+ this.description = e3 || "";
137384
+ this.required = t3.includes("<");
137385
+ this.optional = t3.includes("[");
137386
+ this.variadic = /\w\.\.\.[>\]]$/.test(t3);
137234
137387
  this.mandatory = false;
137235
- const i3 = splitOptionFlags(e3);
137388
+ const i3 = splitOptionFlags(t3);
137236
137389
  this.short = i3.shortFlag;
137237
137390
  this.long = i3.longFlag;
137238
137391
  this.negate = false;
@@ -137241,48 +137394,63 @@ Expecting one of '${i3.join("', '")}'`);
137241
137394
  }
137242
137395
  this.defaultValue = void 0;
137243
137396
  this.defaultValueDescription = void 0;
137397
+ this.presetArg = void 0;
137244
137398
  this.envVar = void 0;
137245
137399
  this.parseArg = void 0;
137246
137400
  this.hidden = false;
137247
137401
  this.argChoices = void 0;
137402
+ this.conflictsWith = [];
137403
+ this.implied = void 0;
137248
137404
  }
137249
- default(e3, t3) {
137250
- this.defaultValue = e3;
137251
- this.defaultValueDescription = t3;
137405
+ default(t3, e3) {
137406
+ this.defaultValue = t3;
137407
+ this.defaultValueDescription = e3;
137252
137408
  return this;
137253
137409
  }
137254
- env(e3) {
137255
- this.envVar = e3;
137410
+ preset(t3) {
137411
+ this.presetArg = t3;
137256
137412
  return this;
137257
137413
  }
137258
- argParser(e3) {
137259
- this.parseArg = e3;
137414
+ conflicts(t3) {
137415
+ this.conflictsWith = this.conflictsWith.concat(t3);
137260
137416
  return this;
137261
137417
  }
137262
- makeOptionMandatory(e3 = true) {
137263
- this.mandatory = !!e3;
137418
+ implies(t3) {
137419
+ this.implied = Object.assign(this.implied || {}, t3);
137264
137420
  return this;
137265
137421
  }
137266
- hideHelp(e3 = true) {
137267
- this.hidden = !!e3;
137422
+ env(t3) {
137423
+ this.envVar = t3;
137268
137424
  return this;
137269
137425
  }
137270
- _concatValue(e3, t3) {
137271
- if (t3 === this.defaultValue || !Array.isArray(t3)) {
137272
- return [e3];
137426
+ argParser(t3) {
137427
+ this.parseArg = t3;
137428
+ return this;
137429
+ }
137430
+ makeOptionMandatory(t3 = true) {
137431
+ this.mandatory = !!t3;
137432
+ return this;
137433
+ }
137434
+ hideHelp(t3 = true) {
137435
+ this.hidden = !!t3;
137436
+ return this;
137437
+ }
137438
+ _concatValue(t3, e3) {
137439
+ if (e3 === this.defaultValue || !Array.isArray(e3)) {
137440
+ return [t3];
137273
137441
  }
137274
- return t3.concat(e3);
137442
+ return e3.concat(t3);
137275
137443
  }
137276
- choices(e3) {
137277
- this.argChoices = e3;
137278
- this.parseArg = (t3, i3) => {
137279
- if (!e3.includes(t3)) {
137280
- throw new n(`Allowed choices are ${e3.join(", ")}.`);
137444
+ choices(t3) {
137445
+ this.argChoices = t3.slice();
137446
+ this.parseArg = (t4, e3) => {
137447
+ if (!this.argChoices.includes(t4)) {
137448
+ throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
137281
137449
  }
137282
137450
  if (this.variadic) {
137283
- return this._concatValue(t3, i3);
137451
+ return this._concatValue(t4, e3);
137284
137452
  }
137285
- return t3;
137453
+ return t4;
137286
137454
  };
137287
137455
  return this;
137288
137456
  }
@@ -137295,86 +137463,117 @@ Expecting one of '${i3.join("', '")}'`);
137295
137463
  attributeName() {
137296
137464
  return camelcase(this.name().replace(/^no-/, ""));
137297
137465
  }
137298
- is(e3) {
137299
- return this.short === e3 || this.long === e3;
137466
+ is(t3) {
137467
+ return this.short === t3 || this.long === t3;
137468
+ }
137469
+ isBoolean() {
137470
+ return !this.required && !this.optional && !this.negate;
137300
137471
  }
137301
137472
  }
137302
- function camelcase(e3) {
137303
- return e3.split("-").reduce((e4, t3) => e4 + t3[0].toUpperCase() + t3.slice(1));
137473
+ class DualOptions {
137474
+ constructor(t3) {
137475
+ this.positiveOptions = /* @__PURE__ */ new Map();
137476
+ this.negativeOptions = /* @__PURE__ */ new Map();
137477
+ this.dualOptions = /* @__PURE__ */ new Set();
137478
+ t3.forEach((t4) => {
137479
+ if (t4.negate) {
137480
+ this.negativeOptions.set(t4.attributeName(), t4);
137481
+ } else {
137482
+ this.positiveOptions.set(t4.attributeName(), t4);
137483
+ }
137484
+ });
137485
+ this.negativeOptions.forEach((t4, e3) => {
137486
+ if (this.positiveOptions.has(e3)) {
137487
+ this.dualOptions.add(e3);
137488
+ }
137489
+ });
137490
+ }
137491
+ valueFromOption(t3, e3) {
137492
+ const i3 = e3.attributeName();
137493
+ if (!this.dualOptions.has(i3))
137494
+ return true;
137495
+ const n2 = this.negativeOptions.get(i3).presetArg;
137496
+ const s = n2 !== void 0 ? n2 : false;
137497
+ return e3.negate === (s === t3);
137498
+ }
137304
137499
  }
137305
- function splitOptionFlags(e3) {
137306
- let t3;
137500
+ function camelcase(t3) {
137501
+ return t3.split("-").reduce((t4, e3) => t4 + e3[0].toUpperCase() + e3.slice(1));
137502
+ }
137503
+ function splitOptionFlags(t3) {
137504
+ let e3;
137307
137505
  let i3;
137308
- const n2 = e3.split(/[ |,]+/);
137506
+ const n2 = t3.split(/[ |,]+/);
137309
137507
  if (n2.length > 1 && !/^[[<]/.test(n2[1]))
137310
- t3 = n2.shift();
137508
+ e3 = n2.shift();
137311
137509
  i3 = n2.shift();
137312
- if (!t3 && /^-[^-]$/.test(i3)) {
137313
- t3 = i3;
137510
+ if (!e3 && /^-[^-]$/.test(i3)) {
137511
+ e3 = i3;
137314
137512
  i3 = void 0;
137315
137513
  }
137316
- return { shortFlag: t3, longFlag: i3 };
137514
+ return { shortFlag: e3, longFlag: i3 };
137317
137515
  }
137318
- t2.Option = Option;
137319
- t2.splitOptionFlags = splitOptionFlags;
137320
- }, 461: (e2, t2) => {
137516
+ e2.Option = Option;
137517
+ e2.splitOptionFlags = splitOptionFlags;
137518
+ e2.DualOptions = DualOptions;
137519
+ }, 860: (t2, e2) => {
137321
137520
  const i2 = 3;
137322
- function editDistance(e3, t3) {
137323
- if (Math.abs(e3.length - t3.length) > i2)
137324
- return Math.max(e3.length, t3.length);
137521
+ function editDistance(t3, e3) {
137522
+ if (Math.abs(t3.length - e3.length) > i2)
137523
+ return Math.max(t3.length, e3.length);
137325
137524
  const n = [];
137326
- for (let t4 = 0; t4 <= e3.length; t4++) {
137327
- n[t4] = [t4];
137328
- }
137329
137525
  for (let e4 = 0; e4 <= t3.length; e4++) {
137330
- n[0][e4] = e4;
137526
+ n[e4] = [e4];
137331
137527
  }
137332
- for (let i3 = 1; i3 <= t3.length; i3++) {
137333
- for (let s = 1; s <= e3.length; s++) {
137528
+ for (let t4 = 0; t4 <= e3.length; t4++) {
137529
+ n[0][t4] = t4;
137530
+ }
137531
+ for (let i3 = 1; i3 <= e3.length; i3++) {
137532
+ for (let s = 1; s <= t3.length; s++) {
137334
137533
  let r = 1;
137335
- if (e3[s - 1] === t3[i3 - 1]) {
137534
+ if (t3[s - 1] === e3[i3 - 1]) {
137336
137535
  r = 0;
137337
137536
  } else {
137338
137537
  r = 1;
137339
137538
  }
137340
137539
  n[s][i3] = Math.min(n[s - 1][i3] + 1, n[s][i3 - 1] + 1, n[s - 1][i3 - 1] + r);
137341
- if (s > 1 && i3 > 1 && e3[s - 1] === t3[i3 - 2] && e3[s - 2] === t3[i3 - 1]) {
137540
+ if (s > 1 && i3 > 1 && t3[s - 1] === e3[i3 - 2] && t3[s - 2] === e3[i3 - 1]) {
137342
137541
  n[s][i3] = Math.min(n[s][i3], n[s - 2][i3 - 2] + 1);
137343
137542
  }
137344
137543
  }
137345
137544
  }
137346
- return n[e3.length][t3.length];
137545
+ return n[t3.length][e3.length];
137347
137546
  }
137348
- function suggestSimilar(e3, t3) {
137349
- if (!t3 || t3.length === 0)
137547
+ function suggestSimilar(t3, e3) {
137548
+ if (!e3 || e3.length === 0)
137350
137549
  return "";
137351
- t3 = Array.from(new Set(t3));
137352
- const n = e3.startsWith("--");
137550
+ e3 = Array.from(new Set(e3));
137551
+ const n = t3.startsWith("--");
137353
137552
  if (n) {
137354
- e3 = e3.slice(2);
137355
- t3 = t3.map((e4) => e4.slice(2));
137553
+ t3 = t3.slice(2);
137554
+ e3 = e3.map((t4) => t4.slice(2));
137356
137555
  }
137357
137556
  let s = [];
137358
137557
  let r = i2;
137359
137558
  const o = 0.4;
137360
- t3.forEach((t4) => {
137361
- if (t4.length <= 1)
137559
+ e3.forEach((e4) => {
137560
+ if (e4.length <= 1)
137362
137561
  return;
137363
- const i3 = editDistance(e3, t4);
137364
- const n2 = Math.max(e3.length, t4.length);
137562
+ const i3 = editDistance(t3, e4);
137563
+ const n2 = Math.max(t3.length, e4.length);
137365
137564
  const a = (n2 - i3) / n2;
137366
137565
  if (a > o) {
137367
137566
  if (i3 < r) {
137368
137567
  r = i3;
137369
- s = [t4];
137568
+ s = [e4];
137370
137569
  } else if (i3 === r) {
137371
- s.push(t4);
137570
+ s.push(e4);
137372
137571
  }
137373
137572
  }
137374
137573
  });
137375
- s.sort((e4, t4) => e4.localeCompare(t4));
137574
+ s.sort((t4, e4) => t4.localeCompare(e4));
137376
137575
  if (n) {
137377
- s = s.map((e4) => `--${e4}`);
137576
+ s = s.map((t4) => `--${t4}`);
137378
137577
  }
137379
137578
  if (s.length > 1) {
137380
137579
  return `
@@ -137386,28 +137585,28 @@ Expecting one of '${i3.join("', '")}'`);
137386
137585
  }
137387
137586
  return "";
137388
137587
  }
137389
- t2.suggestSimilar = suggestSimilar;
137588
+ e2.suggestSimilar = suggestSimilar;
137390
137589
  } };
137391
- var t = {};
137590
+ var e = {};
137392
137591
  function __nccwpck_require__(i2) {
137393
- var n = t[i2];
137592
+ var n = e[i2];
137394
137593
  if (n !== void 0) {
137395
137594
  return n.exports;
137396
137595
  }
137397
- var s = t[i2] = { exports: {} };
137596
+ var s = e[i2] = { exports: {} };
137398
137597
  var r = true;
137399
137598
  try {
137400
- e[i2](s, s.exports, __nccwpck_require__);
137599
+ t[i2](s, s.exports, __nccwpck_require__);
137401
137600
  r = false;
137402
137601
  } finally {
137403
137602
  if (r)
137404
- delete t[i2];
137603
+ delete e[i2];
137405
137604
  }
137406
137605
  return s.exports;
137407
137606
  }
137408
137607
  if (typeof __nccwpck_require__ !== "undefined")
137409
137608
  __nccwpck_require__.ab = __dirname + "/";
137410
- var i = __nccwpck_require__(922);
137609
+ var i = __nccwpck_require__(632);
137411
137610
  module2.exports = i;
137412
137611
  })();
137413
137612
  }
@@ -137547,12 +137746,17 @@ var require_commands = __commonJS({
137547
137746
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
137548
137747
  var commands_exports = {};
137549
137748
  __export2(commands_exports, {
137749
+ getArgv: () => getArgv,
137550
137750
  getCommand: () => getCommand,
137551
137751
  isDevCommand: () => isDevCommand
137552
137752
  });
137553
137753
  module2.exports = __toCommonJS2(commands_exports);
137754
+ var getArgv = () => {
137755
+ var _a2;
137756
+ return (((_a2 = process.env.MODERN_ARGV) == null ? void 0 : _a2.split(" ")) || process.argv).slice(2);
137757
+ };
137554
137758
  var getCommand = () => {
137555
- const args = process.argv.slice(2);
137759
+ const args = getArgv();
137556
137760
  const command = args[0];
137557
137761
  return command;
137558
137762
  };
@@ -137563,108 +137767,6 @@ var require_commands = __commonJS({
137563
137767
  }
137564
137768
  });
137565
137769
 
137566
- // ../../../toolkit/utils/dist/format.js
137567
- var require_format2 = __commonJS({
137568
- "../../../toolkit/utils/dist/format.js"(exports, module2) {
137569
- var __defProp2 = Object.defineProperty;
137570
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
137571
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
137572
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
137573
- var __export2 = (target, all) => {
137574
- for (var name in all)
137575
- __defProp2(target, name, { get: all[name], enumerable: true });
137576
- };
137577
- var __copyProps2 = (to, from, except, desc) => {
137578
- if (from && typeof from === "object" || typeof from === "function") {
137579
- for (let key of __getOwnPropNames2(from))
137580
- if (!__hasOwnProp2.call(to, key) && key !== except)
137581
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
137582
- }
137583
- return to;
137584
- };
137585
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
137586
- var format_exports = {};
137587
- __export2(format_exports, {
137588
- formatWebpackMessages: () => formatWebpackMessages
137589
- });
137590
- module2.exports = __toCommonJS2(format_exports);
137591
- var friendlySyntaxErrorLabel = "SyntaxError:";
137592
- function isLikelyASyntaxError(message) {
137593
- return message.includes(friendlySyntaxErrorLabel);
137594
- }
137595
- function formatMessage(stats) {
137596
- let lines = [];
137597
- let message;
137598
- if (typeof stats === "object") {
137599
- const fileName = stats.moduleName ? `File: ${stats.moduleName}
137600
- ` : "";
137601
- const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
137602
- const details = stats.details ? `
137603
- Details: ${stats.details}
137604
- ` : "";
137605
- const stack = stats.stack ? `
137606
- ${stats.stack}` : "";
137607
- message = `${fileName}${mainMessage}${details}${stack}`;
137608
- } else {
137609
- message = stats;
137610
- }
137611
- lines = message.split("\n");
137612
- lines = lines.map((line) => {
137613
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
137614
- line
137615
- );
137616
- if (!parsingError) {
137617
- return line;
137618
- }
137619
- const [, errorLine, errorColumn, errorMessage] = parsingError;
137620
- return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
137621
- });
137622
- message = lines.join("\n");
137623
- message = message.replace(
137624
- /SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
137625
- `${friendlySyntaxErrorLabel} $3 ($1:$2)
137626
- `
137627
- );
137628
- lines = message.split("\n");
137629
- if (lines.length > 2 && lines[1].trim() === "") {
137630
- lines.splice(1, 1);
137631
- }
137632
- lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
137633
- if (lines[1] && lines[1].indexOf("Module not found:") !== -1) {
137634
- lines[1] = lines[1].replace("Error: ", "");
137635
- }
137636
- message = lines.join("\n");
137637
- message = message.replace(
137638
- /^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
137639
- ""
137640
- );
137641
- message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
137642
- lines = message.split("\n");
137643
- lines = lines.filter(
137644
- (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
137645
- );
137646
- message = lines.join("\n");
137647
- return message.trim();
137648
- }
137649
- function formatWebpackMessages(json) {
137650
- var _a2, _b, _c;
137651
- const formattedErrors = (_a2 = json == null ? void 0 : json.errors) == null ? void 0 : _a2.map(formatMessage);
137652
- const formattedWarnings = (_b = json == null ? void 0 : json.warnings) == null ? void 0 : _b.map(formatMessage);
137653
- const result = {
137654
- errors: formattedErrors || [],
137655
- warnings: formattedWarnings || []
137656
- };
137657
- if ((_c = result.errors) == null ? void 0 : _c.some(isLikelyASyntaxError)) {
137658
- result.errors = result.errors.filter(isLikelyASyntaxError);
137659
- }
137660
- if (result.errors.length > 1) {
137661
- result.errors.length = 1;
137662
- }
137663
- return result;
137664
- }
137665
- }
137666
- });
137667
-
137668
137770
  // ../../../toolkit/utils/dist/logger.js
137669
137771
  var require_logger4 = __commonJS({
137670
137772
  "../../../toolkit/utils/dist/logger.js"(exports, module2) {
@@ -138449,10 +138551,10 @@ var require_constants6 = __commonJS({
138449
138551
  API_DIR: () => API_DIR,
138450
138552
  CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
138451
138553
  CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
138554
+ DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
138452
138555
  DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
138453
138556
  DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
138454
138557
  ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
138455
- HMR_SOCK_PATH: () => HMR_SOCK_PATH,
138456
138558
  INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
138457
138559
  INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
138458
138560
  INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
@@ -138466,8 +138568,7 @@ var require_constants6 = __commonJS({
138466
138568
  MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
138467
138569
  OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
138468
138570
  PLUGIN_SCHEMAS: () => PLUGIN_SCHEMAS,
138469
- ROUTE_MANIFEST: () => ROUTE_MANIFEST,
138470
- ROUTE_MINIFEST_FILE: () => ROUTE_MINIFEST_FILE,
138571
+ ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
138471
138572
  ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
138472
138573
  SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
138473
138574
  SERVER_DIR: () => SERVER_DIR,
@@ -138483,7 +138584,6 @@ var require_constants6 = __commonJS({
138483
138584
  SHARED_DIR: () => SHARED_DIR
138484
138585
  });
138485
138586
  module2.exports = __toCommonJS2(constants_exports);
138486
- var HMR_SOCK_PATH = "/webpack-hmr";
138487
138587
  var ROUTE_SPEC_FILE = "route.json";
138488
138588
  var MAIN_ENTRY_NAME = "main";
138489
138589
  var LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
@@ -138499,8 +138599,7 @@ var require_constants6 = __commonJS({
138499
138599
  var CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
138500
138600
  var OUTPUT_CONFIG_FILE = "modern.config.json";
138501
138601
  var DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
138502
- var ROUTE_MINIFEST_FILE = "routes-manifest.json";
138503
- var ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
138602
+ var ROUTE_MANIFEST_FILE = "routes-manifest.json";
138504
138603
  var LOADER_ROUTES_DIR = `loader-routes`;
138505
138604
  var DEFAULT_DEV_HOST = "0.0.0.0";
138506
138605
  var INTERNAL_APP_TOOLS_PLUGINS = {
@@ -138704,6 +138803,15 @@ var require_constants6 = __commonJS({
138704
138803
  ],
138705
138804
  "@modern-js/plugin-nocode": []
138706
138805
  };
138806
+ var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
138807
+ allowNamespaces: true,
138808
+ allExtensions: true,
138809
+ allowDeclareFields: true,
138810
+ // aligns Babel's behavior with TypeScript's default behavior.
138811
+ // https://babeljs.io/docs/en/babel-preset-typescript#optimizeconstenums
138812
+ optimizeConstEnums: true,
138813
+ isTSX: true
138814
+ };
138707
138815
  }
138708
138816
  });
138709
138817
 
@@ -140225,9 +140333,9 @@ var require_getServerConfig2 = __commonJS({
140225
140333
  }
140226
140334
  });
140227
140335
 
140228
- // ../../../toolkit/utils/dist/tryResolve.js
140229
- var require_tryResolve2 = __commonJS({
140230
- "../../../toolkit/utils/dist/tryResolve.js"(exports, module2) {
140336
+ // ../../../toolkit/utils/dist/resolve.js
140337
+ var require_resolve = __commonJS({
140338
+ "../../../toolkit/utils/dist/resolve.js"(exports, module2) {
140231
140339
  var __defProp2 = Object.defineProperty;
140232
140340
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
140233
140341
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
@@ -140245,12 +140353,13 @@ var require_tryResolve2 = __commonJS({
140245
140353
  return to;
140246
140354
  };
140247
140355
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
140248
- var tryResolve_exports = {};
140249
- __export2(tryResolve_exports, {
140356
+ var resolve_exports = {};
140357
+ __export2(resolve_exports, {
140358
+ getAntdMajorVersion: () => getAntdMajorVersion,
140250
140359
  isPackageInstalled: () => isPackageInstalled,
140251
140360
  tryResolve: () => tryResolve
140252
140361
  });
140253
- module2.exports = __toCommonJS2(tryResolve_exports);
140362
+ module2.exports = __toCommonJS2(resolve_exports);
140254
140363
  var import_ensureArray = require_ensureArray2();
140255
140364
  var tryResolve = (name, resolvePath) => {
140256
140365
  let filePath = "";
@@ -140273,6 +140382,17 @@ var require_tryResolve2 = __commonJS({
140273
140382
  return false;
140274
140383
  }
140275
140384
  };
140385
+ var getAntdMajorVersion = (appDirectory) => {
140386
+ try {
140387
+ const pkgJsonPath = require.resolve("antd/package.json", {
140388
+ paths: [appDirectory]
140389
+ });
140390
+ const { version } = require(pkgJsonPath);
140391
+ return Number(version.split(".")[0]);
140392
+ } catch (err) {
140393
+ return null;
140394
+ }
140395
+ };
140276
140396
  }
140277
140397
  });
140278
140398
 
@@ -140333,15 +140453,16 @@ var require_analyzeProject2 = __commonJS({
140333
140453
  });
140334
140454
  module2.exports = __toCommonJS2(analyzeProject_exports);
140335
140455
  var path3 = __toESM2(require("path"));
140456
+ var import_commands = require_commands();
140336
140457
  var import_compiled = require_compiled2();
140337
140458
  var isApiOnly = (appDirectory, entryDir) => __async2(void 0, null, function* () {
140338
140459
  const srcDir = path3.join(appDirectory, entryDir != null ? entryDir : "src");
140339
140460
  const existSrc = yield import_compiled.fs.pathExists(srcDir);
140340
- const options = (0, import_compiled.minimist)(process.argv.slice(2));
140461
+ const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
140341
140462
  return !existSrc || Boolean(options["api-only"]);
140342
140463
  });
140343
140464
  var isWebOnly = () => __async2(void 0, null, function* () {
140344
- const options = (0, import_compiled.minimist)(process.argv.slice(2));
140465
+ const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
140345
140466
  return Boolean(options["web-only"]);
140346
140467
  });
140347
140468
  }
@@ -140412,27 +140533,10 @@ var require_chainId2 = __commonJS({
140412
140533
  },
140413
140534
  /** Predefined rule groups */
140414
140535
  ONE_OF: {
140415
- JS: "js",
140416
- TS: "ts",
140417
- CSS: "css",
140418
- LESS: "less",
140419
- SASS: "sass",
140420
- YAML: "yml",
140421
- TOML: "toml",
140422
- FALLBACK: "fallback",
140423
- MARKDOWN: "markdown",
140424
- BFF_CLIENT: "bff-client",
140425
- CSS_MODULES: "css-modules",
140426
- LESS_MODULES: "less-modules",
140427
- SASS_MODULES: "sass-modules",
140428
140536
  SVG: "svg",
140429
140537
  SVG_URL: "svg-url",
140430
140538
  SVG_ASSET: "svg-asset",
140431
- SVG_INLINE: "svg-inline",
140432
- ASSETS: "assets",
140433
- ASSETS_URL: "assets-url",
140434
- ASSETS_INLINE: "assets-inline",
140435
- IMAGE_COMPRESS: "image-compress"
140539
+ SVG_INLINE: "svg-inline"
140436
140540
  },
140437
140541
  /** Predefined loaders */
140438
140542
  USE: {
@@ -141117,7 +141221,6 @@ var require_dist3 = __commonJS({
141117
141221
  module2.exports = __toCommonJS2(src_exports2);
141118
141222
  __reExport(src_exports2, require_compiled2(), module2.exports);
141119
141223
  __reExport(src_exports2, require_commands(), module2.exports);
141120
- __reExport(src_exports2, require_format2(), module2.exports);
141121
141224
  __reExport(src_exports2, require_FileSizeReporter2(), module2.exports);
141122
141225
  __reExport(src_exports2, require_printBuildError2(), module2.exports);
141123
141226
  __reExport(src_exports2, require_debug5(), module2.exports);
@@ -141149,7 +141252,7 @@ var require_dist3 = __commonJS({
141149
141252
  __reExport(src_exports2, require_wait2(), module2.exports);
141150
141253
  __reExport(src_exports2, require_emptyDir2(), module2.exports);
141151
141254
  __reExport(src_exports2, require_getServerConfig2(), module2.exports);
141152
- __reExport(src_exports2, require_tryResolve2(), module2.exports);
141255
+ __reExport(src_exports2, require_resolve(), module2.exports);
141153
141256
  __reExport(src_exports2, require_analyzeProject2(), module2.exports);
141154
141257
  __reExport(src_exports2, require_chainId2(), module2.exports);
141155
141258
  __reExport(src_exports2, require_version2(), module2.exports);