@modern-js/packages-generator 3.0.11 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1150 -909
- package/package.json +7 -7
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
|
|
135879
|
+
var t = { 81: (t2) => {
|
|
135880
135880
|
"use strict";
|
|
135881
|
-
|
|
135882
|
-
}, 361: (
|
|
135881
|
+
t2.exports = require("child_process");
|
|
135882
|
+
}, 361: (t2) => {
|
|
135883
135883
|
"use strict";
|
|
135884
|
-
|
|
135885
|
-
}, 147: (
|
|
135884
|
+
t2.exports = require("events");
|
|
135885
|
+
}, 147: (t2) => {
|
|
135886
135886
|
"use strict";
|
|
135887
|
-
|
|
135888
|
-
}, 17: (
|
|
135887
|
+
t2.exports = require("fs");
|
|
135888
|
+
}, 17: (t2) => {
|
|
135889
135889
|
"use strict";
|
|
135890
|
-
|
|
135891
|
-
},
|
|
135892
|
-
|
|
135893
|
-
|
|
135894
|
-
|
|
135895
|
-
const {
|
|
135896
|
-
const {
|
|
135897
|
-
|
|
135898
|
-
|
|
135899
|
-
|
|
135900
|
-
t2.
|
|
135901
|
-
|
|
135902
|
-
|
|
135903
|
-
|
|
135904
|
-
|
|
135905
|
-
|
|
135906
|
-
|
|
135907
|
-
|
|
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(
|
|
135910
|
-
this.description =
|
|
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 (
|
|
135919
|
+
switch (t3[0]) {
|
|
135917
135920
|
case "<":
|
|
135918
135921
|
this.required = true;
|
|
135919
|
-
this._name =
|
|
135922
|
+
this._name = t3.slice(1, -1);
|
|
135920
135923
|
break;
|
|
135921
135924
|
case "[":
|
|
135922
135925
|
this.required = false;
|
|
135923
|
-
this._name =
|
|
135926
|
+
this._name = t3.slice(1, -1);
|
|
135924
135927
|
break;
|
|
135925
135928
|
default:
|
|
135926
135929
|
this.required = true;
|
|
135927
|
-
this._name =
|
|
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(
|
|
135939
|
-
if (
|
|
135940
|
-
return [
|
|
135941
|
+
_concatValue(t3, e3) {
|
|
135942
|
+
if (e3 === this.defaultValue || !Array.isArray(e3)) {
|
|
135943
|
+
return [t3];
|
|
135941
135944
|
}
|
|
135942
|
-
return
|
|
135945
|
+
return e3.concat(t3);
|
|
135943
135946
|
}
|
|
135944
|
-
default(
|
|
135945
|
-
this.defaultValue =
|
|
135946
|
-
this.defaultValueDescription =
|
|
135947
|
+
default(t3, e3) {
|
|
135948
|
+
this.defaultValue = t3;
|
|
135949
|
+
this.defaultValueDescription = e3;
|
|
135947
135950
|
return this;
|
|
135948
135951
|
}
|
|
135949
|
-
argParser(
|
|
135950
|
-
this.parseArg =
|
|
135952
|
+
argParser(t3) {
|
|
135953
|
+
this.parseArg = t3;
|
|
135951
135954
|
return this;
|
|
135952
135955
|
}
|
|
135953
|
-
choices(
|
|
135954
|
-
this.argChoices =
|
|
135955
|
-
this.parseArg = (
|
|
135956
|
-
if (!
|
|
135957
|
-
throw new n(`Allowed choices are ${
|
|
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(
|
|
135963
|
+
return this._concatValue(t4, e3);
|
|
135961
135964
|
}
|
|
135962
|
-
return
|
|
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(
|
|
135976
|
-
const
|
|
135977
|
-
return
|
|
135978
|
+
function humanReadableArgName(t3) {
|
|
135979
|
+
const e3 = t3.name() + (t3.variadic === true ? "..." : "");
|
|
135980
|
+
return t3.required ? "<" + e3 + ">" : "[" + e3 + "]";
|
|
135978
135981
|
}
|
|
135979
|
-
|
|
135980
|
-
|
|
135981
|
-
},
|
|
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
|
|
135987
|
-
const {
|
|
135988
|
-
const {
|
|
135989
|
-
const {
|
|
135990
|
-
const {
|
|
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(
|
|
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 =
|
|
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 =
|
|
136022
|
-
this._outputConfiguration = { writeOut: (
|
|
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(
|
|
136036
|
-
this._outputConfiguration =
|
|
136037
|
-
this._hasHelpOption =
|
|
136038
|
-
this._helpFlags =
|
|
136039
|
-
this._helpDescription =
|
|
136040
|
-
this._helpShortFlag =
|
|
136041
|
-
this._helpLongFlag =
|
|
136042
|
-
this._helpCommandName =
|
|
136043
|
-
this._helpCommandnameAndArgs =
|
|
136044
|
-
this._helpCommandDescription =
|
|
136045
|
-
this._helpConfiguration =
|
|
136046
|
-
this._exitCallback =
|
|
136047
|
-
this._storeOptionsAsProperties =
|
|
136048
|
-
this._combineFlagAndOptionalValue =
|
|
136049
|
-
this._allowExcessArguments =
|
|
136050
|
-
this._enablePositionalOptions =
|
|
136051
|
-
this._showHelpAfterError =
|
|
136052
|
-
this._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(
|
|
136056
|
-
let n2 =
|
|
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] =
|
|
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(
|
|
136083
|
-
return new Command2(
|
|
136088
|
+
createCommand(t3) {
|
|
136089
|
+
return new Command2(t3);
|
|
136084
136090
|
}
|
|
136085
136091
|
createHelp() {
|
|
136086
|
-
return Object.assign(new
|
|
136092
|
+
return Object.assign(new c(), this.configureHelp());
|
|
136087
136093
|
}
|
|
136088
|
-
configureHelp(
|
|
136089
|
-
if (
|
|
136094
|
+
configureHelp(t3) {
|
|
136095
|
+
if (t3 === void 0)
|
|
136090
136096
|
return this._helpConfiguration;
|
|
136091
|
-
this._helpConfiguration =
|
|
136097
|
+
this._helpConfiguration = t3;
|
|
136092
136098
|
return this;
|
|
136093
136099
|
}
|
|
136094
|
-
configureOutput(
|
|
136095
|
-
if (
|
|
136100
|
+
configureOutput(t3) {
|
|
136101
|
+
if (t3 === void 0)
|
|
136096
136102
|
return this._outputConfiguration;
|
|
136097
|
-
Object.assign(this._outputConfiguration,
|
|
136103
|
+
Object.assign(this._outputConfiguration, t3);
|
|
136098
136104
|
return this;
|
|
136099
136105
|
}
|
|
136100
|
-
showHelpAfterError(
|
|
136101
|
-
if (typeof
|
|
136102
|
-
|
|
136103
|
-
this._showHelpAfterError =
|
|
136106
|
+
showHelpAfterError(t3 = true) {
|
|
136107
|
+
if (typeof t3 !== "string")
|
|
136108
|
+
t3 = !!t3;
|
|
136109
|
+
this._showHelpAfterError = t3;
|
|
136104
136110
|
return this;
|
|
136105
136111
|
}
|
|
136106
|
-
showSuggestionAfterError(
|
|
136107
|
-
this._showSuggestionAfterError = !!
|
|
136112
|
+
showSuggestionAfterError(t3 = true) {
|
|
136113
|
+
this._showSuggestionAfterError = !!t3;
|
|
136108
136114
|
return this;
|
|
136109
136115
|
}
|
|
136110
|
-
addCommand(
|
|
136111
|
-
if (!
|
|
136112
|
-
throw new Error(
|
|
136113
|
-
|
|
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
|
-
|
|
136122
|
-
|
|
136123
|
-
|
|
136124
|
-
|
|
136125
|
-
|
|
136126
|
-
|
|
136127
|
-
this
|
|
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(
|
|
136132
|
-
return new
|
|
136130
|
+
createArgument(t3, e3) {
|
|
136131
|
+
return new l(t3, e3);
|
|
136133
136132
|
}
|
|
136134
|
-
argument(
|
|
136135
|
-
const s2 = this.createArgument(
|
|
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(
|
|
136145
|
-
|
|
136146
|
-
this.argument(
|
|
136143
|
+
arguments(t3) {
|
|
136144
|
+
t3.split(/ +/).forEach((t4) => {
|
|
136145
|
+
this.argument(t4);
|
|
136147
136146
|
});
|
|
136148
136147
|
return this;
|
|
136149
136148
|
}
|
|
136150
|
-
addArgument(
|
|
136151
|
-
const
|
|
136152
|
-
if (
|
|
136153
|
-
throw new Error(`only the last argument can be variadic '${
|
|
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 (
|
|
136156
|
-
throw new Error(`a default value for a required argument is never used: '${
|
|
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(
|
|
136157
|
+
this._args.push(t3);
|
|
136159
136158
|
return this;
|
|
136160
136159
|
}
|
|
136161
|
-
addHelpCommand(
|
|
136162
|
-
if (
|
|
136160
|
+
addHelpCommand(t3, e3) {
|
|
136161
|
+
if (t3 === false) {
|
|
136163
136162
|
this._addImplicitHelpCommand = false;
|
|
136164
136163
|
} else {
|
|
136165
136164
|
this._addImplicitHelpCommand = true;
|
|
136166
|
-
if (typeof
|
|
136167
|
-
this._helpCommandName =
|
|
136168
|
-
this._helpCommandnameAndArgs =
|
|
136165
|
+
if (typeof t3 === "string") {
|
|
136166
|
+
this._helpCommandName = t3.split(" ")[0];
|
|
136167
|
+
this._helpCommandnameAndArgs = t3;
|
|
136169
136168
|
}
|
|
136170
|
-
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(
|
|
136181
|
-
const i3 = ["preAction", "postAction"];
|
|
136182
|
-
if (!i3.includes(
|
|
136183
|
-
throw new Error(`Unexpected value for event passed to hook : '${
|
|
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[
|
|
136187
|
-
this._lifeCycleHooks[
|
|
136185
|
+
if (this._lifeCycleHooks[t3]) {
|
|
136186
|
+
this._lifeCycleHooks[t3].push(e3);
|
|
136188
136187
|
} else {
|
|
136189
|
-
this._lifeCycleHooks[
|
|
136188
|
+
this._lifeCycleHooks[t3] = [e3];
|
|
136190
136189
|
}
|
|
136191
136190
|
return this;
|
|
136192
136191
|
}
|
|
136193
|
-
exitOverride(
|
|
136194
|
-
if (
|
|
136195
|
-
this._exitCallback =
|
|
136192
|
+
exitOverride(t3) {
|
|
136193
|
+
if (t3) {
|
|
136194
|
+
this._exitCallback = t3;
|
|
136196
136195
|
} else {
|
|
136197
|
-
this._exitCallback = (
|
|
136198
|
-
if (
|
|
136199
|
-
throw
|
|
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(
|
|
136205
|
+
_exit(t3, e3, i3) {
|
|
136207
136206
|
if (this._exitCallback) {
|
|
136208
|
-
this._exitCallback(new
|
|
136207
|
+
this._exitCallback(new u(t3, e3, i3));
|
|
136209
136208
|
}
|
|
136210
|
-
|
|
136209
|
+
a.exit(t3);
|
|
136211
136210
|
}
|
|
136212
|
-
action(
|
|
136213
|
-
const listener = (
|
|
136211
|
+
action(t3) {
|
|
136212
|
+
const listener = (e3) => {
|
|
136214
136213
|
const i3 = this._args.length;
|
|
136215
|
-
const n2 =
|
|
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
|
|
136221
|
+
return t3.apply(this, n2);
|
|
136223
136222
|
};
|
|
136224
136223
|
this._actionHandler = listener;
|
|
136225
136224
|
return this;
|
|
136226
136225
|
}
|
|
136227
|
-
createOption(
|
|
136228
|
-
return new
|
|
136226
|
+
createOption(t3, e3) {
|
|
136227
|
+
return new p(t3, e3);
|
|
136229
136228
|
}
|
|
136230
|
-
addOption(
|
|
136231
|
-
const
|
|
136232
|
-
const i3 =
|
|
136233
|
-
|
|
136234
|
-
|
|
136235
|
-
if (
|
|
136236
|
-
|
|
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(
|
|
136244
|
-
const handleOptionValue = (
|
|
136245
|
-
|
|
136246
|
-
|
|
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
|
-
|
|
136249
|
-
} catch (
|
|
136250
|
-
if (
|
|
136251
|
-
const
|
|
136252
|
-
this.
|
|
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
|
|
136254
|
+
throw t4;
|
|
136255
136255
|
}
|
|
136256
|
-
} else if (
|
|
136257
|
-
|
|
136256
|
+
} else if (e4 !== null && t3.variadic) {
|
|
136257
|
+
e4 = t3._concatValue(e4, r2);
|
|
136258
136258
|
}
|
|
136259
|
-
if (
|
|
136260
|
-
if (
|
|
136261
|
-
|
|
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
|
-
|
|
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:" +
|
|
136270
|
-
const i4 = `error: option '${
|
|
136271
|
-
handleOptionValue(
|
|
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 (
|
|
136274
|
-
this.on("optionEnv:" +
|
|
136275
|
-
const i4 = `error: option '${
|
|
136276
|
-
handleOptionValue(
|
|
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(
|
|
136282
|
-
|
|
136283
|
-
|
|
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
|
|
136288
|
-
n2 = (
|
|
136289
|
-
const n3 =
|
|
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(
|
|
136299
|
-
return this._optionEx({},
|
|
136302
|
+
option(t3, e3, i3, n2) {
|
|
136303
|
+
return this._optionEx({}, t3, e3, i3, n2);
|
|
136300
136304
|
}
|
|
136301
|
-
requiredOption(
|
|
136302
|
-
return this._optionEx({ mandatory: true },
|
|
136305
|
+
requiredOption(t3, e3, i3, n2) {
|
|
136306
|
+
return this._optionEx({ mandatory: true }, t3, e3, i3, n2);
|
|
136303
136307
|
}
|
|
136304
|
-
combineFlagAndOptionalValue(
|
|
136305
|
-
this._combineFlagAndOptionalValue = !!
|
|
136308
|
+
combineFlagAndOptionalValue(t3 = true) {
|
|
136309
|
+
this._combineFlagAndOptionalValue = !!t3;
|
|
136306
136310
|
return this;
|
|
136307
136311
|
}
|
|
136308
|
-
allowUnknownOption(
|
|
136309
|
-
this._allowUnknownOption = !!
|
|
136312
|
+
allowUnknownOption(t3 = true) {
|
|
136313
|
+
this._allowUnknownOption = !!t3;
|
|
136310
136314
|
return this;
|
|
136311
136315
|
}
|
|
136312
|
-
allowExcessArguments(
|
|
136313
|
-
this._allowExcessArguments = !!
|
|
136316
|
+
allowExcessArguments(t3 = true) {
|
|
136317
|
+
this._allowExcessArguments = !!t3;
|
|
136314
136318
|
return this;
|
|
136315
136319
|
}
|
|
136316
|
-
enablePositionalOptions(
|
|
136317
|
-
this._enablePositionalOptions = !!
|
|
136320
|
+
enablePositionalOptions(t3 = true) {
|
|
136321
|
+
this._enablePositionalOptions = !!t3;
|
|
136318
136322
|
return this;
|
|
136319
136323
|
}
|
|
136320
|
-
passThroughOptions(
|
|
136321
|
-
this._passThroughOptions = !!
|
|
136322
|
-
if (!!this.parent &&
|
|
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(
|
|
136328
|
-
this._storeOptionsAsProperties = !!
|
|
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(
|
|
136338
|
+
getOptionValue(t3) {
|
|
136335
136339
|
if (this._storeOptionsAsProperties) {
|
|
136336
|
-
return this[
|
|
136340
|
+
return this[t3];
|
|
136337
136341
|
}
|
|
136338
|
-
return this._optionValues[
|
|
136342
|
+
return this._optionValues[t3];
|
|
136339
136343
|
}
|
|
136340
|
-
setOptionValue(
|
|
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[
|
|
136349
|
+
this[t3] = e3;
|
|
136343
136350
|
} else {
|
|
136344
|
-
this._optionValues[
|
|
136351
|
+
this._optionValues[t3] = e3;
|
|
136345
136352
|
}
|
|
136353
|
+
this._optionValueSources[t3] = i3;
|
|
136346
136354
|
return this;
|
|
136347
136355
|
}
|
|
136348
|
-
|
|
136349
|
-
this.
|
|
136350
|
-
this._optionValueSources[e3] = i3;
|
|
136351
|
-
return this;
|
|
136356
|
+
getOptionValueSource(t3) {
|
|
136357
|
+
return this._optionValueSources[t3];
|
|
136352
136358
|
}
|
|
136353
|
-
|
|
136354
|
-
|
|
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(
|
|
136357
|
-
if (
|
|
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
|
-
|
|
136361
|
-
if (
|
|
136362
|
-
|
|
136363
|
-
if (
|
|
136364
|
-
|
|
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 =
|
|
136379
|
+
this.rawArgs = t3.slice();
|
|
136368
136380
|
let i3;
|
|
136369
|
-
switch (
|
|
136381
|
+
switch (e3.from) {
|
|
136370
136382
|
case void 0:
|
|
136371
136383
|
case "node":
|
|
136372
|
-
this._scriptPath =
|
|
136373
|
-
i3 =
|
|
136384
|
+
this._scriptPath = t3[1];
|
|
136385
|
+
i3 = t3.slice(2);
|
|
136374
136386
|
break;
|
|
136375
136387
|
case "electron":
|
|
136376
|
-
if (
|
|
136377
|
-
this._scriptPath =
|
|
136378
|
-
i3 =
|
|
136388
|
+
if (a.defaultApp) {
|
|
136389
|
+
this._scriptPath = t3[1];
|
|
136390
|
+
i3 = t3.slice(2);
|
|
136379
136391
|
} else {
|
|
136380
|
-
i3 =
|
|
136392
|
+
i3 = t3.slice(1);
|
|
136381
136393
|
}
|
|
136382
136394
|
break;
|
|
136383
136395
|
case "user":
|
|
136384
|
-
i3 =
|
|
136396
|
+
i3 = t3.slice(0);
|
|
136385
136397
|
break;
|
|
136386
136398
|
default:
|
|
136387
|
-
throw new Error(`unexpected parse option { from: '${
|
|
136399
|
+
throw new Error(`unexpected parse option { from: '${e3.from}' }`);
|
|
136388
136400
|
}
|
|
136389
|
-
if (!this.
|
|
136390
|
-
this._scriptPath
|
|
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(
|
|
136396
|
-
const i3 = this._prepareUserArgs(
|
|
136406
|
+
parse(t3, e3) {
|
|
136407
|
+
const i3 = this._prepareUserArgs(t3, e3);
|
|
136397
136408
|
this._parseCommand([], i3);
|
|
136398
136409
|
return this;
|
|
136399
136410
|
}
|
|
136400
|
-
parseAsync(
|
|
136411
|
+
parseAsync(t3, e3) {
|
|
136401
136412
|
return __async(this, null, function* () {
|
|
136402
|
-
const i3 = this._prepareUserArgs(
|
|
136413
|
+
const i3 = this._prepareUserArgs(t3, e3);
|
|
136403
136414
|
yield this._parseCommand([], i3);
|
|
136404
136415
|
return this;
|
|
136405
136416
|
});
|
|
136406
136417
|
}
|
|
136407
|
-
_executeSubCommand(
|
|
136408
|
-
|
|
136418
|
+
_executeSubCommand(t3, e3) {
|
|
136419
|
+
e3 = e3.slice();
|
|
136409
136420
|
let i3 = false;
|
|
136410
136421
|
const n2 = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
136411
|
-
|
|
136412
|
-
|
|
136413
|
-
|
|
136414
|
-
|
|
136415
|
-
|
|
136416
|
-
|
|
136417
|
-
|
|
136418
|
-
|
|
136419
|
-
|
|
136420
|
-
|
|
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
|
-
|
|
136424
|
-
|
|
136425
|
-
|
|
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
|
-
|
|
136428
|
-
|
|
136429
|
-
|
|
136430
|
-
|
|
136431
|
-
|
|
136432
|
-
|
|
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(
|
|
136438
|
-
let
|
|
136439
|
-
if (
|
|
136456
|
+
i3 = n2.includes(r.extname(l2));
|
|
136457
|
+
let c2;
|
|
136458
|
+
if (a.platform !== "win32") {
|
|
136440
136459
|
if (i3) {
|
|
136441
|
-
|
|
136442
|
-
|
|
136443
|
-
|
|
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
|
-
|
|
136464
|
+
c2 = s.spawn(l2, e3, { stdio: "inherit" });
|
|
136446
136465
|
}
|
|
136447
136466
|
} else {
|
|
136448
|
-
|
|
136449
|
-
|
|
136450
|
-
|
|
136451
|
-
}
|
|
136452
|
-
|
|
136453
|
-
|
|
136454
|
-
|
|
136455
|
-
|
|
136456
|
-
|
|
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
|
|
136461
|
-
if (!
|
|
136462
|
-
|
|
136480
|
+
}
|
|
136481
|
+
const p2 = this._exitCallback;
|
|
136482
|
+
if (!p2) {
|
|
136483
|
+
c2.on("close", a.exit.bind(a));
|
|
136463
136484
|
} else {
|
|
136464
|
-
|
|
136465
|
-
|
|
136485
|
+
c2.on("close", () => {
|
|
136486
|
+
p2(new u(a.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
|
|
136466
136487
|
});
|
|
136467
136488
|
}
|
|
136468
|
-
|
|
136469
|
-
if (
|
|
136470
|
-
const
|
|
136471
|
-
|
|
136472
|
-
- if
|
|
136473
|
-
|
|
136474
|
-
|
|
136475
|
-
throw new Error(
|
|
136476
|
-
}
|
|
136477
|
-
|
|
136478
|
-
|
|
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
|
|
136481
|
-
|
|
136482
|
-
|
|
136503
|
+
const t4 = new u(1, "commander.executeSubCommandAsync", "(error)");
|
|
136504
|
+
t4.nestedError = e4;
|
|
136505
|
+
p2(t4);
|
|
136483
136506
|
}
|
|
136484
136507
|
});
|
|
136485
|
-
this.runningCommand =
|
|
136508
|
+
this.runningCommand = c2;
|
|
136486
136509
|
}
|
|
136487
|
-
_dispatchSubcommand(
|
|
136488
|
-
const n2 = this._findCommand(
|
|
136510
|
+
_dispatchSubcommand(t3, e3, i3) {
|
|
136511
|
+
const n2 = this._findCommand(t3);
|
|
136489
136512
|
if (!n2)
|
|
136490
136513
|
this.help({ error: true });
|
|
136491
|
-
|
|
136492
|
-
|
|
136493
|
-
|
|
136494
|
-
|
|
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((
|
|
136499
|
-
if (
|
|
136500
|
-
this.missingArgument(
|
|
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 = (
|
|
136512
|
-
let n2 =
|
|
136513
|
-
if (
|
|
136539
|
+
const myParseArg = (t4, e3, i3) => {
|
|
136540
|
+
let n2 = e3;
|
|
136541
|
+
if (e3 !== null && t4.parseArg) {
|
|
136514
136542
|
try {
|
|
136515
|
-
n2 =
|
|
136543
|
+
n2 = t4.parseArg(e3, i3);
|
|
136516
136544
|
} catch (i4) {
|
|
136517
136545
|
if (i4.code === "commander.invalidArgument") {
|
|
136518
|
-
const n3 = `error: command-argument value '${
|
|
136519
|
-
this.
|
|
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
|
|
136528
|
-
this._args.forEach((
|
|
136529
|
-
let n2 =
|
|
136530
|
-
if (
|
|
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 (
|
|
136534
|
-
n2 = n2.reduce((
|
|
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 (
|
|
136542
|
-
n2 = myParseArg(
|
|
136569
|
+
if (e3.parseArg) {
|
|
136570
|
+
n2 = myParseArg(e3, n2, e3.defaultValue);
|
|
136543
136571
|
}
|
|
136544
136572
|
}
|
|
136545
|
-
|
|
136573
|
+
t3[i3] = n2;
|
|
136546
136574
|
});
|
|
136547
|
-
this.processedArgs =
|
|
136575
|
+
this.processedArgs = t3;
|
|
136548
136576
|
}
|
|
136549
|
-
_chainOrCall(
|
|
136550
|
-
if (
|
|
136551
|
-
return
|
|
136577
|
+
_chainOrCall(t3, e3) {
|
|
136578
|
+
if (t3 && t3.then && typeof t3.then === "function") {
|
|
136579
|
+
return t3.then(() => e3());
|
|
136552
136580
|
}
|
|
136553
|
-
return
|
|
136581
|
+
return e3();
|
|
136554
136582
|
}
|
|
136555
|
-
_chainOrCallHooks(
|
|
136556
|
-
let i3 =
|
|
136583
|
+
_chainOrCallHooks(t3, e3) {
|
|
136584
|
+
let i3 = t3;
|
|
136557
136585
|
const n2 = [];
|
|
136558
|
-
getCommandAndParents(this).reverse().filter((
|
|
136559
|
-
|
|
136560
|
-
n2.push({ hookedCommand:
|
|
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 (
|
|
136591
|
+
if (e3 === "postAction") {
|
|
136564
136592
|
n2.reverse();
|
|
136565
136593
|
}
|
|
136566
|
-
n2.forEach((
|
|
136567
|
-
i3 = this._chainOrCall(i3, () =>
|
|
136594
|
+
n2.forEach((t4) => {
|
|
136595
|
+
i3 = this._chainOrCall(i3, () => t4.callback(t4.hookedCommand, this));
|
|
136568
136596
|
});
|
|
136569
136597
|
return i3;
|
|
136570
136598
|
}
|
|
136571
|
-
|
|
136572
|
-
|
|
136573
|
-
this.
|
|
136574
|
-
|
|
136575
|
-
|
|
136576
|
-
|
|
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
|
-
|
|
136581
|
-
|
|
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(
|
|
136622
|
+
return this._dispatchSubcommand(t3[1], [], [this._helpLongFlag]);
|
|
136585
136623
|
}
|
|
136586
136624
|
if (this._defaultCommandName) {
|
|
136587
|
-
outputHelpIfRequested(this,
|
|
136588
|
-
return this._dispatchSubcommand(this._defaultCommandName,
|
|
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.
|
|
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,
|
|
136616
|
-
} else if (
|
|
136657
|
+
this.parent.emit(n2, t3, e3);
|
|
136658
|
+
} else if (t3.length) {
|
|
136617
136659
|
if (this._findCommand("*")) {
|
|
136618
|
-
return this._dispatchSubcommand("*",
|
|
136660
|
+
return this._dispatchSubcommand("*", t3, e3);
|
|
136619
136661
|
}
|
|
136620
136662
|
if (this.listenerCount("command:*")) {
|
|
136621
|
-
this.emit("command:*",
|
|
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(
|
|
136637
|
-
if (!
|
|
136678
|
+
_findCommand(t3) {
|
|
136679
|
+
if (!t3)
|
|
136638
136680
|
return void 0;
|
|
136639
|
-
return this.commands.find((
|
|
136681
|
+
return this.commands.find((e3) => e3._name === t3 || e3._aliases.includes(t3));
|
|
136640
136682
|
}
|
|
136641
|
-
_findOption(
|
|
136642
|
-
return this.options.find((
|
|
136683
|
+
_findOption(t3) {
|
|
136684
|
+
return this.options.find((e3) => e3.is(t3));
|
|
136643
136685
|
}
|
|
136644
136686
|
_checkForMissingMandatoryOptions() {
|
|
136645
|
-
for (let
|
|
136646
|
-
|
|
136647
|
-
if (
|
|
136648
|
-
|
|
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
|
-
|
|
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 =
|
|
136657
|
-
const s2 =
|
|
136658
|
-
function maybeOption(
|
|
136659
|
-
return
|
|
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
|
|
136664
|
-
if (
|
|
136726
|
+
const t4 = s2.shift();
|
|
136727
|
+
if (t4 === "--") {
|
|
136665
136728
|
if (n2 === i3)
|
|
136666
|
-
n2.push(
|
|
136729
|
+
n2.push(t4);
|
|
136667
136730
|
n2.push(...s2);
|
|
136668
136731
|
break;
|
|
136669
136732
|
}
|
|
136670
|
-
if (r2 && !maybeOption(
|
|
136671
|
-
this.emit(`option:${r2.name()}`,
|
|
136733
|
+
if (r2 && !maybeOption(t4)) {
|
|
136734
|
+
this.emit(`option:${r2.name()}`, t4);
|
|
136672
136735
|
continue;
|
|
136673
136736
|
}
|
|
136674
136737
|
r2 = null;
|
|
136675
|
-
if (maybeOption(
|
|
136676
|
-
const
|
|
136677
|
-
if (
|
|
136678
|
-
if (
|
|
136679
|
-
const
|
|
136680
|
-
if (
|
|
136681
|
-
this.optionMissingArgument(
|
|
136682
|
-
this.emit(`option:${
|
|
136683
|
-
} else if (
|
|
136684
|
-
let
|
|
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
|
-
|
|
136749
|
+
t5 = s2.shift();
|
|
136687
136750
|
}
|
|
136688
|
-
this.emit(`option:${
|
|
136751
|
+
this.emit(`option:${e4.name()}`, t5);
|
|
136689
136752
|
} else {
|
|
136690
|
-
this.emit(`option:${
|
|
136753
|
+
this.emit(`option:${e4.name()}`);
|
|
136691
136754
|
}
|
|
136692
|
-
r2 =
|
|
136755
|
+
r2 = e4.variadic ? e4 : null;
|
|
136693
136756
|
continue;
|
|
136694
136757
|
}
|
|
136695
136758
|
}
|
|
136696
|
-
if (
|
|
136697
|
-
const
|
|
136698
|
-
if (
|
|
136699
|
-
if (
|
|
136700
|
-
this.emit(`option:${
|
|
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:${
|
|
136703
|
-
s2.unshift(`-${
|
|
136765
|
+
this.emit(`option:${e4.name()}`);
|
|
136766
|
+
s2.unshift(`-${t4.slice(2)}`);
|
|
136704
136767
|
}
|
|
136705
136768
|
continue;
|
|
136706
136769
|
}
|
|
136707
136770
|
}
|
|
136708
|
-
if (/^--[^=]+=/.test(
|
|
136709
|
-
const
|
|
136710
|
-
const i4 = this._findOption(
|
|
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()}`,
|
|
136775
|
+
this.emit(`option:${i4.name()}`, t4.slice(e4 + 1));
|
|
136713
136776
|
continue;
|
|
136714
136777
|
}
|
|
136715
136778
|
}
|
|
136716
|
-
if (maybeOption(
|
|
136779
|
+
if (maybeOption(t4)) {
|
|
136717
136780
|
n2 = i3;
|
|
136718
136781
|
}
|
|
136719
|
-
if ((this._enablePositionalOptions || this._passThroughOptions) &&
|
|
136720
|
-
if (this._findCommand(
|
|
136721
|
-
|
|
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 (
|
|
136726
|
-
|
|
136788
|
+
} else if (t4 === this._helpCommandName && this._hasImplicitHelpCommand()) {
|
|
136789
|
+
e3.push(t4);
|
|
136727
136790
|
if (s2.length > 0)
|
|
136728
|
-
|
|
136791
|
+
e3.push(...s2);
|
|
136729
136792
|
break;
|
|
136730
136793
|
} else if (this._defaultCommandName) {
|
|
136731
|
-
i3.push(
|
|
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(
|
|
136801
|
+
n2.push(t4);
|
|
136739
136802
|
if (s2.length > 0)
|
|
136740
136803
|
n2.push(...s2);
|
|
136741
136804
|
break;
|
|
136742
136805
|
}
|
|
136743
|
-
n2.push(
|
|
136806
|
+
n2.push(t4);
|
|
136744
136807
|
}
|
|
136745
|
-
return { operands:
|
|
136808
|
+
return { operands: e3, unknown: i3 };
|
|
136746
136809
|
}
|
|
136747
136810
|
opts() {
|
|
136748
136811
|
if (this._storeOptionsAsProperties) {
|
|
136749
|
-
const
|
|
136750
|
-
const
|
|
136751
|
-
for (let i3 = 0; i3 <
|
|
136752
|
-
const
|
|
136753
|
-
|
|
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
|
|
136818
|
+
return t3;
|
|
136756
136819
|
}
|
|
136757
136820
|
return this._optionValues;
|
|
136758
136821
|
}
|
|
136759
|
-
|
|
136760
|
-
this.
|
|
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
|
-
|
|
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((
|
|
136773
|
-
if (
|
|
136774
|
-
const
|
|
136775
|
-
if (this.getOptionValue(
|
|
136776
|
-
if (
|
|
136777
|
-
this.emit(`optionEnv:${
|
|
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:${
|
|
136848
|
+
this.emit(`optionEnv:${t3.name()}`);
|
|
136780
136849
|
}
|
|
136781
136850
|
}
|
|
136782
136851
|
}
|
|
136783
136852
|
});
|
|
136784
136853
|
}
|
|
136785
|
-
|
|
136786
|
-
const t3 =
|
|
136787
|
-
this.
|
|
136788
|
-
|
|
136789
|
-
|
|
136790
|
-
|
|
136791
|
-
|
|
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
|
-
|
|
136794
|
-
const
|
|
136795
|
-
this.
|
|
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(
|
|
136898
|
+
unknownOption(t3) {
|
|
136798
136899
|
if (this._allowUnknownOption)
|
|
136799
136900
|
return;
|
|
136800
|
-
let
|
|
136801
|
-
if (
|
|
136901
|
+
let e3 = "";
|
|
136902
|
+
if (t3.startsWith("--") && this._showSuggestionAfterError) {
|
|
136802
136903
|
let i4 = [];
|
|
136803
136904
|
let n2 = this;
|
|
136804
136905
|
do {
|
|
136805
|
-
const
|
|
136806
|
-
i4 = i4.concat(
|
|
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
|
-
|
|
136910
|
+
e3 = f(t3, i4);
|
|
136810
136911
|
}
|
|
136811
|
-
const i3 = `error: unknown option '${
|
|
136812
|
-
this.
|
|
136912
|
+
const i3 = `error: unknown option '${t3}'${e3}`;
|
|
136913
|
+
this.error(i3, { code: "commander.unknownOption" });
|
|
136813
136914
|
}
|
|
136814
|
-
_excessArguments(
|
|
136915
|
+
_excessArguments(t3) {
|
|
136815
136916
|
if (this._allowExcessArguments)
|
|
136816
136917
|
return;
|
|
136817
|
-
const
|
|
136818
|
-
const i3 =
|
|
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 ${
|
|
136821
|
-
this.
|
|
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
|
|
136825
|
-
let
|
|
136925
|
+
const t3 = this.args[0];
|
|
136926
|
+
let e3 = "";
|
|
136826
136927
|
if (this._showSuggestionAfterError) {
|
|
136827
136928
|
const i4 = [];
|
|
136828
|
-
this.createHelp().visibleCommands(this).forEach((
|
|
136829
|
-
i4.push(
|
|
136830
|
-
if (
|
|
136831
|
-
i4.push(
|
|
136929
|
+
this.createHelp().visibleCommands(this).forEach((t4) => {
|
|
136930
|
+
i4.push(t4.name());
|
|
136931
|
+
if (t4.alias())
|
|
136932
|
+
i4.push(t4.alias());
|
|
136832
136933
|
});
|
|
136833
|
-
|
|
136934
|
+
e3 = f(t3, i4);
|
|
136834
136935
|
}
|
|
136835
|
-
const i3 = `error: unknown command '${
|
|
136836
|
-
this.
|
|
136936
|
+
const i3 = `error: unknown command '${t3}'${e3}`;
|
|
136937
|
+
this.error(i3, { code: "commander.unknownCommand" });
|
|
136837
136938
|
}
|
|
136838
|
-
version(
|
|
136839
|
-
if (
|
|
136939
|
+
version(t3, e3, i3) {
|
|
136940
|
+
if (t3 === void 0)
|
|
136840
136941
|
return this._version;
|
|
136841
|
-
this._version =
|
|
136842
|
-
|
|
136942
|
+
this._version = t3;
|
|
136943
|
+
e3 = e3 || "-V, --version";
|
|
136843
136944
|
i3 = i3 || "output the version number";
|
|
136844
|
-
const n2 = this.createOption(
|
|
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(`${
|
|
136949
|
+
this._outputConfiguration.writeOut(`${t3}
|
|
136849
136950
|
`);
|
|
136850
|
-
this._exit(0, "commander.version",
|
|
136951
|
+
this._exit(0, "commander.version", t3);
|
|
136851
136952
|
});
|
|
136852
136953
|
return this;
|
|
136853
136954
|
}
|
|
136854
|
-
description(
|
|
136855
|
-
if (
|
|
136955
|
+
description(t3, e3) {
|
|
136956
|
+
if (t3 === void 0 && e3 === void 0)
|
|
136856
136957
|
return this._description;
|
|
136857
|
-
this._description =
|
|
136858
|
-
if (
|
|
136859
|
-
this._argsDescription =
|
|
136958
|
+
this._description = t3;
|
|
136959
|
+
if (e3) {
|
|
136960
|
+
this._argsDescription = e3;
|
|
136860
136961
|
}
|
|
136861
136962
|
return this;
|
|
136862
136963
|
}
|
|
136863
|
-
|
|
136864
|
-
if (
|
|
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
|
|
136973
|
+
let e3 = this;
|
|
136867
136974
|
if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
|
|
136868
|
-
|
|
136975
|
+
e3 = this.commands[this.commands.length - 1];
|
|
136869
136976
|
}
|
|
136870
|
-
if (
|
|
136977
|
+
if (t3 === e3._name)
|
|
136871
136978
|
throw new Error("Command alias can't be the same as its name");
|
|
136872
|
-
|
|
136979
|
+
e3._aliases.push(t3);
|
|
136873
136980
|
return this;
|
|
136874
136981
|
}
|
|
136875
|
-
aliases(
|
|
136876
|
-
if (
|
|
136982
|
+
aliases(t3) {
|
|
136983
|
+
if (t3 === void 0)
|
|
136877
136984
|
return this._aliases;
|
|
136878
|
-
|
|
136985
|
+
t3.forEach((t4) => this.alias(t4));
|
|
136879
136986
|
return this;
|
|
136880
136987
|
}
|
|
136881
|
-
usage(
|
|
136882
|
-
if (
|
|
136988
|
+
usage(t3) {
|
|
136989
|
+
if (t3 === void 0) {
|
|
136883
136990
|
if (this._usage)
|
|
136884
136991
|
return this._usage;
|
|
136885
|
-
const
|
|
136886
|
-
return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ?
|
|
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 =
|
|
136995
|
+
this._usage = t3;
|
|
136889
136996
|
return this;
|
|
136890
136997
|
}
|
|
136891
|
-
name(
|
|
136892
|
-
if (
|
|
136998
|
+
name(t3) {
|
|
136999
|
+
if (t3 === void 0)
|
|
136893
137000
|
return this._name;
|
|
136894
|
-
this._name =
|
|
137001
|
+
this._name = t3;
|
|
136895
137002
|
return this;
|
|
136896
137003
|
}
|
|
136897
|
-
|
|
136898
|
-
|
|
136899
|
-
|
|
136900
|
-
|
|
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
|
|
137019
|
+
return e3.formatHelp(this, e3);
|
|
136903
137020
|
}
|
|
136904
|
-
_getHelpContext(
|
|
136905
|
-
|
|
136906
|
-
const
|
|
137021
|
+
_getHelpContext(t3) {
|
|
137022
|
+
t3 = t3 || {};
|
|
137023
|
+
const e3 = { error: !!t3.error };
|
|
136907
137024
|
let i3;
|
|
136908
|
-
if (
|
|
136909
|
-
i3 = (
|
|
137025
|
+
if (e3.error) {
|
|
137026
|
+
i3 = (t4) => this._outputConfiguration.writeErr(t4);
|
|
136910
137027
|
} else {
|
|
136911
|
-
i3 = (
|
|
137028
|
+
i3 = (t4) => this._outputConfiguration.writeOut(t4);
|
|
136912
137029
|
}
|
|
136913
|
-
|
|
136914
|
-
|
|
136915
|
-
return
|
|
137030
|
+
e3.write = t3.write || i3;
|
|
137031
|
+
e3.command = this;
|
|
137032
|
+
return e3;
|
|
136916
137033
|
}
|
|
136917
|
-
outputHelp(
|
|
136918
|
-
let
|
|
136919
|
-
if (typeof
|
|
136920
|
-
|
|
136921
|
-
|
|
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(
|
|
136924
|
-
getCommandAndParents(this).reverse().forEach((
|
|
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 (
|
|
136928
|
-
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((
|
|
137053
|
+
getCommandAndParents(this).forEach((t4) => t4.emit("afterAllHelp", i3));
|
|
136937
137054
|
}
|
|
136938
|
-
helpOption(
|
|
136939
|
-
if (typeof
|
|
136940
|
-
this._hasHelpOption =
|
|
137055
|
+
helpOption(t3, e3) {
|
|
137056
|
+
if (typeof t3 === "boolean") {
|
|
137057
|
+
this._hasHelpOption = t3;
|
|
136941
137058
|
return this;
|
|
136942
137059
|
}
|
|
136943
|
-
this._helpFlags =
|
|
136944
|
-
this._helpDescription =
|
|
136945
|
-
const i3 =
|
|
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(
|
|
136951
|
-
this.outputHelp(
|
|
136952
|
-
let
|
|
136953
|
-
if (
|
|
136954
|
-
|
|
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(
|
|
137073
|
+
this._exit(e3, "commander.help", "(outputHelp)");
|
|
136957
137074
|
}
|
|
136958
|
-
addHelpText(
|
|
137075
|
+
addHelpText(t3, e3) {
|
|
136959
137076
|
const i3 = ["beforeAll", "before", "after", "afterAll"];
|
|
136960
|
-
if (!i3.includes(
|
|
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 = `${
|
|
136965
|
-
this.on(n2, (
|
|
137081
|
+
const n2 = `${t3}Help`;
|
|
137082
|
+
this.on(n2, (t4) => {
|
|
136966
137083
|
let i4;
|
|
136967
|
-
if (typeof
|
|
136968
|
-
i4 =
|
|
137084
|
+
if (typeof e3 === "function") {
|
|
137085
|
+
i4 = e3({ error: t4.error, command: t4.command });
|
|
136969
137086
|
} else {
|
|
136970
|
-
i4 =
|
|
137087
|
+
i4 = e3;
|
|
136971
137088
|
}
|
|
136972
137089
|
if (i4) {
|
|
136973
|
-
|
|
137090
|
+
t4.write(`${i4}
|
|
136974
137091
|
`);
|
|
136975
137092
|
}
|
|
136976
137093
|
});
|
|
136977
137094
|
return this;
|
|
136978
137095
|
}
|
|
136979
137096
|
}
|
|
136980
|
-
function outputHelpIfRequested(
|
|
136981
|
-
const i3 =
|
|
137097
|
+
function outputHelpIfRequested(t3, e3) {
|
|
137098
|
+
const i3 = t3._hasHelpOption && e3.find((e4) => e4 === t3._helpLongFlag || e4 === t3._helpShortFlag);
|
|
136982
137099
|
if (i3) {
|
|
136983
|
-
|
|
136984
|
-
|
|
137100
|
+
t3.outputHelp();
|
|
137101
|
+
t3._exit(0, "commander.helpDisplayed", "(outputHelp)");
|
|
136985
137102
|
}
|
|
136986
137103
|
}
|
|
136987
|
-
function incrementNodeInspectorPort(
|
|
136988
|
-
return
|
|
136989
|
-
if (!
|
|
136990
|
-
return
|
|
137104
|
+
function incrementNodeInspectorPort(t3) {
|
|
137105
|
+
return t3.map((t4) => {
|
|
137106
|
+
if (!t4.startsWith("--inspect")) {
|
|
137107
|
+
return t4;
|
|
136991
137108
|
}
|
|
136992
|
-
let
|
|
137109
|
+
let e3;
|
|
136993
137110
|
let i3 = "127.0.0.1";
|
|
136994
137111
|
let n2 = "9229";
|
|
136995
137112
|
let s2;
|
|
136996
|
-
if ((s2 =
|
|
136997
|
-
|
|
136998
|
-
} else if ((s2 =
|
|
136999
|
-
|
|
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 =
|
|
137006
|
-
|
|
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 (
|
|
137011
|
-
return `${
|
|
137127
|
+
if (e3 && n2 !== "0") {
|
|
137128
|
+
return `${e3}=${i3}:${parseInt(n2) + 1}`;
|
|
137012
137129
|
}
|
|
137013
|
-
return
|
|
137130
|
+
return t4;
|
|
137014
137131
|
});
|
|
137015
137132
|
}
|
|
137016
|
-
function getCommandAndParents(
|
|
137017
|
-
const
|
|
137018
|
-
for (let i3 =
|
|
137019
|
-
|
|
137133
|
+
function getCommandAndParents(t3) {
|
|
137134
|
+
const e3 = [];
|
|
137135
|
+
for (let i3 = t3; i3; i3 = i3.parent) {
|
|
137136
|
+
e3.push(i3);
|
|
137020
137137
|
}
|
|
137021
|
-
return
|
|
137138
|
+
return e3;
|
|
137022
137139
|
}
|
|
137023
|
-
|
|
137024
|
-
},
|
|
137140
|
+
e2.Command = Command2;
|
|
137141
|
+
}, 796: (t2, e2) => {
|
|
137025
137142
|
class CommanderError extends Error {
|
|
137026
|
-
constructor(
|
|
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 =
|
|
137031
|
-
this.exitCode =
|
|
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(
|
|
137037
|
-
super(1, "commander.invalidArgument",
|
|
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
|
-
|
|
137043
|
-
|
|
137044
|
-
},
|
|
137045
|
-
const { humanReadableArgName: n } = i2(
|
|
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
|
-
|
|
137053
|
-
|
|
137054
|
-
|
|
137055
|
-
|
|
137056
|
-
const
|
|
137057
|
-
s.
|
|
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
|
-
|
|
137178
|
+
e3.push(s);
|
|
137061
137179
|
}
|
|
137062
137180
|
if (this.sortSubcommands) {
|
|
137063
|
-
|
|
137181
|
+
e3.sort((t4, e4) => t4.name().localeCompare(e4.name()));
|
|
137064
137182
|
}
|
|
137065
|
-
return
|
|
137183
|
+
return e3;
|
|
137066
137184
|
}
|
|
137067
|
-
|
|
137068
|
-
const
|
|
137069
|
-
|
|
137070
|
-
|
|
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 =
|
|
137196
|
+
s = t3.createOption(t3._helpLongFlag, t3._helpDescription);
|
|
137075
137197
|
} else if (!n2) {
|
|
137076
|
-
s =
|
|
137198
|
+
s = t3.createOption(t3._helpShortFlag, t3._helpDescription);
|
|
137077
137199
|
} else {
|
|
137078
|
-
s =
|
|
137200
|
+
s = t3.createOption(t3._helpFlags, t3._helpDescription);
|
|
137079
137201
|
}
|
|
137080
|
-
|
|
137202
|
+
e3.push(s);
|
|
137081
137203
|
}
|
|
137082
137204
|
if (this.sortOptions) {
|
|
137083
|
-
|
|
137084
|
-
t3.sort((e4, t4) => getSortKey(e4).localeCompare(getSortKey(t4)));
|
|
137205
|
+
e3.sort(this.compareOptions);
|
|
137085
137206
|
}
|
|
137086
|
-
return
|
|
137207
|
+
return e3;
|
|
137087
137208
|
}
|
|
137088
|
-
|
|
137089
|
-
if (
|
|
137090
|
-
|
|
137091
|
-
|
|
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 (
|
|
137095
|
-
return
|
|
137228
|
+
if (t3._args.find((t4) => t4.description)) {
|
|
137229
|
+
return t3._args;
|
|
137096
137230
|
}
|
|
137097
137231
|
return [];
|
|
137098
137232
|
}
|
|
137099
|
-
subcommandTerm(
|
|
137100
|
-
const
|
|
137101
|
-
return
|
|
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(
|
|
137104
|
-
return
|
|
137237
|
+
optionTerm(t3) {
|
|
137238
|
+
return t3.flags;
|
|
137105
137239
|
}
|
|
137106
|
-
argumentTerm(
|
|
137107
|
-
return
|
|
137240
|
+
argumentTerm(t3) {
|
|
137241
|
+
return t3.name();
|
|
137108
137242
|
}
|
|
137109
|
-
longestSubcommandTermLength(
|
|
137110
|
-
return
|
|
137243
|
+
longestSubcommandTermLength(t3, e3) {
|
|
137244
|
+
return e3.visibleCommands(t3).reduce((t4, i3) => Math.max(t4, e3.subcommandTerm(i3).length), 0);
|
|
137111
137245
|
}
|
|
137112
|
-
longestOptionTermLength(
|
|
137113
|
-
return
|
|
137246
|
+
longestOptionTermLength(t3, e3) {
|
|
137247
|
+
return e3.visibleOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
|
|
137114
137248
|
}
|
|
137115
|
-
|
|
137116
|
-
return
|
|
137249
|
+
longestGlobalOptionTermLength(t3, e3) {
|
|
137250
|
+
return e3.visibleGlobalOptions(t3).reduce((t4, i3) => Math.max(t4, e3.optionTerm(i3).length), 0);
|
|
137117
137251
|
}
|
|
137118
|
-
|
|
137119
|
-
|
|
137120
|
-
|
|
137121
|
-
|
|
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
|
|
137125
|
-
i3 =
|
|
137261
|
+
for (let e4 = t3.parent; e4; e4 = e4.parent) {
|
|
137262
|
+
i3 = e4.name() + " " + i3;
|
|
137126
137263
|
}
|
|
137127
|
-
return i3 +
|
|
137264
|
+
return i3 + e3 + " " + t3.usage();
|
|
137128
137265
|
}
|
|
137129
|
-
commandDescription(
|
|
137130
|
-
return
|
|
137266
|
+
commandDescription(t3) {
|
|
137267
|
+
return t3.description();
|
|
137131
137268
|
}
|
|
137132
|
-
subcommandDescription(
|
|
137133
|
-
return
|
|
137269
|
+
subcommandDescription(t3) {
|
|
137270
|
+
return t3.summary() || t3.description();
|
|
137134
137271
|
}
|
|
137135
|
-
optionDescription(
|
|
137136
|
-
const
|
|
137137
|
-
if (
|
|
137138
|
-
|
|
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 (
|
|
137141
|
-
t3.
|
|
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 (
|
|
137144
|
-
|
|
137283
|
+
if (t3.presetArg !== void 0 && t3.optional) {
|
|
137284
|
+
e3.push(`preset: ${JSON.stringify(t3.presetArg)}`);
|
|
137145
137285
|
}
|
|
137146
|
-
if (t3.
|
|
137147
|
-
|
|
137286
|
+
if (t3.envVar !== void 0) {
|
|
137287
|
+
e3.push(`env: ${t3.envVar}`);
|
|
137148
137288
|
}
|
|
137149
|
-
|
|
137289
|
+
if (e3.length > 0) {
|
|
137290
|
+
return `${t3.description} (${e3.join(", ")})`;
|
|
137291
|
+
}
|
|
137292
|
+
return t3.description;
|
|
137150
137293
|
}
|
|
137151
|
-
argumentDescription(
|
|
137152
|
-
const
|
|
137153
|
-
if (
|
|
137154
|
-
|
|
137294
|
+
argumentDescription(t3) {
|
|
137295
|
+
const e3 = [];
|
|
137296
|
+
if (t3.argChoices) {
|
|
137297
|
+
e3.push(`choices: ${t3.argChoices.map((t4) => JSON.stringify(t4)).join(", ")}`);
|
|
137155
137298
|
}
|
|
137156
|
-
if (
|
|
137157
|
-
|
|
137299
|
+
if (t3.defaultValue !== void 0) {
|
|
137300
|
+
e3.push(`default: ${t3.defaultValueDescription || JSON.stringify(t3.defaultValue)}`);
|
|
137158
137301
|
}
|
|
137159
|
-
if (
|
|
137160
|
-
const i3 = `(${
|
|
137161
|
-
if (
|
|
137162
|
-
return `${
|
|
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
|
|
137309
|
+
return t3.description;
|
|
137167
137310
|
}
|
|
137168
|
-
formatHelp(
|
|
137169
|
-
const i3 =
|
|
137170
|
-
const n2 =
|
|
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(
|
|
137316
|
+
function formatItem(t4, o2) {
|
|
137174
137317
|
if (o2) {
|
|
137175
|
-
const a2 = `${
|
|
137176
|
-
return
|
|
137318
|
+
const a2 = `${t4.padEnd(i3 + r)}${o2}`;
|
|
137319
|
+
return e3.wrap(a2, n2 - s, i3 + r);
|
|
137177
137320
|
}
|
|
137178
|
-
return
|
|
137321
|
+
return t4;
|
|
137179
137322
|
}
|
|
137180
|
-
function formatList(
|
|
137181
|
-
return
|
|
137323
|
+
function formatList(t4) {
|
|
137324
|
+
return t4.join("\n").replace(/^/gm, " ".repeat(s));
|
|
137182
137325
|
}
|
|
137183
|
-
let o = [`Usage: ${
|
|
137184
|
-
const a =
|
|
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
|
|
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(["
|
|
137337
|
+
o = o.concat(["Options:", formatList(h), ""]);
|
|
137191
137338
|
}
|
|
137192
|
-
|
|
137193
|
-
|
|
137194
|
-
|
|
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 =
|
|
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(
|
|
137203
|
-
return Math.max(
|
|
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(
|
|
137206
|
-
|
|
137207
|
-
|
|
137208
|
-
|
|
137209
|
-
|
|
137210
|
-
|
|
137211
|
-
|
|
137212
|
-
|
|
137213
|
-
const a =
|
|
137214
|
-
const
|
|
137215
|
-
const
|
|
137216
|
-
|
|
137217
|
-
|
|
137218
|
-
|
|
137219
|
-
|
|
137220
|
-
|
|
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
|
-
|
|
137225
|
-
},
|
|
137226
|
-
const { InvalidArgumentError: n } = i2(
|
|
137377
|
+
e2.Help = Help;
|
|
137378
|
+
}, 437: (t2, e2, i2) => {
|
|
137379
|
+
const { InvalidArgumentError: n } = i2(796);
|
|
137227
137380
|
class Option {
|
|
137228
|
-
constructor(
|
|
137229
|
-
this.flags =
|
|
137230
|
-
this.description =
|
|
137231
|
-
this.required =
|
|
137232
|
-
this.optional =
|
|
137233
|
-
this.variadic = /\w\.\.\.[>\]]$/.test(
|
|
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(
|
|
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(
|
|
137250
|
-
this.defaultValue =
|
|
137251
|
-
this.defaultValueDescription =
|
|
137405
|
+
default(t3, e3) {
|
|
137406
|
+
this.defaultValue = t3;
|
|
137407
|
+
this.defaultValueDescription = e3;
|
|
137252
137408
|
return this;
|
|
137253
137409
|
}
|
|
137254
|
-
|
|
137255
|
-
this.
|
|
137410
|
+
preset(t3) {
|
|
137411
|
+
this.presetArg = t3;
|
|
137256
137412
|
return this;
|
|
137257
137413
|
}
|
|
137258
|
-
|
|
137259
|
-
this.
|
|
137414
|
+
conflicts(t3) {
|
|
137415
|
+
this.conflictsWith = this.conflictsWith.concat(t3);
|
|
137260
137416
|
return this;
|
|
137261
137417
|
}
|
|
137262
|
-
|
|
137263
|
-
this.
|
|
137418
|
+
implies(t3) {
|
|
137419
|
+
this.implied = Object.assign(this.implied || {}, t3);
|
|
137264
137420
|
return this;
|
|
137265
137421
|
}
|
|
137266
|
-
|
|
137267
|
-
this.
|
|
137422
|
+
env(t3) {
|
|
137423
|
+
this.envVar = t3;
|
|
137424
|
+
return this;
|
|
137425
|
+
}
|
|
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;
|
|
137268
137436
|
return this;
|
|
137269
137437
|
}
|
|
137270
|
-
_concatValue(
|
|
137271
|
-
if (
|
|
137272
|
-
return [
|
|
137438
|
+
_concatValue(t3, e3) {
|
|
137439
|
+
if (e3 === this.defaultValue || !Array.isArray(e3)) {
|
|
137440
|
+
return [t3];
|
|
137273
137441
|
}
|
|
137274
|
-
return
|
|
137442
|
+
return e3.concat(t3);
|
|
137275
137443
|
}
|
|
137276
|
-
choices(
|
|
137277
|
-
this.argChoices =
|
|
137278
|
-
this.parseArg = (
|
|
137279
|
-
if (!
|
|
137280
|
-
throw new n(`Allowed choices are ${
|
|
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(
|
|
137451
|
+
return this._concatValue(t4, e3);
|
|
137284
137452
|
}
|
|
137285
|
-
return
|
|
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(
|
|
137299
|
-
return this.short ===
|
|
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
|
-
|
|
137303
|
-
|
|
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
|
|
137306
|
-
|
|
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 =
|
|
137506
|
+
const n2 = t3.split(/[ |,]+/);
|
|
137309
137507
|
if (n2.length > 1 && !/^[[<]/.test(n2[1]))
|
|
137310
|
-
|
|
137508
|
+
e3 = n2.shift();
|
|
137311
137509
|
i3 = n2.shift();
|
|
137312
|
-
if (!
|
|
137313
|
-
|
|
137510
|
+
if (!e3 && /^-[^-]$/.test(i3)) {
|
|
137511
|
+
e3 = i3;
|
|
137314
137512
|
i3 = void 0;
|
|
137315
137513
|
}
|
|
137316
|
-
return { shortFlag:
|
|
137514
|
+
return { shortFlag: e3, longFlag: i3 };
|
|
137317
137515
|
}
|
|
137318
|
-
|
|
137319
|
-
|
|
137320
|
-
|
|
137516
|
+
e2.Option = Option;
|
|
137517
|
+
e2.splitOptionFlags = splitOptionFlags;
|
|
137518
|
+
e2.DualOptions = DualOptions;
|
|
137519
|
+
}, 860: (t2, e2) => {
|
|
137321
137520
|
const i2 = 3;
|
|
137322
|
-
function editDistance(
|
|
137323
|
-
if (Math.abs(
|
|
137324
|
-
return Math.max(
|
|
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[
|
|
137526
|
+
n[e4] = [e4];
|
|
137331
137527
|
}
|
|
137332
|
-
for (let
|
|
137333
|
-
|
|
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 (
|
|
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 &&
|
|
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[
|
|
137545
|
+
return n[t3.length][e3.length];
|
|
137347
137546
|
}
|
|
137348
|
-
function suggestSimilar(
|
|
137349
|
-
if (!
|
|
137547
|
+
function suggestSimilar(t3, e3) {
|
|
137548
|
+
if (!e3 || e3.length === 0)
|
|
137350
137549
|
return "";
|
|
137351
|
-
|
|
137352
|
-
const n =
|
|
137550
|
+
e3 = Array.from(new Set(e3));
|
|
137551
|
+
const n = t3.startsWith("--");
|
|
137353
137552
|
if (n) {
|
|
137354
|
-
|
|
137355
|
-
|
|
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
|
-
|
|
137361
|
-
if (
|
|
137559
|
+
e3.forEach((e4) => {
|
|
137560
|
+
if (e4.length <= 1)
|
|
137362
137561
|
return;
|
|
137363
|
-
const i3 = editDistance(
|
|
137364
|
-
const n2 = Math.max(
|
|
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 = [
|
|
137568
|
+
s = [e4];
|
|
137370
137569
|
} else if (i3 === r) {
|
|
137371
|
-
s.push(
|
|
137570
|
+
s.push(e4);
|
|
137372
137571
|
}
|
|
137373
137572
|
}
|
|
137374
137573
|
});
|
|
137375
|
-
s.sort((
|
|
137574
|
+
s.sort((t4, e4) => t4.localeCompare(e4));
|
|
137376
137575
|
if (n) {
|
|
137377
|
-
s = s.map((
|
|
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
|
-
|
|
137588
|
+
e2.suggestSimilar = suggestSimilar;
|
|
137390
137589
|
} };
|
|
137391
|
-
var
|
|
137590
|
+
var e = {};
|
|
137392
137591
|
function __nccwpck_require__(i2) {
|
|
137393
|
-
var n =
|
|
137592
|
+
var n = e[i2];
|
|
137394
137593
|
if (n !== void 0) {
|
|
137395
137594
|
return n.exports;
|
|
137396
137595
|
}
|
|
137397
|
-
var s =
|
|
137596
|
+
var s = e[i2] = { exports: {} };
|
|
137398
137597
|
var r = true;
|
|
137399
137598
|
try {
|
|
137400
|
-
|
|
137599
|
+
t[i2](s, s.exports, __nccwpck_require__);
|
|
137401
137600
|
r = false;
|
|
137402
137601
|
} finally {
|
|
137403
137602
|
if (r)
|
|
137404
|
-
delete
|
|
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__(
|
|
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 =
|
|
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 = 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
|
-
|
|
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
|
|
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/
|
|
140229
|
-
var
|
|
140230
|
-
"../../../toolkit/utils/dist/
|
|
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
|
|
140249
|
-
__export2(
|
|
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(
|
|
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)(
|
|
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)(
|
|
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: {
|
|
@@ -140959,6 +141063,143 @@ var require_getTargetDir = __commonJS({
|
|
|
140959
141063
|
}
|
|
140960
141064
|
});
|
|
140961
141065
|
|
|
141066
|
+
// ../../../toolkit/utils/dist/babel.js
|
|
141067
|
+
var require_babel = __commonJS({
|
|
141068
|
+
"../../../toolkit/utils/dist/babel.js"(exports, module2) {
|
|
141069
|
+
var __defProp2 = Object.defineProperty;
|
|
141070
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
141071
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
141072
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
141073
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
141074
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
141075
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
141076
|
+
var __spreadValues2 = (a, b) => {
|
|
141077
|
+
for (var prop in b || (b = {}))
|
|
141078
|
+
if (__hasOwnProp2.call(b, prop))
|
|
141079
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
141080
|
+
if (__getOwnPropSymbols2)
|
|
141081
|
+
for (var prop of __getOwnPropSymbols2(b)) {
|
|
141082
|
+
if (__propIsEnum2.call(b, prop))
|
|
141083
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
141084
|
+
}
|
|
141085
|
+
return a;
|
|
141086
|
+
};
|
|
141087
|
+
var __export2 = (target, all) => {
|
|
141088
|
+
for (var name in all)
|
|
141089
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
141090
|
+
};
|
|
141091
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
141092
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
141093
|
+
for (let key of __getOwnPropNames2(from))
|
|
141094
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
141095
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
141096
|
+
}
|
|
141097
|
+
return to;
|
|
141098
|
+
};
|
|
141099
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
141100
|
+
var babel_exports = {};
|
|
141101
|
+
__export2(babel_exports, {
|
|
141102
|
+
applyUserBabelConfig: () => applyUserBabelConfig,
|
|
141103
|
+
getBabelUtils: () => getBabelUtils
|
|
141104
|
+
});
|
|
141105
|
+
module2.exports = __toCommonJS2(babel_exports);
|
|
141106
|
+
var import_path4 = require("path");
|
|
141107
|
+
var import_applyOptionsChain = require_applyOptionsChain2();
|
|
141108
|
+
var import_ensureArray = require_ensureArray2();
|
|
141109
|
+
var import_path22 = require_path2();
|
|
141110
|
+
var formatPath = (originPath) => {
|
|
141111
|
+
if ((0, import_path4.isAbsolute)(originPath)) {
|
|
141112
|
+
return originPath.split(import_path4.sep).join("/");
|
|
141113
|
+
}
|
|
141114
|
+
return originPath;
|
|
141115
|
+
};
|
|
141116
|
+
var getPluginItemName = (item) => {
|
|
141117
|
+
if (typeof item === "string") {
|
|
141118
|
+
return formatPath(item);
|
|
141119
|
+
}
|
|
141120
|
+
if (Array.isArray(item) && typeof item[0] === "string") {
|
|
141121
|
+
return formatPath(item[0]);
|
|
141122
|
+
}
|
|
141123
|
+
return null;
|
|
141124
|
+
};
|
|
141125
|
+
var addPlugins = (plugins, config) => {
|
|
141126
|
+
if (config.plugins) {
|
|
141127
|
+
config.plugins.push(...plugins);
|
|
141128
|
+
} else {
|
|
141129
|
+
config.plugins = plugins;
|
|
141130
|
+
}
|
|
141131
|
+
};
|
|
141132
|
+
var addPresets = (presets, config) => {
|
|
141133
|
+
if (config.presets) {
|
|
141134
|
+
config.presets.push(...presets);
|
|
141135
|
+
} else {
|
|
141136
|
+
config.presets = presets;
|
|
141137
|
+
}
|
|
141138
|
+
};
|
|
141139
|
+
var removePlugins = (plugins, config) => {
|
|
141140
|
+
if (!config.plugins) {
|
|
141141
|
+
return;
|
|
141142
|
+
}
|
|
141143
|
+
const removeList = (0, import_ensureArray.ensureArray)(plugins);
|
|
141144
|
+
config.plugins = config.plugins.filter((item) => {
|
|
141145
|
+
const name = getPluginItemName(item);
|
|
141146
|
+
if (name) {
|
|
141147
|
+
return !removeList.find((removeItem) => name.includes(removeItem));
|
|
141148
|
+
}
|
|
141149
|
+
return true;
|
|
141150
|
+
});
|
|
141151
|
+
};
|
|
141152
|
+
var removePresets = (presets, config) => {
|
|
141153
|
+
if (!config.presets) {
|
|
141154
|
+
return;
|
|
141155
|
+
}
|
|
141156
|
+
const removeList = (0, import_ensureArray.ensureArray)(presets);
|
|
141157
|
+
config.presets = config.presets.filter((item) => {
|
|
141158
|
+
const name = getPluginItemName(item);
|
|
141159
|
+
if (name) {
|
|
141160
|
+
return !removeList.find((removeItem) => name.includes(removeItem));
|
|
141161
|
+
}
|
|
141162
|
+
return true;
|
|
141163
|
+
});
|
|
141164
|
+
};
|
|
141165
|
+
var modifyPresetOptions = (presetName, options, presets = []) => {
|
|
141166
|
+
presets.forEach((preset, index) => {
|
|
141167
|
+
if (Array.isArray(preset)) {
|
|
141168
|
+
if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
|
|
141169
|
+
preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
|
|
141170
|
+
}
|
|
141171
|
+
} else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
|
|
141172
|
+
presets[index] = [preset, options];
|
|
141173
|
+
}
|
|
141174
|
+
});
|
|
141175
|
+
};
|
|
141176
|
+
var getBabelUtils = (config) => {
|
|
141177
|
+
const noop = () => {
|
|
141178
|
+
};
|
|
141179
|
+
return {
|
|
141180
|
+
addPlugins: (plugins) => addPlugins(plugins, config),
|
|
141181
|
+
addPresets: (presets) => addPresets(presets, config),
|
|
141182
|
+
removePlugins: (plugins) => removePlugins(plugins, config),
|
|
141183
|
+
removePresets: (presets) => removePresets(presets, config),
|
|
141184
|
+
// `addIncludes` and `addExcludes` are noop functions by default,
|
|
141185
|
+
// It can be overridden by `extraBabelUtils`.
|
|
141186
|
+
addIncludes: noop,
|
|
141187
|
+
addExcludes: noop,
|
|
141188
|
+
// Compat `presetEnvOptions` and `presetReactOptions` in Eden.
|
|
141189
|
+
modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
|
|
141190
|
+
modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
|
|
141191
|
+
};
|
|
141192
|
+
};
|
|
141193
|
+
var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
|
|
141194
|
+
if (userBabelConfig) {
|
|
141195
|
+
const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
|
|
141196
|
+
return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
|
|
141197
|
+
}
|
|
141198
|
+
return defaultOptions;
|
|
141199
|
+
};
|
|
141200
|
+
}
|
|
141201
|
+
});
|
|
141202
|
+
|
|
140962
141203
|
// ../../../toolkit/utils/dist/index.js
|
|
140963
141204
|
var require_dist3 = __commonJS({
|
|
140964
141205
|
"../../../toolkit/utils/dist/index.js"(exports, module2) {
|
|
@@ -140980,7 +141221,6 @@ var require_dist3 = __commonJS({
|
|
|
140980
141221
|
module2.exports = __toCommonJS2(src_exports2);
|
|
140981
141222
|
__reExport(src_exports2, require_compiled2(), module2.exports);
|
|
140982
141223
|
__reExport(src_exports2, require_commands(), module2.exports);
|
|
140983
|
-
__reExport(src_exports2, require_format2(), module2.exports);
|
|
140984
141224
|
__reExport(src_exports2, require_FileSizeReporter2(), module2.exports);
|
|
140985
141225
|
__reExport(src_exports2, require_printBuildError2(), module2.exports);
|
|
140986
141226
|
__reExport(src_exports2, require_debug5(), module2.exports);
|
|
@@ -141012,7 +141252,7 @@ var require_dist3 = __commonJS({
|
|
|
141012
141252
|
__reExport(src_exports2, require_wait2(), module2.exports);
|
|
141013
141253
|
__reExport(src_exports2, require_emptyDir2(), module2.exports);
|
|
141014
141254
|
__reExport(src_exports2, require_getServerConfig2(), module2.exports);
|
|
141015
|
-
__reExport(src_exports2,
|
|
141255
|
+
__reExport(src_exports2, require_resolve(), module2.exports);
|
|
141016
141256
|
__reExport(src_exports2, require_analyzeProject2(), module2.exports);
|
|
141017
141257
|
__reExport(src_exports2, require_chainId2(), module2.exports);
|
|
141018
141258
|
__reExport(src_exports2, require_version2(), module2.exports);
|
|
@@ -141022,6 +141262,7 @@ var require_dist3 = __commonJS({
|
|
|
141022
141262
|
__reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
|
|
141023
141263
|
__reExport(src_exports2, require_react(), module2.exports);
|
|
141024
141264
|
__reExport(src_exports2, require_getTargetDir(), module2.exports);
|
|
141265
|
+
__reExport(src_exports2, require_babel(), module2.exports);
|
|
141025
141266
|
}
|
|
141026
141267
|
});
|
|
141027
141268
|
|