create-rstack 1.8.0 → 1.8.2
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 +461 -417
- package/package.json +23 -21
- package/template-biome/package.json +1 -1
- package/template-eslint/react-js/package.json +4 -4
- package/template-eslint/react-ts/package.json +5 -5
- package/template-eslint/svelte-js/package.json +4 -4
- package/template-eslint/svelte-ts/package.json +5 -5
- package/template-eslint/vanilla-js/package.json +3 -3
- package/template-eslint/vanilla-ts/package.json +4 -4
- package/template-eslint/vue-js/package.json +4 -4
- package/template-eslint/vue-ts/package.json +5 -5
- package/dist/rslib-runtime.js +0 -39
package/dist/index.js
CHANGED
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import
|
|
3
|
-
import * as __rspack_external_fs from "fs";
|
|
4
|
-
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
5
|
-
import * as __rspack_external_node_fs_promises_153e37e0 from "node:fs/promises";
|
|
6
|
-
import * as __rspack_external_path from "path";
|
|
7
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
2
|
+
import node_fs from "node:fs";
|
|
8
3
|
import node_path, { dirname } from "node:path";
|
|
9
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import node_util, { styleText } from "node:util";
|
|
10
6
|
import node_process, { stdin, stdout } from "node:process";
|
|
11
7
|
import node_readline from "node:readline";
|
|
12
8
|
import node_tty from "node:tty";
|
|
13
|
-
import { styleText } from "node:util";
|
|
14
9
|
import node_os from "node:os";
|
|
10
|
+
import { createRequire as __rspack_createRequire } from "node:module";
|
|
11
|
+
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
12
|
+
var __webpack_modules__ = {};
|
|
13
|
+
var __webpack_module_cache__ = {};
|
|
14
|
+
function __webpack_require__(moduleId) {
|
|
15
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
16
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
17
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
18
|
+
exports: {}
|
|
19
|
+
};
|
|
20
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
21
|
+
return module.exports;
|
|
22
|
+
}
|
|
23
|
+
__webpack_require__.m = __webpack_modules__;
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.n = (module)=>{
|
|
26
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
27
|
+
__webpack_require__.d(getter, {
|
|
28
|
+
a: getter
|
|
29
|
+
});
|
|
30
|
+
return getter;
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
(()=>{
|
|
34
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
35
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: definition[key]
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
(()=>{
|
|
42
|
+
__webpack_require__.add = function(modules) {
|
|
43
|
+
Object.assign(__webpack_require__.m, modules);
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
48
|
+
})();
|
|
15
49
|
__webpack_require__.add({
|
|
16
|
-
"./node_modules/.pnpm/@vercel+detect-agent@1.1
|
|
50
|
+
"./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
17
51
|
var __defProp = Object.defineProperty;
|
|
18
52
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
19
53
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -43,37 +77,52 @@ __webpack_require__.add({
|
|
|
43
77
|
});
|
|
44
78
|
module.exports = __toCommonJS(src_exports);
|
|
45
79
|
var import_promises = __webpack_require__("node:fs/promises");
|
|
46
|
-
var import_node_fs = __webpack_require__("node:fs");
|
|
80
|
+
var import_node_fs = __webpack_require__("node:fs?31c0");
|
|
47
81
|
const DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
48
82
|
const CURSOR = "cursor";
|
|
49
83
|
const CURSOR_CLI = "cursor-cli";
|
|
50
84
|
const CLAUDE = "claude";
|
|
85
|
+
const COWORK = "cowork";
|
|
51
86
|
const DEVIN = "devin";
|
|
52
87
|
const REPLIT = "replit";
|
|
53
88
|
const GEMINI = "gemini";
|
|
54
89
|
const CODEX = "codex";
|
|
90
|
+
const ANTIGRAVITY = "antigravity";
|
|
55
91
|
const AUGMENT_CLI = "augment-cli";
|
|
56
92
|
const OPENCODE = "opencode";
|
|
93
|
+
const GITHUB_COPILOT = "github-copilot";
|
|
94
|
+
const GITHUB_COPILOT_CLI = "github-copilot-cli";
|
|
57
95
|
const KNOWN_AGENTS = {
|
|
58
96
|
CURSOR,
|
|
59
97
|
CURSOR_CLI,
|
|
60
98
|
CLAUDE,
|
|
99
|
+
COWORK,
|
|
61
100
|
DEVIN,
|
|
62
101
|
REPLIT,
|
|
63
102
|
GEMINI,
|
|
64
103
|
CODEX,
|
|
104
|
+
ANTIGRAVITY,
|
|
65
105
|
AUGMENT_CLI,
|
|
66
|
-
OPENCODE
|
|
106
|
+
OPENCODE,
|
|
107
|
+
GITHUB_COPILOT
|
|
67
108
|
};
|
|
68
109
|
async function determineAgent() {
|
|
69
110
|
if (process.env.AI_AGENT) {
|
|
70
111
|
const name = process.env.AI_AGENT.trim();
|
|
71
|
-
if (name)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
112
|
+
if (name) {
|
|
113
|
+
if (name === GITHUB_COPILOT || name === GITHUB_COPILOT_CLI) return {
|
|
114
|
+
isAgent: true,
|
|
115
|
+
agent: {
|
|
116
|
+
name: GITHUB_COPILOT
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
isAgent: true,
|
|
121
|
+
agent: {
|
|
122
|
+
name
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
77
126
|
}
|
|
78
127
|
if (process.env.CURSOR_TRACE_ID) return {
|
|
79
128
|
isAgent: true,
|
|
@@ -93,12 +142,18 @@ __webpack_require__.add({
|
|
|
93
142
|
name: GEMINI
|
|
94
143
|
}
|
|
95
144
|
};
|
|
96
|
-
if (process.env.CODEX_SANDBOX) return {
|
|
145
|
+
if (process.env.CODEX_SANDBOX || process.env.CODEX_CI || process.env.CODEX_THREAD_ID) return {
|
|
97
146
|
isAgent: true,
|
|
98
147
|
agent: {
|
|
99
148
|
name: CODEX
|
|
100
149
|
}
|
|
101
150
|
};
|
|
151
|
+
if (process.env.ANTIGRAVITY_AGENT) return {
|
|
152
|
+
isAgent: true,
|
|
153
|
+
agent: {
|
|
154
|
+
name: ANTIGRAVITY
|
|
155
|
+
}
|
|
156
|
+
};
|
|
102
157
|
if (process.env.AUGMENT_AGENT) return {
|
|
103
158
|
isAgent: true,
|
|
104
159
|
agent: {
|
|
@@ -111,16 +166,30 @@ __webpack_require__.add({
|
|
|
111
166
|
name: OPENCODE
|
|
112
167
|
}
|
|
113
168
|
};
|
|
114
|
-
if (process.env.CLAUDECODE || process.env.CLAUDE_CODE)
|
|
169
|
+
if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) {
|
|
170
|
+
if (process.env.CLAUDE_CODE_IS_COWORK) return {
|
|
171
|
+
isAgent: true,
|
|
172
|
+
agent: {
|
|
173
|
+
name: COWORK
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
return {
|
|
177
|
+
isAgent: true,
|
|
178
|
+
agent: {
|
|
179
|
+
name: CLAUDE
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (process.env.REPL_ID) return {
|
|
115
184
|
isAgent: true,
|
|
116
185
|
agent: {
|
|
117
|
-
name:
|
|
186
|
+
name: REPLIT
|
|
118
187
|
}
|
|
119
188
|
};
|
|
120
|
-
if (process.env.
|
|
189
|
+
if (process.env.COPILOT_MODEL || process.env.COPILOT_ALLOW_ALL || process.env.COPILOT_GITHUB_TOKEN) return {
|
|
121
190
|
isAgent: true,
|
|
122
191
|
agent: {
|
|
123
|
-
name:
|
|
192
|
+
name: GITHUB_COPILOT
|
|
124
193
|
}
|
|
125
194
|
};
|
|
126
195
|
try {
|
|
@@ -131,7 +200,7 @@ __webpack_require__.add({
|
|
|
131
200
|
name: DEVIN
|
|
132
201
|
}
|
|
133
202
|
};
|
|
134
|
-
} catch (
|
|
203
|
+
} catch (_error) {}
|
|
135
204
|
return {
|
|
136
205
|
isAgent: false,
|
|
137
206
|
agent: void 0
|
|
@@ -692,72 +761,6 @@ __webpack_require__.add({
|
|
|
692
761
|
module.exports = pathKey;
|
|
693
762
|
module.exports["default"] = pathKey;
|
|
694
763
|
},
|
|
695
|
-
"./node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
|
|
696
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
697
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
698
|
-
let formatter = (open, close, replace = open)=>(input)=>{
|
|
699
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
700
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
701
|
-
};
|
|
702
|
-
let replaceClose = (string, close, replace, index)=>{
|
|
703
|
-
let result = "", cursor = 0;
|
|
704
|
-
do {
|
|
705
|
-
result += string.substring(cursor, index) + replace;
|
|
706
|
-
cursor = index + close.length;
|
|
707
|
-
index = string.indexOf(close, cursor);
|
|
708
|
-
}while (~index);
|
|
709
|
-
return result + string.substring(cursor);
|
|
710
|
-
};
|
|
711
|
-
let createColors = (enabled = isColorSupported)=>{
|
|
712
|
-
let f = enabled ? formatter : ()=>String;
|
|
713
|
-
return {
|
|
714
|
-
isColorSupported: enabled,
|
|
715
|
-
reset: f("\x1b[0m", "\x1b[0m"),
|
|
716
|
-
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
717
|
-
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
718
|
-
italic: f("\x1b[3m", "\x1b[23m"),
|
|
719
|
-
underline: f("\x1b[4m", "\x1b[24m"),
|
|
720
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
721
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
722
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
723
|
-
black: f("\x1b[30m", "\x1b[39m"),
|
|
724
|
-
red: f("\x1b[31m", "\x1b[39m"),
|
|
725
|
-
green: f("\x1b[32m", "\x1b[39m"),
|
|
726
|
-
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
727
|
-
blue: f("\x1b[34m", "\x1b[39m"),
|
|
728
|
-
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
729
|
-
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
730
|
-
white: f("\x1b[37m", "\x1b[39m"),
|
|
731
|
-
gray: f("\x1b[90m", "\x1b[39m"),
|
|
732
|
-
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
733
|
-
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
734
|
-
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
735
|
-
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
736
|
-
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
737
|
-
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
738
|
-
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
739
|
-
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
740
|
-
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
741
|
-
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
742
|
-
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
743
|
-
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
744
|
-
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
745
|
-
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
746
|
-
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
747
|
-
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
748
|
-
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
749
|
-
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
750
|
-
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
751
|
-
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
752
|
-
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
753
|
-
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
754
|
-
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
755
|
-
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
756
|
-
};
|
|
757
|
-
};
|
|
758
|
-
module.exports = createColors();
|
|
759
|
-
module.exports.createColors = createColors;
|
|
760
|
-
},
|
|
761
764
|
"./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
762
765
|
const shebangRegex = __webpack_require__("./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");
|
|
763
766
|
module.exports = (string = '')=>{
|
|
@@ -914,51 +917,54 @@ __webpack_require__.add({
|
|
|
914
917
|
which.sync = whichSync;
|
|
915
918
|
},
|
|
916
919
|
child_process (module) {
|
|
917
|
-
module.exports =
|
|
920
|
+
module.exports = __rspack_createRequire_require("child_process");
|
|
918
921
|
},
|
|
919
922
|
fs (module) {
|
|
920
|
-
module.exports =
|
|
923
|
+
module.exports = __rspack_createRequire_require("fs");
|
|
921
924
|
},
|
|
922
|
-
"node:fs" (module) {
|
|
923
|
-
module.exports =
|
|
925
|
+
"node:fs?31c0" (module) {
|
|
926
|
+
module.exports = __rspack_createRequire_require("node:fs");
|
|
924
927
|
},
|
|
925
928
|
"node:fs/promises" (module) {
|
|
926
|
-
module.exports =
|
|
929
|
+
module.exports = __rspack_createRequire_require("node:fs/promises");
|
|
927
930
|
},
|
|
928
931
|
path (module) {
|
|
929
|
-
module.exports =
|
|
932
|
+
module.exports = __rspack_createRequire_require("path");
|
|
930
933
|
}
|
|
931
934
|
});
|
|
932
935
|
const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
const
|
|
936
|
+
function x(t, e, s) {
|
|
937
|
+
if (!s.some((u)=>!u.disabled)) return t;
|
|
938
|
+
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
939
|
+
return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
|
|
940
|
+
}
|
|
941
|
+
const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 === t || 173 === t || 174 === t || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || 198 === t || 208 === t || 215 === t || 216 === t || t >= 222 && t <= 225 || 230 === t || t >= 232 && t <= 234 || 236 === t || 237 === t || 240 === t || 242 === t || 243 === t || t >= 247 && t <= 250 || 252 === t || 254 === t || 257 === t || 273 === t || 275 === t || 283 === t || 294 === t || 295 === t || 299 === t || t >= 305 && t <= 307 || 312 === t || t >= 319 && t <= 322 || 324 === t || t >= 328 && t <= 331 || 333 === t || 338 === t || 339 === t || 358 === t || 359 === t || 363 === t || 462 === t || 464 === t || 466 === t || 468 === t || 470 === t || 472 === t || 474 === t || 476 === t || 593 === t || 609 === t || 708 === t || 711 === t || t >= 713 && t <= 715 || 717 === t || 720 === t || t >= 728 && t <= 731 || 733 === t || 735 === t || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || 1025 === t || t >= 1040 && t <= 1103 || 1105 === t || 8208 === t || t >= 8211 && t <= 8214 || 8216 === t || 8217 === t || 8220 === t || 8221 === t || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || 8240 === t || 8242 === t || 8243 === t || 8245 === t || 8251 === t || 8254 === t || 8308 === t || 8319 === t || t >= 8321 && t <= 8324 || 8364 === t || 8451 === t || 8453 === t || 8457 === t || 8467 === t || 8470 === t || 8481 === t || 8482 === t || 8486 === t || 8491 === t || 8531 === t || 8532 === t || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || 8585 === t || t >= 8592 && t <= 8601 || 8632 === t || 8633 === t || 8658 === t || 8660 === t || 8679 === t || 8704 === t || 8706 === t || 8707 === t || 8711 === t || 8712 === t || 8715 === t || 8719 === t || 8721 === t || 8725 === t || 8730 === t || t >= 8733 && t <= 8736 || 8739 === t || 8741 === t || t >= 8743 && t <= 8748 || 8750 === t || t >= 8756 && t <= 8759 || 8764 === t || 8765 === t || 8776 === t || 8780 === t || 8786 === t || 8800 === t || 8801 === t || t >= 8804 && t <= 8807 || 8810 === t || 8811 === t || 8814 === t || 8815 === t || 8834 === t || 8835 === t || 8838 === t || 8839 === t || 8853 === t || 8857 === t || 8869 === t || 8895 === t || 8978 === t || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || 9632 === t || 9633 === t || t >= 9635 && t <= 9641 || 9650 === t || 9651 === t || 9654 === t || 9655 === t || 9660 === t || 9661 === t || 9664 === t || 9665 === t || t >= 9670 && t <= 9672 || 9675 === t || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || 9711 === t || 9733 === t || 9734 === t || 9737 === t || 9742 === t || 9743 === t || 9756 === t || 9758 === t || 9792 === t || 9794 === t || 9824 === t || 9825 === t || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || 9836 === t || 9837 === t || 9839 === t || 9886 === t || 9887 === t || 9919 === t || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || 9955 === t || 9960 === t || 9961 === t || t >= 9963 && t <= 9969 || 9972 === t || t >= 9974 && t <= 9977 || 9979 === t || 9980 === t || 9982 === t || 9983 === t || 10045 === t || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || 65533 === t || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || 127375 === t || 127376 === t || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t)=>12288 === t || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, dist_ht = (t)=>t >= 4352 && t <= 4447 || 8986 === t || 8987 === t || 9001 === t || 9002 === t || t >= 9193 && t <= 9196 || 9200 === t || 9203 === t || 9725 === t || 9726 === t || 9748 === t || 9749 === t || t >= 9800 && t <= 9811 || 9855 === t || 9875 === t || 9889 === t || 9898 === t || 9899 === t || 9917 === t || 9918 === t || 9924 === t || 9925 === t || 9934 === t || 9940 === t || 9962 === t || 9970 === t || 9971 === t || 9973 === t || 9978 === t || 9981 === t || 9989 === t || 9994 === t || 9995 === t || 10024 === t || 10060 === t || 10062 === t || t >= 10067 && t <= 10069 || 10071 === t || t >= 10133 && t <= 10135 || 10160 === t || 10175 === t || 11035 === t || 11036 === t || 11088 === t || 11093 === t || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || 94192 === t || 94193 === t || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || 110589 === t || 110590 === t || t >= 110592 && t <= 110882 || 110898 === t || t >= 110928 && t <= 110930 || 110933 === t || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || 126980 === t || 127183 === t || 127374 === t || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || 127568 === t || 127569 === t || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || 127988 === t || t >= 127992 && t <= 128062 || 128064 === t || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || 128378 === t || 128405 === t || 128406 === t || 128420 === t || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || 128716 === t || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || 128747 === t || 128748 === t || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || 129008 === t || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, dist_O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, dist_y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, dist_L = /\t{1,1000}/y, dist_P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, dist_M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, ft = {
|
|
936
942
|
limit: 1 / 0,
|
|
937
943
|
ellipsis: ""
|
|
938
|
-
},
|
|
939
|
-
const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ?
|
|
940
|
-
let h = 0, o = 0,
|
|
944
|
+
}, X = (t, e = {}, s = {})=>{
|
|
945
|
+
const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
946
|
+
let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
941
947
|
t: for(;;){
|
|
942
|
-
if (
|
|
943
|
-
const ut = t.slice(C,
|
|
948
|
+
if (w > C || o >= p && o > h) {
|
|
949
|
+
const ut = t.slice(C, w) || t.slice(h, o);
|
|
944
950
|
v = 0;
|
|
945
|
-
for (const Y of ut.replaceAll(
|
|
951
|
+
for (const Y of ut.replaceAll(ct, "")){
|
|
946
952
|
const $ = Y.codePointAt(0) || 0;
|
|
947
|
-
if (
|
|
953
|
+
if (lt($) ? f = m : dist_ht($) ? f = V : E !== A && dist_at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
948
954
|
F = !0;
|
|
949
955
|
break t;
|
|
950
956
|
}
|
|
951
|
-
v += Y.length, c +=
|
|
957
|
+
v += Y.length, c += f;
|
|
952
958
|
}
|
|
953
|
-
C =
|
|
959
|
+
C = w = 0;
|
|
954
960
|
}
|
|
955
|
-
if (o >=
|
|
956
|
-
if (
|
|
957
|
-
if (v =
|
|
961
|
+
if (o >= p) break;
|
|
962
|
+
if (dist_M.lastIndex = o, dist_M.test(t)) {
|
|
963
|
+
if (v = dist_M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
958
964
|
F = !0;
|
|
959
965
|
break;
|
|
960
966
|
}
|
|
961
|
-
c +=
|
|
967
|
+
c += f, C = h, w = o, o = h = dist_M.lastIndex;
|
|
962
968
|
continue;
|
|
963
969
|
}
|
|
964
970
|
if (dist_O.lastIndex = o, dist_O.test(t)) {
|
|
@@ -966,46 +972,46 @@ const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 ===
|
|
|
966
972
|
F = !0;
|
|
967
973
|
break;
|
|
968
974
|
}
|
|
969
|
-
c += u, C = h,
|
|
975
|
+
c += u, C = h, w = o, o = h = dist_O.lastIndex;
|
|
970
976
|
continue;
|
|
971
977
|
}
|
|
972
978
|
if (dist_y.lastIndex = o, dist_y.test(t)) {
|
|
973
|
-
if (v = dist_y.lastIndex - o,
|
|
979
|
+
if (v = dist_y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
974
980
|
F = !0;
|
|
975
981
|
break;
|
|
976
982
|
}
|
|
977
|
-
c +=
|
|
983
|
+
c += f, C = h, w = o, o = h = dist_y.lastIndex;
|
|
978
984
|
continue;
|
|
979
985
|
}
|
|
980
|
-
if (
|
|
981
|
-
if (v =
|
|
986
|
+
if (dist_L.lastIndex = o, dist_L.test(t)) {
|
|
987
|
+
if (v = dist_L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
982
988
|
F = !0;
|
|
983
989
|
break;
|
|
984
990
|
}
|
|
985
|
-
c +=
|
|
991
|
+
c += f, C = h, w = o, o = h = dist_L.lastIndex;
|
|
986
992
|
continue;
|
|
987
993
|
}
|
|
988
|
-
if (
|
|
994
|
+
if (dist_P.lastIndex = o, dist_P.test(t)) {
|
|
989
995
|
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
990
996
|
F = !0;
|
|
991
997
|
break;
|
|
992
998
|
}
|
|
993
|
-
c += g, C = h,
|
|
999
|
+
c += g, C = h, w = o, o = h = dist_P.lastIndex;
|
|
994
1000
|
continue;
|
|
995
1001
|
}
|
|
996
1002
|
o += 1;
|
|
997
1003
|
}
|
|
998
1004
|
return {
|
|
999
1005
|
width: F ? b : c,
|
|
1000
|
-
index: F ? d :
|
|
1006
|
+
index: F ? d : p,
|
|
1001
1007
|
truncated: F,
|
|
1002
1008
|
ellipsed: F && i >= n
|
|
1003
1009
|
};
|
|
1004
|
-
},
|
|
1010
|
+
}, pt = {
|
|
1005
1011
|
limit: 1 / 0,
|
|
1006
1012
|
ellipsis: "",
|
|
1007
1013
|
ellipsisWidth: 0
|
|
1008
|
-
}, dist_S = (t, e = {})=>
|
|
1014
|
+
}, dist_S = (t, e = {})=>X(t, pt, e).width, dist_T = "\x1B", dist_Z = "\x9B", Ft = 39, dist_j = "\x07", Q = "[", dist_dt = "]", tt = "m", U = `${dist_dt}8;;`, dist_et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${dist_j})`, "y"), mt = (t)=>{
|
|
1009
1015
|
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
1010
1016
|
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
1011
1017
|
if (1 === t || 2 === t) return 22;
|
|
@@ -1015,12 +1021,12 @@ const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 ===
|
|
|
1015
1021
|
if (8 === t) return 28;
|
|
1016
1022
|
if (9 === t) return 29;
|
|
1017
1023
|
if (0 === t) return 0;
|
|
1018
|
-
}, dist_st = (t)=>`${
|
|
1024
|
+
}, dist_st = (t)=>`${dist_T}${Q}${t}${tt}`, dist_it = (t)=>`${dist_T}${U}${t}${dist_j}`, gt = (t)=>t.map((e)=>dist_S(e)), dist_G = (t, e, s)=>{
|
|
1019
1025
|
const i = e[Symbol.iterator]();
|
|
1020
1026
|
let r = !1, n = !1, u = t.at(-1), a = void 0 === u ? 0 : dist_S(u), l = i.next(), E = i.next(), g = 0;
|
|
1021
1027
|
for(; !l.done;){
|
|
1022
1028
|
const m = l.value, A = dist_S(m);
|
|
1023
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m ===
|
|
1029
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === dist_T || m === dist_Z) && (r = !0, n = e.startsWith(U, g + 1)), r ? n ? m === dist_j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a !== s || E.done || (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
1024
1030
|
}
|
|
1025
1031
|
u = t.at(-1), !a && void 0 !== u && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
1026
1032
|
}, vt = (t)=>{
|
|
@@ -1037,21 +1043,21 @@ const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 ===
|
|
|
1037
1043
|
];
|
|
1038
1044
|
for (const [h, o] of u.entries()){
|
|
1039
1045
|
!1 !== s.trim && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
1040
|
-
let
|
|
1041
|
-
if (0 !== h && (
|
|
1042
|
-
const v = e -
|
|
1043
|
-
Math.floor((a[h] - 1) / e) < F && l.push(""),
|
|
1046
|
+
let p = dist_S(l.at(-1) ?? "");
|
|
1047
|
+
if (0 !== h && (p >= e && (!1 === s.wordWrap || !1 === s.trim) && (l.push(""), p = 0), (p > 0 || !1 === s.trim) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
1048
|
+
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
1049
|
+
Math.floor((a[h] - 1) / e) < F && l.push(""), dist_G(l, o, e);
|
|
1044
1050
|
continue;
|
|
1045
1051
|
}
|
|
1046
|
-
if (
|
|
1047
|
-
if (!1 === s.wordWrap &&
|
|
1048
|
-
|
|
1052
|
+
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
1053
|
+
if (!1 === s.wordWrap && p < e) {
|
|
1054
|
+
dist_G(l, o, e);
|
|
1049
1055
|
continue;
|
|
1050
1056
|
}
|
|
1051
1057
|
l.push("");
|
|
1052
1058
|
}
|
|
1053
|
-
if (
|
|
1054
|
-
|
|
1059
|
+
if (p + a[h] > e && !1 === s.wordWrap) {
|
|
1060
|
+
dist_G(l, o, e);
|
|
1055
1061
|
continue;
|
|
1056
1062
|
}
|
|
1057
1063
|
l[l.length - 1] += o;
|
|
@@ -1062,18 +1068,18 @@ const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 ===
|
|
|
1062
1068
|
let m = g.next(), A = g.next(), V = 0;
|
|
1063
1069
|
for(; !m.done;){
|
|
1064
1070
|
const h = m.value, o = A.value;
|
|
1065
|
-
if (i += h, h ===
|
|
1066
|
-
|
|
1067
|
-
const F =
|
|
1071
|
+
if (i += h, h === dist_T || h === dist_Z) {
|
|
1072
|
+
dist_et.lastIndex = V + 1;
|
|
1073
|
+
const F = dist_et.exec(E)?.groups;
|
|
1068
1074
|
if (F?.code !== void 0) {
|
|
1069
1075
|
const d = Number.parseFloat(F.code);
|
|
1070
1076
|
r = d === Ft ? void 0 : d;
|
|
1071
1077
|
} else F?.uri !== void 0 && (n = 0 === F.uri.length ? void 0 : F.uri);
|
|
1072
1078
|
}
|
|
1073
|
-
const
|
|
1079
|
+
const p = r ? mt(r) : void 0;
|
|
1074
1080
|
o === `
|
|
1075
|
-
` ? (n && (i +=
|
|
1076
|
-
` && (r &&
|
|
1081
|
+
` ? (n && (i += dist_it("")), r && p && (i += dist_st(p))) : h === `
|
|
1082
|
+
` && (r && p && (i += dist_st(r)), n && (i += dist_it(n))), V += h.length, m = A, A = g.next();
|
|
1077
1083
|
}
|
|
1078
1084
|
return i;
|
|
1079
1085
|
};
|
|
@@ -1149,11 +1155,11 @@ const z = Symbol("clack:cancel");
|
|
|
1149
1155
|
function Ct(t) {
|
|
1150
1156
|
return t === z;
|
|
1151
1157
|
}
|
|
1152
|
-
function
|
|
1158
|
+
function W(t, e) {
|
|
1153
1159
|
const s = t;
|
|
1154
1160
|
s.isTTY && s.setRawMode(e);
|
|
1155
1161
|
}
|
|
1156
|
-
const dist_rt = (t)=>"columns" in t && "number" == typeof t.columns ? t.columns : 80,
|
|
1162
|
+
const dist_rt = (t)=>"columns" in t && "number" == typeof t.columns ? t.columns : 80, nt = (t)=>"rows" in t && "number" == typeof t.rows ? t.rows : 20;
|
|
1157
1163
|
function Bt(t, e, s, i = s) {
|
|
1158
1164
|
const r = dist_rt(t ?? stdout);
|
|
1159
1165
|
return K(e, r - s.length, {
|
|
@@ -1163,7 +1169,7 @@ function Bt(t, e, s, i = s) {
|
|
|
1163
1169
|
`).map((n, u)=>`${0 === u ? i : s}${n}`).join(`
|
|
1164
1170
|
`);
|
|
1165
1171
|
}
|
|
1166
|
-
class
|
|
1172
|
+
class dist_B {
|
|
1167
1173
|
input;
|
|
1168
1174
|
output;
|
|
1169
1175
|
_abortSignal;
|
|
@@ -1221,10 +1227,10 @@ class x {
|
|
|
1221
1227
|
prompt: "",
|
|
1222
1228
|
escapeCodeTimeout: 50,
|
|
1223
1229
|
terminal: !0
|
|
1224
|
-
}), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
1225
|
-
this.output.write(src.cursor.show), this.output.off("resize", this.render),
|
|
1230
|
+
}), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
|
|
1231
|
+
this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(this.value);
|
|
1226
1232
|
}), this.once("cancel", ()=>{
|
|
1227
|
-
this.output.write(src.cursor.show), this.output.off("resize", this.render),
|
|
1233
|
+
this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(z);
|
|
1228
1234
|
});
|
|
1229
1235
|
});
|
|
1230
1236
|
}
|
|
@@ -1262,7 +1268,7 @@ class x {
|
|
|
1262
1268
|
}
|
|
1263
1269
|
close() {
|
|
1264
1270
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
1265
|
-
`),
|
|
1271
|
+
`), W(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
1266
1272
|
}
|
|
1267
1273
|
restoreCursor() {
|
|
1268
1274
|
const e = K(this._prevFrame, process.stdout.columns, {
|
|
@@ -1280,7 +1286,7 @@ class x {
|
|
|
1280
1286
|
if (e !== this._prevFrame) {
|
|
1281
1287
|
if ("initial" === this.state) this.output.write(src.cursor.hide);
|
|
1282
1288
|
else {
|
|
1283
|
-
const s = _t(this._prevFrame, e), i =
|
|
1289
|
+
const s = _t(this._prevFrame, e), i = nt(this.output);
|
|
1284
1290
|
if (this.restoreCursor(), s) {
|
|
1285
1291
|
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
1286
1292
|
let u = s.lines.find((a)=>a >= r);
|
|
@@ -1315,11 +1321,7 @@ class x {
|
|
|
1315
1321
|
}
|
|
1316
1322
|
}
|
|
1317
1323
|
}
|
|
1318
|
-
|
|
1319
|
-
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
1320
|
-
return s[n].disabled ? dist_D(n, e < 0 ? -1 : 1, s) : n;
|
|
1321
|
-
}
|
|
1322
|
-
class Mt extends x {
|
|
1324
|
+
let Lt = class extends dist_B {
|
|
1323
1325
|
options;
|
|
1324
1326
|
cursor = 0;
|
|
1325
1327
|
get _value() {
|
|
@@ -1351,17 +1353,17 @@ class Mt extends x {
|
|
|
1351
1353
|
...e.initialValues ?? []
|
|
1352
1354
|
];
|
|
1353
1355
|
const s = Math.max(this.options.findIndex(({ value: i })=>i === e.cursorAt), 0);
|
|
1354
|
-
this.cursor = this.options[s].disabled ?
|
|
1356
|
+
this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i)=>{
|
|
1355
1357
|
"a" === i && this.toggleAll(), "i" === i && this.toggleInvert();
|
|
1356
1358
|
}), this.on("cursor", (i)=>{
|
|
1357
1359
|
switch(i){
|
|
1358
1360
|
case "left":
|
|
1359
1361
|
case "up":
|
|
1360
|
-
this.cursor =
|
|
1362
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
1361
1363
|
break;
|
|
1362
1364
|
case "down":
|
|
1363
1365
|
case "right":
|
|
1364
|
-
this.cursor =
|
|
1366
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
1365
1367
|
break;
|
|
1366
1368
|
case "space":
|
|
1367
1369
|
this.toggleValue();
|
|
@@ -1369,8 +1371,8 @@ class Mt extends x {
|
|
|
1369
1371
|
}
|
|
1370
1372
|
});
|
|
1371
1373
|
}
|
|
1372
|
-
}
|
|
1373
|
-
class
|
|
1374
|
+
};
|
|
1375
|
+
class Tt extends dist_B {
|
|
1374
1376
|
options;
|
|
1375
1377
|
cursor = 0;
|
|
1376
1378
|
get _selectedValue() {
|
|
@@ -1382,28 +1384,28 @@ class Wt extends x {
|
|
|
1382
1384
|
constructor(e){
|
|
1383
1385
|
super(e, !1), this.options = e.options;
|
|
1384
1386
|
const s = this.options.findIndex(({ value: r })=>r === e.initialValue), i = -1 === s ? 0 : s;
|
|
1385
|
-
this.cursor = this.options[i].disabled ?
|
|
1387
|
+
this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r)=>{
|
|
1386
1388
|
switch(r){
|
|
1387
1389
|
case "left":
|
|
1388
1390
|
case "up":
|
|
1389
|
-
this.cursor =
|
|
1391
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
1390
1392
|
break;
|
|
1391
1393
|
case "down":
|
|
1392
1394
|
case "right":
|
|
1393
|
-
this.cursor =
|
|
1395
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
1394
1396
|
break;
|
|
1395
1397
|
}
|
|
1396
1398
|
this.changeValue();
|
|
1397
1399
|
});
|
|
1398
1400
|
}
|
|
1399
1401
|
}
|
|
1400
|
-
class dist_$t extends
|
|
1402
|
+
class dist_$t extends dist_B {
|
|
1401
1403
|
get userInputWithCursor() {
|
|
1402
1404
|
if ("submit" === this.state) return this.userInput;
|
|
1403
1405
|
const e = this.userInput;
|
|
1404
1406
|
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
1405
1407
|
const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
|
|
1406
|
-
return `${s}${
|
|
1408
|
+
return `${s}${styleText("inverse", i)}${r.join("")}`;
|
|
1407
1409
|
}
|
|
1408
1410
|
get cursor() {
|
|
1409
1411
|
return this._cursor;
|
|
@@ -1419,108 +1421,107 @@ class dist_$t extends x {
|
|
|
1419
1421
|
});
|
|
1420
1422
|
}
|
|
1421
1423
|
}
|
|
1422
|
-
|
|
1423
|
-
function dist_ht() {
|
|
1424
|
+
function dist_pt() {
|
|
1424
1425
|
return "win32" !== node_process.platform ? "linux" !== node_process.env.TERM : !!node_process.env.CI || !!node_process.env.WT_SESSION || !!node_process.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === node_process.env.ConEmuTask || "Terminus-Sublime" === node_process.env.TERM_PROGRAM || "vscode" === node_process.env.TERM_PROGRAM || "xterm-256color" === node_process.env.TERM || "alacritty" === node_process.env.TERM || "JetBrains-JediTerm" === node_process.env.TERMINAL_EMULATOR;
|
|
1425
1426
|
}
|
|
1426
|
-
const ee =
|
|
1427
|
+
const ee = dist_pt(), dist_I = (e, r)=>ee ? e : r, Re = dist_I("\u25C6", "*"), $e = dist_I("\u25A0", "x"), de = dist_I("\u25B2", "x"), dist_V = dist_I("\u25C7", "o"), dist_h = (dist_I("\u250C", "T"), dist_I("\u2502", "|")), dist_x = dist_I("\u2514", "\u2014"), dist_z = (dist_I("\u2510", "T"), dist_I("\u2518", "\u2014"), dist_I("\u25CF", ">")), dist_H = dist_I("\u25CB", " "), te = dist_I("\u25FB", "[\u2022]"), dist_U = dist_I("\u25FC", "[+]"), dist_q = dist_I("\u25FB", "[ ]"), se = (dist_I("\u25AA", "\u2022"), dist_I("\u2500", "-")), pe = dist_I("\u256E", "+"), We = dist_I("\u251C", "+"), me = dist_I("\u256F", "+"), ge = dist_I("\u2570", "+"), dist_W = (dist_I("\u256D", "+"), dist_I("\u25CF", "\u2022"), dist_I("\u25C6", "*"), dist_I("\u25B2", "!"), dist_I("\u25A0", "x"), (e)=>{
|
|
1427
1428
|
switch(e){
|
|
1428
1429
|
case "initial":
|
|
1429
1430
|
case "active":
|
|
1430
|
-
return
|
|
1431
|
+
return styleText("cyan", Re);
|
|
1431
1432
|
case "cancel":
|
|
1432
|
-
return
|
|
1433
|
+
return styleText("red", $e);
|
|
1433
1434
|
case "error":
|
|
1434
|
-
return
|
|
1435
|
+
return styleText("yellow", de);
|
|
1435
1436
|
case "submit":
|
|
1436
|
-
return
|
|
1437
|
+
return styleText("green", dist_V);
|
|
1437
1438
|
}
|
|
1438
|
-
}),
|
|
1439
|
+
}), ve = (e)=>{
|
|
1439
1440
|
switch(e){
|
|
1440
1441
|
case "initial":
|
|
1441
1442
|
case "active":
|
|
1442
|
-
return
|
|
1443
|
+
return styleText("cyan", dist_h);
|
|
1443
1444
|
case "cancel":
|
|
1444
|
-
return
|
|
1445
|
+
return styleText("red", dist_h);
|
|
1445
1446
|
case "error":
|
|
1446
|
-
return
|
|
1447
|
+
return styleText("yellow", dist_h);
|
|
1447
1448
|
case "submit":
|
|
1448
|
-
return
|
|
1449
|
+
return styleText("green", dist_h);
|
|
1449
1450
|
}
|
|
1450
|
-
}, dist_mt = (e)=>161 === e || 164 === e || 167 === e || 168 === e || 170 === e || 173 === e || 174 === e || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || 198 === e || 208 === e || 215 === e || 216 === e || e >= 222 && e <= 225 || 230 === e || e >= 232 && e <= 234 || 236 === e || 237 === e || 240 === e || 242 === e || 243 === e || e >= 247 && e <= 250 || 252 === e || 254 === e || 257 === e || 273 === e || 275 === e || 283 === e || 294 === e || 295 === e || 299 === e || e >= 305 && e <= 307 || 312 === e || e >= 319 && e <= 322 || 324 === e || e >= 328 && e <= 331 || 333 === e || 338 === e || 339 === e || 358 === e || 359 === e || 363 === e || 462 === e || 464 === e || 466 === e || 468 === e || 470 === e || 472 === e || 474 === e || 476 === e || 593 === e || 609 === e || 708 === e || 711 === e || e >= 713 && e <= 715 || 717 === e || 720 === e || e >= 728 && e <= 731 || 733 === e || 735 === e || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || 1025 === e || e >= 1040 && e <= 1103 || 1105 === e || 8208 === e || e >= 8211 && e <= 8214 || 8216 === e || 8217 === e || 8220 === e || 8221 === e || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || 8240 === e || 8242 === e || 8243 === e || 8245 === e || 8251 === e || 8254 === e || 8308 === e || 8319 === e || e >= 8321 && e <= 8324 || 8364 === e || 8451 === e || 8453 === e || 8457 === e || 8467 === e || 8470 === e || 8481 === e || 8482 === e || 8486 === e || 8491 === e || 8531 === e || 8532 === e || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || 8585 === e || e >= 8592 && e <= 8601 || 8632 === e || 8633 === e || 8658 === e || 8660 === e || 8679 === e || 8704 === e || 8706 === e || 8707 === e || 8711 === e || 8712 === e || 8715 === e || 8719 === e || 8721 === e || 8725 === e || 8730 === e || e >= 8733 && e <= 8736 || 8739 === e || 8741 === e || e >= 8743 && e <= 8748 || 8750 === e || e >= 8756 && e <= 8759 || 8764 === e || 8765 === e || 8776 === e || 8780 === e || 8786 === e || 8800 === e || 8801 === e || e >= 8804 && e <= 8807 || 8810 === e || 8811 === e || 8814 === e || 8815 === e || 8834 === e || 8835 === e || 8838 === e || 8839 === e || 8853 === e || 8857 === e || 8869 === e || 8895 === e || 8978 === e || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || 9632 === e || 9633 === e || e >= 9635 && e <= 9641 || 9650 === e || 9651 === e || 9654 === e || 9655 === e || 9660 === e || 9661 === e || 9664 === e || 9665 === e || e >= 9670 && e <= 9672 || 9675 === e || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || 9711 === e || 9733 === e || 9734 === e || 9737 === e || 9742 === e || 9743 === e || 9756 === e || 9758 === e || 9792 === e || 9794 === e || 9824 === e || 9825 === e || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || 9836 === e || 9837 === e || 9839 === e || 9886 === e || 9887 === e || 9919 === e || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || 9955 === e || 9960 === e || 9961 === e || e >= 9963 && e <= 9969 || 9972 === e || e >= 9974 && e <= 9977 || 9979 === e || 9980 === e || 9982 === e || 9983 === e || 10045 === e || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || 65533 === e || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || 127375 === e || 127376 === e || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109,
|
|
1451
|
+
}, dist_mt = (e)=>161 === e || 164 === e || 167 === e || 168 === e || 170 === e || 173 === e || 174 === e || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || 198 === e || 208 === e || 215 === e || 216 === e || e >= 222 && e <= 225 || 230 === e || e >= 232 && e <= 234 || 236 === e || 237 === e || 240 === e || 242 === e || 243 === e || e >= 247 && e <= 250 || 252 === e || 254 === e || 257 === e || 273 === e || 275 === e || 283 === e || 294 === e || 295 === e || 299 === e || e >= 305 && e <= 307 || 312 === e || e >= 319 && e <= 322 || 324 === e || e >= 328 && e <= 331 || 333 === e || 338 === e || 339 === e || 358 === e || 359 === e || 363 === e || 462 === e || 464 === e || 466 === e || 468 === e || 470 === e || 472 === e || 474 === e || 476 === e || 593 === e || 609 === e || 708 === e || 711 === e || e >= 713 && e <= 715 || 717 === e || 720 === e || e >= 728 && e <= 731 || 733 === e || 735 === e || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || 1025 === e || e >= 1040 && e <= 1103 || 1105 === e || 8208 === e || e >= 8211 && e <= 8214 || 8216 === e || 8217 === e || 8220 === e || 8221 === e || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || 8240 === e || 8242 === e || 8243 === e || 8245 === e || 8251 === e || 8254 === e || 8308 === e || 8319 === e || e >= 8321 && e <= 8324 || 8364 === e || 8451 === e || 8453 === e || 8457 === e || 8467 === e || 8470 === e || 8481 === e || 8482 === e || 8486 === e || 8491 === e || 8531 === e || 8532 === e || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || 8585 === e || e >= 8592 && e <= 8601 || 8632 === e || 8633 === e || 8658 === e || 8660 === e || 8679 === e || 8704 === e || 8706 === e || 8707 === e || 8711 === e || 8712 === e || 8715 === e || 8719 === e || 8721 === e || 8725 === e || 8730 === e || e >= 8733 && e <= 8736 || 8739 === e || 8741 === e || e >= 8743 && e <= 8748 || 8750 === e || e >= 8756 && e <= 8759 || 8764 === e || 8765 === e || 8776 === e || 8780 === e || 8786 === e || 8800 === e || 8801 === e || e >= 8804 && e <= 8807 || 8810 === e || 8811 === e || 8814 === e || 8815 === e || 8834 === e || 8835 === e || 8838 === e || 8839 === e || 8853 === e || 8857 === e || 8869 === e || 8895 === e || 8978 === e || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || 9632 === e || 9633 === e || e >= 9635 && e <= 9641 || 9650 === e || 9651 === e || 9654 === e || 9655 === e || 9660 === e || 9661 === e || 9664 === e || 9665 === e || e >= 9670 && e <= 9672 || 9675 === e || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || 9711 === e || 9733 === e || 9734 === e || 9737 === e || 9742 === e || 9743 === e || 9756 === e || 9758 === e || 9792 === e || 9794 === e || 9824 === e || 9825 === e || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || 9836 === e || 9837 === e || 9839 === e || 9886 === e || 9887 === e || 9919 === e || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || 9955 === e || 9960 === e || 9961 === e || e >= 9963 && e <= 9969 || 9972 === e || e >= 9974 && e <= 9977 || 9979 === e || 9980 === e || 9982 === e || 9983 === e || 10045 === e || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || 65533 === e || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || 127375 === e || 127376 === e || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, dist_gt = (e)=>12288 === e || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, dist_ft = (e)=>e >= 4352 && e <= 4447 || 8986 === e || 8987 === e || 9001 === e || 9002 === e || e >= 9193 && e <= 9196 || 9200 === e || 9203 === e || 9725 === e || 9726 === e || 9748 === e || 9749 === e || e >= 9800 && e <= 9811 || 9855 === e || 9875 === e || 9889 === e || 9898 === e || 9899 === e || 9917 === e || 9918 === e || 9924 === e || 9925 === e || 9934 === e || 9940 === e || 9962 === e || 9970 === e || 9971 === e || 9973 === e || 9978 === e || 9981 === e || 9989 === e || 9994 === e || 9995 === e || 10024 === e || 10060 === e || 10062 === e || e >= 10067 && e <= 10069 || 10071 === e || e >= 10133 && e <= 10135 || 10160 === e || 10175 === e || 11035 === e || 11036 === e || 11088 === e || 11093 === e || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || 94192 === e || 94193 === e || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || 110589 === e || 110590 === e || e >= 110592 && e <= 110882 || 110898 === e || e >= 110928 && e <= 110930 || 110933 === e || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || 126980 === e || 127183 === e || 127374 === e || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || 127568 === e || 127569 === e || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || 127988 === e || e >= 127992 && e <= 128062 || 128064 === e || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || 128378 === e || 128405 === e || 128406 === e || 128420 === e || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || 128716 === e || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || 128747 === e || 128748 === e || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || 129008 === e || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, dist_Ft = /\p{M}+/gu, dist_yt = {
|
|
1451
1452
|
limit: 1 / 0,
|
|
1452
1453
|
ellipsis: ""
|
|
1453
1454
|
}, Le = (e, r = {}, s = {})=>{
|
|
1454
|
-
const i = r.limit ?? 1 / 0,
|
|
1455
|
-
let $ = 0,
|
|
1455
|
+
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, dist_yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
1456
|
+
let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
|
|
1456
1457
|
e: for(;;){
|
|
1457
|
-
if (b >
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
for (const
|
|
1461
|
-
const
|
|
1462
|
-
if (
|
|
1463
|
-
|
|
1458
|
+
if (b > A || m >= d && m > $) {
|
|
1459
|
+
const T = e.slice(A, b) || e.slice($, m);
|
|
1460
|
+
F = 0;
|
|
1461
|
+
for (const M of T.replaceAll(dist_Ft, "")){
|
|
1462
|
+
const O = M.codePointAt(0) || 0;
|
|
1463
|
+
if (dist_gt(O) ? S = f : dist_ft(O) ? S = E : c !== g && dist_mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
|
|
1464
|
+
y = !0;
|
|
1464
1465
|
break e;
|
|
1465
1466
|
}
|
|
1466
|
-
|
|
1467
|
+
F += M.length, w += S;
|
|
1467
1468
|
}
|
|
1468
|
-
|
|
1469
|
+
A = b = 0;
|
|
1469
1470
|
}
|
|
1470
|
-
if (
|
|
1471
|
-
if (ne.lastIndex =
|
|
1472
|
-
if (
|
|
1473
|
-
|
|
1471
|
+
if (m >= d) break;
|
|
1472
|
+
if (ne.lastIndex = m, ne.test(e)) {
|
|
1473
|
+
if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
|
|
1474
|
+
y = !0;
|
|
1474
1475
|
break;
|
|
1475
1476
|
}
|
|
1476
|
-
|
|
1477
|
+
w += S, A = $, b = m, m = $ = ne.lastIndex;
|
|
1477
1478
|
continue;
|
|
1478
1479
|
}
|
|
1479
|
-
if (
|
|
1480
|
-
if (
|
|
1481
|
-
|
|
1480
|
+
if (we.lastIndex = m, we.test(e)) {
|
|
1481
|
+
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
1482
|
+
y = !0;
|
|
1482
1483
|
break;
|
|
1483
1484
|
}
|
|
1484
|
-
|
|
1485
|
+
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
1485
1486
|
continue;
|
|
1486
1487
|
}
|
|
1487
|
-
if (re.lastIndex =
|
|
1488
|
-
if (
|
|
1489
|
-
|
|
1488
|
+
if (re.lastIndex = m, re.test(e)) {
|
|
1489
|
+
if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
|
|
1490
|
+
y = !0;
|
|
1490
1491
|
break;
|
|
1491
1492
|
}
|
|
1492
|
-
|
|
1493
|
+
w += S, A = $, b = m, m = $ = re.lastIndex;
|
|
1493
1494
|
continue;
|
|
1494
1495
|
}
|
|
1495
|
-
if (ie.lastIndex =
|
|
1496
|
-
if (
|
|
1497
|
-
|
|
1496
|
+
if (ie.lastIndex = m, ie.test(e)) {
|
|
1497
|
+
if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
|
|
1498
|
+
y = !0;
|
|
1498
1499
|
break;
|
|
1499
1500
|
}
|
|
1500
|
-
|
|
1501
|
+
w += S, A = $, b = m, m = $ = ie.lastIndex;
|
|
1501
1502
|
continue;
|
|
1502
1503
|
}
|
|
1503
|
-
if (Ae.lastIndex =
|
|
1504
|
-
if (
|
|
1505
|
-
|
|
1504
|
+
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
1505
|
+
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
1506
|
+
y = !0;
|
|
1506
1507
|
break;
|
|
1507
1508
|
}
|
|
1508
|
-
|
|
1509
|
+
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
1509
1510
|
continue;
|
|
1510
1511
|
}
|
|
1511
|
-
|
|
1512
|
+
m += 1;
|
|
1512
1513
|
}
|
|
1513
1514
|
return {
|
|
1514
|
-
width:
|
|
1515
|
-
index:
|
|
1516
|
-
truncated:
|
|
1517
|
-
ellipsed:
|
|
1515
|
+
width: y ? C : w,
|
|
1516
|
+
index: y ? v : d,
|
|
1517
|
+
truncated: y,
|
|
1518
|
+
ellipsed: y && i >= o
|
|
1518
1519
|
};
|
|
1519
|
-
},
|
|
1520
|
+
}, dist_Et = {
|
|
1520
1521
|
limit: 1 / 0,
|
|
1521
1522
|
ellipsis: "",
|
|
1522
1523
|
ellipsisWidth: 0
|
|
1523
|
-
},
|
|
1524
|
+
}, D = (e, r = {})=>Le(e, dist_Et, r).width, ae = "\x1B", je = "\x9B", dist_vt = 39, Ce = "\x07", ke = "[", dist_wt = "]", Ve = "m", Se = `${dist_wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), dist_At = (e)=>{
|
|
1524
1525
|
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
1525
1526
|
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
1526
1527
|
if (1 === e || 2 === e) return 22;
|
|
@@ -1530,129 +1531,137 @@ const ee = dist_ht(), dist_w = (e, r)=>ee ? e : r, Me = dist_w("\u25C6", "*"), c
|
|
|
1530
1531
|
if (8 === e) return 28;
|
|
1531
1532
|
if (9 === e) return 29;
|
|
1532
1533
|
if (0 === e) return 0;
|
|
1533
|
-
},
|
|
1534
|
+
}, Ue = (e)=>`${ae}${ke}${e}${Ve}`, Ke = (e)=>`${ae}${Se}${e}${Ce}`, dist_Ct = (e)=>e.map((r)=>D(r)), Ie = (e, r, s)=>{
|
|
1534
1535
|
const i = r[Symbol.iterator]();
|
|
1535
|
-
let
|
|
1536
|
-
for(; !
|
|
1537
|
-
const
|
|
1538
|
-
l +
|
|
1536
|
+
let a = !1, o = !1, u = e.at(-1), l = void 0 === u ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
|
|
1537
|
+
for(; !n.done;){
|
|
1538
|
+
const f = n.value, g = D(f);
|
|
1539
|
+
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l !== s || c.done || (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
1539
1540
|
}
|
|
1540
1541
|
u = e.at(-1), !l && void 0 !== u && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
1541
|
-
},
|
|
1542
|
+
}, dist_St = (e)=>{
|
|
1542
1543
|
const r = e.split(" ");
|
|
1543
1544
|
let s = r.length;
|
|
1544
|
-
for(; s > 0 && !(
|
|
1545
|
+
for(; s > 0 && !(D(r[s - 1]) > 0);)s--;
|
|
1545
1546
|
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
1546
|
-
},
|
|
1547
|
+
}, dist_It = (e, r, s = {})=>{
|
|
1547
1548
|
if (!1 !== s.trim && "" === e.trim()) return "";
|
|
1548
|
-
let i = "",
|
|
1549
|
+
let i = "", a, o;
|
|
1549
1550
|
const u = e.split(" "), l = dist_Ct(u);
|
|
1550
|
-
let
|
|
1551
|
+
let n = [
|
|
1551
1552
|
""
|
|
1552
1553
|
];
|
|
1553
|
-
for (const [$,
|
|
1554
|
-
!1 !== s.trim && (
|
|
1555
|
-
let
|
|
1556
|
-
if (0 !== $ && (
|
|
1557
|
-
const
|
|
1558
|
-
Math.floor((l[$] - 1) / r) <
|
|
1554
|
+
for (const [$, m] of u.entries()){
|
|
1555
|
+
!1 !== s.trim && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
1556
|
+
let d = D(n.at(-1) ?? "");
|
|
1557
|
+
if (0 !== $ && (d >= r && (!1 === s.wordWrap || !1 === s.trim) && (n.push(""), d = 0), (d > 0 || !1 === s.trim) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
1558
|
+
const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
|
|
1559
|
+
Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
|
|
1559
1560
|
continue;
|
|
1560
1561
|
}
|
|
1561
|
-
if (
|
|
1562
|
-
if (!1 === s.wordWrap &&
|
|
1563
|
-
|
|
1562
|
+
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
1563
|
+
if (!1 === s.wordWrap && d < r) {
|
|
1564
|
+
Ie(n, m, r);
|
|
1564
1565
|
continue;
|
|
1565
1566
|
}
|
|
1566
|
-
|
|
1567
|
+
n.push("");
|
|
1567
1568
|
}
|
|
1568
|
-
if (
|
|
1569
|
-
|
|
1569
|
+
if (d + l[$] > r && !1 === s.wordWrap) {
|
|
1570
|
+
Ie(n, m, r);
|
|
1570
1571
|
continue;
|
|
1571
1572
|
}
|
|
1572
|
-
|
|
1573
|
+
n[n.length - 1] += m;
|
|
1573
1574
|
}
|
|
1574
|
-
!1 !== s.trim && (
|
|
1575
|
-
const
|
|
1576
|
-
`),
|
|
1577
|
-
let
|
|
1578
|
-
for(; !
|
|
1579
|
-
const $ =
|
|
1575
|
+
!1 !== s.trim && (n = n.map(($)=>dist_St($)));
|
|
1576
|
+
const c = n.join(`
|
|
1577
|
+
`), p = c[Symbol.iterator]();
|
|
1578
|
+
let f = p.next(), g = p.next(), E = 0;
|
|
1579
|
+
for(; !f.done;){
|
|
1580
|
+
const $ = f.value, m = g.value;
|
|
1580
1581
|
if (i += $, $ === ae || $ === je) {
|
|
1581
|
-
|
|
1582
|
-
const
|
|
1583
|
-
if (
|
|
1584
|
-
const v = Number.parseFloat(
|
|
1585
|
-
|
|
1586
|
-
} else
|
|
1587
|
-
}
|
|
1588
|
-
const
|
|
1589
|
-
|
|
1590
|
-
` ? (o && (i +=
|
|
1591
|
-
` && (
|
|
1582
|
+
He.lastIndex = E + 1;
|
|
1583
|
+
const y = He.exec(c)?.groups;
|
|
1584
|
+
if (y?.code !== void 0) {
|
|
1585
|
+
const v = Number.parseFloat(y.code);
|
|
1586
|
+
a = v === dist_vt ? void 0 : v;
|
|
1587
|
+
} else y?.uri !== void 0 && (o = 0 === y.uri.length ? void 0 : y.uri);
|
|
1588
|
+
}
|
|
1589
|
+
const d = a ? dist_At(a) : void 0;
|
|
1590
|
+
m === `
|
|
1591
|
+
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
1592
|
+
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
1592
1593
|
}
|
|
1593
1594
|
return i;
|
|
1594
1595
|
};
|
|
1595
|
-
function
|
|
1596
|
+
function dist_J(e, r, s) {
|
|
1596
1597
|
return String(e).normalize().replaceAll(`\r
|
|
1597
1598
|
`, `
|
|
1598
1599
|
`).split(`
|
|
1599
|
-
`).map((i)=>
|
|
1600
|
+
`).map((i)=>dist_It(i, r, s)).join(`
|
|
1600
1601
|
`);
|
|
1601
1602
|
}
|
|
1602
|
-
const
|
|
1603
|
+
const dist_bt = (e, r, s, i, a)=>{
|
|
1603
1604
|
let o = r, u = 0;
|
|
1604
1605
|
for(let l = s; l < i; l++){
|
|
1605
|
-
const
|
|
1606
|
-
if (o -=
|
|
1606
|
+
const n = e[l];
|
|
1607
|
+
if (o -= n.length, u++, o <= a) break;
|
|
1607
1608
|
}
|
|
1608
1609
|
return {
|
|
1609
1610
|
lineCount: o,
|
|
1610
1611
|
removals: u
|
|
1611
1612
|
};
|
|
1612
|
-
},
|
|
1613
|
-
const
|
|
1614
|
-
let
|
|
1615
|
-
|
|
1616
|
-
let
|
|
1617
|
-
const
|
|
1618
|
-
let
|
|
1619
|
-
|
|
1620
|
-
const
|
|
1621
|
-
for(let A =
|
|
1622
|
-
const
|
|
1613
|
+
}, dist_X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = 1 / 0, columnPadding: o = 0, rowPadding: u = 4 })=>{
|
|
1614
|
+
const l = dist_rt(i) - o, n = nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
1615
|
+
let g = 0;
|
|
1616
|
+
e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
|
|
1617
|
+
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
1618
|
+
const m = Math.min(g + f, r.length), d = [];
|
|
1619
|
+
let F = 0;
|
|
1620
|
+
E && F++, $ && F++;
|
|
1621
|
+
const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
|
|
1622
|
+
for(let A = y; A < v; A++){
|
|
1623
|
+
const b = dist_J(s(r[A], A === e), l, {
|
|
1623
1624
|
hard: !0,
|
|
1624
1625
|
trim: !1
|
|
1625
1626
|
}).split(`
|
|
1626
1627
|
`);
|
|
1627
|
-
|
|
1628
|
+
d.push(b), F += b.length;
|
|
1628
1629
|
}
|
|
1629
|
-
if (
|
|
1630
|
-
let A = 0,
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1630
|
+
if (F > p) {
|
|
1631
|
+
let A = 0, b = 0, w = F;
|
|
1632
|
+
const S = e - y, T = (M, O)=>dist_bt(d, w, M, O, p);
|
|
1633
|
+
E ? ({ lineCount: w, removals: A } = T(0, S), w > p && ({ lineCount: w, removals: b } = T(S + 1, d.length))) : ({ lineCount: w, removals: b } = T(S + 1, d.length), w > p && ({ lineCount: w, removals: A } = T(0, S))), A > 0 && (E = !0, d.splice(0, A)), b > 0 && ($ = !0, d.splice(d.length - b, b));
|
|
1633
1634
|
}
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
for (const A of
|
|
1637
|
-
return
|
|
1635
|
+
const C = [];
|
|
1636
|
+
E && C.push(c);
|
|
1637
|
+
for (const A of d)for (const b of A)C.push(b);
|
|
1638
|
+
return $ && C.push(c), C;
|
|
1638
1639
|
};
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1640
|
+
const Nt = (e = "", r)=>{
|
|
1641
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_x)} ` : "";
|
|
1642
|
+
s.write(`${i}${styleText("red", e)}
|
|
1641
1643
|
|
|
1642
1644
|
`);
|
|
1643
|
-
},
|
|
1644
|
-
|
|
1645
|
-
${
|
|
1645
|
+
}, Gt = (e = "", r)=>{
|
|
1646
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_h)}
|
|
1647
|
+
${styleText("gray", dist_x)} ` : "";
|
|
1648
|
+
s.write(`${i}${e}
|
|
1646
1649
|
|
|
1647
1650
|
`);
|
|
1648
1651
|
}, dist_Q = (e, r)=>e.split(`
|
|
1649
1652
|
`).map((s)=>r(s)).join(`
|
|
1650
1653
|
`), dist_Lt = (e)=>{
|
|
1651
|
-
const r = (i,
|
|
1654
|
+
const r = (i, a)=>{
|
|
1652
1655
|
const o = i.label ?? String(i.value);
|
|
1653
|
-
return "disabled" ===
|
|
1656
|
+
return "disabled" === a ? `${styleText("gray", dist_q)} ${dist_Q(o, (u)=>styleText([
|
|
1657
|
+
"strikethrough",
|
|
1658
|
+
"gray"
|
|
1659
|
+
], u))}${i.hint ? ` ${styleText("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : "active" === a ? `${styleText("cyan", te)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : "selected" === a ? `${styleText("green", dist_U)} ${dist_Q(o, (u)=>styleText("dim", u))}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : "cancelled" === a ? `${dist_Q(o, (u)=>styleText([
|
|
1660
|
+
"strikethrough",
|
|
1661
|
+
"dim"
|
|
1662
|
+
], u))}` : "active-selected" === a ? `${styleText("green", dist_U)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : "submitted" === a ? `${dist_Q(o, (u)=>styleText("dim", u))}` : `${styleText("dim", dist_q)} ${dist_Q(o, (u)=>styleText("dim", u))}`;
|
|
1654
1663
|
}, s = e.required ?? !0;
|
|
1655
|
-
return new
|
|
1664
|
+
return new Lt({
|
|
1656
1665
|
options: e.options,
|
|
1657
1666
|
signal: e.signal,
|
|
1658
1667
|
input: e.input,
|
|
@@ -1662,157 +1671,164 @@ ${picocolors.gray(dist_x)} ${e}
|
|
|
1662
1671
|
cursorAt: e.cursorAt,
|
|
1663
1672
|
validate (i) {
|
|
1664
1673
|
if (s && (void 0 === i || 0 === i.length)) return `Please select at least one option.
|
|
1665
|
-
${
|
|
1674
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1675
|
+
"gray",
|
|
1676
|
+
"bgWhite",
|
|
1677
|
+
"inverse"
|
|
1678
|
+
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
1666
1679
|
},
|
|
1667
1680
|
render () {
|
|
1668
|
-
const i = Bt(e.output, e.message, `${
|
|
1681
|
+
const i = Bt(e.output, e.message, `${ve(this.state)} `, `${dist_W(this.state)} `), a = `${styleText("gray", dist_h)}
|
|
1669
1682
|
${i}
|
|
1670
|
-
`, o = this.value ?? [], u = (l,
|
|
1683
|
+
`, o = this.value ?? [], u = (l, n)=>{
|
|
1671
1684
|
if (l.disabled) return r(l, "disabled");
|
|
1672
|
-
const
|
|
1673
|
-
return
|
|
1685
|
+
const c = o.includes(l.value);
|
|
1686
|
+
return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
|
|
1674
1687
|
};
|
|
1675
1688
|
switch(this.state){
|
|
1676
1689
|
case "submit":
|
|
1677
1690
|
{
|
|
1678
|
-
const l = this.options.filter(({ value:
|
|
1679
|
-
return `${
|
|
1691
|
+
const l = this.options.filter(({ value: c })=>o.includes(c)).map((c)=>r(c, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), n = Bt(e.output, l, `${styleText("gray", dist_h)} `);
|
|
1692
|
+
return `${a}${n}`;
|
|
1680
1693
|
}
|
|
1681
1694
|
case "cancel":
|
|
1682
1695
|
{
|
|
1683
|
-
const l = this.options.filter(({ value:
|
|
1684
|
-
if ("" === l.trim()) return `${
|
|
1685
|
-
const
|
|
1686
|
-
return `${
|
|
1687
|
-
${
|
|
1696
|
+
const l = this.options.filter(({ value: c })=>o.includes(c)).map((c)=>r(c, "cancelled")).join(styleText("dim", ", "));
|
|
1697
|
+
if ("" === l.trim()) return `${a}${styleText("gray", dist_h)}`;
|
|
1698
|
+
const n = Bt(e.output, l, `${styleText("gray", dist_h)} `);
|
|
1699
|
+
return `${a}${n}
|
|
1700
|
+
${styleText("gray", dist_h)}`;
|
|
1688
1701
|
}
|
|
1689
1702
|
case "error":
|
|
1690
1703
|
{
|
|
1691
|
-
const l = `${
|
|
1692
|
-
`).map((
|
|
1693
|
-
`),
|
|
1694
|
-
`).length,
|
|
1704
|
+
const l = `${styleText("yellow", dist_h)} `, n = this.error.split(`
|
|
1705
|
+
`).map((f, g)=>0 === g ? `${styleText("yellow", dist_x)} ${styleText("yellow", f)}` : ` ${f}`).join(`
|
|
1706
|
+
`), c = a.split(`
|
|
1707
|
+
`).length, p = n.split(`
|
|
1695
1708
|
`).length + 1;
|
|
1696
|
-
return `${
|
|
1709
|
+
return `${a}${l}${dist_X({
|
|
1697
1710
|
output: e.output,
|
|
1698
1711
|
options: this.options,
|
|
1699
1712
|
cursor: this.cursor,
|
|
1700
1713
|
maxItems: e.maxItems,
|
|
1701
1714
|
columnPadding: l.length,
|
|
1702
|
-
rowPadding:
|
|
1715
|
+
rowPadding: c + p,
|
|
1703
1716
|
style: u
|
|
1704
1717
|
}).join(`
|
|
1705
1718
|
${l}`)}
|
|
1706
|
-
${
|
|
1719
|
+
${n}
|
|
1707
1720
|
`;
|
|
1708
1721
|
}
|
|
1709
1722
|
default:
|
|
1710
1723
|
{
|
|
1711
|
-
const l = `${
|
|
1724
|
+
const l = `${styleText("cyan", dist_h)} `, n = a.split(`
|
|
1712
1725
|
`).length;
|
|
1713
|
-
return `${
|
|
1726
|
+
return `${a}${l}${dist_X({
|
|
1714
1727
|
output: e.output,
|
|
1715
1728
|
options: this.options,
|
|
1716
1729
|
cursor: this.cursor,
|
|
1717
1730
|
maxItems: e.maxItems,
|
|
1718
1731
|
columnPadding: l.length,
|
|
1719
|
-
rowPadding:
|
|
1732
|
+
rowPadding: n + 2,
|
|
1720
1733
|
style: u
|
|
1721
1734
|
}).join(`
|
|
1722
1735
|
${l}`)}
|
|
1723
|
-
${
|
|
1736
|
+
${styleText("cyan", dist_x)}
|
|
1724
1737
|
`;
|
|
1725
1738
|
}
|
|
1726
1739
|
}
|
|
1727
1740
|
}
|
|
1728
1741
|
}).prompt();
|
|
1729
|
-
}, jt = (e)=>
|
|
1742
|
+
}, jt = (e)=>styleText("dim", e), dist_kt = (e, r, s)=>{
|
|
1730
1743
|
const i = {
|
|
1731
1744
|
hard: !0,
|
|
1732
1745
|
trim: !1
|
|
1733
|
-
},
|
|
1734
|
-
`), o =
|
|
1735
|
-
return
|
|
1736
|
-
},
|
|
1737
|
-
const i = s?.output ?? node_process.stdout,
|
|
1746
|
+
}, a = dist_J(e, r, i).split(`
|
|
1747
|
+
`), o = a.reduce((n, c)=>Math.max(D(c), n), 0), u = a.map(s).reduce((n, c)=>Math.max(D(c), n), 0), l = r - (u - o);
|
|
1748
|
+
return dist_J(e, l, i);
|
|
1749
|
+
}, dist_Vt = (e = "", r = "", s)=>{
|
|
1750
|
+
const i = s?.output ?? node_process.stdout, a = s?.withGuide ?? dist_.withGuide, o = s?.format ?? jt, u = [
|
|
1738
1751
|
"",
|
|
1739
|
-
...
|
|
1752
|
+
...dist_kt(e, dist_rt(i) - 6, o).split(`
|
|
1740
1753
|
`).map(o),
|
|
1741
1754
|
""
|
|
1742
|
-
], l =
|
|
1743
|
-
const $ =
|
|
1744
|
-
return $ >
|
|
1745
|
-
}, 0), l) + 2,
|
|
1746
|
-
`),
|
|
1747
|
-
` : "",
|
|
1748
|
-
i.write(`${
|
|
1749
|
-
${
|
|
1750
|
-
${
|
|
1755
|
+
], l = D(r), n = Math.max(u.reduce((g, E)=>{
|
|
1756
|
+
const $ = D(E);
|
|
1757
|
+
return $ > g ? $ : g;
|
|
1758
|
+
}, 0), l) + 2, c = u.map((g)=>`${styleText("gray", dist_h)} ${g}${" ".repeat(n - D(g))}${styleText("gray", dist_h)}`).join(`
|
|
1759
|
+
`), p = a ? `${styleText("gray", dist_h)}
|
|
1760
|
+
` : "", f = a ? We : ge;
|
|
1761
|
+
i.write(`${p}${styleText("green", dist_V)} ${styleText("reset", r)} ${styleText("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
|
|
1762
|
+
${c}
|
|
1763
|
+
${styleText("gray", f + se.repeat(n + 2) + me)}
|
|
1751
1764
|
`);
|
|
1752
1765
|
};
|
|
1753
|
-
|
|
1766
|
+
dist_I("\u2500", "-"), dist_I("\u2501", "="), dist_I("\u2588", "#");
|
|
1754
1767
|
const oe = (e, r)=>e.includes(`
|
|
1755
1768
|
`) ? e.split(`
|
|
1756
1769
|
`).map((s)=>r(s)).join(`
|
|
1757
|
-
`) : r(e),
|
|
1770
|
+
`) : r(e), Jt = (e)=>{
|
|
1758
1771
|
const r = (s, i)=>{
|
|
1759
|
-
const
|
|
1772
|
+
const a = s.label ?? String(s.value);
|
|
1760
1773
|
switch(i){
|
|
1761
1774
|
case "disabled":
|
|
1762
|
-
return `${
|
|
1775
|
+
return `${styleText("gray", dist_H)} ${oe(a, (o)=>styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1763
1776
|
case "selected":
|
|
1764
|
-
return `${oe(
|
|
1777
|
+
return `${oe(a, (o)=>styleText("dim", o))}`;
|
|
1765
1778
|
case "active":
|
|
1766
|
-
return `${
|
|
1779
|
+
return `${styleText("green", dist_z)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
1767
1780
|
case "cancelled":
|
|
1768
|
-
return `${oe(
|
|
1781
|
+
return `${oe(a, (o)=>styleText([
|
|
1782
|
+
"strikethrough",
|
|
1783
|
+
"dim"
|
|
1784
|
+
], o))}`;
|
|
1769
1785
|
default:
|
|
1770
|
-
return `${
|
|
1786
|
+
return `${styleText("dim", dist_H)} ${oe(a, (o)=>styleText("dim", o))}`;
|
|
1771
1787
|
}
|
|
1772
1788
|
};
|
|
1773
|
-
return new
|
|
1789
|
+
return new Tt({
|
|
1774
1790
|
options: e.options,
|
|
1775
1791
|
signal: e.signal,
|
|
1776
1792
|
input: e.input,
|
|
1777
1793
|
output: e.output,
|
|
1778
1794
|
initialValue: e.initialValue,
|
|
1779
1795
|
render () {
|
|
1780
|
-
const s = `${
|
|
1781
|
-
${
|
|
1796
|
+
const s = e.withGuide ?? dist_.withGuide, i = `${dist_W(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${styleText("gray", dist_h)}
|
|
1797
|
+
` : ""}${o}
|
|
1782
1798
|
`;
|
|
1783
1799
|
switch(this.state){
|
|
1784
1800
|
case "submit":
|
|
1785
1801
|
{
|
|
1786
|
-
const
|
|
1787
|
-
return `${
|
|
1802
|
+
const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
|
|
1803
|
+
return `${u}${n}`;
|
|
1788
1804
|
}
|
|
1789
1805
|
case "cancel":
|
|
1790
1806
|
{
|
|
1791
|
-
const
|
|
1792
|
-
return `${
|
|
1793
|
-
${
|
|
1807
|
+
const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
|
|
1808
|
+
return `${u}${n}${s ? `
|
|
1809
|
+
${styleText("gray", dist_h)}` : ""}`;
|
|
1794
1810
|
}
|
|
1795
1811
|
default:
|
|
1796
1812
|
{
|
|
1797
|
-
const
|
|
1798
|
-
`).length;
|
|
1799
|
-
return `${
|
|
1813
|
+
const l = s ? `${styleText("cyan", dist_h)} ` : "", n = s ? styleText("cyan", dist_x) : "", c = u.split(`
|
|
1814
|
+
`).length, p = s ? 2 : 1;
|
|
1815
|
+
return `${u}${l}${dist_X({
|
|
1800
1816
|
output: e.output,
|
|
1801
1817
|
cursor: this.cursor,
|
|
1802
1818
|
options: this.options,
|
|
1803
1819
|
maxItems: e.maxItems,
|
|
1804
|
-
columnPadding:
|
|
1805
|
-
rowPadding:
|
|
1806
|
-
style: (
|
|
1820
|
+
columnPadding: l.length,
|
|
1821
|
+
rowPadding: c + p,
|
|
1822
|
+
style: (f, g)=>r(f, f.disabled ? "disabled" : g ? "active" : "inactive")
|
|
1807
1823
|
}).join(`
|
|
1808
|
-
${
|
|
1809
|
-
${
|
|
1824
|
+
${l}`)}
|
|
1825
|
+
${n}
|
|
1810
1826
|
`;
|
|
1811
1827
|
}
|
|
1812
1828
|
}
|
|
1813
1829
|
}
|
|
1814
1830
|
}).prompt();
|
|
1815
|
-
},
|
|
1831
|
+
}, Zt = (styleText("gray", dist_h), (e)=>new dist_$t({
|
|
1816
1832
|
validate: e.validate,
|
|
1817
1833
|
placeholder: e.placeholder,
|
|
1818
1834
|
defaultValue: e.defaultValue,
|
|
@@ -1821,47 +1837,68 @@ ${picocolors_default().cyan(dist_x)}
|
|
|
1821
1837
|
signal: e.signal,
|
|
1822
1838
|
input: e.input,
|
|
1823
1839
|
render () {
|
|
1824
|
-
const r =
|
|
1825
|
-
` : ""}${
|
|
1826
|
-
`, i = e.placeholder ?
|
|
1840
|
+
const r = e?.withGuide ?? dist_.withGuide, s = `${r ? `${styleText("gray", dist_h)}
|
|
1841
|
+
` : ""}${dist_W(this.state)} ${e.message}
|
|
1842
|
+
`, i = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText([
|
|
1843
|
+
"inverse",
|
|
1844
|
+
"hidden"
|
|
1845
|
+
], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
|
|
1827
1846
|
switch(this.state){
|
|
1828
1847
|
case "error":
|
|
1829
1848
|
{
|
|
1830
|
-
const u = this.error ? ` ${
|
|
1849
|
+
const u = this.error ? ` ${styleText("yellow", this.error)}` : "", l = r ? `${styleText("yellow", dist_h)} ` : "", n = r ? styleText("yellow", dist_x) : "";
|
|
1831
1850
|
return `${s.trim()}
|
|
1832
|
-
${l}${
|
|
1833
|
-
${
|
|
1851
|
+
${l}${a}
|
|
1852
|
+
${n}${u}
|
|
1834
1853
|
`;
|
|
1835
1854
|
}
|
|
1836
1855
|
case "submit":
|
|
1837
1856
|
{
|
|
1838
|
-
const u = o ? ` ${
|
|
1857
|
+
const u = o ? ` ${styleText("dim", o)}` : "", l = r ? styleText("gray", dist_h) : "";
|
|
1839
1858
|
return `${s}${l}${u}`;
|
|
1840
1859
|
}
|
|
1841
1860
|
case "cancel":
|
|
1842
1861
|
{
|
|
1843
|
-
const u = o ? ` ${
|
|
1862
|
+
const u = o ? ` ${styleText([
|
|
1863
|
+
"strikethrough",
|
|
1864
|
+
"dim"
|
|
1865
|
+
], o)}` : "", l = r ? styleText("gray", dist_h) : "";
|
|
1844
1866
|
return `${s}${l}${u}${o.trim() ? `
|
|
1845
1867
|
${l}` : ""}`;
|
|
1846
1868
|
}
|
|
1847
1869
|
default:
|
|
1848
1870
|
{
|
|
1849
|
-
const u = r ? `${
|
|
1850
|
-
return `${s}${u}${
|
|
1871
|
+
const u = r ? `${styleText("cyan", dist_h)} ` : "", l = r ? styleText("cyan", dist_x) : "";
|
|
1872
|
+
return `${s}${u}${a}
|
|
1851
1873
|
${l}
|
|
1852
1874
|
`;
|
|
1853
1875
|
}
|
|
1854
1876
|
}
|
|
1855
1877
|
}
|
|
1856
1878
|
}).prompt());
|
|
1857
|
-
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
const
|
|
1864
|
-
const
|
|
1879
|
+
function checkNodeVersion() {
|
|
1880
|
+
const { versions } = process;
|
|
1881
|
+
if ("styleText" in node_util || !versions.node || versions.bun || versions.deno) return;
|
|
1882
|
+
throw new Error(`Unsupported Node.js version: "${process.versions.node || 'unknown'}". Expected Node.js >= 20.`);
|
|
1883
|
+
}
|
|
1884
|
+
checkNodeVersion();
|
|
1885
|
+
const createStyler = (style)=>(text)=>node_util.styleText(style, String(text));
|
|
1886
|
+
const color = {
|
|
1887
|
+
dim: createStyler('dim'),
|
|
1888
|
+
red: createStyler('red'),
|
|
1889
|
+
bold: createStyler('bold'),
|
|
1890
|
+
blue: createStyler('blue'),
|
|
1891
|
+
cyan: createStyler('cyan'),
|
|
1892
|
+
gray: createStyler('gray'),
|
|
1893
|
+
black: createStyler('black'),
|
|
1894
|
+
green: createStyler('green'),
|
|
1895
|
+
white: createStyler('white'),
|
|
1896
|
+
reset: createStyler('reset'),
|
|
1897
|
+
yellow: createStyler('yellow'),
|
|
1898
|
+
magenta: createStyler('magenta'),
|
|
1899
|
+
underline: createStyler('underline'),
|
|
1900
|
+
strikethrough: createStyler('strikethrough')
|
|
1901
|
+
};
|
|
1865
1902
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
1866
1903
|
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
1867
1904
|
const position = argv.indexOf(prefix + flag);
|
|
@@ -1980,7 +2017,7 @@ let endColor = [
|
|
|
1980
2017
|
];
|
|
1981
2018
|
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
1982
2019
|
let gradient = (message)=>{
|
|
1983
|
-
if (colorLevel < 3) return 2 === colorLevel ?
|
|
2020
|
+
if (colorLevel < 3) return 2 === colorLevel ? color.cyan(message) : message;
|
|
1984
2021
|
let chars = [
|
|
1985
2022
|
...message
|
|
1986
2023
|
];
|
|
@@ -2000,7 +2037,7 @@ let gradient = (message)=>{
|
|
|
2000
2037
|
}
|
|
2001
2038
|
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
2002
2039
|
}
|
|
2003
|
-
return bold(output);
|
|
2040
|
+
return color.bold(output);
|
|
2004
2041
|
};
|
|
2005
2042
|
let LOG_LEVEL = {
|
|
2006
2043
|
silent: -1,
|
|
@@ -2014,32 +2051,32 @@ let LOG_TYPES = {
|
|
|
2014
2051
|
error: {
|
|
2015
2052
|
label: 'error',
|
|
2016
2053
|
level: 'error',
|
|
2017
|
-
color: red
|
|
2054
|
+
color: color.red
|
|
2018
2055
|
},
|
|
2019
2056
|
warn: {
|
|
2020
2057
|
label: 'warn',
|
|
2021
2058
|
level: 'warn',
|
|
2022
|
-
color: yellow
|
|
2059
|
+
color: color.yellow
|
|
2023
2060
|
},
|
|
2024
2061
|
info: {
|
|
2025
2062
|
label: 'info',
|
|
2026
2063
|
level: 'info',
|
|
2027
|
-
color: cyan
|
|
2064
|
+
color: color.cyan
|
|
2028
2065
|
},
|
|
2029
2066
|
start: {
|
|
2030
2067
|
label: 'start',
|
|
2031
2068
|
level: 'info',
|
|
2032
|
-
color: cyan
|
|
2069
|
+
color: color.cyan
|
|
2033
2070
|
},
|
|
2034
2071
|
ready: {
|
|
2035
2072
|
label: 'ready',
|
|
2036
2073
|
level: 'info',
|
|
2037
|
-
color: green
|
|
2074
|
+
color: color.green
|
|
2038
2075
|
},
|
|
2039
2076
|
success: {
|
|
2040
2077
|
label: 'success',
|
|
2041
2078
|
level: 'info',
|
|
2042
|
-
color: green
|
|
2079
|
+
color: color.green
|
|
2043
2080
|
},
|
|
2044
2081
|
log: {
|
|
2045
2082
|
level: 'info'
|
|
@@ -2047,43 +2084,45 @@ let LOG_TYPES = {
|
|
|
2047
2084
|
debug: {
|
|
2048
2085
|
label: 'debug',
|
|
2049
2086
|
level: 'verbose',
|
|
2050
|
-
color: magenta
|
|
2087
|
+
color: color.magenta
|
|
2051
2088
|
}
|
|
2052
2089
|
};
|
|
2053
2090
|
const normalizeErrorMessage = (err)=>{
|
|
2054
2091
|
if (err.stack) {
|
|
2055
2092
|
let [name, ...rest] = err.stack.split('\n');
|
|
2056
2093
|
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
2057
|
-
return `${name}\n${gray(rest.join('\n'))}`;
|
|
2094
|
+
return `${name}\n${color.gray(rest.join('\n'))}`;
|
|
2058
2095
|
}
|
|
2059
2096
|
return err.message;
|
|
2060
2097
|
};
|
|
2061
2098
|
let createLogger = (options = {})=>{
|
|
2062
|
-
|
|
2099
|
+
const { level = 'info', prefix, console: console1 = globalThis.console } = options;
|
|
2100
|
+
let maxLevel = level;
|
|
2063
2101
|
let log = (type, message, ...args)=>{
|
|
2064
2102
|
let logType = LOG_TYPES[type];
|
|
2065
2103
|
const { level } = logType;
|
|
2066
2104
|
if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
|
|
2067
|
-
if (null == message) return
|
|
2105
|
+
if (null == message) return console1.log();
|
|
2068
2106
|
let label = '';
|
|
2069
2107
|
let text = '';
|
|
2070
2108
|
if ('label' in logType) {
|
|
2071
2109
|
label = (logType.label || '').padEnd(7);
|
|
2072
|
-
label = bold(logType.color ? logType.color(label) : label);
|
|
2110
|
+
label = color.bold(logType.color ? logType.color(label) : label);
|
|
2073
2111
|
}
|
|
2074
2112
|
if (message instanceof Error) {
|
|
2075
2113
|
text += normalizeErrorMessage(message);
|
|
2076
2114
|
const { cause } = message;
|
|
2077
2115
|
if (cause) {
|
|
2078
|
-
text += yellow('\n [cause]: ');
|
|
2116
|
+
text += color.yellow('\n [cause]: ');
|
|
2079
2117
|
text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
|
|
2080
2118
|
}
|
|
2081
2119
|
} else if ('error' === level && 'string' == typeof message) {
|
|
2082
2120
|
let lines = message.split('\n');
|
|
2083
|
-
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
2121
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? color.gray(line) : line).join('\n');
|
|
2084
2122
|
} else text = `${message}`;
|
|
2123
|
+
if (prefix) text = `${prefix} ${text}`;
|
|
2085
2124
|
const method = 'error' === level || 'warn' === level ? level : 'log';
|
|
2086
|
-
|
|
2125
|
+
console1[method](label.length ? `${label} ${text}` : text, ...args);
|
|
2087
2126
|
};
|
|
2088
2127
|
let logger = {
|
|
2089
2128
|
greet: (message)=>log('log', gradient(message))
|
|
@@ -2097,13 +2136,18 @@ let createLogger = (options = {})=>{
|
|
|
2097
2136
|
maxLevel = val;
|
|
2098
2137
|
}
|
|
2099
2138
|
});
|
|
2139
|
+
Object.defineProperty(logger, 'options', {
|
|
2140
|
+
get: ()=>({
|
|
2141
|
+
...options
|
|
2142
|
+
})
|
|
2143
|
+
});
|
|
2100
2144
|
logger.override = (customLogger)=>{
|
|
2101
2145
|
Object.assign(logger, customLogger);
|
|
2102
2146
|
};
|
|
2103
2147
|
return logger;
|
|
2104
2148
|
};
|
|
2105
2149
|
let src_logger = createLogger();
|
|
2106
|
-
const dist = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.1
|
|
2150
|
+
const dist = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js");
|
|
2107
2151
|
const cross_spawn = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js");
|
|
2108
2152
|
var cross_spawn_default = /*#__PURE__*/ __webpack_require__.n(cross_spawn);
|
|
2109
2153
|
const cjs = __webpack_require__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
@@ -2113,7 +2157,7 @@ var minimist_default = /*#__PURE__*/ __webpack_require__.n(minimist);
|
|
|
2113
2157
|
const src_filename = fileURLToPath(import.meta.url);
|
|
2114
2158
|
const src_dirname = dirname(src_filename);
|
|
2115
2159
|
function cancelAndExit() {
|
|
2116
|
-
|
|
2160
|
+
Nt('Operation cancelled.');
|
|
2117
2161
|
process.exit(0);
|
|
2118
2162
|
}
|
|
2119
2163
|
function checkCancel(value) {
|
|
@@ -2137,7 +2181,7 @@ function pkgFromUserAgent(userAgent) {
|
|
|
2137
2181
|
};
|
|
2138
2182
|
}
|
|
2139
2183
|
function isEmptyDir(path) {
|
|
2140
|
-
const files =
|
|
2184
|
+
const files = node_fs.readdirSync(path);
|
|
2141
2185
|
return 0 === files.length || 1 === files.length && '.git' === files[0];
|
|
2142
2186
|
}
|
|
2143
2187
|
function parseToolsOption(tools) {
|
|
@@ -2222,7 +2266,7 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
|
|
|
2222
2266
|
function upperFirst(str) {
|
|
2223
2267
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2224
2268
|
}
|
|
2225
|
-
const readJSON = async (path)=>JSON.parse(await
|
|
2269
|
+
const readJSON = async (path)=>JSON.parse(await node_fs.promises.readFile(path, 'utf-8'));
|
|
2226
2270
|
const readPackageJson = async (filePath)=>readJSON(node_path.join(filePath, 'package.json'));
|
|
2227
2271
|
const parseArgv = (processArgv)=>{
|
|
2228
2272
|
const argv = minimist_default()(processArgv.slice(2), {
|
|
@@ -2270,7 +2314,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2270
2314
|
packageManager
|
|
2271
2315
|
};
|
|
2272
2316
|
if (!version) version = (await readPackageJson(root)).version;
|
|
2273
|
-
const projectName = argv.dir ?? checkCancel(await
|
|
2317
|
+
const projectName = argv.dir ?? checkCancel(await Zt({
|
|
2274
2318
|
message: 'Project name or path',
|
|
2275
2319
|
placeholder: `${name.toLowerCase()}-project`,
|
|
2276
2320
|
defaultValue: `${name.toLowerCase()}-project`,
|
|
@@ -2282,8 +2326,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2282
2326
|
const { targetDir } = formatted;
|
|
2283
2327
|
const packageName = argv.packageName || formatted.packageName;
|
|
2284
2328
|
const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
|
|
2285
|
-
if (!argv.override &&
|
|
2286
|
-
const option = checkCancel(await
|
|
2329
|
+
if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
|
|
2330
|
+
const option = checkCancel(await Jt({
|
|
2287
2331
|
message: `"${targetDir}" is not empty, please choose:`,
|
|
2288
2332
|
options: [
|
|
2289
2333
|
{
|
|
@@ -2302,7 +2346,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2302
2346
|
const tools = await getTools(argv, extraTools, templateName);
|
|
2303
2347
|
const srcFolder = node_path.join(root, `template-${templateName}`);
|
|
2304
2348
|
const commonFolder = node_path.join(root, 'template-common');
|
|
2305
|
-
if (!
|
|
2349
|
+
if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
|
|
2306
2350
|
copyFolder({
|
|
2307
2351
|
from: commonFolder,
|
|
2308
2352
|
to: distFolder,
|
|
@@ -2364,22 +2408,22 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2364
2408
|
isMergePackageJson: true
|
|
2365
2409
|
});
|
|
2366
2410
|
agentsMdSearchDirs.push(toolFolder);
|
|
2367
|
-
if ('biome' === tool) await
|
|
2411
|
+
if ('biome' === tool) await node_fs.promises.rename(node_path.join(distFolder, 'biome.json.template'), node_path.join(distFolder, 'biome.json'));
|
|
2368
2412
|
}
|
|
2369
2413
|
const agentsFiles = collectAgentsFiles(agentsMdSearchDirs);
|
|
2370
2414
|
if (agentsFiles.length > 0) {
|
|
2371
2415
|
const mergedAgents = mergeAgentsFiles(agentsFiles);
|
|
2372
2416
|
const agentsPath = node_path.join(distFolder, 'AGENTS.md');
|
|
2373
|
-
|
|
2417
|
+
node_fs.writeFileSync(agentsPath, `${replacePlaceholder(mergedAgents, templateParameters)}\n`);
|
|
2374
2418
|
}
|
|
2375
2419
|
const nextSteps = noteInformation ? noteInformation : [
|
|
2376
|
-
`1. ${
|
|
2377
|
-
`2. ${
|
|
2378
|
-
`3. ${
|
|
2379
|
-
`4. ${
|
|
2420
|
+
`1. ${color.cyan(`cd ${targetDir}`)}`,
|
|
2421
|
+
`2. ${color.cyan('git init')} ${color.dim('(optional)')}`,
|
|
2422
|
+
`3. ${color.cyan(`${packageManager} install`)}`,
|
|
2423
|
+
`4. ${color.cyan(`${packageManager} run dev`)}`
|
|
2380
2424
|
];
|
|
2381
|
-
if (nextSteps.length)
|
|
2382
|
-
|
|
2425
|
+
if (nextSteps.length) dist_Vt(nextSteps.map((step)=>color.reset(step)).join('\n'), 'Next steps');
|
|
2426
|
+
Gt('All set, happy coding!');
|
|
2383
2427
|
}
|
|
2384
2428
|
function sortObjectKeys(obj) {
|
|
2385
2429
|
const sortedKeys = Object.keys(obj).sort();
|
|
@@ -2388,9 +2432,9 @@ function sortObjectKeys(obj) {
|
|
|
2388
2432
|
return sortedObj;
|
|
2389
2433
|
}
|
|
2390
2434
|
function mergePackageJson(targetPackage, extraPackage) {
|
|
2391
|
-
if (!
|
|
2392
|
-
const targetJson = JSON.parse(
|
|
2393
|
-
const extraJson = JSON.parse(
|
|
2435
|
+
if (!node_fs.existsSync(targetPackage)) return;
|
|
2436
|
+
const targetJson = JSON.parse(node_fs.readFileSync(targetPackage, 'utf-8'));
|
|
2437
|
+
const extraJson = JSON.parse(node_fs.readFileSync(extraPackage, 'utf-8'));
|
|
2394
2438
|
const mergedJson = cjs_default()(targetJson, extraJson);
|
|
2395
2439
|
mergedJson.name = targetJson.name || extraJson.name;
|
|
2396
2440
|
for (const key of [
|
|
@@ -2398,7 +2442,7 @@ function mergePackageJson(targetPackage, extraPackage) {
|
|
|
2398
2442
|
'dependencies',
|
|
2399
2443
|
'devDependencies'
|
|
2400
2444
|
])if (key in mergedJson) mergedJson[key] = sortObjectKeys(mergedJson[key]);
|
|
2401
|
-
|
|
2445
|
+
node_fs.writeFileSync(targetPackage, `${JSON.stringify(mergedJson, null, 2)}\n`);
|
|
2402
2446
|
}
|
|
2403
2447
|
const isMarkdown = (file)=>file.endsWith('.md') || file.endsWith('.mdx');
|
|
2404
2448
|
const replacePlaceholder = (content, templateParameters)=>{
|
|
@@ -2415,14 +2459,14 @@ function copyFolder({ from, to, version, packageName, templateParameters, isMerg
|
|
|
2415
2459
|
'dist',
|
|
2416
2460
|
...skipFiles
|
|
2417
2461
|
];
|
|
2418
|
-
|
|
2462
|
+
node_fs.mkdirSync(to, {
|
|
2419
2463
|
recursive: true
|
|
2420
2464
|
});
|
|
2421
|
-
for (const file of
|
|
2465
|
+
for (const file of node_fs.readdirSync(from)){
|
|
2422
2466
|
if (allSkipFiles.includes(file)) continue;
|
|
2423
2467
|
const srcFile = node_path.resolve(from, file);
|
|
2424
2468
|
const distFile = renameFiles[file] ? node_path.resolve(to, renameFiles[file]) : node_path.resolve(to, file);
|
|
2425
|
-
const stat =
|
|
2469
|
+
const stat = node_fs.statSync(srcFile);
|
|
2426
2470
|
if (stat.isDirectory()) copyFolder({
|
|
2427
2471
|
from: srcFile,
|
|
2428
2472
|
to: distFile,
|
|
@@ -2432,14 +2476,14 @@ function copyFolder({ from, to, version, packageName, templateParameters, isMerg
|
|
|
2432
2476
|
});
|
|
2433
2477
|
else if ('package.json' === file) {
|
|
2434
2478
|
const targetPackage = node_path.resolve(to, 'package.json');
|
|
2435
|
-
if (isMergePackageJson &&
|
|
2436
|
-
else
|
|
2479
|
+
if (isMergePackageJson && node_fs.existsSync(targetPackage)) mergePackageJson(targetPackage, srcFile);
|
|
2480
|
+
else node_fs.copyFileSync(srcFile, distFile);
|
|
2437
2481
|
updatePackageJson(distFile, version, packageName);
|
|
2438
2482
|
} else {
|
|
2439
|
-
|
|
2483
|
+
node_fs.copyFileSync(srcFile, distFile);
|
|
2440
2484
|
if (templateParameters && isMarkdown(distFile)) {
|
|
2441
|
-
const content =
|
|
2442
|
-
|
|
2485
|
+
const content = node_fs.readFileSync(distFile, 'utf-8');
|
|
2486
|
+
node_fs.writeFileSync(distFile, replacePlaceholder(content, templateParameters));
|
|
2443
2487
|
}
|
|
2444
2488
|
}
|
|
2445
2489
|
}
|
|
@@ -2452,7 +2496,7 @@ const isStableVersion = (version)=>[
|
|
|
2452
2496
|
'nightly'
|
|
2453
2497
|
].every((tag)=>!version.includes(tag));
|
|
2454
2498
|
const updatePackageJson = (pkgJsonPath, version, name)=>{
|
|
2455
|
-
let content =
|
|
2499
|
+
let content = node_fs.readFileSync(pkgJsonPath, 'utf-8');
|
|
2456
2500
|
if ('string' == typeof version) {
|
|
2457
2501
|
const targetVersion = isStableVersion(version) ? `^${version}` : version;
|
|
2458
2502
|
content = content.replace(/workspace:\*/g, targetVersion);
|
|
@@ -2466,11 +2510,11 @@ const updatePackageJson = (pkgJsonPath, version, name)=>{
|
|
|
2466
2510
|
const projectName = node_path.basename(node_path.dirname(pkgJsonPath));
|
|
2467
2511
|
if (projectName.length) pkg.name = projectName;
|
|
2468
2512
|
} else if (name) pkg.name = name;
|
|
2469
|
-
|
|
2513
|
+
node_fs.writeFileSync(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
2470
2514
|
};
|
|
2471
2515
|
function readAgentsFile(filePath) {
|
|
2472
|
-
if (!
|
|
2473
|
-
return
|
|
2516
|
+
if (!node_fs.existsSync(filePath)) return null;
|
|
2517
|
+
return node_fs.readFileSync(filePath, 'utf-8');
|
|
2474
2518
|
}
|
|
2475
2519
|
function parseAgentsContent(content) {
|
|
2476
2520
|
const sections = {};
|
|
@@ -2542,4 +2586,4 @@ function collectAgentsFiles(agentsMdSearchDirs) {
|
|
|
2542
2586
|
}
|
|
2543
2587
|
return agentsFiles;
|
|
2544
2588
|
}
|
|
2545
|
-
export { BUILTIN_TOOLS,
|
|
2589
|
+
export { BUILTIN_TOOLS, Jt as select, Zt as text, checkCancel, collectAgentsFiles, copyFolder, create, dist_Lt as multiselect, mergeAgentsFiles, mergePackageJson };
|