@modern-js/entry-generator 3.0.4 → 3.0.6
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/README.md +14 -18
- package/dist/index.js +138 -106
- package/package.json +8 -8
- package/src/index.ts +136 -0
package/README.md
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
|
|
2
1
|
<p align="center">
|
|
3
2
|
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
|
4
3
|
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Modern.js</h1>
|
|
6
|
+
|
|
5
7
|
<p align="center">
|
|
6
|
-
|
|
7
|
-
<br/>
|
|
8
|
-
<a href="https://modernjs.dev" target="blank">
|
|
9
|
-
modernjs.dev
|
|
10
|
-
</a>
|
|
11
|
-
</p>
|
|
12
|
-
<p align="center">
|
|
13
|
-
The meta-framework suite designed from scratch for frontend-focused modern web development
|
|
8
|
+
A Progressive React Framework for modern web development.
|
|
14
9
|
</p>
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
|
11
|
+
## Getting Started
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
|
|
21
14
|
|
|
22
|
-
##
|
|
15
|
+
## Documentation
|
|
23
16
|
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
- [API References](https://modernjs.dev/docs/apis)
|
|
17
|
+
- [English Documentation](https://modernjs.dev/en/)
|
|
18
|
+
- [中文文档](https://modernjs.dev)
|
|
27
19
|
|
|
28
20
|
## Contributing
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
|
package/dist/index.js
CHANGED
|
@@ -34714,6 +34714,26 @@ var require_compiled = __commonJS({
|
|
|
34714
34714
|
}
|
|
34715
34715
|
});
|
|
34716
34716
|
|
|
34717
|
+
// ../../../toolkit/utils/dist/commands.js
|
|
34718
|
+
var require_commands = __commonJS({
|
|
34719
|
+
"../../../toolkit/utils/dist/commands.js"(exports) {
|
|
34720
|
+
"use strict";
|
|
34721
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34722
|
+
exports.isDevCommand = exports.getCommand = void 0;
|
|
34723
|
+
var getCommand = () => {
|
|
34724
|
+
const args = process.argv.slice(2);
|
|
34725
|
+
const command = args[0];
|
|
34726
|
+
return command;
|
|
34727
|
+
};
|
|
34728
|
+
exports.getCommand = getCommand;
|
|
34729
|
+
var isDevCommand = () => {
|
|
34730
|
+
const command = (0, exports.getCommand)();
|
|
34731
|
+
return command === "dev" || command === "start";
|
|
34732
|
+
};
|
|
34733
|
+
exports.isDevCommand = isDevCommand;
|
|
34734
|
+
}
|
|
34735
|
+
});
|
|
34736
|
+
|
|
34717
34737
|
// ../../../toolkit/utils/dist/format.js
|
|
34718
34738
|
var require_format = __commonJS({
|
|
34719
34739
|
"../../../toolkit/utils/dist/format.js"(exports) {
|
|
@@ -35089,12 +35109,14 @@ var require_node_env = __commonJS({
|
|
|
35089
35109
|
"../../../toolkit/utils/dist/is/node-env.js"(exports) {
|
|
35090
35110
|
"use strict";
|
|
35091
35111
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35092
|
-
exports.isProdProfile = exports.isTest = exports.isProd = exports.isDev = void 0;
|
|
35093
|
-
var
|
|
35112
|
+
exports.isProdProfile = exports.isTest = exports.isProd = exports.isDev = exports.getNodeEnv = void 0;
|
|
35113
|
+
var getNodeEnv = () => process.env.NODE_ENV || "development";
|
|
35114
|
+
exports.getNodeEnv = getNodeEnv;
|
|
35115
|
+
var isDev = () => (0, exports.getNodeEnv)() === "development";
|
|
35094
35116
|
exports.isDev = isDev;
|
|
35095
|
-
var isProd = () =>
|
|
35117
|
+
var isProd = () => (0, exports.getNodeEnv)() === "production";
|
|
35096
35118
|
exports.isProd = isProd;
|
|
35097
|
-
var isTest = () =>
|
|
35119
|
+
var isTest = () => (0, exports.getNodeEnv)() === "test";
|
|
35098
35120
|
exports.isTest = isTest;
|
|
35099
35121
|
var isProdProfile = () => (0, exports.isProd)() && process.argv.includes("--profile");
|
|
35100
35122
|
exports.isProdProfile = isProdProfile;
|
|
@@ -35237,10 +35259,10 @@ var require_is = __commonJS({
|
|
|
35237
35259
|
|
|
35238
35260
|
// ../../../toolkit/utils/dist/compatRequire.js
|
|
35239
35261
|
var require_compatRequire = __commonJS({
|
|
35240
|
-
"../../../toolkit/utils/dist/compatRequire.js"(exports) {
|
|
35262
|
+
"../../../toolkit/utils/dist/compatRequire.js"(exports, module2) {
|
|
35241
35263
|
"use strict";
|
|
35242
35264
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35243
|
-
exports.cleanRequireCache = exports.requireExistModule = exports.dynamicImport = exports.compatRequire = void 0;
|
|
35265
|
+
exports.deleteRequireCache = exports.cleanRequireCache = exports.requireExistModule = exports.dynamicImport = exports.compatRequire = void 0;
|
|
35244
35266
|
var findExists_1 = require_findExists();
|
|
35245
35267
|
var compatRequire = (filePath, interop = true) => {
|
|
35246
35268
|
const mod = require(filePath);
|
|
@@ -35267,6 +35289,15 @@ var require_compatRequire = __commonJS({
|
|
|
35267
35289
|
});
|
|
35268
35290
|
};
|
|
35269
35291
|
exports.cleanRequireCache = cleanRequireCache;
|
|
35292
|
+
function deleteRequireCache(path4) {
|
|
35293
|
+
if (require.cache[path4]) {
|
|
35294
|
+
delete require.cache[path4];
|
|
35295
|
+
}
|
|
35296
|
+
if (module2.children) {
|
|
35297
|
+
module2.children = module2.children.filter((item) => item.filename !== path4);
|
|
35298
|
+
}
|
|
35299
|
+
}
|
|
35300
|
+
exports.deleteRequireCache = deleteRequireCache;
|
|
35270
35301
|
}
|
|
35271
35302
|
});
|
|
35272
35303
|
|
|
@@ -35288,7 +35319,7 @@ var require_constants = __commonJS({
|
|
|
35288
35319
|
exports.SERVER_DIR = "server";
|
|
35289
35320
|
exports.SHARED_DIR = "shared";
|
|
35290
35321
|
exports.CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
|
|
35291
|
-
exports.CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".
|
|
35322
|
+
exports.CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
|
|
35292
35323
|
exports.OUTPUT_CONFIG_FILE = "modern.config.json";
|
|
35293
35324
|
exports.DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
|
35294
35325
|
exports.ROUTE_MINIFEST_FILE = "routes-manifest.json";
|
|
@@ -35779,7 +35810,7 @@ var require_nodeEnv = __commonJS({
|
|
|
35779
35810
|
});
|
|
35780
35811
|
}
|
|
35781
35812
|
exports.canUseNpm = canUseNpm3;
|
|
35782
|
-
function
|
|
35813
|
+
function canUseYarn2() {
|
|
35783
35814
|
return __async(this, null, function* () {
|
|
35784
35815
|
try {
|
|
35785
35816
|
yield (0, compiled_1.execa)("yarn", ["--version"], { env: process.env });
|
|
@@ -35789,7 +35820,7 @@ var require_nodeEnv = __commonJS({
|
|
|
35789
35820
|
}
|
|
35790
35821
|
});
|
|
35791
35822
|
}
|
|
35792
|
-
exports.canUseYarn =
|
|
35823
|
+
exports.canUseYarn = canUseYarn2;
|
|
35793
35824
|
function canUsePnpm3() {
|
|
35794
35825
|
return __async(this, null, function* () {
|
|
35795
35826
|
try {
|
|
@@ -36868,6 +36899,7 @@ var require_dist = __commonJS({
|
|
|
36868
36899
|
};
|
|
36869
36900
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36870
36901
|
__exportStar(require_compiled(), exports);
|
|
36902
|
+
__exportStar(require_commands(), exports);
|
|
36871
36903
|
__exportStar(require_format(), exports);
|
|
36872
36904
|
__exportStar(require_FileSizeReporter(), exports);
|
|
36873
36905
|
__exportStar(require_printBuildError(), exports);
|
|
@@ -66974,7 +67006,7 @@ var require_nodeEnv2 = __commonJS({
|
|
|
66974
67006
|
});
|
|
66975
67007
|
}
|
|
66976
67008
|
exports.canUseNpm = canUseNpm3;
|
|
66977
|
-
function
|
|
67009
|
+
function canUseYarn2() {
|
|
66978
67010
|
return __async(this, null, function* () {
|
|
66979
67011
|
try {
|
|
66980
67012
|
yield (0, compiled_1.execa)("yarn", ["--version"], { env: process.env });
|
|
@@ -66984,7 +67016,7 @@ var require_nodeEnv2 = __commonJS({
|
|
|
66984
67016
|
}
|
|
66985
67017
|
});
|
|
66986
67018
|
}
|
|
66987
|
-
exports.canUseYarn =
|
|
67019
|
+
exports.canUseYarn = canUseYarn2;
|
|
66988
67020
|
function canUsePnpm3() {
|
|
66989
67021
|
return __async(this, null, function* () {
|
|
66990
67022
|
try {
|
|
@@ -75622,7 +75654,7 @@ var require_env = __commonJS({
|
|
|
75622
75654
|
exports.canUseNpm = canUseNpm3;
|
|
75623
75655
|
exports.canUseNvm = canUseNvm;
|
|
75624
75656
|
exports.canUsePnpm = canUsePnpm3;
|
|
75625
|
-
exports.canUseYarn =
|
|
75657
|
+
exports.canUseYarn = canUseYarn2;
|
|
75626
75658
|
var _utils = require_dist2();
|
|
75627
75659
|
function canUseNvm() {
|
|
75628
75660
|
return __async(this, null, function* () {
|
|
@@ -75649,7 +75681,7 @@ var require_env = __commonJS({
|
|
|
75649
75681
|
}
|
|
75650
75682
|
});
|
|
75651
75683
|
}
|
|
75652
|
-
function
|
|
75684
|
+
function canUseYarn2() {
|
|
75653
75685
|
return __async(this, null, function* () {
|
|
75654
75686
|
try {
|
|
75655
75687
|
yield (0, _utils.execa)("yarn", ["--version"], {
|
|
@@ -76685,14 +76717,14 @@ var require_packageManager = __commonJS({
|
|
|
76685
76717
|
value: true
|
|
76686
76718
|
});
|
|
76687
76719
|
exports.canUsePnpm = canUsePnpm3;
|
|
76688
|
-
exports.canUseYarn =
|
|
76720
|
+
exports.canUseYarn = canUseYarn2;
|
|
76689
76721
|
exports.runInstall = runInstall;
|
|
76690
76722
|
var _path = _interopRequireDefault(require("path"));
|
|
76691
76723
|
var _utils = require_dist2();
|
|
76692
76724
|
function _interopRequireDefault(obj) {
|
|
76693
76725
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
76694
76726
|
}
|
|
76695
|
-
function
|
|
76727
|
+
function canUseYarn2() {
|
|
76696
76728
|
return __async(this, null, function* () {
|
|
76697
76729
|
try {
|
|
76698
76730
|
yield (0, _utils.execa)("yarn", ["--version"], {
|
|
@@ -76739,7 +76771,7 @@ var require_packageManager = __commonJS({
|
|
|
76739
76771
|
params.push(`--registry=${registryUrl}`);
|
|
76740
76772
|
}
|
|
76741
76773
|
yield (0, _utils.execa)("pnpm", params, options);
|
|
76742
|
-
} else if (yield
|
|
76774
|
+
} else if (yield canUseYarn2()) {
|
|
76743
76775
|
const params = ["install", "--production", "--silent", "--ignore-scripts"];
|
|
76744
76776
|
if (registryUrl) {
|
|
76745
76777
|
params.push(`--registry=${registryUrl}`);
|
|
@@ -102004,12 +102036,12 @@ var require_figures = __commonJS({
|
|
|
102004
102036
|
var require_separator = __commonJS({
|
|
102005
102037
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/objects/separator.js"(exports, module2) {
|
|
102006
102038
|
"use strict";
|
|
102007
|
-
var
|
|
102039
|
+
var chalk2 = require_chalk2();
|
|
102008
102040
|
var figures = require_figures();
|
|
102009
102041
|
var Separator = class {
|
|
102010
102042
|
constructor(line) {
|
|
102011
102043
|
this.type = "separator";
|
|
102012
|
-
this.line =
|
|
102044
|
+
this.line = chalk2.dim(line || new Array(15).join(figures.line));
|
|
102013
102045
|
}
|
|
102014
102046
|
toString() {
|
|
102015
102047
|
return this.line;
|
|
@@ -121427,7 +121459,7 @@ var require_ora3 = __commonJS({
|
|
|
121427
121459
|
"../../../../node_modules/.pnpm/ora@5.4.1/node_modules/ora/index.js"(exports, module2) {
|
|
121428
121460
|
"use strict";
|
|
121429
121461
|
var readline = require("readline");
|
|
121430
|
-
var
|
|
121462
|
+
var chalk2 = require_chalk2();
|
|
121431
121463
|
var cliCursor = require_cli_cursor();
|
|
121432
121464
|
var cliSpinners = require_cli_spinners();
|
|
121433
121465
|
var logSymbols = require_browser2();
|
|
@@ -121623,7 +121655,7 @@ var require_ora3 = __commonJS({
|
|
|
121623
121655
|
const { frames } = this.spinner;
|
|
121624
121656
|
let frame = frames[this.frameIndex];
|
|
121625
121657
|
if (this.color) {
|
|
121626
|
-
frame =
|
|
121658
|
+
frame = chalk2[this.color](frame);
|
|
121627
121659
|
}
|
|
121628
121660
|
this.frameIndex = ++this.frameIndex % frames.length;
|
|
121629
121661
|
const fullPrefixText = typeof this.prefixText === "string" && this.prefixText !== "" ? this.prefixText + " " : "";
|
|
@@ -121872,7 +121904,7 @@ var require_base3 = __commonJS({
|
|
|
121872
121904
|
defaults: require_defaults2(),
|
|
121873
121905
|
clone: require_clone()
|
|
121874
121906
|
};
|
|
121875
|
-
var
|
|
121907
|
+
var chalk2 = require_chalk2();
|
|
121876
121908
|
var runAsync = require_run_async();
|
|
121877
121909
|
var { filter, flatMap, share, take, takeUntil } = require_operators();
|
|
121878
121910
|
var Choices = require_choices();
|
|
@@ -121890,7 +121922,7 @@ var require_base3 = __commonJS({
|
|
|
121890
121922
|
filteringText: "",
|
|
121891
121923
|
when: () => true,
|
|
121892
121924
|
suffix: "",
|
|
121893
|
-
prefix:
|
|
121925
|
+
prefix: chalk2.green("?")
|
|
121894
121926
|
});
|
|
121895
121927
|
if (!this.opt.name) {
|
|
121896
121928
|
this.throwParamError("name");
|
|
@@ -121963,12 +121995,12 @@ var require_base3 = __commonJS({
|
|
|
121963
121995
|
return value;
|
|
121964
121996
|
}
|
|
121965
121997
|
getQuestion() {
|
|
121966
|
-
let message = (this.opt.prefix ? this.opt.prefix + " " : "") +
|
|
121998
|
+
let message = (this.opt.prefix ? this.opt.prefix + " " : "") + chalk2.bold(this.opt.message) + this.opt.suffix + chalk2.reset(" ");
|
|
121967
121999
|
if (this.opt.default != null && this.status !== "touched" && this.status !== "answered") {
|
|
121968
122000
|
if (this.opt.type === "password") {
|
|
121969
|
-
message +=
|
|
122001
|
+
message += chalk2.italic.dim("[hidden] ");
|
|
121970
122002
|
} else {
|
|
121971
|
-
message +=
|
|
122003
|
+
message += chalk2.dim("(" + this.opt.default + ") ");
|
|
121972
122004
|
}
|
|
121973
122005
|
}
|
|
121974
122006
|
return message;
|
|
@@ -122030,7 +122062,7 @@ var require_events = __commonJS({
|
|
|
122030
122062
|
var require_paginator = __commonJS({
|
|
122031
122063
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/utils/paginator.js"(exports, module2) {
|
|
122032
122064
|
"use strict";
|
|
122033
|
-
var
|
|
122065
|
+
var chalk2 = require_chalk2();
|
|
122034
122066
|
var Paginator = class {
|
|
122035
122067
|
constructor(screen, options = {}) {
|
|
122036
122068
|
const { isInfinite = true } = options;
|
|
@@ -122051,7 +122083,7 @@ var require_paginator = __commonJS({
|
|
|
122051
122083
|
}
|
|
122052
122084
|
const visibleLines = this.isInfinite ? this.getInfiniteLines(lines, active, pageSize) : this.getFiniteLines(lines, active, pageSize);
|
|
122053
122085
|
this.lastIndex = active;
|
|
122054
|
-
return visibleLines.join("\n") + "\n" +
|
|
122086
|
+
return visibleLines.join("\n") + "\n" + chalk2.dim("(Move up and down to reveal more choices)");
|
|
122055
122087
|
}
|
|
122056
122088
|
getInfiniteLines(lines, active, pageSize) {
|
|
122057
122089
|
if (this.pointer === void 0) {
|
|
@@ -122107,7 +122139,7 @@ var require_incrementListIndex = __commonJS({
|
|
|
122107
122139
|
var require_list2 = __commonJS({
|
|
122108
122140
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/list.js"(exports, module2) {
|
|
122109
122141
|
"use strict";
|
|
122110
|
-
var
|
|
122142
|
+
var chalk2 = require_chalk2();
|
|
122111
122143
|
var figures = require_figures();
|
|
122112
122144
|
var cliCursor = require_cli_cursor();
|
|
122113
122145
|
var runAsync = require_run_async();
|
|
@@ -122156,10 +122188,10 @@ var require_list2 = __commonJS({
|
|
|
122156
122188
|
render() {
|
|
122157
122189
|
let message = this.getQuestion();
|
|
122158
122190
|
if (this.firstRender) {
|
|
122159
|
-
message +=
|
|
122191
|
+
message += chalk2.dim("(Use arrow keys)");
|
|
122160
122192
|
}
|
|
122161
122193
|
if (this.status === "answered") {
|
|
122162
|
-
message +=
|
|
122194
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
122163
122195
|
} else {
|
|
122164
122196
|
const choicesStr = listRender(this.opt.choices, this.selected);
|
|
122165
122197
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -122228,7 +122260,7 @@ var require_list2 = __commonJS({
|
|
|
122228
122260
|
const isSelected = i - separatorOffset === pointer;
|
|
122229
122261
|
let line = (isSelected ? figures.pointer + " " : " ") + choice.name;
|
|
122230
122262
|
if (isSelected) {
|
|
122231
|
-
line =
|
|
122263
|
+
line = chalk2.cyan(line);
|
|
122232
122264
|
}
|
|
122233
122265
|
output2 += line + " \n";
|
|
122234
122266
|
});
|
|
@@ -122242,7 +122274,7 @@ var require_list2 = __commonJS({
|
|
|
122242
122274
|
var require_input = __commonJS({
|
|
122243
122275
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/input.js"(exports, module2) {
|
|
122244
122276
|
"use strict";
|
|
122245
|
-
var
|
|
122277
|
+
var chalk2 = require_chalk2();
|
|
122246
122278
|
var { map: map2, takeUntil } = require_operators();
|
|
122247
122279
|
var Base = require_base3();
|
|
122248
122280
|
var observe2 = require_events();
|
|
@@ -122272,10 +122304,10 @@ var require_input = __commonJS({
|
|
|
122272
122304
|
if (transformer) {
|
|
122273
122305
|
message += transformer(appendContent, this.answers, { isFinal });
|
|
122274
122306
|
} else {
|
|
122275
|
-
message += isFinal ?
|
|
122307
|
+
message += isFinal ? chalk2.cyan(appendContent) : appendContent;
|
|
122276
122308
|
}
|
|
122277
122309
|
if (error) {
|
|
122278
|
-
bottomContent =
|
|
122310
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
122279
122311
|
}
|
|
122280
122312
|
this.screen.render(message, bottomContent);
|
|
122281
122313
|
}
|
|
@@ -122331,7 +122363,7 @@ var require_number = __commonJS({
|
|
|
122331
122363
|
var require_confirm = __commonJS({
|
|
122332
122364
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/confirm.js"(exports, module2) {
|
|
122333
122365
|
"use strict";
|
|
122334
|
-
var
|
|
122366
|
+
var chalk2 = require_chalk2();
|
|
122335
122367
|
var { take, takeUntil } = require_operators();
|
|
122336
122368
|
var Base = require_base3();
|
|
122337
122369
|
var observe2 = require_events();
|
|
@@ -122364,7 +122396,7 @@ var require_confirm = __commonJS({
|
|
|
122364
122396
|
render(answer) {
|
|
122365
122397
|
let message = this.getQuestion();
|
|
122366
122398
|
if (typeof answer === "boolean") {
|
|
122367
|
-
message +=
|
|
122399
|
+
message += chalk2.cyan(answer ? "Yes" : "No");
|
|
122368
122400
|
} else {
|
|
122369
122401
|
message += this.rl.line;
|
|
122370
122402
|
}
|
|
@@ -122390,7 +122422,7 @@ var require_confirm = __commonJS({
|
|
|
122390
122422
|
var require_rawlist = __commonJS({
|
|
122391
122423
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/rawlist.js"(exports, module2) {
|
|
122392
122424
|
"use strict";
|
|
122393
|
-
var
|
|
122425
|
+
var chalk2 = require_chalk2();
|
|
122394
122426
|
var { map: map2, takeUntil } = require_operators();
|
|
122395
122427
|
var Base = require_base3();
|
|
122396
122428
|
var Separator = require_separator();
|
|
@@ -122444,7 +122476,7 @@ var require_rawlist = __commonJS({
|
|
|
122444
122476
|
let message = this.getQuestion();
|
|
122445
122477
|
let bottomContent = "";
|
|
122446
122478
|
if (this.status === "answered") {
|
|
122447
|
-
message +=
|
|
122479
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
122448
122480
|
} else {
|
|
122449
122481
|
const choicesStr = renderChoices(this.opt.choices, this.selected);
|
|
122450
122482
|
message += "\n" + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
|
@@ -122452,7 +122484,7 @@ var require_rawlist = __commonJS({
|
|
|
122452
122484
|
}
|
|
122453
122485
|
message += this.rl.line;
|
|
122454
122486
|
if (error) {
|
|
122455
|
-
bottomContent = "\n" +
|
|
122487
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
122456
122488
|
}
|
|
122457
122489
|
this.screen.render(message, bottomContent);
|
|
122458
122490
|
}
|
|
@@ -122519,7 +122551,7 @@ var require_rawlist = __commonJS({
|
|
|
122519
122551
|
const index = i - separatorOffset;
|
|
122520
122552
|
let display = index + 1 + ") " + choice.name;
|
|
122521
122553
|
if (index === pointer) {
|
|
122522
|
-
display =
|
|
122554
|
+
display = chalk2.cyan(display);
|
|
122523
122555
|
}
|
|
122524
122556
|
output2 += display;
|
|
122525
122557
|
});
|
|
@@ -122533,7 +122565,7 @@ var require_rawlist = __commonJS({
|
|
|
122533
122565
|
var require_expand2 = __commonJS({
|
|
122534
122566
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/expand.js"(exports, module2) {
|
|
122535
122567
|
"use strict";
|
|
122536
|
-
var
|
|
122568
|
+
var chalk2 = require_chalk2();
|
|
122537
122569
|
var { map: map2, takeUntil } = require_operators();
|
|
122538
122570
|
var Base = require_base3();
|
|
122539
122571
|
var Separator = require_separator();
|
|
@@ -122576,7 +122608,7 @@ var require_expand2 = __commonJS({
|
|
|
122576
122608
|
let message = this.getQuestion();
|
|
122577
122609
|
let bottomContent = "";
|
|
122578
122610
|
if (this.status === "answered") {
|
|
122579
|
-
message +=
|
|
122611
|
+
message += chalk2.cyan(this.answer);
|
|
122580
122612
|
} else if (this.status === "expanded") {
|
|
122581
122613
|
const choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
|
122582
122614
|
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
|
|
@@ -122584,10 +122616,10 @@ var require_expand2 = __commonJS({
|
|
|
122584
122616
|
}
|
|
122585
122617
|
message += this.rl.line;
|
|
122586
122618
|
if (error) {
|
|
122587
|
-
bottomContent =
|
|
122619
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
122588
122620
|
}
|
|
122589
122621
|
if (hint) {
|
|
122590
|
-
bottomContent =
|
|
122622
|
+
bottomContent = chalk2.cyan(">> ") + hint;
|
|
122591
122623
|
}
|
|
122592
122624
|
this.screen.render(message, bottomContent);
|
|
122593
122625
|
}
|
|
@@ -122611,7 +122643,7 @@ var require_expand2 = __commonJS({
|
|
|
122611
122643
|
}
|
|
122612
122644
|
let choiceStr = choice.key + ") " + choice.name;
|
|
122613
122645
|
if (this.selectedKey === choice.key) {
|
|
122614
|
-
choiceStr =
|
|
122646
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
122615
122647
|
}
|
|
122616
122648
|
output2 += choiceStr;
|
|
122617
122649
|
});
|
|
@@ -122697,7 +122729,7 @@ var require_expand2 = __commonJS({
|
|
|
122697
122729
|
}
|
|
122698
122730
|
let choiceStr = choice.key + ") " + choice.name;
|
|
122699
122731
|
if (pointer === choice.key) {
|
|
122700
|
-
choiceStr =
|
|
122732
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
122701
122733
|
}
|
|
122702
122734
|
output2 += choiceStr;
|
|
122703
122735
|
});
|
|
@@ -122711,7 +122743,7 @@ var require_expand2 = __commonJS({
|
|
|
122711
122743
|
var require_checkbox = __commonJS({
|
|
122712
122744
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/checkbox.js"(exports, module2) {
|
|
122713
122745
|
"use strict";
|
|
122714
|
-
var
|
|
122746
|
+
var chalk2 = require_chalk2();
|
|
122715
122747
|
var cliCursor = require_cli_cursor();
|
|
122716
122748
|
var figures = require_figures();
|
|
122717
122749
|
var { map: map2, takeUntil } = require_operators();
|
|
@@ -122760,10 +122792,10 @@ var require_checkbox = __commonJS({
|
|
|
122760
122792
|
let message = this.getQuestion();
|
|
122761
122793
|
let bottomContent = "";
|
|
122762
122794
|
if (!this.dontShowHints) {
|
|
122763
|
-
message += "(Press " +
|
|
122795
|
+
message += "(Press " + chalk2.cyan.bold("<space>") + " to select, " + chalk2.cyan.bold("<a>") + " to toggle all, " + chalk2.cyan.bold("<i>") + " to invert selection, and " + chalk2.cyan.bold("<enter>") + " to proceed)";
|
|
122764
122796
|
}
|
|
122765
122797
|
if (this.status === "answered") {
|
|
122766
|
-
message +=
|
|
122798
|
+
message += chalk2.cyan(this.selection.join(", "));
|
|
122767
122799
|
} else {
|
|
122768
122800
|
const choicesStr = renderChoices(this.opt.choices, this.pointer);
|
|
122769
122801
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -122786,7 +122818,7 @@ var require_checkbox = __commonJS({
|
|
|
122786
122818
|
message += "\n" + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
|
|
122787
122819
|
}
|
|
122788
122820
|
if (error) {
|
|
122789
|
-
bottomContent =
|
|
122821
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
122790
122822
|
}
|
|
122791
122823
|
this.screen.render(message, bottomContent);
|
|
122792
122824
|
}
|
|
@@ -122869,7 +122901,7 @@ var require_checkbox = __commonJS({
|
|
|
122869
122901
|
} else {
|
|
122870
122902
|
const line = getCheckbox(choice.checked) + " " + choice.name;
|
|
122871
122903
|
if (i - separatorOffset === pointer) {
|
|
122872
|
-
output2 +=
|
|
122904
|
+
output2 += chalk2.cyan(figures.pointer + line);
|
|
122873
122905
|
} else {
|
|
122874
122906
|
output2 += " " + line;
|
|
122875
122907
|
}
|
|
@@ -122879,7 +122911,7 @@ var require_checkbox = __commonJS({
|
|
|
122879
122911
|
return output2.replace(/\n$/, "");
|
|
122880
122912
|
}
|
|
122881
122913
|
function getCheckbox(checked) {
|
|
122882
|
-
return checked ?
|
|
122914
|
+
return checked ? chalk2.green(figures.radioOn) : figures.radioOff;
|
|
122883
122915
|
}
|
|
122884
122916
|
module2.exports = CheckboxPrompt;
|
|
122885
122917
|
}
|
|
@@ -122889,7 +122921,7 @@ var require_checkbox = __commonJS({
|
|
|
122889
122921
|
var require_password = __commonJS({
|
|
122890
122922
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/password.js"(exports, module2) {
|
|
122891
122923
|
"use strict";
|
|
122892
|
-
var
|
|
122924
|
+
var chalk2 = require_chalk2();
|
|
122893
122925
|
var { map: map2, takeUntil } = require_operators();
|
|
122894
122926
|
var Base = require_base3();
|
|
122895
122927
|
var observe2 = require_events();
|
|
@@ -122922,15 +122954,15 @@ var require_password = __commonJS({
|
|
|
122922
122954
|
message += this.getMaskedValue(this.rl.line || "");
|
|
122923
122955
|
}
|
|
122924
122956
|
if (error) {
|
|
122925
|
-
bottomContent = "\n" +
|
|
122957
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
122926
122958
|
}
|
|
122927
122959
|
this.screen.render(message, bottomContent);
|
|
122928
122960
|
}
|
|
122929
122961
|
getMaskedValue(value) {
|
|
122930
122962
|
if (this.status === "answered") {
|
|
122931
|
-
return this.opt.mask ?
|
|
122963
|
+
return this.opt.mask ? chalk2.cyan(mask(value, this.opt.mask)) : chalk2.italic.dim("[hidden]");
|
|
122932
122964
|
}
|
|
122933
|
-
return this.opt.mask ? mask(value, this.opt.mask) :
|
|
122965
|
+
return this.opt.mask ? mask(value, this.opt.mask) : chalk2.italic.dim("[input is hidden] ");
|
|
122934
122966
|
}
|
|
122935
122967
|
getSpinningValue(value) {
|
|
122936
122968
|
return this.getMaskedValue(value);
|
|
@@ -132438,7 +132470,7 @@ var require_main = __commonJS({
|
|
|
132438
132470
|
var require_editor = __commonJS({
|
|
132439
132471
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/editor.js"(exports, module2) {
|
|
132440
132472
|
"use strict";
|
|
132441
|
-
var
|
|
132473
|
+
var chalk2 = require_chalk2();
|
|
132442
132474
|
var { editAsync } = require_main();
|
|
132443
132475
|
var Base = require_base3();
|
|
132444
132476
|
var observe2 = require_events();
|
|
@@ -132461,12 +132493,12 @@ var require_editor = __commonJS({
|
|
|
132461
132493
|
let bottomContent = "";
|
|
132462
132494
|
let message = this.getQuestion();
|
|
132463
132495
|
if (this.status === "answered") {
|
|
132464
|
-
message +=
|
|
132496
|
+
message += chalk2.dim("Received");
|
|
132465
132497
|
} else {
|
|
132466
|
-
message +=
|
|
132498
|
+
message += chalk2.dim("Press <enter> to launch your preferred editor.");
|
|
132467
132499
|
}
|
|
132468
132500
|
if (error) {
|
|
132469
|
-
bottomContent =
|
|
132501
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
132470
132502
|
}
|
|
132471
132503
|
this.screen.render(message, bottomContent);
|
|
132472
132504
|
}
|
|
@@ -133010,12 +133042,12 @@ var require_node7 = __commonJS({
|
|
|
133010
133042
|
var require_separator2 = __commonJS({
|
|
133011
133043
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/objects/separator.js"(exports, module2) {
|
|
133012
133044
|
"use strict";
|
|
133013
|
-
var
|
|
133045
|
+
var chalk2 = require_chalk2();
|
|
133014
133046
|
var figures = require_figures();
|
|
133015
133047
|
var Separator = class {
|
|
133016
133048
|
constructor(line) {
|
|
133017
133049
|
this.type = "separator";
|
|
133018
|
-
this.line =
|
|
133050
|
+
this.line = chalk2.dim(line || new Array(15).join(figures.line));
|
|
133019
133051
|
}
|
|
133020
133052
|
toString() {
|
|
133021
133053
|
return this.line;
|
|
@@ -134004,7 +134036,7 @@ var require_base4 = __commonJS({
|
|
|
134004
134036
|
defaults: require_defaults2(),
|
|
134005
134037
|
clone: require_clone()
|
|
134006
134038
|
};
|
|
134007
|
-
var
|
|
134039
|
+
var chalk2 = require_chalk2();
|
|
134008
134040
|
var runAsync = require_run_async();
|
|
134009
134041
|
var { filter, flatMap, share, take, takeUntil } = require_operators();
|
|
134010
134042
|
var Choices = require_choices2();
|
|
@@ -134022,7 +134054,7 @@ var require_base4 = __commonJS({
|
|
|
134022
134054
|
filteringText: "",
|
|
134023
134055
|
when: () => true,
|
|
134024
134056
|
suffix: "",
|
|
134025
|
-
prefix:
|
|
134057
|
+
prefix: chalk2.green("?")
|
|
134026
134058
|
});
|
|
134027
134059
|
if (!this.opt.name) {
|
|
134028
134060
|
this.throwParamError("name");
|
|
@@ -134095,12 +134127,12 @@ var require_base4 = __commonJS({
|
|
|
134095
134127
|
return value;
|
|
134096
134128
|
}
|
|
134097
134129
|
getQuestion() {
|
|
134098
|
-
let message = (this.opt.prefix ? this.opt.prefix + " " : "") +
|
|
134130
|
+
let message = (this.opt.prefix ? this.opt.prefix + " " : "") + chalk2.bold(this.opt.message) + this.opt.suffix + chalk2.reset(" ");
|
|
134099
134131
|
if (this.opt.default != null && this.status !== "touched" && this.status !== "answered") {
|
|
134100
134132
|
if (this.opt.type === "password") {
|
|
134101
|
-
message +=
|
|
134133
|
+
message += chalk2.italic.dim("[hidden] ");
|
|
134102
134134
|
} else {
|
|
134103
|
-
message +=
|
|
134135
|
+
message += chalk2.dim("(" + this.opt.default + ") ");
|
|
134104
134136
|
}
|
|
134105
134137
|
}
|
|
134106
134138
|
return message;
|
|
@@ -134195,7 +134227,7 @@ var require_paginator2 = __commonJS({
|
|
|
134195
134227
|
sum: require_sum(),
|
|
134196
134228
|
flatten: require_flatten()
|
|
134197
134229
|
};
|
|
134198
|
-
var
|
|
134230
|
+
var chalk2 = require_chalk2();
|
|
134199
134231
|
var Paginator = class {
|
|
134200
134232
|
constructor(screen, options = {}) {
|
|
134201
134233
|
const { isInfinite = true } = options;
|
|
@@ -134216,7 +134248,7 @@ var require_paginator2 = __commonJS({
|
|
|
134216
134248
|
}
|
|
134217
134249
|
const visibleLines = this.isInfinite ? this.getInfiniteLines(lines, active, pageSize) : this.getFiniteLines(lines, active, pageSize);
|
|
134218
134250
|
this.lastIndex = active;
|
|
134219
|
-
return visibleLines.join("\n") + "\n" +
|
|
134251
|
+
return visibleLines.join("\n") + "\n" + chalk2.dim("(Move up and down to reveal more choices)");
|
|
134220
134252
|
}
|
|
134221
134253
|
getInfiniteLines(lines, active, pageSize) {
|
|
134222
134254
|
if (this.pointer === void 0) {
|
|
@@ -134277,7 +134309,7 @@ var require_list3 = __commonJS({
|
|
|
134277
134309
|
findIndex: require_findIndex2(),
|
|
134278
134310
|
isString: require_isString()
|
|
134279
134311
|
};
|
|
134280
|
-
var
|
|
134312
|
+
var chalk2 = require_chalk2();
|
|
134281
134313
|
var figures = require_figures();
|
|
134282
134314
|
var cliCursor = require_cli_cursor();
|
|
134283
134315
|
var runAsync = require_run_async();
|
|
@@ -134329,10 +134361,10 @@ var require_list3 = __commonJS({
|
|
|
134329
134361
|
render() {
|
|
134330
134362
|
let message = this.getQuestion();
|
|
134331
134363
|
if (this.firstRender) {
|
|
134332
|
-
message +=
|
|
134364
|
+
message += chalk2.dim("(Use arrow keys)");
|
|
134333
134365
|
}
|
|
134334
134366
|
if (this.status === "answered") {
|
|
134335
|
-
message +=
|
|
134367
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
134336
134368
|
} else {
|
|
134337
134369
|
const choicesStr = listRender(this.opt.choices, this.selected);
|
|
134338
134370
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -134401,7 +134433,7 @@ var require_list3 = __commonJS({
|
|
|
134401
134433
|
const isSelected = i - separatorOffset === pointer;
|
|
134402
134434
|
let line = (isSelected ? figures.pointer + " " : " ") + choice.name;
|
|
134403
134435
|
if (isSelected) {
|
|
134404
|
-
line =
|
|
134436
|
+
line = chalk2.cyan(line);
|
|
134405
134437
|
}
|
|
134406
134438
|
output2 += line + " \n";
|
|
134407
134439
|
});
|
|
@@ -134415,7 +134447,7 @@ var require_list3 = __commonJS({
|
|
|
134415
134447
|
var require_input2 = __commonJS({
|
|
134416
134448
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/prompts/input.js"(exports, module2) {
|
|
134417
134449
|
"use strict";
|
|
134418
|
-
var
|
|
134450
|
+
var chalk2 = require_chalk2();
|
|
134419
134451
|
var { map: map2, takeUntil } = require_operators();
|
|
134420
134452
|
var Base = require_base4();
|
|
134421
134453
|
var observe2 = require_events2();
|
|
@@ -134445,10 +134477,10 @@ var require_input2 = __commonJS({
|
|
|
134445
134477
|
if (transformer) {
|
|
134446
134478
|
message += transformer(appendContent, this.answers, { isFinal });
|
|
134447
134479
|
} else {
|
|
134448
|
-
message += isFinal ?
|
|
134480
|
+
message += isFinal ? chalk2.cyan(appendContent) : appendContent;
|
|
134449
134481
|
}
|
|
134450
134482
|
if (error) {
|
|
134451
|
-
bottomContent =
|
|
134483
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
134452
134484
|
}
|
|
134453
134485
|
this.screen.render(message, bottomContent);
|
|
134454
134486
|
}
|
|
@@ -134521,7 +134553,7 @@ var require_confirm2 = __commonJS({
|
|
|
134521
134553
|
extend: require_extend(),
|
|
134522
134554
|
isBoolean: require_isBoolean()
|
|
134523
134555
|
};
|
|
134524
|
-
var
|
|
134556
|
+
var chalk2 = require_chalk2();
|
|
134525
134557
|
var { take, takeUntil } = require_operators();
|
|
134526
134558
|
var Base = require_base4();
|
|
134527
134559
|
var observe2 = require_events2();
|
|
@@ -134554,7 +134586,7 @@ var require_confirm2 = __commonJS({
|
|
|
134554
134586
|
render(answer) {
|
|
134555
134587
|
let message = this.getQuestion();
|
|
134556
134588
|
if (typeof answer === "boolean") {
|
|
134557
|
-
message +=
|
|
134589
|
+
message += chalk2.cyan(answer ? "Yes" : "No");
|
|
134558
134590
|
} else {
|
|
134559
134591
|
message += this.rl.line;
|
|
134560
134592
|
}
|
|
@@ -134585,7 +134617,7 @@ var require_rawlist2 = __commonJS({
|
|
|
134585
134617
|
isNumber: require_isNumber(),
|
|
134586
134618
|
findIndex: require_findIndex2()
|
|
134587
134619
|
};
|
|
134588
|
-
var
|
|
134620
|
+
var chalk2 = require_chalk2();
|
|
134589
134621
|
var { map: map2, takeUntil } = require_operators();
|
|
134590
134622
|
var Base = require_base4();
|
|
134591
134623
|
var Separator = require_separator2();
|
|
@@ -134640,7 +134672,7 @@ var require_rawlist2 = __commonJS({
|
|
|
134640
134672
|
let message = this.getQuestion();
|
|
134641
134673
|
let bottomContent = "";
|
|
134642
134674
|
if (this.status === "answered") {
|
|
134643
|
-
message +=
|
|
134675
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
134644
134676
|
} else {
|
|
134645
134677
|
const choicesStr = renderChoices(this.opt.choices, this.selected);
|
|
134646
134678
|
message += "\n" + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
|
@@ -134648,7 +134680,7 @@ var require_rawlist2 = __commonJS({
|
|
|
134648
134680
|
}
|
|
134649
134681
|
message += this.rl.line;
|
|
134650
134682
|
if (error) {
|
|
134651
|
-
bottomContent = "\n" +
|
|
134683
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
134652
134684
|
}
|
|
134653
134685
|
this.screen.render(message, bottomContent);
|
|
134654
134686
|
}
|
|
@@ -134706,7 +134738,7 @@ var require_rawlist2 = __commonJS({
|
|
|
134706
134738
|
const index = i - separatorOffset;
|
|
134707
134739
|
let display = index + 1 + ") " + choice.name;
|
|
134708
134740
|
if (index === pointer) {
|
|
134709
|
-
display =
|
|
134741
|
+
display = chalk2.cyan(display);
|
|
134710
134742
|
}
|
|
134711
134743
|
output2 += display;
|
|
134712
134744
|
});
|
|
@@ -134881,7 +134913,7 @@ var require_expand3 = __commonJS({
|
|
|
134881
134913
|
isNumber: require_isNumber(),
|
|
134882
134914
|
findIndex: require_findIndex2()
|
|
134883
134915
|
};
|
|
134884
|
-
var
|
|
134916
|
+
var chalk2 = require_chalk2();
|
|
134885
134917
|
var { map: map2, takeUntil } = require_operators();
|
|
134886
134918
|
var Base = require_base4();
|
|
134887
134919
|
var Separator = require_separator2();
|
|
@@ -134924,7 +134956,7 @@ var require_expand3 = __commonJS({
|
|
|
134924
134956
|
let message = this.getQuestion();
|
|
134925
134957
|
let bottomContent = "";
|
|
134926
134958
|
if (this.status === "answered") {
|
|
134927
|
-
message +=
|
|
134959
|
+
message += chalk2.cyan(this.answer);
|
|
134928
134960
|
} else if (this.status === "expanded") {
|
|
134929
134961
|
const choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
|
134930
134962
|
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
|
|
@@ -134932,10 +134964,10 @@ var require_expand3 = __commonJS({
|
|
|
134932
134964
|
}
|
|
134933
134965
|
message += this.rl.line;
|
|
134934
134966
|
if (error) {
|
|
134935
|
-
bottomContent =
|
|
134967
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
134936
134968
|
}
|
|
134937
134969
|
if (hint) {
|
|
134938
|
-
bottomContent =
|
|
134970
|
+
bottomContent = chalk2.cyan(">> ") + hint;
|
|
134939
134971
|
}
|
|
134940
134972
|
this.screen.render(message, bottomContent);
|
|
134941
134973
|
}
|
|
@@ -134959,7 +134991,7 @@ var require_expand3 = __commonJS({
|
|
|
134959
134991
|
}
|
|
134960
134992
|
let choiceStr = choice.key + ") " + choice.name;
|
|
134961
134993
|
if (this.selectedKey === choice.key) {
|
|
134962
|
-
choiceStr =
|
|
134994
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
134963
134995
|
}
|
|
134964
134996
|
output2 += choiceStr;
|
|
134965
134997
|
});
|
|
@@ -135048,7 +135080,7 @@ var require_expand3 = __commonJS({
|
|
|
135048
135080
|
}
|
|
135049
135081
|
let choiceStr = choice.key + ") " + choice.name;
|
|
135050
135082
|
if (pointer === choice.key) {
|
|
135051
|
-
choiceStr =
|
|
135083
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
135052
135084
|
}
|
|
135053
135085
|
output2 += choiceStr;
|
|
135054
135086
|
});
|
|
@@ -135067,7 +135099,7 @@ var require_checkbox2 = __commonJS({
|
|
|
135067
135099
|
map: require_map2(),
|
|
135068
135100
|
isString: require_isString()
|
|
135069
135101
|
};
|
|
135070
|
-
var
|
|
135102
|
+
var chalk2 = require_chalk2();
|
|
135071
135103
|
var cliCursor = require_cli_cursor();
|
|
135072
135104
|
var figures = require_figures();
|
|
135073
135105
|
var { map: map2, takeUntil } = require_operators();
|
|
@@ -135116,10 +135148,10 @@ var require_checkbox2 = __commonJS({
|
|
|
135116
135148
|
let message = this.getQuestion();
|
|
135117
135149
|
let bottomContent = "";
|
|
135118
135150
|
if (!this.spaceKeyPressed) {
|
|
135119
|
-
message += "(Press " +
|
|
135151
|
+
message += "(Press " + chalk2.cyan.bold("<space>") + " to select, " + chalk2.cyan.bold("<a>") + " to toggle all, " + chalk2.cyan.bold("<i>") + " to invert selection)";
|
|
135120
135152
|
}
|
|
135121
135153
|
if (this.status === "answered") {
|
|
135122
|
-
message +=
|
|
135154
|
+
message += chalk2.cyan(this.selection.join(", "));
|
|
135123
135155
|
} else {
|
|
135124
135156
|
const choicesStr = renderChoices(this.opt.choices, this.pointer);
|
|
135125
135157
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -135142,7 +135174,7 @@ var require_checkbox2 = __commonJS({
|
|
|
135142
135174
|
message += "\n" + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
|
|
135143
135175
|
}
|
|
135144
135176
|
if (error) {
|
|
135145
|
-
bottomContent =
|
|
135177
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
135146
135178
|
}
|
|
135147
135179
|
this.screen.render(message, bottomContent);
|
|
135148
135180
|
}
|
|
@@ -135226,7 +135258,7 @@ var require_checkbox2 = __commonJS({
|
|
|
135226
135258
|
} else {
|
|
135227
135259
|
const line = getCheckbox(choice.checked) + " " + choice.name;
|
|
135228
135260
|
if (i - separatorOffset === pointer) {
|
|
135229
|
-
output2 +=
|
|
135261
|
+
output2 += chalk2.cyan(figures.pointer + line);
|
|
135230
135262
|
} else {
|
|
135231
135263
|
output2 += " " + line;
|
|
135232
135264
|
}
|
|
@@ -135236,7 +135268,7 @@ var require_checkbox2 = __commonJS({
|
|
|
135236
135268
|
return output2.replace(/\n$/, "");
|
|
135237
135269
|
}
|
|
135238
135270
|
function getCheckbox(checked) {
|
|
135239
|
-
return checked ?
|
|
135271
|
+
return checked ? chalk2.green(figures.radioOn) : figures.radioOff;
|
|
135240
135272
|
}
|
|
135241
135273
|
module2.exports = CheckboxPrompt;
|
|
135242
135274
|
}
|
|
@@ -135246,7 +135278,7 @@ var require_checkbox2 = __commonJS({
|
|
|
135246
135278
|
var require_password2 = __commonJS({
|
|
135247
135279
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/prompts/password.js"(exports, module2) {
|
|
135248
135280
|
"use strict";
|
|
135249
|
-
var
|
|
135281
|
+
var chalk2 = require_chalk2();
|
|
135250
135282
|
var { map: map2, takeUntil } = require_operators();
|
|
135251
135283
|
var Base = require_base4();
|
|
135252
135284
|
var observe2 = require_events2();
|
|
@@ -135279,15 +135311,15 @@ var require_password2 = __commonJS({
|
|
|
135279
135311
|
message += this.getMaskedValue(this.rl.line || "");
|
|
135280
135312
|
}
|
|
135281
135313
|
if (error) {
|
|
135282
|
-
bottomContent = "\n" +
|
|
135314
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
135283
135315
|
}
|
|
135284
135316
|
this.screen.render(message, bottomContent);
|
|
135285
135317
|
}
|
|
135286
135318
|
getMaskedValue(value) {
|
|
135287
135319
|
if (this.status === "answered") {
|
|
135288
|
-
return this.opt.mask ?
|
|
135320
|
+
return this.opt.mask ? chalk2.cyan(mask(value, this.opt.mask)) : chalk2.italic.dim("[hidden]");
|
|
135289
135321
|
}
|
|
135290
|
-
return this.opt.mask ? mask(value, this.opt.mask) :
|
|
135322
|
+
return this.opt.mask ? mask(value, this.opt.mask) : chalk2.italic.dim("[input is hidden] ");
|
|
135291
135323
|
}
|
|
135292
135324
|
getSpinningValue(value) {
|
|
135293
135325
|
return this.getMaskedValue(value);
|
|
@@ -135323,7 +135355,7 @@ var require_password2 = __commonJS({
|
|
|
135323
135355
|
var require_editor2 = __commonJS({
|
|
135324
135356
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/prompts/editor.js"(exports, module2) {
|
|
135325
135357
|
"use strict";
|
|
135326
|
-
var
|
|
135358
|
+
var chalk2 = require_chalk2();
|
|
135327
135359
|
var { editAsync } = require_main();
|
|
135328
135360
|
var Base = require_base4();
|
|
135329
135361
|
var observe2 = require_events2();
|
|
@@ -135346,12 +135378,12 @@ var require_editor2 = __commonJS({
|
|
|
135346
135378
|
let bottomContent = "";
|
|
135347
135379
|
let message = this.getQuestion();
|
|
135348
135380
|
if (this.status === "answered") {
|
|
135349
|
-
message +=
|
|
135381
|
+
message += chalk2.dim("Received");
|
|
135350
135382
|
} else {
|
|
135351
|
-
message +=
|
|
135383
|
+
message += chalk2.dim("Press <enter> to launch your preferred editor.");
|
|
135352
135384
|
}
|
|
135353
135385
|
if (error) {
|
|
135354
|
-
bottomContent =
|
|
135386
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
135355
135387
|
}
|
|
135356
135388
|
this.screen.render(message, bottomContent);
|
|
135357
135389
|
}
|
|
@@ -136193,7 +136225,7 @@ var ZH_LOCALE = {
|
|
|
136193
136225
|
var EN_LOCALE = {
|
|
136194
136226
|
solution: {
|
|
136195
136227
|
self: "Please select the solution you want to create",
|
|
136196
|
-
mwa: "
|
|
136228
|
+
mwa: "Web App Solution",
|
|
136197
136229
|
module: "Module Solution",
|
|
136198
136230
|
monorepo: "Monorepo Solution",
|
|
136199
136231
|
custom: "Custom Solution",
|
|
@@ -136204,10 +136236,10 @@ var EN_LOCALE = {
|
|
|
136204
136236
|
},
|
|
136205
136237
|
sub_solution: {
|
|
136206
136238
|
self: "Please select the solution you want to create",
|
|
136207
|
-
mwa: "
|
|
136208
|
-
mwa_test: "
|
|
136239
|
+
mwa: "Web App Solution",
|
|
136240
|
+
mwa_test: "Web App Solution (Test)",
|
|
136209
136241
|
module: "Module Solution",
|
|
136210
|
-
inner_module: "Module Solution(Inner)",
|
|
136242
|
+
inner_module: "Module Solution (Inner)",
|
|
136211
136243
|
monorepo: "Monorepo Solution"
|
|
136212
136244
|
},
|
|
136213
136245
|
action: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/entry-generator",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "A Progressive React Framework for modern web development.",
|
|
4
4
|
"homepage": "https://modernjs.dev",
|
|
5
5
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
|
6
6
|
"repository": "modern-js-dev/modern.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "3.0.
|
|
14
|
+
"version": "3.0.6",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"main": "./dist/index.js",
|
|
17
17
|
"files": [
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"@types/node": "^14",
|
|
28
28
|
"jest": "^27",
|
|
29
29
|
"typescript": "^4",
|
|
30
|
-
"@modern-js/generator-utils": "3.0.
|
|
31
|
-
"@modern-js/
|
|
32
|
-
"@modern-js/
|
|
33
|
-
"@modern-js/generator-common": "3.0.
|
|
34
|
-
"@scripts/
|
|
35
|
-
"@scripts/
|
|
30
|
+
"@modern-js/generator-utils": "3.0.6",
|
|
31
|
+
"@modern-js/plugin-i18n": "2.4.0",
|
|
32
|
+
"@modern-js/utils": "2.4.0",
|
|
33
|
+
"@modern-js/generator-common": "3.0.6",
|
|
34
|
+
"@scripts/jest-config": "2.4.0",
|
|
35
|
+
"@scripts/build": "2.4.0"
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": false,
|
|
38
38
|
"publishConfig": {
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { merge } from '@modern-js/utils/lodash';
|
|
3
|
+
import { fs, getPackageObj, isTsProject } from '@modern-js/generator-utils';
|
|
4
|
+
import { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
|
|
5
|
+
import { AppAPI } from '@modern-js/codesmith-api-app';
|
|
6
|
+
import {
|
|
7
|
+
i18n as commonI18n,
|
|
8
|
+
getEntrySchema,
|
|
9
|
+
} from '@modern-js/generator-common';
|
|
10
|
+
import { isEmptySource, isSingleEntry } from './utils';
|
|
11
|
+
import { i18n, localeKeys } from './locale';
|
|
12
|
+
|
|
13
|
+
const handleInput = async (
|
|
14
|
+
context: GeneratorContext,
|
|
15
|
+
generator: GeneratorCore,
|
|
16
|
+
appApi: AppAPI,
|
|
17
|
+
) => {
|
|
18
|
+
const appDir = context.materials.default.basePath;
|
|
19
|
+
|
|
20
|
+
const { entriesDir } = context.config;
|
|
21
|
+
|
|
22
|
+
await fs.ensureDir(path.join(appDir, entriesDir));
|
|
23
|
+
|
|
24
|
+
const analysisInfo = {
|
|
25
|
+
isEmptySrc: isEmptySource(appDir, entriesDir),
|
|
26
|
+
isSingleEntry: isSingleEntry(appDir, entriesDir),
|
|
27
|
+
isTsProject: isTsProject(appDir),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
generator.logger.debug('analysisInfo:', analysisInfo);
|
|
31
|
+
|
|
32
|
+
const config = { ...context.config, ...analysisInfo };
|
|
33
|
+
const ans = await appApi.getInputBySchemaFunc(getEntrySchema, config);
|
|
34
|
+
|
|
35
|
+
return ans;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const refactorSingleEntry = async (
|
|
39
|
+
context: GeneratorContext,
|
|
40
|
+
generator: GeneratorCore,
|
|
41
|
+
) => {
|
|
42
|
+
const pkgObj = await getPackageObj(context);
|
|
43
|
+
const pkgName = pkgObj.name;
|
|
44
|
+
|
|
45
|
+
const { entriesDir } = context.config;
|
|
46
|
+
|
|
47
|
+
const oldFilePath = path.join(context.materials.default.basePath, entriesDir);
|
|
48
|
+
const oldFiles = fs
|
|
49
|
+
.readdirSync(oldFilePath)
|
|
50
|
+
.filter(filePath => {
|
|
51
|
+
if (fs.statSync(path.join(oldFilePath, filePath)).isDirectory()) {
|
|
52
|
+
const files = fs.readdirSync(path.join(oldFilePath, filePath));
|
|
53
|
+
return files.length;
|
|
54
|
+
}
|
|
55
|
+
return (
|
|
56
|
+
filePath !== '.eslintrc.json' &&
|
|
57
|
+
filePath !== '.eslintrc.js' &&
|
|
58
|
+
filePath !== 'modern-app-env.d.ts'
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
.map(file =>
|
|
62
|
+
path.join(context.materials.default.basePath, entriesDir, file),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// create new dir in entriesDir and move code to that dir
|
|
66
|
+
fs.mkdirpSync(
|
|
67
|
+
path.join(context.materials.default.basePath, entriesDir, pkgName),
|
|
68
|
+
);
|
|
69
|
+
oldFiles.forEach(file => {
|
|
70
|
+
generator.logger.debug(
|
|
71
|
+
`rename ${file} to ${file.replace(
|
|
72
|
+
entriesDir,
|
|
73
|
+
path.join(entriesDir, pkgName),
|
|
74
|
+
)}`,
|
|
75
|
+
);
|
|
76
|
+
fs.renameSync(
|
|
77
|
+
file,
|
|
78
|
+
file.replace(entriesDir, path.join(entriesDir, pkgName)),
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const handleTemplateFile = async (
|
|
84
|
+
context: GeneratorContext,
|
|
85
|
+
generator: GeneratorCore,
|
|
86
|
+
appApi: AppAPI,
|
|
87
|
+
) => {
|
|
88
|
+
const ans = await handleInput(context, generator, appApi);
|
|
89
|
+
|
|
90
|
+
if (ans.isSingleEntry) {
|
|
91
|
+
generator.logger.debug(
|
|
92
|
+
'current is single entry, refactoring to multi entry',
|
|
93
|
+
);
|
|
94
|
+
await refactorSingleEntry(context, generator);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const entryName = (ans.name as string) || '';
|
|
98
|
+
const fileExtra = ans.isTsProject ? 'tsx' : 'jsx';
|
|
99
|
+
const targetPath = path.join(context.config.entriesDir, entryName);
|
|
100
|
+
|
|
101
|
+
await appApi.forgeTemplate(`templates/**/*`, undefined, resourceKey =>
|
|
102
|
+
resourceKey
|
|
103
|
+
.replace('templates', targetPath)
|
|
104
|
+
.replace('.handlebars', `.${fileExtra}`),
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
|
109
|
+
const appApi = new AppAPI(context, generator);
|
|
110
|
+
|
|
111
|
+
const { locale } = context.config;
|
|
112
|
+
commonI18n.changeLanguage({ locale });
|
|
113
|
+
appApi.i18n.changeLanguage({ locale });
|
|
114
|
+
i18n.changeLanguage({ locale });
|
|
115
|
+
|
|
116
|
+
if (!(await appApi.checkEnvironment())) {
|
|
117
|
+
// eslint-disable-next-line no-process-exit
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
generator.logger.debug(`start run @modern-js/entry-generator`);
|
|
122
|
+
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
123
|
+
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
124
|
+
|
|
125
|
+
merge(context.config, { entriesDir: context.config.entriesDir || 'src' });
|
|
126
|
+
|
|
127
|
+
await handleTemplateFile(context, generator, appApi);
|
|
128
|
+
|
|
129
|
+
if (!context.config.isEmptySrc) {
|
|
130
|
+
appApi.showSuccessInfo(
|
|
131
|
+
i18n.t(localeKeys.success, { name: context.config.name }),
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
generator.logger.debug(`forge @modern-js/entry-generator succeed `);
|
|
136
|
+
};
|