create-rue 0.3.12 → 0.7.3
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/bundle.js +265 -323
- package/package.json +3 -3
- package/template/base/app/env.d.ts +1 -0
- package/template/base/app/pages/Home.tsx +1 -1
- package/template/base/app/pages/TodoApp.tsx +158 -412
- package/template/base/app/pages/components/Layout.tsx +29 -135
- package/template/base/package.json +19 -21
- package/template/base/tsconfig.json +4 -3
- package/template/base/vite.config.ts +14 -7
package/bundle.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! create-rue v0.3
|
|
2
|
+
/*! create-rue v0.7.3 | MIT */
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
|
-
import "node:fs";
|
|
6
5
|
import * as path from "node:path";
|
|
7
|
-
import "node:path";
|
|
8
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
|
-
import { parseArgs,
|
|
10
|
-
import
|
|
11
|
-
import "node:readline";
|
|
12
|
-
import P$1 from "node:readline";
|
|
13
|
-
import "node:tty";
|
|
7
|
+
import { parseArgs, styleText } from "node:util";
|
|
8
|
+
import process$1, { stdin, stdout } from "node:process";
|
|
9
|
+
import l__default from "node:readline";
|
|
14
10
|
//#region \0rolldown/runtime.js
|
|
15
11
|
var __create = Object.create;
|
|
16
12
|
var __defProp = Object.defineProperty;
|
|
@@ -35,20 +31,27 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
31
|
}) : target, mod));
|
|
36
32
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
37
33
|
//#endregion
|
|
38
|
-
//#region node_modules/.pnpm/fast-string-truncated-width@
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
//#region node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
35
|
+
const getCodePointsLength = (() => {
|
|
36
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
37
|
+
return (input) => {
|
|
38
|
+
let surrogatePairsNr = 0;
|
|
39
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
40
|
+
while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
|
|
41
|
+
return input.length - surrogatePairsNr;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
42
44
|
const isFullWidth = (x) => {
|
|
43
45
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
44
46
|
};
|
|
45
|
-
const
|
|
46
|
-
return x
|
|
47
|
+
const isWideNotCJKTNotEmoji = (x) => {
|
|
48
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
47
49
|
};
|
|
48
50
|
//#endregion
|
|
49
|
-
//#region node_modules/.pnpm/fast-string-truncated-width@
|
|
50
|
-
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
51
|
+
//#region node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
52
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
51
53
|
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
54
|
+
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
52
55
|
const TAB_RE = /\t{1,1000}/y;
|
|
53
56
|
const EMOJI_RE = /[\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?))*/uy;
|
|
54
57
|
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -61,14 +64,21 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
61
64
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
62
65
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
63
66
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
64
|
-
const ANSI_WIDTH =
|
|
67
|
+
const ANSI_WIDTH = 0;
|
|
65
68
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
66
69
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
67
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
68
70
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
69
|
-
const FULL_WIDTH_WIDTH =
|
|
71
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
70
72
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
71
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
73
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
74
|
+
const PARSE_BLOCKS = [
|
|
75
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
76
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
77
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
78
|
+
[TAB_RE, TAB_WIDTH],
|
|
79
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
80
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
81
|
+
];
|
|
72
82
|
let indexPrev = 0;
|
|
73
83
|
let index = 0;
|
|
74
84
|
let length = input.length;
|
|
@@ -87,8 +97,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
87
97
|
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
88
98
|
const codePoint = char.codePointAt(0) || 0;
|
|
89
99
|
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
90
|
-
else if (
|
|
91
|
-
else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) widthExtra = AMBIGUOUS_WIDTH;
|
|
100
|
+
else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
|
|
92
101
|
else widthExtra = REGULAR_WIDTH;
|
|
93
102
|
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
94
103
|
if (width + widthExtra > LIMIT) {
|
|
@@ -100,77 +109,24 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
100
109
|
}
|
|
101
110
|
unmatchedStart = unmatchedEnd = 0;
|
|
102
111
|
}
|
|
103
|
-
if (index >= length) break;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (ANSI_RE.test(input)) {
|
|
121
|
-
if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
122
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
123
|
-
truncationEnabled = true;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
width += ANSI_WIDTH;
|
|
127
|
-
unmatchedStart = indexPrev;
|
|
128
|
-
unmatchedEnd = index;
|
|
129
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
CONTROL_RE.lastIndex = index;
|
|
133
|
-
if (CONTROL_RE.test(input)) {
|
|
134
|
-
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
135
|
-
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
136
|
-
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
137
|
-
if (width + widthExtra > LIMIT) {
|
|
138
|
-
truncationEnabled = true;
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
width += widthExtra;
|
|
142
|
-
unmatchedStart = indexPrev;
|
|
143
|
-
unmatchedEnd = index;
|
|
144
|
-
index = indexPrev = CONTROL_RE.lastIndex;
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
TAB_RE.lastIndex = index;
|
|
148
|
-
if (TAB_RE.test(input)) {
|
|
149
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
150
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
151
|
-
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
152
|
-
if (width + widthExtra > LIMIT) {
|
|
153
|
-
truncationEnabled = true;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
width += widthExtra;
|
|
157
|
-
unmatchedStart = indexPrev;
|
|
158
|
-
unmatchedEnd = index;
|
|
159
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
EMOJI_RE.lastIndex = index;
|
|
163
|
-
if (EMOJI_RE.test(input)) {
|
|
164
|
-
if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
165
|
-
if (width + EMOJI_WIDTH > LIMIT) {
|
|
166
|
-
truncationEnabled = true;
|
|
167
|
-
break;
|
|
112
|
+
if (index >= length) break outer;
|
|
113
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
114
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
115
|
+
BLOCK_RE.lastIndex = index;
|
|
116
|
+
if (BLOCK_RE.test(input)) {
|
|
117
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
118
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
119
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
120
|
+
if (width + widthExtra > LIMIT) {
|
|
121
|
+
truncationEnabled = true;
|
|
122
|
+
break outer;
|
|
123
|
+
}
|
|
124
|
+
width += widthExtra;
|
|
125
|
+
unmatchedStart = indexPrev;
|
|
126
|
+
unmatchedEnd = index;
|
|
127
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
128
|
+
continue outer;
|
|
168
129
|
}
|
|
169
|
-
width += EMOJI_WIDTH;
|
|
170
|
-
unmatchedStart = indexPrev;
|
|
171
|
-
unmatchedEnd = index;
|
|
172
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
173
|
-
continue;
|
|
174
130
|
}
|
|
175
131
|
index += 1;
|
|
176
132
|
}
|
|
@@ -182,7 +138,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
182
138
|
};
|
|
183
139
|
};
|
|
184
140
|
//#endregion
|
|
185
|
-
//#region node_modules/.pnpm/fast-string-width@
|
|
141
|
+
//#region node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
186
142
|
const NO_TRUNCATION = {
|
|
187
143
|
limit: Infinity,
|
|
188
144
|
ellipsis: "",
|
|
@@ -192,7 +148,7 @@ const fastStringWidth = (input, options = {}) => {
|
|
|
192
148
|
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
193
149
|
};
|
|
194
150
|
//#endregion
|
|
195
|
-
//#region node_modules/.pnpm/fast-wrap-ansi@0.
|
|
151
|
+
//#region node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
196
152
|
const ESC = "\x1B";
|
|
197
153
|
const CSI = "";
|
|
198
154
|
const END_CODE = 39;
|
|
@@ -329,8 +285,10 @@ const exec = (string, columns, options = {}) => {
|
|
|
329
285
|
for (let i = 0; i < preString.length; i++) {
|
|
330
286
|
const character = preString[i];
|
|
331
287
|
returnValue += character;
|
|
332
|
-
if (!inSurrogate)
|
|
333
|
-
|
|
288
|
+
if (!inSurrogate) {
|
|
289
|
+
inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
290
|
+
if (inSurrogate) continue;
|
|
291
|
+
} else inSurrogate = false;
|
|
334
292
|
if (character === ESC || character === CSI) {
|
|
335
293
|
GROUP_REGEX.lastIndex = i + 1;
|
|
336
294
|
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
@@ -355,7 +313,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
355
313
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
356
314
|
}
|
|
357
315
|
//#endregion
|
|
358
|
-
//#region node_modules/.pnpm/@clack+core@1.2
|
|
316
|
+
//#region node_modules/.pnpm/@clack+core@1.4.2/node_modules/@clack/core/dist/index.mjs
|
|
359
317
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
360
318
|
const ESC = "\x1B";
|
|
361
319
|
const CSI = `${ESC}[`;
|
|
@@ -408,12 +366,7 @@ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
408
366
|
beep
|
|
409
367
|
};
|
|
410
368
|
})))();
|
|
411
|
-
|
|
412
|
-
if (!e.some((o) => !o.disabled)) return r;
|
|
413
|
-
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
414
|
-
return e[n].disabled ? d$1(n, t < 0 ? -1 : 1, e) : n;
|
|
415
|
-
}
|
|
416
|
-
const u = {
|
|
369
|
+
const settings = {
|
|
417
370
|
actions: new Set([
|
|
418
371
|
"up",
|
|
419
372
|
"down",
|
|
@@ -423,7 +376,7 @@ const u = {
|
|
|
423
376
|
"enter",
|
|
424
377
|
"cancel"
|
|
425
378
|
]),
|
|
426
|
-
aliases: new Map([
|
|
379
|
+
aliases: /* @__PURE__ */ new Map([
|
|
427
380
|
["k", "up"],
|
|
428
381
|
["j", "down"],
|
|
429
382
|
["h", "left"],
|
|
@@ -435,7 +388,7 @@ const u = {
|
|
|
435
388
|
cancel: "Canceled",
|
|
436
389
|
error: "Something went wrong"
|
|
437
390
|
},
|
|
438
|
-
withGuide:
|
|
391
|
+
withGuide: true,
|
|
439
392
|
date: {
|
|
440
393
|
monthNames: [...[
|
|
441
394
|
"January",
|
|
@@ -454,56 +407,67 @@ const u = {
|
|
|
454
407
|
messages: {
|
|
455
408
|
required: "Please enter a valid date",
|
|
456
409
|
invalidMonth: "There are only 12 months in a year",
|
|
457
|
-
invalidDay: (
|
|
458
|
-
afterMin: (
|
|
459
|
-
beforeMax: (
|
|
410
|
+
invalidDay: (n, e) => `There are only ${n} days in ${e}`,
|
|
411
|
+
afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
|
|
412
|
+
beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
|
|
460
413
|
}
|
|
461
414
|
}
|
|
462
415
|
};
|
|
463
|
-
function
|
|
464
|
-
if (typeof
|
|
465
|
-
for (const
|
|
466
|
-
return
|
|
416
|
+
function isActionKey(n, e) {
|
|
417
|
+
if (typeof n == "string") return settings.aliases.get(n) === e;
|
|
418
|
+
for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
|
|
419
|
+
return false;
|
|
467
420
|
}
|
|
468
|
-
function
|
|
469
|
-
if (
|
|
470
|
-
const e =
|
|
471
|
-
`),
|
|
472
|
-
`),
|
|
473
|
-
for (let
|
|
421
|
+
function diffLines(i, s) {
|
|
422
|
+
if (i === s) return;
|
|
423
|
+
const e = i.split(`
|
|
424
|
+
`), t = s.split(`
|
|
425
|
+
`), r = Math.max(e.length, t.length), f = [];
|
|
426
|
+
for (let n = 0; n < r; n++) e[n] !== t[n] && f.push(n);
|
|
474
427
|
return {
|
|
475
|
-
lines:
|
|
428
|
+
lines: f,
|
|
476
429
|
numLinesBefore: e.length,
|
|
477
|
-
numLinesAfter:
|
|
478
|
-
numLines:
|
|
430
|
+
numLinesAfter: t.length,
|
|
431
|
+
numLines: r
|
|
479
432
|
};
|
|
480
433
|
}
|
|
481
434
|
globalThis.process.platform.startsWith("win");
|
|
482
|
-
const
|
|
483
|
-
function
|
|
484
|
-
return
|
|
435
|
+
const CANCEL_SYMBOL = Symbol("clack:cancel");
|
|
436
|
+
function isCancel(e) {
|
|
437
|
+
return e === CANCEL_SYMBOL;
|
|
485
438
|
}
|
|
486
|
-
function
|
|
487
|
-
const
|
|
488
|
-
|
|
439
|
+
function setRawMode(e, r) {
|
|
440
|
+
const o = e;
|
|
441
|
+
o.isTTY && o.setRawMode(r);
|
|
489
442
|
}
|
|
490
|
-
const
|
|
491
|
-
function
|
|
492
|
-
return wrapAnsi(
|
|
493
|
-
hard:
|
|
494
|
-
trim:
|
|
443
|
+
const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80, getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
444
|
+
function wrapTextWithPrefix(e, r, o, t = o, s = o, n) {
|
|
445
|
+
return wrapAnsi(r, getColumns(e ?? stdout) - o.length, {
|
|
446
|
+
hard: true,
|
|
447
|
+
trim: false
|
|
495
448
|
}).split(`
|
|
496
|
-
`).map((
|
|
449
|
+
`).map((c, i, m) => {
|
|
450
|
+
const d = n ? n(c, i) : c;
|
|
451
|
+
return i === 0 ? `${t}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
452
|
+
}).join(`
|
|
497
453
|
`);
|
|
498
454
|
}
|
|
499
|
-
|
|
455
|
+
function runValidation(e, n) {
|
|
456
|
+
if ("~standard" in e) {
|
|
457
|
+
const a = e["~standard"].validate(n);
|
|
458
|
+
if (a instanceof Promise) throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
|
|
459
|
+
return a.issues?.at(0)?.message;
|
|
460
|
+
}
|
|
461
|
+
return e(n);
|
|
462
|
+
}
|
|
463
|
+
var V = class {
|
|
500
464
|
input;
|
|
501
465
|
output;
|
|
502
466
|
_abortSignal;
|
|
503
467
|
rl;
|
|
504
468
|
opts;
|
|
505
469
|
_render;
|
|
506
|
-
_track =
|
|
470
|
+
_track = false;
|
|
507
471
|
_prevFrame = "";
|
|
508
472
|
_subscribers = /* @__PURE__ */ new Map();
|
|
509
473
|
_cursor = 0;
|
|
@@ -511,55 +475,80 @@ let p = class {
|
|
|
511
475
|
error = "";
|
|
512
476
|
value;
|
|
513
477
|
userInput = "";
|
|
514
|
-
constructor(t, e =
|
|
515
|
-
const { input:
|
|
516
|
-
this.opts =
|
|
478
|
+
constructor(t, e = true) {
|
|
479
|
+
const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t;
|
|
480
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
|
|
517
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* Unsubscribe all listeners
|
|
484
|
+
*/
|
|
518
485
|
unsubscribe() {
|
|
519
486
|
this._subscribers.clear();
|
|
520
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* Set a subscriber with opts
|
|
490
|
+
* @param event - The event name
|
|
491
|
+
*/
|
|
521
492
|
setSubscriber(t, e) {
|
|
522
|
-
const
|
|
523
|
-
|
|
493
|
+
const i = this._subscribers.get(t) ?? [];
|
|
494
|
+
i.push(e), this._subscribers.set(t, i);
|
|
524
495
|
}
|
|
496
|
+
/**
|
|
497
|
+
* Subscribe to an event
|
|
498
|
+
* @param event - The event name
|
|
499
|
+
* @param cb - The callback
|
|
500
|
+
*/
|
|
525
501
|
on(t, e) {
|
|
526
502
|
this.setSubscriber(t, { cb: e });
|
|
527
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Subscribe to an event once
|
|
506
|
+
* @param event - The event name
|
|
507
|
+
* @param cb - The callback
|
|
508
|
+
*/
|
|
528
509
|
once(t, e) {
|
|
529
510
|
this.setSubscriber(t, {
|
|
530
511
|
cb: e,
|
|
531
|
-
once:
|
|
512
|
+
once: true
|
|
532
513
|
});
|
|
533
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* Emit an event with data
|
|
517
|
+
* @param event - The event name
|
|
518
|
+
* @param data - The data to pass to the callback
|
|
519
|
+
*/
|
|
534
520
|
emit(t, ...e) {
|
|
535
|
-
const
|
|
536
|
-
for (const
|
|
537
|
-
for (const
|
|
521
|
+
const i = this._subscribers.get(t) ?? [], n = [];
|
|
522
|
+
for (const s of i) s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
|
|
523
|
+
for (const s of n) s();
|
|
538
524
|
}
|
|
539
525
|
prompt() {
|
|
540
526
|
return new Promise((t) => {
|
|
541
527
|
if (this._abortSignal) {
|
|
542
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(
|
|
528
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
|
|
543
529
|
this._abortSignal.addEventListener("abort", () => {
|
|
544
530
|
this.state = "cancel", this.close();
|
|
545
|
-
}, { once:
|
|
531
|
+
}, { once: true });
|
|
546
532
|
}
|
|
547
|
-
this.rl =
|
|
533
|
+
this.rl = l__default.createInterface({
|
|
548
534
|
input: this.input,
|
|
549
535
|
tabSize: 2,
|
|
550
536
|
prompt: "",
|
|
551
537
|
escapeCodeTimeout: 50,
|
|
552
|
-
terminal:
|
|
553
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput,
|
|
554
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
538
|
+
terminal: true
|
|
539
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
540
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
|
|
555
541
|
}), this.once("cancel", () => {
|
|
556
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
542
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
|
|
557
543
|
});
|
|
558
544
|
});
|
|
559
545
|
}
|
|
560
546
|
_isActionKey(t, e) {
|
|
561
547
|
return t === " ";
|
|
562
548
|
}
|
|
549
|
+
_shouldSubmit(t, e) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
563
552
|
_setValue(t) {
|
|
564
553
|
this.value = t, this.emit("value", this.value);
|
|
565
554
|
}
|
|
@@ -568,22 +557,22 @@ let p = class {
|
|
|
568
557
|
}
|
|
569
558
|
_clearUserInput() {
|
|
570
559
|
this.rl?.write(null, {
|
|
571
|
-
ctrl:
|
|
560
|
+
ctrl: true,
|
|
572
561
|
name: "u"
|
|
573
562
|
}), this._setUserInput("");
|
|
574
563
|
}
|
|
575
564
|
onKeypress(t, e) {
|
|
576
565
|
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
577
|
-
ctrl:
|
|
566
|
+
ctrl: true,
|
|
578
567
|
name: "h"
|
|
579
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track &&
|
|
568
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
|
|
580
569
|
if (this.opts.validate) {
|
|
581
|
-
const
|
|
582
|
-
|
|
570
|
+
const i = runValidation(this.opts.validate, this.value);
|
|
571
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
583
572
|
}
|
|
584
573
|
this.state !== "error" && (this.state = "submit");
|
|
585
574
|
}
|
|
586
|
-
|
|
575
|
+
isActionKey([
|
|
587
576
|
t,
|
|
588
577
|
e?.name,
|
|
589
578
|
e?.sequence
|
|
@@ -591,48 +580,48 @@ let p = class {
|
|
|
591
580
|
}
|
|
592
581
|
close() {
|
|
593
582
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
594
|
-
`),
|
|
583
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
595
584
|
}
|
|
596
585
|
restoreCursor() {
|
|
597
586
|
const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
|
|
598
|
-
hard:
|
|
599
|
-
trim:
|
|
587
|
+
hard: true,
|
|
588
|
+
trim: false
|
|
600
589
|
}).split(`
|
|
601
590
|
`).length - 1;
|
|
602
591
|
this.output.write(import_src.cursor.move(-999, t * -1));
|
|
603
592
|
}
|
|
604
593
|
render() {
|
|
605
594
|
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
606
|
-
hard:
|
|
607
|
-
trim:
|
|
595
|
+
hard: true,
|
|
596
|
+
trim: false
|
|
608
597
|
});
|
|
609
598
|
if (t !== this._prevFrame) {
|
|
610
599
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
611
600
|
else {
|
|
612
|
-
const e =
|
|
601
|
+
const e = diffLines(this._prevFrame, t), i = getRows(this.output);
|
|
613
602
|
if (this.restoreCursor(), e) {
|
|
614
|
-
const
|
|
615
|
-
let
|
|
616
|
-
if (
|
|
603
|
+
const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
|
|
604
|
+
let r = e.lines.find((o) => o >= n);
|
|
605
|
+
if (r === void 0) {
|
|
617
606
|
this._prevFrame = t;
|
|
618
607
|
return;
|
|
619
608
|
}
|
|
620
609
|
if (e.lines.length === 1) {
|
|
621
|
-
this.output.write(import_src.cursor.move(0,
|
|
622
|
-
const
|
|
610
|
+
this.output.write(import_src.cursor.move(0, r - s)), this.output.write(import_src.erase.lines(1));
|
|
611
|
+
const o = t.split(`
|
|
623
612
|
`);
|
|
624
|
-
this.output.write(
|
|
613
|
+
this.output.write(o[r]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - r - 1));
|
|
625
614
|
return;
|
|
626
615
|
} else if (e.lines.length > 1) {
|
|
627
|
-
if (
|
|
616
|
+
if (n < s) r = n;
|
|
628
617
|
else {
|
|
629
|
-
const h =
|
|
618
|
+
const h = r - s;
|
|
630
619
|
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
631
620
|
}
|
|
632
621
|
this.output.write(import_src.erase.down());
|
|
633
|
-
const
|
|
634
|
-
`).slice(
|
|
635
|
-
this.output.write(
|
|
622
|
+
const f = t.split(`
|
|
623
|
+
`).slice(r);
|
|
624
|
+
this.output.write(f.join(`
|
|
636
625
|
`)), this._prevFrame = t;
|
|
637
626
|
return;
|
|
638
627
|
}
|
|
@@ -643,7 +632,7 @@ let p = class {
|
|
|
643
632
|
}
|
|
644
633
|
}
|
|
645
634
|
};
|
|
646
|
-
var
|
|
635
|
+
var r = class extends V {
|
|
647
636
|
get cursor() {
|
|
648
637
|
return this.value ? 0 : 1;
|
|
649
638
|
}
|
|
@@ -651,22 +640,22 @@ var Q$1 = class extends p {
|
|
|
651
640
|
return this.cursor === 0;
|
|
652
641
|
}
|
|
653
642
|
constructor(t) {
|
|
654
|
-
super(t,
|
|
643
|
+
super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
655
644
|
this.value = this._value;
|
|
656
|
-
}), this.on("confirm", (
|
|
657
|
-
this.output.write(import_src.cursor.move(0, -1)), this.value =
|
|
645
|
+
}), this.on("confirm", (i) => {
|
|
646
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
|
|
658
647
|
}), this.on("cursor", () => {
|
|
659
648
|
this.value = !this.value;
|
|
660
649
|
});
|
|
661
650
|
}
|
|
662
651
|
};
|
|
663
|
-
var
|
|
652
|
+
var n = class extends V {
|
|
664
653
|
get userInputWithCursor() {
|
|
665
654
|
if (this.state === "submit") return this.userInput;
|
|
666
655
|
const t = this.userInput;
|
|
667
656
|
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
668
|
-
const e = t.slice(0, this.cursor), [s, ...
|
|
669
|
-
return `${e}${styleText("inverse", s)}${
|
|
657
|
+
const e = t.slice(0, this.cursor), [s, ...r] = t.slice(this.cursor);
|
|
658
|
+
return `${e}${styleText("inverse", s)}${r.join("")}`;
|
|
670
659
|
}
|
|
671
660
|
get cursor() {
|
|
672
661
|
return this._cursor;
|
|
@@ -683,165 +672,118 @@ var at$1 = class extends p {
|
|
|
683
672
|
}
|
|
684
673
|
};
|
|
685
674
|
//#endregion
|
|
686
|
-
//#region node_modules/.pnpm/@clack+prompts@1.
|
|
687
|
-
function
|
|
688
|
-
|
|
675
|
+
//#region node_modules/.pnpm/@clack+prompts@1.6.0/node_modules/@clack/prompts/dist/index.mjs
|
|
676
|
+
function isUnicodeSupported() {
|
|
677
|
+
if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
|
|
678
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
689
679
|
}
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
680
|
+
const unicode = isUnicodeSupported(), unicodeOr = (o, e) => unicode ? o : e, S_STEP_ACTIVE = unicodeOr("◆", "*"), S_STEP_CANCEL = unicodeOr("■", "x"), S_STEP_ERROR = unicodeOr("▲", "x"), S_STEP_SUBMIT = unicodeOr("◇", "o"), S_BAR_START = unicodeOr("┌", "T"), S_BAR = unicodeOr("│", "|"), S_BAR_END = unicodeOr("└", "—");
|
|
681
|
+
unicodeOr("┐", "T");
|
|
682
|
+
unicodeOr("┘", "—");
|
|
683
|
+
const S_RADIO_ACTIVE = unicodeOr("●", ">"), S_RADIO_INACTIVE = unicodeOr("○", " ");
|
|
684
|
+
unicodeOr("◻", "[•]");
|
|
685
|
+
unicodeOr("◼", "[+]");
|
|
686
|
+
unicodeOr("◻", "[ ]");
|
|
687
|
+
unicodeOr("▪", "•");
|
|
688
|
+
unicodeOr("─", "-");
|
|
689
|
+
unicodeOr("╮", "+");
|
|
690
|
+
unicodeOr("├", "+");
|
|
691
|
+
unicodeOr("╯", "+");
|
|
692
|
+
unicodeOr("╰", "+");
|
|
693
|
+
unicodeOr("╭", "+");
|
|
694
|
+
unicodeOr("●", "•");
|
|
695
|
+
unicodeOr("◆", "*");
|
|
696
|
+
unicodeOr("▲", "!");
|
|
697
|
+
unicodeOr("■", "x");
|
|
698
|
+
const symbol = (o) => {
|
|
699
|
+
switch (o) {
|
|
693
700
|
case "initial":
|
|
694
|
-
case "active": return styleText("cyan",
|
|
695
|
-
case "cancel": return styleText("red",
|
|
696
|
-
case "error": return styleText("yellow",
|
|
697
|
-
case "submit": return styleText("green",
|
|
701
|
+
case "active": return styleText("cyan", S_STEP_ACTIVE);
|
|
702
|
+
case "cancel": return styleText("red", S_STEP_CANCEL);
|
|
703
|
+
case "error": return styleText("yellow", S_STEP_ERROR);
|
|
704
|
+
case "submit": return styleText("green", S_STEP_SUBMIT);
|
|
698
705
|
}
|
|
699
706
|
};
|
|
700
|
-
const
|
|
701
|
-
const
|
|
702
|
-
return new
|
|
703
|
-
active:
|
|
707
|
+
const confirm = (i) => {
|
|
708
|
+
const a = i.active ?? "Yes", s = i.inactive ?? "No";
|
|
709
|
+
return new r({
|
|
710
|
+
active: a,
|
|
704
711
|
inactive: s,
|
|
705
|
-
signal:
|
|
706
|
-
input:
|
|
707
|
-
output:
|
|
708
|
-
initialValue:
|
|
712
|
+
signal: i.signal,
|
|
713
|
+
input: i.input,
|
|
714
|
+
output: i.output,
|
|
715
|
+
initialValue: i.initialValue ?? true,
|
|
709
716
|
render() {
|
|
710
|
-
const
|
|
711
|
-
` : ""}${
|
|
712
|
-
`,
|
|
717
|
+
const e = i.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = e ? `${styleText("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(i.output, i.message, l, u), o = `${e ? `${styleText("gray", S_BAR)}
|
|
718
|
+
` : ""}${f}
|
|
719
|
+
`, c = this.value ? a : s;
|
|
713
720
|
switch (this.state) {
|
|
714
|
-
case "submit": return `${
|
|
715
|
-
case "cancel": return `${
|
|
716
|
-
${styleText("gray",
|
|
721
|
+
case "submit": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", c)}`;
|
|
722
|
+
case "cancel": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], c)}${e ? `
|
|
723
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
717
724
|
default: {
|
|
718
|
-
const
|
|
719
|
-
return `${
|
|
720
|
-
${styleText("cyan",
|
|
721
|
-
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim",
|
|
722
|
-
${
|
|
725
|
+
const r = e ? `${styleText("cyan", S_BAR)} ` : "", g = e ? styleText("cyan", S_BAR_END) : "";
|
|
726
|
+
return `${o}${r}${this.value ? `${styleText("green", S_RADIO_ACTIVE)} ${a}` : `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`}${i.vertical ? e ? `
|
|
727
|
+
${styleText("cyan", S_BAR)} ` : `
|
|
728
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", s)}` : `${styleText("green", S_RADIO_ACTIVE)} ${s}`}
|
|
729
|
+
${g}
|
|
723
730
|
`;
|
|
724
731
|
}
|
|
725
732
|
}
|
|
726
733
|
}
|
|
727
734
|
}).prompt();
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
`);
|
|
734
|
-
if (y.length > 0) {
|
|
735
|
-
const [p, ...m] = y;
|
|
736
|
-
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
|
|
737
|
-
for (const g of m) g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
|
|
738
|
-
}
|
|
739
|
-
r.write(`${o.join(`
|
|
740
|
-
`)}
|
|
741
|
-
`);
|
|
742
|
-
},
|
|
743
|
-
info: (e, i) => {
|
|
744
|
-
O.message(e, {
|
|
745
|
-
...i,
|
|
746
|
-
symbol: styleText("blue", he)
|
|
747
|
-
});
|
|
748
|
-
},
|
|
749
|
-
success: (e, i) => {
|
|
750
|
-
O.message(e, {
|
|
751
|
-
...i,
|
|
752
|
-
symbol: styleText("green", pe)
|
|
753
|
-
});
|
|
754
|
-
},
|
|
755
|
-
step: (e, i) => {
|
|
756
|
-
O.message(e, {
|
|
757
|
-
...i,
|
|
758
|
-
symbol: styleText("green", F)
|
|
759
|
-
});
|
|
760
|
-
},
|
|
761
|
-
warn: (e, i) => {
|
|
762
|
-
O.message(e, {
|
|
763
|
-
...i,
|
|
764
|
-
symbol: styleText("yellow", me)
|
|
765
|
-
});
|
|
766
|
-
},
|
|
767
|
-
warning: (e, i) => {
|
|
768
|
-
O.warn(e, i);
|
|
769
|
-
},
|
|
770
|
-
error: (e, i) => {
|
|
771
|
-
O.message(e, {
|
|
772
|
-
...i,
|
|
773
|
-
symbol: styleText("red", ge)
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
}, pt = (e = "", i) => {
|
|
777
|
-
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", E)} ` : "";
|
|
778
|
-
s.write(`${r}${styleText("red", e)}
|
|
735
|
+
};
|
|
736
|
+
`${styleText("dim", "↑/↓")}`, `${styleText("dim", "Space:")}`, `${styleText("dim", "Enter:")}`;
|
|
737
|
+
const cancel = (o = "", t) => {
|
|
738
|
+
const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_END)} ` : "";
|
|
739
|
+
i.write(`${e}${styleText("red", o)}
|
|
779
740
|
|
|
780
741
|
`);
|
|
781
|
-
},
|
|
782
|
-
const
|
|
783
|
-
|
|
742
|
+
}, intro = (o = "", t) => {
|
|
743
|
+
const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_START)} ` : "";
|
|
744
|
+
i.write(`${e}${o}
|
|
784
745
|
`);
|
|
785
|
-
},
|
|
786
|
-
const
|
|
787
|
-
${styleText("gray",
|
|
788
|
-
|
|
746
|
+
}, outro = (o = "", t) => {
|
|
747
|
+
const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR)}
|
|
748
|
+
${styleText("gray", S_BAR_END)} ` : "";
|
|
749
|
+
i.write(`${e}${o}
|
|
789
750
|
|
|
790
751
|
`);
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
${je}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
804
|
-
}
|
|
805
|
-
process.stdout.write(`
|
|
806
|
-
`);
|
|
807
|
-
},
|
|
808
|
-
info: (e) => K.message(e, { symbol: styleText("blue", he) }),
|
|
809
|
-
success: (e) => K.message(e, { symbol: styleText("green", pe) }),
|
|
810
|
-
step: (e) => K.message(e, { symbol: styleText("green", F) }),
|
|
811
|
-
warn: (e) => K.message(e, { symbol: styleText("yellow", me) }),
|
|
812
|
-
warning: (e) => K.warn(e),
|
|
813
|
-
error: (e) => K.message(e, { symbol: styleText("red", ge) })
|
|
814
|
-
}, Ot = (e) => new at$1({
|
|
815
|
-
validate: e.validate,
|
|
816
|
-
placeholder: e.placeholder,
|
|
817
|
-
defaultValue: e.defaultValue,
|
|
818
|
-
initialValue: e.initialValue,
|
|
819
|
-
output: e.output,
|
|
820
|
-
signal: e.signal,
|
|
821
|
-
input: e.input,
|
|
752
|
+
};
|
|
753
|
+
unicodeOr("─", "-"), unicodeOr("━", "="), unicodeOr("█", "#");
|
|
754
|
+
`${styleText("dim", "↑/↓")}`, `${styleText("dim", "Enter:")}`;
|
|
755
|
+
`${styleText("gray", S_BAR)}`;
|
|
756
|
+
const text = (t) => new n({
|
|
757
|
+
validate: t.validate,
|
|
758
|
+
placeholder: t.placeholder,
|
|
759
|
+
defaultValue: t.defaultValue,
|
|
760
|
+
initialValue: t.initialValue,
|
|
761
|
+
output: t.output,
|
|
762
|
+
signal: t.signal,
|
|
763
|
+
input: t.input,
|
|
822
764
|
render() {
|
|
823
|
-
const i =
|
|
824
|
-
` : ""}${
|
|
825
|
-
`,
|
|
765
|
+
const i = t?.withGuide ?? settings.withGuide, s = `${`${i ? `${styleText("gray", S_BAR)}
|
|
766
|
+
` : ""}${symbol(this.state)} `}${t.message}
|
|
767
|
+
`, c = t.placeholder ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : c, a = this.value ?? "";
|
|
826
768
|
switch (this.state) {
|
|
827
769
|
case "error": {
|
|
828
|
-
const
|
|
770
|
+
const n = this.error ? ` ${styleText("yellow", this.error)}` : "", r = i ? `${styleText("yellow", S_BAR)} ` : "", d = i ? styleText("yellow", S_BAR_END) : "";
|
|
829
771
|
return `${s.trim()}
|
|
830
|
-
${
|
|
831
|
-
${
|
|
772
|
+
${r}${o}
|
|
773
|
+
${d}${n}
|
|
832
774
|
`;
|
|
833
775
|
}
|
|
834
776
|
case "submit": {
|
|
835
|
-
const
|
|
836
|
-
return `${s}${i ? styleText("gray",
|
|
777
|
+
const n = a ? ` ${styleText("dim", a)}` : "";
|
|
778
|
+
return `${s}${i ? styleText("gray", S_BAR) : ""}${n}`;
|
|
837
779
|
}
|
|
838
780
|
case "cancel": {
|
|
839
|
-
const
|
|
840
|
-
return `${s}${
|
|
841
|
-
${
|
|
781
|
+
const n = a ? ` ${styleText(["strikethrough", "dim"], a)}` : "", r = i ? styleText("gray", S_BAR) : "";
|
|
782
|
+
return `${s}${r}${n}${a.trim() ? `
|
|
783
|
+
${r}` : ""}`;
|
|
842
784
|
}
|
|
843
|
-
default: return `${s}${i ? `${styleText("cyan",
|
|
844
|
-
${i ? styleText("cyan",
|
|
785
|
+
default: return `${s}${i ? `${styleText("cyan", S_BAR)} ` : ""}${o}
|
|
786
|
+
${i ? styleText("cyan", S_BAR_END) : ""}
|
|
845
787
|
`;
|
|
846
788
|
}
|
|
847
789
|
}
|
|
@@ -1799,8 +1741,8 @@ var require_ejs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1799
1741
|
//#region utils/banners.ts
|
|
1800
1742
|
var import_picocolors = require_picocolors();
|
|
1801
1743
|
var import_ejs = /* @__PURE__ */ __toESM(require_ejs(), 1);
|
|
1802
|
-
const defaultBanner = "Rue.js - The Wasm Framework For Native DOM";
|
|
1803
|
-
const gradientBanner = "\x1B[38;2;66;211;146mR\x1B[39m\x1B[38;2;66;211;146mu\x1B[39m\x1B[38;2;66;211;146me\x1B[39m\x1B[38;2;66;211;146m.\x1B[39m\x1B[38;2;66;211;146mj\x1B[39m\x1B[38;2;
|
|
1744
|
+
const defaultBanner = "Rue.js - The Wasm Framework For Vapor Native DOM";
|
|
1745
|
+
const gradientBanner = "\x1B[38;2;66;211;146mR\x1B[39m\x1B[38;2;66;211;146mu\x1B[39m\x1B[38;2;66;211;146me\x1B[39m\x1B[38;2;66;211;146m.\x1B[39m\x1B[38;2;66;211;146mj\x1B[39m\x1B[38;2;66;210;147ms\x1B[39m \x1B[38;2;68;206;152m-\x1B[39m \x1B[38;2;69;202;157mT\x1B[39m\x1B[38;2;70;200;160mh\x1B[39m\x1B[38;2;71;198;162me\x1B[39m \x1B[38;2;73;194;167mW\x1B[39m\x1B[38;2;73;192;170ma\x1B[39m\x1B[38;2;74;190;173ms\x1B[39m\x1B[38;2;75;188;175mm\x1B[39m \x1B[38;2;77;184;180mF\x1B[39m\x1B[38;2;77;182;183mr\x1B[39m\x1B[38;2;78;180;185ma\x1B[39m\x1B[38;2;79;178;188mm\x1B[39m\x1B[38;2;80;176;191me\x1B[39m\x1B[38;2;81;174;193mw\x1B[39m\x1B[38;2;82;172;196mo\x1B[39m\x1B[38;2;82;170;198mr\x1B[39m\x1B[38;2;83;168;201mk\x1B[39m \x1B[38;2;85;164;206mF\x1B[39m\x1B[38;2;86;162;209mo\x1B[39m\x1B[38;2;86;160;211mr\x1B[39m \x1B[38;2;88;156;216mV\x1B[39m\x1B[38;2;89;154;219ma\x1B[39m\x1B[38;2;90;152;222mp\x1B[39m\x1B[38;2;90;150;224mo\x1B[39m\x1B[38;2;91;148;227mr\x1B[39m \x1B[38;2;93;144;232mN\x1B[39m\x1B[38;2;94;142;234ma\x1B[39m\x1B[38;2;94;140;237mt\x1B[39m\x1B[38;2;95;138;240mi\x1B[39m\x1B[38;2;96;136;242mv\x1B[39m\x1B[38;2;97;134;245me\x1B[39m \x1B[38;2;98;130;250mD\x1B[39m\x1B[38;2;99;128;252mO\x1B[39m\x1B[38;2;100;126;255mM\x1B[39m";
|
|
1804
1746
|
//#endregion
|
|
1805
1747
|
//#region utils/deepMerge.ts
|
|
1806
1748
|
const isObject = (val) => val && typeof val === "object";
|
|
@@ -2037,7 +1979,7 @@ function inferPackageManager() {
|
|
|
2037
1979
|
//#endregion
|
|
2038
1980
|
//#region package.json
|
|
2039
1981
|
var name = "create-rue";
|
|
2040
|
-
var version = "0.3
|
|
1982
|
+
var version = "0.7.3";
|
|
2041
1983
|
//#endregion
|
|
2042
1984
|
//#region index.ts
|
|
2043
1985
|
const language = await getLanguage(fileURLToPath(new URL("./locales", import.meta.url)));
|
|
@@ -2064,8 +2006,8 @@ function emptyDir(dir) {
|
|
|
2064
2006
|
}
|
|
2065
2007
|
async function unwrapPrompt(maybeCancelPromise) {
|
|
2066
2008
|
const result = await maybeCancelPromise;
|
|
2067
|
-
if (
|
|
2068
|
-
|
|
2009
|
+
if (isCancel(result)) {
|
|
2010
|
+
cancel((0, import_picocolors.red)("✖") + ` ${language.errors.operationCancelled}`);
|
|
2069
2011
|
process.exit(0);
|
|
2070
2012
|
}
|
|
2071
2013
|
return result;
|
|
@@ -2120,24 +2062,24 @@ async function init() {
|
|
|
2120
2062
|
shouldOverwrite: forceOverwrite,
|
|
2121
2063
|
packageName: defaultProjectName
|
|
2122
2064
|
};
|
|
2123
|
-
|
|
2124
|
-
if (!targetDir) targetDir = result.projectName = result.packageName = (await unwrapPrompt(
|
|
2065
|
+
intro(process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner);
|
|
2066
|
+
if (!targetDir) targetDir = result.projectName = result.packageName = (await unwrapPrompt(text({
|
|
2125
2067
|
message: language.projectName.message,
|
|
2126
2068
|
placeholder: defaultProjectName,
|
|
2127
2069
|
defaultValue: defaultProjectName,
|
|
2128
2070
|
validate: (value) => !value || value.trim().length > 0 ? void 0 : language.projectName.invalidMessage
|
|
2129
2071
|
})))?.trim() || defaultProjectName;
|
|
2130
2072
|
if (!canSkipEmptying(targetDir) && !forceOverwrite) {
|
|
2131
|
-
result.shouldOverwrite = await unwrapPrompt(
|
|
2073
|
+
result.shouldOverwrite = await unwrapPrompt(confirm({
|
|
2132
2074
|
message: `${targetDir === "." ? language.shouldOverwrite.dirForPrompts.current : `${language.shouldOverwrite.dirForPrompts.target} "${targetDir}"`} ${language.shouldOverwrite.message}`,
|
|
2133
2075
|
initialValue: false
|
|
2134
2076
|
}));
|
|
2135
2077
|
if (!result.shouldOverwrite) {
|
|
2136
|
-
|
|
2078
|
+
cancel((0, import_picocolors.red)("✖") + ` ${language.errors.operationCancelled}`);
|
|
2137
2079
|
process.exit(0);
|
|
2138
2080
|
}
|
|
2139
2081
|
}
|
|
2140
|
-
if (!isValidPackageName(targetDir)) result.packageName = await unwrapPrompt(
|
|
2082
|
+
if (!isValidPackageName(targetDir)) result.packageName = await unwrapPrompt(text({
|
|
2141
2083
|
message: language.packageName.message,
|
|
2142
2084
|
initialValue: toValidPackageName(targetDir),
|
|
2143
2085
|
validate: (value) => isValidPackageName(value) ? void 0 : language.packageName.invalidMessage
|
|
@@ -2184,7 +2126,7 @@ async function init() {
|
|
|
2184
2126
|
${(0, import_picocolors.dim)("|")} ${language.infos.optionalGitCommand}
|
|
2185
2127
|
|
|
2186
2128
|
${(0, import_picocolors.bold)((0, import_picocolors.green)("git init && git add -A && git commit -m \"initial commit\""))}`;
|
|
2187
|
-
|
|
2129
|
+
outro(outroMessage);
|
|
2188
2130
|
}
|
|
2189
2131
|
init().catch((e) => {
|
|
2190
2132
|
console.error(e);
|