@robelest/convex-auth 0.0.4-preview.20 → 0.0.4-preview.22
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/{bin.cjs → bin.js} +331 -330
- package/dist/component/model.d.ts +9 -9
- package/dist/component/model.d.ts.map +1 -1
- package/dist/component/schema.d.ts +37 -37
- package/dist/component/server/auth.d.ts +71 -25
- package/dist/component/server/auth.d.ts.map +1 -1
- package/dist/component/server/auth.js +13 -27
- package/dist/component/server/auth.js.map +1 -1
- package/dist/component/server/runtime.d.ts +1 -1
- package/dist/server/auth.d.ts +70 -24
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +13 -27
- package/dist/server/auth.js.map +1 -1
- package/dist/server/http.d.ts +2 -2
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/mounts.d.ts +18 -18
- package/dist/server/mutations/account.d.ts +6 -6
- package/dist/server/mutations/account.d.ts.map +1 -1
- package/dist/server/mutations/code.d.ts +11 -11
- package/dist/server/mutations/invalidate.d.ts +4 -4
- package/dist/server/mutations/oauth.d.ts +9 -9
- package/dist/server/mutations/oauth.d.ts.map +1 -1
- package/dist/server/mutations/refresh.d.ts +3 -3
- package/dist/server/mutations/refresh.d.ts.map +1 -1
- package/dist/server/mutations/register.d.ts +2 -2
- package/dist/server/mutations/retrieve.d.ts +6 -6
- package/dist/server/mutations/signature.d.ts +4 -4
- package/dist/server/mutations/signature.d.ts.map +1 -1
- package/dist/server/mutations/signin.d.ts +5 -5
- package/dist/server/mutations/store.d.ts +83 -83
- package/dist/server/mutations/verify.d.ts +7 -7
- package/dist/server/mutations/verify.d.ts.map +1 -1
- package/dist/server/runtime.d.ts +7 -7
- package/package.json +4 -4
- package/src/cli/index.ts +1 -1
- package/src/component/index.ts +1 -0
- package/src/server/auth.ts +103 -59
- package/src/server/index.ts +2 -0
package/dist/{bin.cjs → bin.js}
RENAMED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { execFileSync } from "child_process";
|
|
4
|
+
import { existsSync, mkdtempSync, readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
5
|
+
import { tmpdir } from "os";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { stripVTControlCharacters, styleText } from "node:util";
|
|
8
|
+
import N, { stdin, stdout } from "node:process";
|
|
9
|
+
import * as k from "node:readline";
|
|
10
|
+
import ot from "node:readline";
|
|
11
|
+
import { ReadStream } from "node:tty";
|
|
12
|
+
import { existsSync as existsSync$1, lstatSync, readdirSync } from "node:fs";
|
|
13
|
+
import { dirname, join } from "node:path";
|
|
14
|
+
import { randomBytes } from "node:crypto";
|
|
15
|
+
import { exportJWK, exportPKCS8, generateKeyPair } from "jose";
|
|
16
|
+
|
|
2
17
|
//#region rolldown:runtime
|
|
3
18
|
var __create = Object.create;
|
|
4
19
|
var __defProp = Object.defineProperty;
|
|
@@ -13,7 +28,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
28
|
key = keys[i];
|
|
14
29
|
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
15
30
|
__defProp(to, key, {
|
|
16
|
-
get: ((k) => from[k]).bind(null, key),
|
|
31
|
+
get: ((k$1) => from[k$1]).bind(null, key),
|
|
17
32
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
33
|
});
|
|
19
34
|
}
|
|
@@ -25,24 +40,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
40
|
value: mod,
|
|
26
41
|
enumerable: true
|
|
27
42
|
}) : target, mod));
|
|
43
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
28
44
|
|
|
29
45
|
//#endregion
|
|
30
|
-
let child_process = require("child_process");
|
|
31
|
-
let fs = require("fs");
|
|
32
|
-
let os = require("os");
|
|
33
|
-
let path = require("path");
|
|
34
|
-
path = __toESM(path);
|
|
35
|
-
let node_util = require("node:util");
|
|
36
|
-
let node_process = require("node:process");
|
|
37
|
-
node_process = __toESM(node_process);
|
|
38
|
-
let node_readline = require("node:readline");
|
|
39
|
-
node_readline = __toESM(node_readline);
|
|
40
|
-
let node_tty = require("node:tty");
|
|
41
|
-
let node_fs = require("node:fs");
|
|
42
|
-
let node_path = require("node:path");
|
|
43
|
-
let node_crypto = require("node:crypto");
|
|
44
|
-
let jose = require("jose");
|
|
45
|
-
|
|
46
46
|
//#region ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
47
47
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
48
48
|
const ESC = "\x1B";
|
|
@@ -102,24 +102,24 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region ../../node_modules/.pnpm/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
|
|
104
104
|
var import_src = require_src();
|
|
105
|
-
function x$1(t
|
|
106
|
-
if (!s.some((u) => !u.disabled)) return t
|
|
107
|
-
const i = t
|
|
105
|
+
function x$1(t, e, s) {
|
|
106
|
+
if (!s.some((u) => !u.disabled)) return t;
|
|
107
|
+
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
108
108
|
return s[n].disabled ? x$1(n, e < 0 ? -1 : 1, s) : n;
|
|
109
109
|
}
|
|
110
|
-
const at = (t
|
|
110
|
+
const at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 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 >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 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 >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 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 >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 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 >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || 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 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || 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 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || 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, O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L = /\t{1,1000}/y, 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?))*/uy, M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, ft$1 = {
|
|
111
111
|
limit: Infinity,
|
|
112
112
|
ellipsis: ""
|
|
113
|
-
}, X$1 = (t
|
|
113
|
+
}, X$1 = (t, e = {}, s = {}) => {
|
|
114
114
|
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X$1(r, ft$1, 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$1 = s.wideWidth ?? 2;
|
|
115
|
-
let h$1 = 0, o = 0, p = t
|
|
115
|
+
let h$1 = 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;
|
|
116
116
|
t: for (;;) {
|
|
117
117
|
if (w > C || o >= p && o > h$1) {
|
|
118
|
-
const ut = t
|
|
118
|
+
const ut = t.slice(C, w) || t.slice(h$1, o);
|
|
119
119
|
v = 0;
|
|
120
120
|
for (const Y of ut.replaceAll(ct, "")) {
|
|
121
121
|
const $ = Y.codePointAt(0) || 0;
|
|
122
|
-
if (lt($) ? f = m : ht
|
|
122
|
+
if (lt($) ? f = m : ht($) ? f = V$1 : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h$1) + v)), c + f > i) {
|
|
123
123
|
F = !0;
|
|
124
124
|
break t;
|
|
125
125
|
}
|
|
@@ -128,7 +128,7 @@ const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 ||
|
|
|
128
128
|
C = w = 0;
|
|
129
129
|
}
|
|
130
130
|
if (o >= p) break;
|
|
131
|
-
if (M.lastIndex = o, M.test(t
|
|
131
|
+
if (M.lastIndex = o, M.test(t)) {
|
|
132
132
|
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
133
133
|
F = !0;
|
|
134
134
|
break;
|
|
@@ -136,7 +136,7 @@ const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 ||
|
|
|
136
136
|
c += f, C = h$1, w = o, o = h$1 = M.lastIndex;
|
|
137
137
|
continue;
|
|
138
138
|
}
|
|
139
|
-
if (O.lastIndex = o, O.test(t
|
|
139
|
+
if (O.lastIndex = o, O.test(t)) {
|
|
140
140
|
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
141
141
|
F = !0;
|
|
142
142
|
break;
|
|
@@ -144,7 +144,7 @@ const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 ||
|
|
|
144
144
|
c += u, C = h$1, w = o, o = h$1 = O.lastIndex;
|
|
145
145
|
continue;
|
|
146
146
|
}
|
|
147
|
-
if (y.lastIndex = o, y.test(t
|
|
147
|
+
if (y.lastIndex = o, y.test(t)) {
|
|
148
148
|
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
149
149
|
F = !0;
|
|
150
150
|
break;
|
|
@@ -152,7 +152,7 @@ const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 ||
|
|
|
152
152
|
c += f, C = h$1, w = o, o = h$1 = y.lastIndex;
|
|
153
153
|
continue;
|
|
154
154
|
}
|
|
155
|
-
if (L.lastIndex = o, L.test(t
|
|
155
|
+
if (L.lastIndex = o, L.test(t)) {
|
|
156
156
|
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
157
157
|
F = !0;
|
|
158
158
|
break;
|
|
@@ -160,7 +160,7 @@ const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 ||
|
|
|
160
160
|
c += f, C = h$1, w = o, o = h$1 = L.lastIndex;
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
if (P.lastIndex = o, P.test(t
|
|
163
|
+
if (P.lastIndex = o, P.test(t)) {
|
|
164
164
|
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
165
165
|
F = !0;
|
|
166
166
|
break;
|
|
@@ -180,33 +180,33 @@ const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 ||
|
|
|
180
180
|
limit: Infinity,
|
|
181
181
|
ellipsis: "",
|
|
182
182
|
ellipsisWidth: 0
|
|
183
|
-
}, S = (t
|
|
184
|
-
if (t
|
|
185
|
-
if (t
|
|
186
|
-
if (t
|
|
187
|
-
if (t
|
|
188
|
-
if (t
|
|
189
|
-
if (t
|
|
190
|
-
if (t
|
|
191
|
-
if (t
|
|
192
|
-
if (t
|
|
193
|
-
}, st = (t
|
|
183
|
+
}, S = (t, e = {}) => X$1(t, pt$1, e).width, T = "\x1B", Z = "", Ft$1 = 39, j = "\x07", Q$1 = "[", dt = "]", tt = "m", U$1 = `${dt}8;;`, et = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j})`, "y"), mt$1 = (t) => {
|
|
184
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
185
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
186
|
+
if (t === 1 || t === 2) return 22;
|
|
187
|
+
if (t === 3) return 23;
|
|
188
|
+
if (t === 4) return 24;
|
|
189
|
+
if (t === 7) return 27;
|
|
190
|
+
if (t === 8) return 28;
|
|
191
|
+
if (t === 9) return 29;
|
|
192
|
+
if (t === 0) return 0;
|
|
193
|
+
}, st = (t) => `${T}${Q$1}${t}${tt}`, it = (t) => `${T}${U$1}${t}${j}`, gt$1 = (t) => t.map((e) => S(e)), G = (t, e, s) => {
|
|
194
194
|
const i = e[Symbol.iterator]();
|
|
195
|
-
let r = !1, n = !1, u = t
|
|
195
|
+
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
196
196
|
for (; !l.done;) {
|
|
197
197
|
const m = l.value, A = S(m);
|
|
198
|
-
a + A <= s ? t
|
|
198
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = !0, n = e.startsWith(U$1, g + 1)), r ? n ? m === 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;
|
|
199
199
|
}
|
|
200
|
-
u = t
|
|
201
|
-
}, vt$1 = (t
|
|
202
|
-
const e = t
|
|
200
|
+
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
201
|
+
}, vt$1 = (t) => {
|
|
202
|
+
const e = t.split(" ");
|
|
203
203
|
let s = e.length;
|
|
204
204
|
for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
|
|
205
|
-
return s === e.length ? t
|
|
206
|
-
}, Et$1 = (t
|
|
207
|
-
if (s.trim !== !1 && t
|
|
205
|
+
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
206
|
+
}, Et$1 = (t, e, s = {}) => {
|
|
207
|
+
if (s.trim !== !1 && t.trim() === "") return "";
|
|
208
208
|
let i = "", r, n;
|
|
209
|
-
const u = t
|
|
209
|
+
const u = t.split(" "), a = gt$1(u);
|
|
210
210
|
let l = [""];
|
|
211
211
|
for (const [h$1, o] of u.entries()) {
|
|
212
212
|
s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
@@ -250,8 +250,8 @@ const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 ||
|
|
|
250
250
|
}
|
|
251
251
|
return i;
|
|
252
252
|
};
|
|
253
|
-
function K$1(t
|
|
254
|
-
return String(t
|
|
253
|
+
function K$1(t, e, s) {
|
|
254
|
+
return String(t).normalize().replaceAll(`\r
|
|
255
255
|
`, `
|
|
256
256
|
`).split(`
|
|
257
257
|
`).map((i) => Et$1(i, e, s)).join(`
|
|
@@ -281,14 +281,14 @@ const _ = {
|
|
|
281
281
|
},
|
|
282
282
|
withGuide: !0
|
|
283
283
|
};
|
|
284
|
-
function H$1(t
|
|
285
|
-
if (typeof t
|
|
286
|
-
for (const s of t
|
|
284
|
+
function H$1(t, e) {
|
|
285
|
+
if (typeof t == "string") return _.aliases.get(t) === e;
|
|
286
|
+
for (const s of t) if (s !== void 0 && H$1(s, e)) return !0;
|
|
287
287
|
return !1;
|
|
288
288
|
}
|
|
289
|
-
function _t$1(t
|
|
290
|
-
if (t
|
|
291
|
-
const s = t
|
|
289
|
+
function _t$1(t, e) {
|
|
290
|
+
if (t === e) return;
|
|
291
|
+
const s = t.split(`
|
|
292
292
|
`), i = e.split(`
|
|
293
293
|
`), r = Math.max(s.length, i.length), n = [];
|
|
294
294
|
for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
|
|
@@ -300,21 +300,21 @@ function _t$1(t$1, e) {
|
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
302
|
const bt$1 = globalThis.process.platform.startsWith("win"), z$1 = Symbol("clack:cancel");
|
|
303
|
-
function Ct$1(t
|
|
304
|
-
return t
|
|
303
|
+
function Ct$1(t) {
|
|
304
|
+
return t === z$1;
|
|
305
305
|
}
|
|
306
|
-
function W$1(t
|
|
307
|
-
const s = t
|
|
306
|
+
function W$1(t, e) {
|
|
307
|
+
const s = t;
|
|
308
308
|
s.isTTY && s.setRawMode(e);
|
|
309
309
|
}
|
|
310
|
-
function xt$1({ input: t
|
|
311
|
-
const r =
|
|
312
|
-
input: t
|
|
310
|
+
function xt$1({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
|
|
311
|
+
const r = k.createInterface({
|
|
312
|
+
input: t,
|
|
313
313
|
output: e,
|
|
314
314
|
prompt: "",
|
|
315
315
|
tabSize: 1
|
|
316
316
|
});
|
|
317
|
-
|
|
317
|
+
k.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
|
|
318
318
|
const n = (u, { name: a, sequence: l }) => {
|
|
319
319
|
if (H$1([
|
|
320
320
|
String(u),
|
|
@@ -326,19 +326,19 @@ function xt$1({ input: t$1 = node_process.stdin, output: e = node_process.stdout
|
|
|
326
326
|
}
|
|
327
327
|
if (!s) return;
|
|
328
328
|
const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
t
|
|
329
|
+
k.moveCursor(e, g, m, () => {
|
|
330
|
+
k.clearLine(e, 1, () => {
|
|
331
|
+
t.once("keypress", n);
|
|
332
332
|
});
|
|
333
333
|
});
|
|
334
334
|
};
|
|
335
|
-
return i && e.write(import_src.cursor.hide), t
|
|
336
|
-
t
|
|
335
|
+
return i && e.write(import_src.cursor.hide), t.once("keypress", n), () => {
|
|
336
|
+
t.off("keypress", n), i && e.write(import_src.cursor.show), t instanceof ReadStream && t.isTTY && !bt$1 && t.setRawMode(!1), r.terminal = !1, r.close();
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
|
-
const rt = (t
|
|
340
|
-
function Bt$1(t
|
|
341
|
-
return K$1(e, rt(t
|
|
339
|
+
const rt = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
|
|
340
|
+
function Bt$1(t, e, s, i = s) {
|
|
341
|
+
return K$1(e, rt(t ?? stdout) - s.length, {
|
|
342
342
|
hard: !0,
|
|
343
343
|
trim: !1
|
|
344
344
|
}).split(`
|
|
@@ -361,7 +361,7 @@ var B = class {
|
|
|
361
361
|
value;
|
|
362
362
|
userInput = "";
|
|
363
363
|
constructor(e, s = !0) {
|
|
364
|
-
const { input: i =
|
|
364
|
+
const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
|
|
365
365
|
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
|
|
366
366
|
}
|
|
367
367
|
unsubscribe() {
|
|
@@ -393,7 +393,7 @@ var B = class {
|
|
|
393
393
|
this.state = "cancel", this.close();
|
|
394
394
|
}, { once: !0 });
|
|
395
395
|
}
|
|
396
|
-
this.rl =
|
|
396
|
+
this.rl = ot.createInterface({
|
|
397
397
|
input: this.input,
|
|
398
398
|
tabSize: 2,
|
|
399
399
|
prompt: "",
|
|
@@ -492,16 +492,16 @@ var B = class {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
};
|
|
495
|
-
function wt$1(t
|
|
496
|
-
if (t
|
|
497
|
-
const s = e.findIndex((i) => i.value === t
|
|
495
|
+
function wt$1(t, e) {
|
|
496
|
+
if (t === void 0 || e.length === 0) return 0;
|
|
497
|
+
const s = e.findIndex((i) => i.value === t);
|
|
498
498
|
return s !== -1 ? s : 0;
|
|
499
499
|
}
|
|
500
|
-
function Dt$1(t
|
|
501
|
-
return (e.label ?? String(e.value)).toLowerCase().includes(t
|
|
500
|
+
function Dt$1(t, e) {
|
|
501
|
+
return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
|
|
502
502
|
}
|
|
503
|
-
function St$1(t
|
|
504
|
-
if (e) return t
|
|
503
|
+
function St$1(t, e) {
|
|
504
|
+
if (e) return t ? e : e[0];
|
|
505
505
|
}
|
|
506
506
|
var Vt$1 = class extends B {
|
|
507
507
|
filteredOptions;
|
|
@@ -517,10 +517,10 @@ var Vt$1 = class extends B {
|
|
|
517
517
|
return this.#t;
|
|
518
518
|
}
|
|
519
519
|
get userInputWithCursor() {
|
|
520
|
-
if (!this.userInput) return
|
|
520
|
+
if (!this.userInput) return styleText(["inverse", "hidden"], "_");
|
|
521
521
|
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
522
522
|
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
523
|
-
return `${e}${
|
|
523
|
+
return `${e}${styleText("inverse", s)}${i.join("")}`;
|
|
524
524
|
}
|
|
525
525
|
get options() {
|
|
526
526
|
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
@@ -683,9 +683,9 @@ var Mt$1 = class extends B {
|
|
|
683
683
|
get userInputWithCursor() {
|
|
684
684
|
if (this.state === "submit" || this.state === "cancel") return this.masked;
|
|
685
685
|
const e = this.userInput;
|
|
686
|
-
if (this.cursor >= e.length) return `${this.masked}${
|
|
686
|
+
if (this.cursor >= e.length) return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
|
|
687
687
|
const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
|
|
688
|
-
return `${i}${
|
|
688
|
+
return `${i}${styleText("inverse", r[0])}${r.slice(1)}`;
|
|
689
689
|
}
|
|
690
690
|
clear() {
|
|
691
691
|
this._clearUserInput();
|
|
@@ -738,13 +738,13 @@ var Wt$1 = class extends B {
|
|
|
738
738
|
});
|
|
739
739
|
}
|
|
740
740
|
};
|
|
741
|
-
var $t
|
|
741
|
+
var $t = class extends B {
|
|
742
742
|
get userInputWithCursor() {
|
|
743
743
|
if (this.state === "submit") return this.userInput;
|
|
744
744
|
const e = this.userInput;
|
|
745
745
|
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
746
746
|
const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
|
|
747
|
-
return `${s}${
|
|
747
|
+
return `${s}${styleText("inverse", i)}${r.join("")}`;
|
|
748
748
|
}
|
|
749
749
|
get cursor() {
|
|
750
750
|
return this._cursor;
|
|
@@ -764,23 +764,23 @@ var $t$1 = class extends B {
|
|
|
764
764
|
//#endregion
|
|
765
765
|
//#region ../../node_modules/.pnpm/@clack+prompts@1.1.0/node_modules/@clack/prompts/dist/index.mjs
|
|
766
766
|
function pt() {
|
|
767
|
-
return
|
|
767
|
+
return N.platform !== "win32" ? N.env.TERM !== "linux" : !!N.env.CI || !!N.env.WT_SESSION || !!N.env.TERMINUS_SUBLIME || N.env.ConEmuTask === "{cmd::Cmder}" || N.env.TERM_PROGRAM === "Terminus-Sublime" || N.env.TERM_PROGRAM === "vscode" || N.env.TERM === "xterm-256color" || N.env.TERM === "alacritty" || N.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
768
768
|
}
|
|
769
769
|
const ee = pt(), ce = () => process.env.CI === "true", Me = (e) => e.isTTY === !0, I = (e, r) => ee ? e : r, Re = I("◆", "*"), $e = I("■", "x"), de = I("▲", "x"), V = I("◇", "o"), he = I("┌", "T"), h = I("│", "|"), x = I("└", "—"), Oe = I("┐", "T"), Pe = I("┘", "—"), z = I("●", ">"), H = I("○", " "), te = I("◻", "[•]"), U = I("◼", "[+]"), q = I("◻", "[ ]"), Ne = I("▪", "•"), se = I("─", "-"), pe = I("╮", "+"), We = I("├", "+"), me = I("╯", "+"), ge = I("╰", "+"), Ge = I("╭", "+"), fe = I("●", "•"), Fe = I("◆", "*"), ye = I("▲", "!"), Ee = I("■", "x"), W = (e) => {
|
|
770
770
|
switch (e) {
|
|
771
771
|
case "initial":
|
|
772
|
-
case "active": return
|
|
773
|
-
case "cancel": return
|
|
774
|
-
case "error": return
|
|
775
|
-
case "submit": return
|
|
772
|
+
case "active": return styleText("cyan", Re);
|
|
773
|
+
case "cancel": return styleText("red", $e);
|
|
774
|
+
case "error": return styleText("yellow", de);
|
|
775
|
+
case "submit": return styleText("green", V);
|
|
776
776
|
}
|
|
777
777
|
}, ve = (e) => {
|
|
778
778
|
switch (e) {
|
|
779
779
|
case "initial":
|
|
780
|
-
case "active": return
|
|
781
|
-
case "cancel": return
|
|
782
|
-
case "error": return
|
|
783
|
-
case "submit": return
|
|
780
|
+
case "active": return styleText("cyan", h);
|
|
781
|
+
case "cancel": return styleText("red", h);
|
|
782
|
+
case "error": return styleText("yellow", h);
|
|
783
|
+
case "submit": return styleText("green", h);
|
|
784
784
|
}
|
|
785
785
|
}, mt = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 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 >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 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 >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 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 >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, gt = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, ft = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 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 >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || 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 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || 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 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || 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?))*/uy, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Ft = /\p{M}+/gu, yt = {
|
|
786
786
|
limit: Infinity,
|
|
@@ -943,7 +943,7 @@ const bt = (e, r, s, i, a) => {
|
|
|
943
943
|
removals: u
|
|
944
944
|
};
|
|
945
945
|
}, X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
|
|
946
|
-
const l = rt(i) - o, n = nt(i), c =
|
|
946
|
+
const l = rt(i) - o, n = nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
947
947
|
let g = 0;
|
|
948
948
|
e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
|
|
949
949
|
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
@@ -992,40 +992,40 @@ const Xe = (e) => new Vt$1({
|
|
|
992
992
|
output: e.output,
|
|
993
993
|
validate: e.validate,
|
|
994
994
|
render() {
|
|
995
|
-
const r = e.withGuide ?? _.withGuide, s = r ? [`${
|
|
996
|
-
const p = qe(n), f = n.hint && n.value === this.focusedValue ?
|
|
995
|
+
const r = e.withGuide ?? _.withGuide, s = r ? [`${styleText("gray", h)}`, `${W(this.state)} ${e.message}`] : [`${W(this.state)} ${e.message}`], i = this.userInput, a = this.options, o = e.placeholder, u = i === "" && o !== void 0, l = (n, c) => {
|
|
996
|
+
const p = qe(n), f = n.hint && n.value === this.focusedValue ? styleText("dim", ` (${n.hint})`) : "";
|
|
997
997
|
switch (c) {
|
|
998
|
-
case "active": return `${
|
|
999
|
-
case "inactive": return `${
|
|
1000
|
-
case "disabled": return `${
|
|
998
|
+
case "active": return `${styleText("green", z)} ${p}${f}`;
|
|
999
|
+
case "inactive": return `${styleText("dim", H)} ${styleText("dim", p)}`;
|
|
1000
|
+
case "disabled": return `${styleText("gray", H)} ${styleText(["strikethrough", "gray"], p)}`;
|
|
1001
1001
|
}
|
|
1002
1002
|
};
|
|
1003
1003
|
switch (this.state) {
|
|
1004
1004
|
case "submit": {
|
|
1005
|
-
const n = Bt(this.selectedValues, a), c = n.length > 0 ? ` ${
|
|
1005
|
+
const n = Bt(this.selectedValues, a), c = n.length > 0 ? ` ${styleText("dim", n.map(qe).join(", "))}` : "", p = r ? styleText("gray", h) : "";
|
|
1006
1006
|
return `${s.join(`
|
|
1007
1007
|
`)}
|
|
1008
1008
|
${p}${c}`;
|
|
1009
1009
|
}
|
|
1010
1010
|
case "cancel": {
|
|
1011
|
-
const n = i ? ` ${
|
|
1011
|
+
const n = i ? ` ${styleText(["strikethrough", "dim"], i)}` : "", c = r ? styleText("gray", h) : "";
|
|
1012
1012
|
return `${s.join(`
|
|
1013
1013
|
`)}
|
|
1014
1014
|
${c}${n}`;
|
|
1015
1015
|
}
|
|
1016
1016
|
default: {
|
|
1017
|
-
const n = this.state === "error" ? "yellow" : "cyan", c = r ? `${
|
|
1017
|
+
const n = this.state === "error" ? "yellow" : "cyan", c = r ? `${styleText(n, h)} ` : "", p = r ? styleText(n, x) : "";
|
|
1018
1018
|
let f = "";
|
|
1019
1019
|
if (this.isNavigating || u) {
|
|
1020
1020
|
const y$1 = u ? o : i;
|
|
1021
|
-
f = y$1 !== "" ? ` ${
|
|
1021
|
+
f = y$1 !== "" ? ` ${styleText("dim", y$1)}` : "";
|
|
1022
1022
|
} else f = ` ${this.userInputWithCursor}`;
|
|
1023
|
-
const g = this.filteredOptions.length !== a.length ?
|
|
1024
|
-
r && s.push(`${c.trimEnd()}`), s.push(`${c}${
|
|
1023
|
+
const g = this.filteredOptions.length !== a.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${styleText("yellow", "No matches found")}`] : [], $ = this.state === "error" ? [`${c}${styleText("yellow", this.error)}`] : [];
|
|
1024
|
+
r && s.push(`${c.trimEnd()}`), s.push(`${c}${styleText("dim", "Search:")}${f}${g}`, ...E, ...$);
|
|
1025
1025
|
const d = [`${c}${[
|
|
1026
|
-
`${
|
|
1027
|
-
`${
|
|
1028
|
-
`${
|
|
1026
|
+
`${styleText("dim", "↑/↓")} to select`,
|
|
1027
|
+
`${styleText("dim", "Enter:")} confirm`,
|
|
1028
|
+
`${styleText("dim", "Type:")} to search`
|
|
1029
1029
|
].join(" • ")}`, p], F = this.filteredOptions.length === 0 ? [] : X({
|
|
1030
1030
|
cursor: this.cursor,
|
|
1031
1031
|
options: this.filteredOptions,
|
|
@@ -1046,8 +1046,8 @@ ${c}${n}`;
|
|
|
1046
1046
|
}
|
|
1047
1047
|
}).prompt(), xt = (e) => {
|
|
1048
1048
|
const r = (i, a, o, u) => {
|
|
1049
|
-
const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ?
|
|
1050
|
-
return i.disabled ? `${
|
|
1049
|
+
const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ? styleText("dim", ` (${i.hint})`) : "", p = l ? styleText("green", U) : styleText("dim", q);
|
|
1050
|
+
return i.disabled ? `${styleText("gray", q)} ${styleText(["strikethrough", "gray"], n)}` : a ? `${p} ${n}${c}` : `${p} ${styleText("dim", n)}`;
|
|
1051
1051
|
}, s = new Vt$1({
|
|
1052
1052
|
options: e.options,
|
|
1053
1053
|
multiple: !0,
|
|
@@ -1060,25 +1060,25 @@ ${c}${n}`;
|
|
|
1060
1060
|
input: e.input,
|
|
1061
1061
|
output: e.output,
|
|
1062
1062
|
render() {
|
|
1063
|
-
const i = `${
|
|
1063
|
+
const i = `${styleText("gray", h)}
|
|
1064
1064
|
${W(this.state)} ${e.message}
|
|
1065
|
-
`, a = this.userInput, o = e.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ?
|
|
1065
|
+
`, a = this.userInput, o = e.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ? styleText("dim", u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
1066
1066
|
switch (this.state) {
|
|
1067
|
-
case "submit": return `${i}${
|
|
1068
|
-
case "cancel": return `${i}${
|
|
1067
|
+
case "submit": return `${i}${styleText("gray", h)} ${styleText("dim", `${this.selectedValues.length} items selected`)}`;
|
|
1068
|
+
case "cancel": return `${i}${styleText("gray", h)} ${styleText(["strikethrough", "dim"], a)}`;
|
|
1069
1069
|
default: {
|
|
1070
1070
|
const p = this.state === "error" ? "yellow" : "cyan", f = [
|
|
1071
|
-
`${
|
|
1072
|
-
`${
|
|
1073
|
-
`${
|
|
1074
|
-
`${
|
|
1075
|
-
], g = this.filteredOptions.length === 0 && a ? [`${
|
|
1076
|
-
...`${i}${
|
|
1071
|
+
`${styleText("dim", "↑/↓")} to navigate`,
|
|
1072
|
+
`${styleText("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
1073
|
+
`${styleText("dim", "Enter:")} confirm`,
|
|
1074
|
+
`${styleText("dim", "Type:")} to search`
|
|
1075
|
+
], g = this.filteredOptions.length === 0 && a ? [`${styleText(p, h)} ${styleText("yellow", "No matches found")}`] : [], E = this.state === "error" ? [`${styleText(p, h)} ${styleText("yellow", this.error)}`] : [], $ = [
|
|
1076
|
+
...`${i}${styleText(p, h)}`.split(`
|
|
1077
1077
|
`),
|
|
1078
|
-
`${
|
|
1078
|
+
`${styleText(p, h)} ${styleText("dim", "Search:")} ${l}${c}`,
|
|
1079
1079
|
...g,
|
|
1080
1080
|
...E
|
|
1081
|
-
], m = [`${
|
|
1081
|
+
], m = [`${styleText(p, h)} ${f.join(" • ")}`, styleText(p, x)], d = X({
|
|
1082
1082
|
cursor: this.cursor,
|
|
1083
1083
|
options: this.filteredOptions,
|
|
1084
1084
|
style: (F, y$1) => r(F, y$1, this.selectedValues, this.focusedValue),
|
|
@@ -1088,7 +1088,7 @@ ${W(this.state)} ${e.message}
|
|
|
1088
1088
|
});
|
|
1089
1089
|
return [
|
|
1090
1090
|
...$,
|
|
1091
|
-
...d.map((F) => `${
|
|
1091
|
+
...d.map((F) => `${styleText(p, h)} ${F}`),
|
|
1092
1092
|
...m
|
|
1093
1093
|
].join(`
|
|
1094
1094
|
`);
|
|
@@ -1120,8 +1120,8 @@ const Tt = (e) => e, Mt = (e = "", r = "", s) => {
|
|
|
1120
1120
|
`);
|
|
1121
1121
|
let M$1 = m + u * 2;
|
|
1122
1122
|
for (const le of T$1) {
|
|
1123
|
-
const k = D(le) + l * 2;
|
|
1124
|
-
k > M$1 && (M$1 = k);
|
|
1123
|
+
const k$1 = D(le) + l * 2;
|
|
1124
|
+
k$1 > M$1 && (M$1 = k$1);
|
|
1125
1125
|
}
|
|
1126
1126
|
const O$1 = M$1 + o;
|
|
1127
1127
|
O$1 < F && (F = O$1);
|
|
@@ -1152,18 +1152,18 @@ const Tt = (e) => e, Mt = (e = "", r = "", s) => {
|
|
|
1152
1152
|
output: e.output,
|
|
1153
1153
|
initialValue: e.initialValue ?? !0,
|
|
1154
1154
|
render() {
|
|
1155
|
-
const i = e.withGuide ?? _.withGuide, a = `${i ? `${
|
|
1155
|
+
const i = e.withGuide ?? _.withGuide, a = `${i ? `${styleText("gray", h)}
|
|
1156
1156
|
` : ""}${W(this.state)} ${e.message}
|
|
1157
1157
|
`, o = this.value ? r : s;
|
|
1158
1158
|
switch (this.state) {
|
|
1159
|
-
case "submit": return `${a}${i ? `${
|
|
1160
|
-
case "cancel": return `${a}${i ? `${
|
|
1161
|
-
${
|
|
1159
|
+
case "submit": return `${a}${i ? `${styleText("gray", h)} ` : ""}${styleText("dim", o)}`;
|
|
1160
|
+
case "cancel": return `${a}${i ? `${styleText("gray", h)} ` : ""}${styleText(["strikethrough", "dim"], o)}${i ? `
|
|
1161
|
+
${styleText("gray", h)}` : ""}`;
|
|
1162
1162
|
default: {
|
|
1163
|
-
const u = i ? `${
|
|
1164
|
-
return `${a}${u}${this.value ? `${
|
|
1165
|
-
${
|
|
1166
|
-
` : ` ${
|
|
1163
|
+
const u = i ? `${styleText("cyan", h)} ` : "", l = i ? styleText("cyan", x) : "";
|
|
1164
|
+
return `${a}${u}${this.value ? `${styleText("green", z)} ${r}` : `${styleText("dim", H)} ${styleText("dim", r)}`}${e.vertical ? i ? `
|
|
1165
|
+
${styleText("cyan", h)} ` : `
|
|
1166
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
1167
1167
|
${l}
|
|
1168
1168
|
`;
|
|
1169
1169
|
}
|
|
@@ -1189,21 +1189,21 @@ ${l}
|
|
|
1189
1189
|
let E = "";
|
|
1190
1190
|
if (s > 0 && !c) {
|
|
1191
1191
|
const m = `
|
|
1192
|
-
${
|
|
1192
|
+
${styleText("cyan", h)}`;
|
|
1193
1193
|
E = `${m.repeat(s - 1)}${m} `;
|
|
1194
1194
|
}
|
|
1195
|
-
if (u === "active") return `${E}${
|
|
1196
|
-
if (u === "group-active") return `${E}${g}${
|
|
1197
|
-
if (u === "group-active-selected") return `${E}${g}${
|
|
1195
|
+
if (u === "active") return `${E}${styleText("dim", g)}${styleText("cyan", te)} ${n}${o.hint ? ` ${styleText("dim", `(${o.hint})`)}` : ""}`;
|
|
1196
|
+
if (u === "group-active") return `${E}${g}${styleText("cyan", te)} ${styleText("dim", n)}`;
|
|
1197
|
+
if (u === "group-active-selected") return `${E}${g}${styleText("green", U)} ${styleText("dim", n)}`;
|
|
1198
1198
|
if (u === "selected") {
|
|
1199
|
-
const m = c || r ?
|
|
1200
|
-
return `${E}${
|
|
1201
|
-
}
|
|
1202
|
-
if (u === "cancelled") return `${
|
|
1203
|
-
if (u === "active-selected") return `${E}${
|
|
1204
|
-
if (u === "submitted") return `${
|
|
1205
|
-
const $ = c || r ?
|
|
1206
|
-
return `${E}${
|
|
1199
|
+
const m = c || r ? styleText("green", U) : "";
|
|
1200
|
+
return `${E}${styleText("dim", g)}${m} ${styleText("dim", n)}${o.hint ? ` ${styleText("dim", `(${o.hint})`)}` : ""}`;
|
|
1201
|
+
}
|
|
1202
|
+
if (u === "cancelled") return `${styleText(["strikethrough", "dim"], n)}`;
|
|
1203
|
+
if (u === "active-selected") return `${E}${styleText("dim", g)}${styleText("green", U)} ${n}${o.hint ? ` ${styleText("dim", `(${o.hint})`)}` : ""}`;
|
|
1204
|
+
if (u === "submitted") return `${styleText("dim", n)}`;
|
|
1205
|
+
const $ = c || r ? styleText("dim", q) : "";
|
|
1206
|
+
return `${E}${styleText("dim", g)}${$} ${styleText("dim", n)}`;
|
|
1207
1207
|
}, a = e.required ?? !0;
|
|
1208
1208
|
return new yt$1({
|
|
1209
1209
|
options: e.options,
|
|
@@ -1216,35 +1216,35 @@ ${(0, node_util.styleText)("cyan", h)}`;
|
|
|
1216
1216
|
selectableGroups: r,
|
|
1217
1217
|
validate(o) {
|
|
1218
1218
|
if (a && (o === void 0 || o.length === 0)) return `Please select at least one option.
|
|
1219
|
-
${
|
|
1219
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1220
1220
|
"gray",
|
|
1221
1221
|
"bgWhite",
|
|
1222
1222
|
"inverse"
|
|
1223
|
-
], " space ")} to select, ${
|
|
1223
|
+
], " space ")} to select, ${styleText("gray", styleText(["bgWhite", "inverse"], " enter "))} to submit`))}`;
|
|
1224
1224
|
},
|
|
1225
1225
|
render() {
|
|
1226
|
-
const o = `${
|
|
1226
|
+
const o = `${styleText("gray", h)}
|
|
1227
1227
|
${W(this.state)} ${e.message}
|
|
1228
1228
|
`, u = this.value ?? [];
|
|
1229
1229
|
switch (this.state) {
|
|
1230
1230
|
case "submit": {
|
|
1231
|
-
const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(
|
|
1232
|
-
return `${o}${
|
|
1231
|
+
const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(styleText("dim", ", "))}`;
|
|
1232
|
+
return `${o}${styleText("gray", h)}${n}`;
|
|
1233
1233
|
}
|
|
1234
1234
|
case "cancel": {
|
|
1235
|
-
const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(
|
|
1236
|
-
return `${o}${
|
|
1237
|
-
${
|
|
1235
|
+
const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(styleText("dim", ", "));
|
|
1236
|
+
return `${o}${styleText("gray", h)} ${l.trim() ? `${l}
|
|
1237
|
+
${styleText("gray", h)}` : ""}`;
|
|
1238
1238
|
}
|
|
1239
1239
|
case "error": {
|
|
1240
1240
|
const l = this.error.split(`
|
|
1241
|
-
`).map((n, c) => c === 0 ? `${
|
|
1241
|
+
`).map((n, c) => c === 0 ? `${styleText("yellow", x)} ${styleText("yellow", n)}` : ` ${n}`).join(`
|
|
1242
1242
|
`);
|
|
1243
|
-
return `${o}${
|
|
1243
|
+
return `${o}${styleText("yellow", h)} ${this.options.map((n, c, p) => {
|
|
1244
1244
|
const f = u.includes(n.value) || n.group === !0 && this.isGroupSelected(`${n.value}`), g = c === this.cursor;
|
|
1245
1245
|
return !g && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, f ? "group-active-selected" : "group-active", p) : g && f ? i(n, "active-selected", p) : f ? i(n, "selected", p) : i(n, g ? "active" : "inactive", p);
|
|
1246
1246
|
}).join(`
|
|
1247
|
-
${
|
|
1247
|
+
${styleText("yellow", h)} `)}
|
|
1248
1248
|
${l}
|
|
1249
1249
|
`;
|
|
1250
1250
|
}
|
|
@@ -1255,17 +1255,17 @@ ${l}
|
|
|
1255
1255
|
return $ ? m = i(c, g ? "group-active-selected" : "group-active", f) : E && g ? m = i(c, "active-selected", f) : g ? m = i(c, "selected", f) : m = i(c, E ? "active" : "inactive", f), `${p !== 0 && !m.startsWith(`
|
|
1256
1256
|
`) ? " " : ""}${m}`;
|
|
1257
1257
|
}).join(`
|
|
1258
|
-
${
|
|
1258
|
+
${styleText("cyan", h)}`), n = l.startsWith(`
|
|
1259
1259
|
`) ? "" : " ";
|
|
1260
|
-
return `${o}${
|
|
1261
|
-
${
|
|
1260
|
+
return `${o}${styleText("cyan", h)}${n}${l}
|
|
1261
|
+
${styleText("cyan", x)}
|
|
1262
1262
|
`;
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
1266
1266
|
}).prompt();
|
|
1267
1267
|
}, R = {
|
|
1268
|
-
message: (e = [], { symbol: r =
|
|
1268
|
+
message: (e = [], { symbol: r = styleText("gray", h), secondarySymbol: s = styleText("gray", h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
|
|
1269
1269
|
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
|
|
1270
1270
|
for (let g = 0; g < a; g++) u.push(n);
|
|
1271
1271
|
const f = Array.isArray(e) ? e : e.split(`
|
|
@@ -1282,25 +1282,25 @@ ${(0, node_util.styleText)("cyan", x)}
|
|
|
1282
1282
|
info: (e, r) => {
|
|
1283
1283
|
R.message(e, {
|
|
1284
1284
|
...r,
|
|
1285
|
-
symbol:
|
|
1285
|
+
symbol: styleText("blue", fe)
|
|
1286
1286
|
});
|
|
1287
1287
|
},
|
|
1288
1288
|
success: (e, r) => {
|
|
1289
1289
|
R.message(e, {
|
|
1290
1290
|
...r,
|
|
1291
|
-
symbol:
|
|
1291
|
+
symbol: styleText("green", Fe)
|
|
1292
1292
|
});
|
|
1293
1293
|
},
|
|
1294
1294
|
step: (e, r) => {
|
|
1295
1295
|
R.message(e, {
|
|
1296
1296
|
...r,
|
|
1297
|
-
symbol:
|
|
1297
|
+
symbol: styleText("green", V)
|
|
1298
1298
|
});
|
|
1299
1299
|
},
|
|
1300
1300
|
warn: (e, r) => {
|
|
1301
1301
|
R.message(e, {
|
|
1302
1302
|
...r,
|
|
1303
|
-
symbol:
|
|
1303
|
+
symbol: styleText("yellow", ye)
|
|
1304
1304
|
});
|
|
1305
1305
|
},
|
|
1306
1306
|
warning: (e, r) => {
|
|
@@ -1309,21 +1309,21 @@ ${(0, node_util.styleText)("cyan", x)}
|
|
|
1309
1309
|
error: (e, r) => {
|
|
1310
1310
|
R.message(e, {
|
|
1311
1311
|
...r,
|
|
1312
|
-
symbol:
|
|
1312
|
+
symbol: styleText("red", Ee)
|
|
1313
1313
|
});
|
|
1314
1314
|
}
|
|
1315
1315
|
}, Nt = (e = "", r) => {
|
|
1316
|
-
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${
|
|
1317
|
-
s.write(`${i}${
|
|
1316
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", x)} ` : "";
|
|
1317
|
+
s.write(`${i}${styleText("red", e)}
|
|
1318
1318
|
|
|
1319
1319
|
`);
|
|
1320
1320
|
}, Wt = (e = "", r) => {
|
|
1321
|
-
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${
|
|
1321
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", he)} ` : "";
|
|
1322
1322
|
s.write(`${i}${e}
|
|
1323
1323
|
`);
|
|
1324
1324
|
}, Gt = (e = "", r) => {
|
|
1325
|
-
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${
|
|
1326
|
-
${
|
|
1325
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", h)}
|
|
1326
|
+
${styleText("gray", x)} ` : "";
|
|
1327
1327
|
s.write(`${i}${e}
|
|
1328
1328
|
|
|
1329
1329
|
`);
|
|
@@ -1332,7 +1332,7 @@ ${(0, node_util.styleText)("gray", x)} ` : "";
|
|
|
1332
1332
|
`), Lt = (e) => {
|
|
1333
1333
|
const r = (i, a) => {
|
|
1334
1334
|
const o = i.label ?? String(i.value);
|
|
1335
|
-
return a === "disabled" ? `${
|
|
1335
|
+
return a === "disabled" ? `${styleText("gray", q)} ${Q(o, (u) => styleText(["strikethrough", "gray"], u))}${i.hint ? ` ${styleText("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", te)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", U)} ${Q(o, (u) => styleText("dim", u))}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Q(o, (u) => styleText(["strikethrough", "dim"], u))}` : a === "active-selected" ? `${styleText("green", U)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : a === "submitted" ? `${Q(o, (u) => styleText("dim", u))}` : `${styleText("dim", q)} ${Q(o, (u) => styleText("dim", u))}`;
|
|
1336
1336
|
}, s = e.required ?? !0;
|
|
1337
1337
|
return new Lt$1({
|
|
1338
1338
|
options: e.options,
|
|
@@ -1344,14 +1344,14 @@ ${(0, node_util.styleText)("gray", x)} ` : "";
|
|
|
1344
1344
|
cursorAt: e.cursorAt,
|
|
1345
1345
|
validate(i) {
|
|
1346
1346
|
if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
|
|
1347
|
-
${
|
|
1347
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1348
1348
|
"gray",
|
|
1349
1349
|
"bgWhite",
|
|
1350
1350
|
"inverse"
|
|
1351
|
-
], " space ")} to select, ${
|
|
1351
|
+
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
1352
1352
|
},
|
|
1353
1353
|
render() {
|
|
1354
|
-
const i = Bt$1(e.output, e.message, `${ve(this.state)} `, `${W(this.state)} `), a = `${
|
|
1354
|
+
const i = Bt$1(e.output, e.message, `${ve(this.state)} `, `${W(this.state)} `), a = `${styleText("gray", h)}
|
|
1355
1355
|
${i}
|
|
1356
1356
|
`, o = this.value ?? [], u = (l, n) => {
|
|
1357
1357
|
if (l.disabled) return r(l, "disabled");
|
|
@@ -1360,18 +1360,18 @@ ${i}
|
|
|
1360
1360
|
};
|
|
1361
1361
|
switch (this.state) {
|
|
1362
1362
|
case "submit": {
|
|
1363
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(
|
|
1364
|
-
return `${a}${Bt$1(e.output, l, `${
|
|
1363
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
|
|
1364
|
+
return `${a}${Bt$1(e.output, l, `${styleText("gray", h)} `)}`;
|
|
1365
1365
|
}
|
|
1366
1366
|
case "cancel": {
|
|
1367
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(
|
|
1368
|
-
if (l.trim() === "") return `${a}${
|
|
1369
|
-
return `${a}${Bt$1(e.output, l, `${
|
|
1370
|
-
${
|
|
1367
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(styleText("dim", ", "));
|
|
1368
|
+
if (l.trim() === "") return `${a}${styleText("gray", h)}`;
|
|
1369
|
+
return `${a}${Bt$1(e.output, l, `${styleText("gray", h)} `)}
|
|
1370
|
+
${styleText("gray", h)}`;
|
|
1371
1371
|
}
|
|
1372
1372
|
case "error": {
|
|
1373
|
-
const l = `${
|
|
1374
|
-
`).map((f, g) => g === 0 ? `${
|
|
1373
|
+
const l = `${styleText("yellow", h)} `, n = this.error.split(`
|
|
1374
|
+
`).map((f, g) => g === 0 ? `${styleText("yellow", x)} ${styleText("yellow", f)}` : ` ${f}`).join(`
|
|
1375
1375
|
`), c = a.split(`
|
|
1376
1376
|
`).length, p = n.split(`
|
|
1377
1377
|
`).length + 1;
|
|
@@ -1389,7 +1389,7 @@ ${n}
|
|
|
1389
1389
|
`;
|
|
1390
1390
|
}
|
|
1391
1391
|
default: {
|
|
1392
|
-
const l = `${
|
|
1392
|
+
const l = `${styleText("cyan", h)} `, n = a.split(`
|
|
1393
1393
|
`).length;
|
|
1394
1394
|
return `${a}${l}${X({
|
|
1395
1395
|
output: e.output,
|
|
@@ -1401,13 +1401,13 @@ ${n}
|
|
|
1401
1401
|
style: u
|
|
1402
1402
|
}).join(`
|
|
1403
1403
|
${l}`)}
|
|
1404
|
-
${
|
|
1404
|
+
${styleText("cyan", x)}
|
|
1405
1405
|
`;
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
}).prompt();
|
|
1410
|
-
}, jt = (e) =>
|
|
1410
|
+
}, jt = (e) => styleText("dim", e), kt = (e, r, s) => {
|
|
1411
1411
|
const i = {
|
|
1412
1412
|
hard: !0,
|
|
1413
1413
|
trim: !1
|
|
@@ -1415,7 +1415,7 @@ ${(0, node_util.styleText)("cyan", x)}
|
|
|
1415
1415
|
`), o = a.reduce((n, c) => Math.max(D(c), n), 0);
|
|
1416
1416
|
return J(e, r - (a.map(s).reduce((n, c) => Math.max(D(c), n), 0) - o), i);
|
|
1417
1417
|
}, Vt = (e = "", r = "", s) => {
|
|
1418
|
-
const i = s?.output ??
|
|
1418
|
+
const i = s?.output ?? N.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? jt, u = [
|
|
1419
1419
|
"",
|
|
1420
1420
|
...kt(e, rt(i) - 6, o).split(`
|
|
1421
1421
|
`).map(o),
|
|
@@ -1423,12 +1423,12 @@ ${(0, node_util.styleText)("cyan", x)}
|
|
|
1423
1423
|
], l = D(r), n = Math.max(u.reduce((g, E) => {
|
|
1424
1424
|
const $ = D(E);
|
|
1425
1425
|
return $ > g ? $ : g;
|
|
1426
|
-
}, 0), l) + 2, c = u.map((g) => `${
|
|
1427
|
-
`), p = a ? `${
|
|
1426
|
+
}, 0), l) + 2, c = u.map((g) => `${styleText("gray", h)} ${g}${" ".repeat(n - D(g))}${styleText("gray", h)}`).join(`
|
|
1427
|
+
`), p = a ? `${styleText("gray", h)}
|
|
1428
1428
|
` : "", f = a ? We : ge;
|
|
1429
|
-
i.write(`${p}${
|
|
1429
|
+
i.write(`${p}${styleText("green", V)} ${styleText("reset", r)} ${styleText("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
|
|
1430
1430
|
${c}
|
|
1431
|
-
${
|
|
1431
|
+
${styleText("gray", f + se.repeat(n + 2) + me)}
|
|
1432
1432
|
`);
|
|
1433
1433
|
}, Ht = (e) => new Mt$1({
|
|
1434
1434
|
validate: e.validate,
|
|
@@ -1437,22 +1437,22 @@ ${(0, node_util.styleText)("gray", f + se.repeat(n + 2) + me)}
|
|
|
1437
1437
|
input: e.input,
|
|
1438
1438
|
output: e.output,
|
|
1439
1439
|
render() {
|
|
1440
|
-
const r = e.withGuide ?? _.withGuide, s = `${r ? `${
|
|
1440
|
+
const r = e.withGuide ?? _.withGuide, s = `${r ? `${styleText("gray", h)}
|
|
1441
1441
|
` : ""}${W(this.state)} ${e.message}
|
|
1442
1442
|
`, i = this.userInputWithCursor, a = this.masked;
|
|
1443
1443
|
switch (this.state) {
|
|
1444
1444
|
case "error": {
|
|
1445
|
-
const o = r ? `${
|
|
1445
|
+
const o = r ? `${styleText("yellow", h)} ` : "", u = r ? `${styleText("yellow", x)} ` : "", l = a ?? "";
|
|
1446
1446
|
return e.clearOnError && this.clear(), `${s.trim()}
|
|
1447
1447
|
${o}${l}
|
|
1448
|
-
${u}${
|
|
1448
|
+
${u}${styleText("yellow", this.error)}
|
|
1449
1449
|
`;
|
|
1450
1450
|
}
|
|
1451
|
-
case "submit": return `${s}${r ? `${
|
|
1452
|
-
case "cancel": return `${s}${r ? `${
|
|
1453
|
-
${
|
|
1454
|
-
default: return `${s}${r ? `${
|
|
1455
|
-
${r ?
|
|
1451
|
+
case "submit": return `${s}${r ? `${styleText("gray", h)} ` : ""}${a ? styleText("dim", a) : ""}`;
|
|
1452
|
+
case "cancel": return `${s}${r ? `${styleText("gray", h)} ` : ""}${a ? styleText(["strikethrough", "dim"], a) : ""}${a && r ? `
|
|
1453
|
+
${styleText("gray", h)}` : ""}`;
|
|
1454
|
+
default: return `${s}${r ? `${styleText("cyan", h)} ` : ""}${i}
|
|
1455
|
+
${r ? styleText("cyan", x) : ""}
|
|
1456
1456
|
`;
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
@@ -1473,12 +1473,12 @@ ${r ? (0, node_util.styleText)("cyan", x) : ""}
|
|
|
1473
1473
|
if (s === "") return [];
|
|
1474
1474
|
try {
|
|
1475
1475
|
let i;
|
|
1476
|
-
return
|
|
1477
|
-
const o =
|
|
1476
|
+
return existsSync$1(s) ? lstatSync(s).isDirectory() ? i = s : i = dirname(s) : i = dirname(s), readdirSync(i).map((a) => {
|
|
1477
|
+
const o = join(i, a);
|
|
1478
1478
|
return {
|
|
1479
1479
|
name: a,
|
|
1480
1480
|
path: o,
|
|
1481
|
-
isDirectory:
|
|
1481
|
+
isDirectory: lstatSync(o).isDirectory()
|
|
1482
1482
|
};
|
|
1483
1483
|
}).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (e.directory || !o)).map((a) => ({ value: a.path }));
|
|
1484
1484
|
} catch {
|
|
@@ -1486,7 +1486,7 @@ ${r ? (0, node_util.styleText)("cyan", x) : ""}
|
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
});
|
|
1489
|
-
}, Kt = (e) =>
|
|
1489
|
+
}, Kt = (e) => styleText("magenta", e), be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? [
|
|
1490
1490
|
"◒",
|
|
1491
1491
|
"◐",
|
|
1492
1492
|
"◓",
|
|
@@ -1501,7 +1501,7 @@ ${r ? (0, node_util.styleText)("cyan", x) : ""}
|
|
|
1501
1501
|
let p, f, g = !1, E = !1, $ = "", m, d = performance.now();
|
|
1502
1502
|
const F = rt(s), y$1 = n?.styleFrame ?? Kt, v = (B$1) => {
|
|
1503
1503
|
const P$1 = B$1 > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
|
|
1504
|
-
E = B$1 === 1, g && (k(P$1, B$1), E && typeof r == "function" && r());
|
|
1504
|
+
E = B$1 === 1, g && (k$1(P$1, B$1), E && typeof r == "function" && r());
|
|
1505
1505
|
}, C = () => v(2), A = () => v(1), b = () => {
|
|
1506
1506
|
process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
|
|
1507
1507
|
}, w = () => {
|
|
@@ -1520,7 +1520,7 @@ ${r ? (0, node_util.styleText)("cyan", x) : ""}
|
|
|
1520
1520
|
const P$1 = (performance.now() - B$1) / 1e3, G$1 = Math.floor(P$1 / 60), L$1 = Math.floor(P$1 % 60);
|
|
1521
1521
|
return G$1 > 0 ? `[${G$1}m ${L$1}s]` : `[${L$1}s]`;
|
|
1522
1522
|
}, O$1 = n.withGuide ?? _.withGuide, le = (B$1 = "") => {
|
|
1523
|
-
g = !0, p = xt$1({ output: s }), $ = T$1(B$1), d = performance.now(), O$1 && s.write(`${
|
|
1523
|
+
g = !0, p = xt$1({ output: s }), $ = T$1(B$1), d = performance.now(), O$1 && s.write(`${styleText("gray", h)}
|
|
1524
1524
|
`);
|
|
1525
1525
|
let P$1 = 0, G$1 = 0;
|
|
1526
1526
|
b(), f = setInterval(() => {
|
|
@@ -1540,23 +1540,23 @@ ${r ? (0, node_util.styleText)("cyan", x) : ""}
|
|
|
1540
1540
|
});
|
|
1541
1541
|
s.write(Ze), P$1 = P$1 + 1 < o.length ? P$1 + 1 : 0, G$1 = G$1 < 4 ? G$1 + .125 : 0;
|
|
1542
1542
|
}, u);
|
|
1543
|
-
}, k = (B$1 = "", P$1 = 0, G$1 = !1) => {
|
|
1543
|
+
}, k$1 = (B$1 = "", P$1 = 0, G$1 = !1) => {
|
|
1544
1544
|
if (!g) return;
|
|
1545
1545
|
g = !1, clearInterval(f), S$1();
|
|
1546
|
-
const L$1 = P$1 === 0 ?
|
|
1546
|
+
const L$1 = P$1 === 0 ? styleText("green", V) : P$1 === 1 ? styleText("red", $e) : styleText("red", de);
|
|
1547
1547
|
$ = B$1 ?? $, G$1 || (e === "timer" ? s.write(`${L$1} ${$} ${M$1(d)}
|
|
1548
1548
|
`) : s.write(`${L$1} ${$}
|
|
1549
1549
|
`)), w(), p();
|
|
1550
1550
|
};
|
|
1551
1551
|
return {
|
|
1552
1552
|
start: le,
|
|
1553
|
-
stop: (B$1 = "") => k(B$1, 0),
|
|
1553
|
+
stop: (B$1 = "") => k$1(B$1, 0),
|
|
1554
1554
|
message: (B$1 = "") => {
|
|
1555
1555
|
$ = T$1(B$1 ?? $);
|
|
1556
1556
|
},
|
|
1557
|
-
cancel: (B$1 = "") => k(B$1, 1),
|
|
1558
|
-
error: (B$1 = "") => k(B$1, 2),
|
|
1559
|
-
clear: () => k("", 0, !0),
|
|
1557
|
+
cancel: (B$1 = "") => k$1(B$1, 1),
|
|
1558
|
+
error: (B$1 = "") => k$1(B$1, 2),
|
|
1559
|
+
clear: () => k$1("", 0, !0),
|
|
1560
1560
|
get isCancelled() {
|
|
1561
1561
|
return E;
|
|
1562
1562
|
}
|
|
@@ -1573,11 +1573,11 @@ const oe = (e, r) => e.includes(`
|
|
|
1573
1573
|
const r = (s, i) => {
|
|
1574
1574
|
const a = s.label ?? String(s.value);
|
|
1575
1575
|
switch (i) {
|
|
1576
|
-
case "disabled": return `${
|
|
1577
|
-
case "selected": return `${oe(a, (o) =>
|
|
1578
|
-
case "active": return `${
|
|
1579
|
-
case "cancelled": return `${oe(a, (o) =>
|
|
1580
|
-
default: return `${
|
|
1576
|
+
case "disabled": return `${styleText("gray", H)} ${oe(a, (o) => styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1577
|
+
case "selected": return `${oe(a, (o) => styleText("dim", o))}`;
|
|
1578
|
+
case "active": return `${styleText("green", z)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
1579
|
+
case "cancelled": return `${oe(a, (o) => styleText(["strikethrough", "dim"], o))}`;
|
|
1580
|
+
default: return `${styleText("dim", H)} ${oe(a, (o) => styleText("dim", o))}`;
|
|
1581
1581
|
}
|
|
1582
1582
|
};
|
|
1583
1583
|
return new Tt$1({
|
|
@@ -1587,21 +1587,21 @@ const oe = (e, r) => e.includes(`
|
|
|
1587
1587
|
output: e.output,
|
|
1588
1588
|
initialValue: e.initialValue,
|
|
1589
1589
|
render() {
|
|
1590
|
-
const s = e.withGuide ?? _.withGuide, i = `${W(this.state)} `, a = `${ve(this.state)} `, o = Bt$1(e.output, e.message, a, i), u = `${s ? `${
|
|
1590
|
+
const s = e.withGuide ?? _.withGuide, i = `${W(this.state)} `, a = `${ve(this.state)} `, o = Bt$1(e.output, e.message, a, i), u = `${s ? `${styleText("gray", h)}
|
|
1591
1591
|
` : ""}${o}
|
|
1592
1592
|
`;
|
|
1593
1593
|
switch (this.state) {
|
|
1594
1594
|
case "submit": {
|
|
1595
|
-
const l = s ? `${
|
|
1595
|
+
const l = s ? `${styleText("gray", h)} ` : "";
|
|
1596
1596
|
return `${u}${Bt$1(e.output, r(this.options[this.cursor], "selected"), l)}`;
|
|
1597
1597
|
}
|
|
1598
1598
|
case "cancel": {
|
|
1599
|
-
const l = s ? `${
|
|
1599
|
+
const l = s ? `${styleText("gray", h)} ` : "";
|
|
1600
1600
|
return `${u}${Bt$1(e.output, r(this.options[this.cursor], "cancelled"), l)}${s ? `
|
|
1601
|
-
${
|
|
1601
|
+
${styleText("gray", h)}` : ""}`;
|
|
1602
1602
|
}
|
|
1603
1603
|
default: {
|
|
1604
|
-
const l = s ? `${
|
|
1604
|
+
const l = s ? `${styleText("cyan", h)} ` : "", n = s ? styleText("cyan", x) : "", c = u.split(`
|
|
1605
1605
|
`).length, p = s ? 2 : 1;
|
|
1606
1606
|
return `${u}${l}${X({
|
|
1607
1607
|
output: e.output,
|
|
@@ -1622,11 +1622,11 @@ ${n}
|
|
|
1622
1622
|
}, Xt = (e) => {
|
|
1623
1623
|
const r = (s, i = "inactive") => {
|
|
1624
1624
|
const a = s.label ?? String(s.value);
|
|
1625
|
-
return i === "selected" ? `${
|
|
1625
|
+
return i === "selected" ? `${styleText("dim", a)}` : i === "cancelled" ? `${styleText(["strikethrough", "dim"], a)}` : i === "active" ? `${styleText(["bgCyan", "gray"], ` ${s.value} `)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}` : `${styleText([
|
|
1626
1626
|
"gray",
|
|
1627
1627
|
"bgWhite",
|
|
1628
1628
|
"inverse"
|
|
1629
|
-
], ` ${s.value} `)} ${a}${s.hint ? ` ${
|
|
1629
|
+
], ` ${s.value} `)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
1630
1630
|
};
|
|
1631
1631
|
return new Wt$1({
|
|
1632
1632
|
options: e.options,
|
|
@@ -1636,21 +1636,21 @@ ${n}
|
|
|
1636
1636
|
initialValue: e.initialValue,
|
|
1637
1637
|
caseSensitive: e.caseSensitive,
|
|
1638
1638
|
render() {
|
|
1639
|
-
const s = e.withGuide ?? _.withGuide, i = `${s ? `${
|
|
1639
|
+
const s = e.withGuide ?? _.withGuide, i = `${s ? `${styleText("gray", h)}
|
|
1640
1640
|
` : ""}${W(this.state)} ${e.message}
|
|
1641
1641
|
`;
|
|
1642
1642
|
switch (this.state) {
|
|
1643
1643
|
case "submit": {
|
|
1644
|
-
const a = s ? `${
|
|
1644
|
+
const a = s ? `${styleText("gray", h)} ` : "", o = this.options.find((l) => l.value === this.value) ?? e.options[0];
|
|
1645
1645
|
return `${i}${Bt$1(e.output, r(o, "selected"), a)}`;
|
|
1646
1646
|
}
|
|
1647
1647
|
case "cancel": {
|
|
1648
|
-
const a = s ? `${
|
|
1648
|
+
const a = s ? `${styleText("gray", h)} ` : "";
|
|
1649
1649
|
return `${i}${Bt$1(e.output, r(this.options[0], "cancelled"), a)}${s ? `
|
|
1650
|
-
${
|
|
1650
|
+
${styleText("gray", h)}` : ""}`;
|
|
1651
1651
|
}
|
|
1652
1652
|
default: {
|
|
1653
|
-
const a = s ? `${
|
|
1653
|
+
const a = s ? `${styleText("cyan", h)} ` : "", o = s ? styleText("cyan", x) : "";
|
|
1654
1654
|
return `${i}${this.options.map((l, n) => Bt$1(e.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
|
|
1655
1655
|
`)}
|
|
1656
1656
|
${o}
|
|
@@ -1659,29 +1659,29 @@ ${o}
|
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
1661
1661
|
}).prompt();
|
|
1662
|
-
}, Qe = `${
|
|
1663
|
-
message: async (e, { symbol: r =
|
|
1664
|
-
process.stdout.write(`${
|
|
1662
|
+
}, Qe = `${styleText("gray", h)} `, K = {
|
|
1663
|
+
message: async (e, { symbol: r = styleText("gray", h) } = {}) => {
|
|
1664
|
+
process.stdout.write(`${styleText("gray", h)}
|
|
1665
1665
|
${r} `);
|
|
1666
1666
|
let s = 3;
|
|
1667
1667
|
for await (let i of e) {
|
|
1668
1668
|
i = i.replace(/\n/g, `
|
|
1669
1669
|
${Qe}`), i.includes(`
|
|
1670
|
-
`) && (s = 3 +
|
|
1670
|
+
`) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
1671
1671
|
`))).length);
|
|
1672
|
-
const a =
|
|
1672
|
+
const a = stripVTControlCharacters(i).length;
|
|
1673
1673
|
s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
|
|
1674
|
-
${Qe}${i.trimStart()}`), s = 3 +
|
|
1674
|
+
${Qe}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
|
|
1675
1675
|
}
|
|
1676
1676
|
process.stdout.write(`
|
|
1677
1677
|
`);
|
|
1678
1678
|
},
|
|
1679
|
-
info: (e) => K.message(e, { symbol:
|
|
1680
|
-
success: (e) => K.message(e, { symbol:
|
|
1681
|
-
step: (e) => K.message(e, { symbol:
|
|
1682
|
-
warn: (e) => K.message(e, { symbol:
|
|
1679
|
+
info: (e) => K.message(e, { symbol: styleText("blue", fe) }),
|
|
1680
|
+
success: (e) => K.message(e, { symbol: styleText("green", Fe) }),
|
|
1681
|
+
step: (e) => K.message(e, { symbol: styleText("green", V) }),
|
|
1682
|
+
warn: (e) => K.message(e, { symbol: styleText("yellow", ye) }),
|
|
1683
1683
|
warning: (e) => K.warn(e),
|
|
1684
|
-
error: (e) => K.message(e, { symbol:
|
|
1684
|
+
error: (e) => K.message(e, { symbol: styleText("red", Ee) })
|
|
1685
1685
|
}, Yt = async (e, r) => {
|
|
1686
1686
|
for (const s of e) {
|
|
1687
1687
|
if (s.enabled === !1) continue;
|
|
@@ -1691,9 +1691,9 @@ ${Qe}${i.trimStart()}`), s = 3 + (0, node_util.stripVTControlCharacters)(i.trimS
|
|
|
1691
1691
|
i.stop(a || s.title);
|
|
1692
1692
|
}
|
|
1693
1693
|
}, zt = (e) => e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Qt = (e) => {
|
|
1694
|
-
const r = e.output ?? process.stdout, s = rt(r), i =
|
|
1694
|
+
const r = e.output ?? process.stdout, s = rt(r), i = styleText("gray", h), a = e.spacing ?? 1, o = 3, u = e.retainLog === !0, l = !ce() && Me(r);
|
|
1695
1695
|
r.write(`${i}
|
|
1696
|
-
`), r.write(`${
|
|
1696
|
+
`), r.write(`${styleText("green", V)} ${e.title}
|
|
1697
1697
|
`);
|
|
1698
1698
|
for (let d = 0; d < a; d++) r.write(`${i}
|
|
1699
1699
|
`);
|
|
@@ -1721,13 +1721,13 @@ ${y$1.header}`);
|
|
|
1721
1721
|
const v = y$1 ? `${d.full}
|
|
1722
1722
|
${d.value}` : d.value;
|
|
1723
1723
|
d.header !== void 0 && d.header !== "" && R.message(d.header.split(`
|
|
1724
|
-
`).map((C) =>
|
|
1724
|
+
`).map((C) => styleText("bold", C)), {
|
|
1725
1725
|
output: r,
|
|
1726
1726
|
secondarySymbol: i,
|
|
1727
1727
|
symbol: i,
|
|
1728
1728
|
spacing: 0
|
|
1729
1729
|
}), R.message(v.split(`
|
|
1730
|
-
`).map((C) =>
|
|
1730
|
+
`).map((C) => styleText("dim", C)), {
|
|
1731
1731
|
output: r,
|
|
1732
1732
|
secondarySymbol: i,
|
|
1733
1733
|
symbol: i,
|
|
@@ -1809,7 +1809,7 @@ ${d.value}` : d.value;
|
|
|
1809
1809
|
}), F?.showLog === !0 && g(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
1810
1810
|
}
|
|
1811
1811
|
};
|
|
1812
|
-
}, Zt = (e) => new $t
|
|
1812
|
+
}, Zt = (e) => new $t({
|
|
1813
1813
|
validate: e.validate,
|
|
1814
1814
|
placeholder: e.placeholder,
|
|
1815
1815
|
defaultValue: e.defaultValue,
|
|
@@ -1818,28 +1818,28 @@ ${d.value}` : d.value;
|
|
|
1818
1818
|
signal: e.signal,
|
|
1819
1819
|
input: e.input,
|
|
1820
1820
|
render() {
|
|
1821
|
-
const r = e?.withGuide ?? _.withGuide, s = `${`${r ? `${
|
|
1821
|
+
const r = e?.withGuide ?? _.withGuide, s = `${`${r ? `${styleText("gray", h)}
|
|
1822
1822
|
` : ""}${W(this.state)} `}${e.message}
|
|
1823
|
-
`, i = e.placeholder ?
|
|
1823
|
+
`, i = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
|
|
1824
1824
|
switch (this.state) {
|
|
1825
1825
|
case "error": {
|
|
1826
|
-
const u = this.error ? ` ${
|
|
1826
|
+
const u = this.error ? ` ${styleText("yellow", this.error)}` : "", l = r ? `${styleText("yellow", h)} ` : "", n = r ? styleText("yellow", x) : "";
|
|
1827
1827
|
return `${s.trim()}
|
|
1828
1828
|
${l}${a}
|
|
1829
1829
|
${n}${u}
|
|
1830
1830
|
`;
|
|
1831
1831
|
}
|
|
1832
1832
|
case "submit": {
|
|
1833
|
-
const u = o ? ` ${
|
|
1834
|
-
return `${s}${r ?
|
|
1833
|
+
const u = o ? ` ${styleText("dim", o)}` : "";
|
|
1834
|
+
return `${s}${r ? styleText("gray", h) : ""}${u}`;
|
|
1835
1835
|
}
|
|
1836
1836
|
case "cancel": {
|
|
1837
|
-
const u = o ? ` ${
|
|
1837
|
+
const u = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", l = r ? styleText("gray", h) : "";
|
|
1838
1838
|
return `${s}${l}${u}${o.trim() ? `
|
|
1839
1839
|
${l}` : ""}`;
|
|
1840
1840
|
}
|
|
1841
|
-
default: return `${s}${r ? `${
|
|
1842
|
-
${r ?
|
|
1841
|
+
default: return `${s}${r ? `${styleText("cyan", h)} ` : ""}${a}
|
|
1842
|
+
${r ? styleText("cyan", x) : ""}
|
|
1843
1843
|
`;
|
|
1844
1844
|
}
|
|
1845
1845
|
}
|
|
@@ -2865,11 +2865,11 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2865
2865
|
//#endregion
|
|
2866
2866
|
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js
|
|
2867
2867
|
var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2868
|
-
const EventEmitter =
|
|
2869
|
-
const childProcess =
|
|
2870
|
-
const path$
|
|
2871
|
-
const fs$
|
|
2872
|
-
const process$1 =
|
|
2868
|
+
const EventEmitter = __require("node:events").EventEmitter;
|
|
2869
|
+
const childProcess = __require("node:child_process");
|
|
2870
|
+
const path$2 = __require("node:path");
|
|
2871
|
+
const fs$1 = __require("node:fs");
|
|
2872
|
+
const process$1 = __require("node:process");
|
|
2873
2873
|
const { Argument, humanReadableArgName } = require_argument();
|
|
2874
2874
|
const { CommanderError } = require_error();
|
|
2875
2875
|
const { Help, stripColor } = require_help();
|
|
@@ -3764,7 +3764,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3764
3764
|
* @param {string} subcommandName
|
|
3765
3765
|
*/
|
|
3766
3766
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
3767
|
-
if (fs$
|
|
3767
|
+
if (fs$1.existsSync(executableFile)) return;
|
|
3768
3768
|
const executableMissing = `'${executableFile}' does not exist
|
|
3769
3769
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
3770
3770
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -3787,10 +3787,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3787
3787
|
".cjs"
|
|
3788
3788
|
];
|
|
3789
3789
|
function findFile(baseDir, baseName) {
|
|
3790
|
-
const localBin = path$
|
|
3791
|
-
if (fs$
|
|
3792
|
-
if (sourceExt.includes(path$
|
|
3793
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
3790
|
+
const localBin = path$2.resolve(baseDir, baseName);
|
|
3791
|
+
if (fs$1.existsSync(localBin)) return localBin;
|
|
3792
|
+
if (sourceExt.includes(path$2.extname(baseName))) return void 0;
|
|
3793
|
+
const foundExt = sourceExt.find((ext) => fs$1.existsSync(`${localBin}${ext}`));
|
|
3794
3794
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
3795
3795
|
}
|
|
3796
3796
|
this._checkForMissingMandatoryOptions();
|
|
@@ -3800,21 +3800,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3800
3800
|
if (this._scriptPath) {
|
|
3801
3801
|
let resolvedScriptPath;
|
|
3802
3802
|
try {
|
|
3803
|
-
resolvedScriptPath = fs$
|
|
3803
|
+
resolvedScriptPath = fs$1.realpathSync(this._scriptPath);
|
|
3804
3804
|
} catch {
|
|
3805
3805
|
resolvedScriptPath = this._scriptPath;
|
|
3806
3806
|
}
|
|
3807
|
-
executableDir = path$
|
|
3807
|
+
executableDir = path$2.resolve(path$2.dirname(resolvedScriptPath), executableDir);
|
|
3808
3808
|
}
|
|
3809
3809
|
if (executableDir) {
|
|
3810
3810
|
let localFile = findFile(executableDir, executableFile);
|
|
3811
3811
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
3812
|
-
const legacyName = path$
|
|
3812
|
+
const legacyName = path$2.basename(this._scriptPath, path$2.extname(this._scriptPath));
|
|
3813
3813
|
if (legacyName !== this._name) localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
3814
3814
|
}
|
|
3815
3815
|
executableFile = localFile || executableFile;
|
|
3816
3816
|
}
|
|
3817
|
-
launchWithNode = sourceExt.includes(path$
|
|
3817
|
+
launchWithNode = sourceExt.includes(path$2.extname(executableFile));
|
|
3818
3818
|
let proc;
|
|
3819
3819
|
if (process$1.platform !== "win32") if (launchWithNode) {
|
|
3820
3820
|
args.unshift(executableFile);
|
|
@@ -4582,7 +4582,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4582
4582
|
* @return {Command}
|
|
4583
4583
|
*/
|
|
4584
4584
|
nameFromFilename(filename) {
|
|
4585
|
-
this._name = path$
|
|
4585
|
+
this._name = path$2.basename(filename, path$2.extname(filename));
|
|
4586
4586
|
return this;
|
|
4587
4587
|
}
|
|
4588
4588
|
/**
|
|
@@ -4596,9 +4596,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4596
4596
|
* @param {string} [path]
|
|
4597
4597
|
* @return {(string|null|Command)}
|
|
4598
4598
|
*/
|
|
4599
|
-
executableDir(path$
|
|
4600
|
-
if (path$
|
|
4601
|
-
this._executableDir = path$
|
|
4599
|
+
executableDir(path$3) {
|
|
4600
|
+
if (path$3 === void 0) return this._executableDir;
|
|
4601
|
+
this._executableDir = path$3;
|
|
4602
4602
|
return this;
|
|
4603
4603
|
}
|
|
4604
4604
|
/**
|
|
@@ -4957,10 +4957,10 @@ var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4957
4957
|
//#endregion
|
|
4958
4958
|
//#region ../../node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.js
|
|
4959
4959
|
var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4960
|
-
const fs
|
|
4961
|
-
const path$
|
|
4962
|
-
const os
|
|
4963
|
-
const crypto =
|
|
4960
|
+
const fs = __require("fs");
|
|
4961
|
+
const path$1 = __require("path");
|
|
4962
|
+
const os = __require("os");
|
|
4963
|
+
const crypto = __require("crypto");
|
|
4964
4964
|
const version = require_package().version;
|
|
4965
4965
|
const TIPS = [
|
|
4966
4966
|
"🔐 encrypt with Dotenvx: https://dotenvx.com",
|
|
@@ -5091,14 +5091,14 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5091
5091
|
function _vaultPath(options) {
|
|
5092
5092
|
let possibleVaultPath = null;
|
|
5093
5093
|
if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
|
|
5094
|
-
for (const filepath of options.path) if (fs
|
|
5094
|
+
for (const filepath of options.path) if (fs.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
5095
5095
|
} else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
5096
|
-
else possibleVaultPath = path$
|
|
5097
|
-
if (fs
|
|
5096
|
+
else possibleVaultPath = path$1.resolve(process.cwd(), ".env.vault");
|
|
5097
|
+
if (fs.existsSync(possibleVaultPath)) return possibleVaultPath;
|
|
5098
5098
|
return null;
|
|
5099
5099
|
}
|
|
5100
5100
|
function _resolveHome(envPath) {
|
|
5101
|
-
return envPath[0] === "~" ? path$
|
|
5101
|
+
return envPath[0] === "~" ? path$1.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
5102
5102
|
}
|
|
5103
5103
|
function _configVault(options) {
|
|
5104
5104
|
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
@@ -5111,7 +5111,7 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5111
5111
|
return { parsed };
|
|
5112
5112
|
}
|
|
5113
5113
|
function configDotenv(options) {
|
|
5114
|
-
const dotenvPath = path$
|
|
5114
|
+
const dotenvPath = path$1.resolve(process.cwd(), ".env");
|
|
5115
5115
|
let encoding = "utf8";
|
|
5116
5116
|
let processEnv = process.env;
|
|
5117
5117
|
if (options && options.processEnv != null) processEnv = options.processEnv;
|
|
@@ -5127,11 +5127,11 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5127
5127
|
}
|
|
5128
5128
|
let lastError;
|
|
5129
5129
|
const parsedAll = {};
|
|
5130
|
-
for (const path$
|
|
5131
|
-
const parsed = DotenvModule.parse(fs
|
|
5130
|
+
for (const path$3 of optionPaths) try {
|
|
5131
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path$3, { encoding }));
|
|
5132
5132
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
5133
5133
|
} catch (e) {
|
|
5134
|
-
if (debug) _debug(`Failed to load ${path$
|
|
5134
|
+
if (debug) _debug(`Failed to load ${path$3} ${e.message}`);
|
|
5135
5135
|
lastError = e;
|
|
5136
5136
|
}
|
|
5137
5137
|
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
@@ -5141,7 +5141,7 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5141
5141
|
const keysCount = Object.keys(populated).length;
|
|
5142
5142
|
const shortPaths = [];
|
|
5143
5143
|
for (const filePath of optionPaths) try {
|
|
5144
|
-
const relative = path$
|
|
5144
|
+
const relative = path$1.relative(process.cwd(), filePath);
|
|
5145
5145
|
shortPaths.push(relative);
|
|
5146
5146
|
} catch (e) {
|
|
5147
5147
|
if (debug) _debug(`Failed to load ${filePath} ${e.message}`);
|
|
@@ -5599,9 +5599,9 @@ function actionDescription(action) {
|
|
|
5599
5599
|
//#region src/cli/keys.ts
|
|
5600
5600
|
async function generateKeys() {
|
|
5601
5601
|
try {
|
|
5602
|
-
const keys = await
|
|
5603
|
-
const privateKey = await
|
|
5604
|
-
const publicKey = await
|
|
5602
|
+
const keys = await generateKeyPair("RS256", { extractable: true });
|
|
5603
|
+
const privateKey = await exportPKCS8(keys.privateKey);
|
|
5604
|
+
const publicKey = await exportJWK(keys.publicKey);
|
|
5605
5605
|
const jwks = JSON.stringify({ keys: [{
|
|
5606
5606
|
use: "sig",
|
|
5607
5607
|
...publicKey
|
|
@@ -5609,7 +5609,7 @@ async function generateKeys() {
|
|
|
5609
5609
|
return {
|
|
5610
5610
|
JWT_PRIVATE_KEY: `${privateKey.trimEnd().replace(/\n/g, " ")}`,
|
|
5611
5611
|
JWKS: jwks,
|
|
5612
|
-
AUTH_SECRET_ENCRYPTION_KEY:
|
|
5612
|
+
AUTH_SECRET_ENCRYPTION_KEY: randomBytes(32).toString("base64url")
|
|
5613
5613
|
};
|
|
5614
5614
|
} catch (error) {
|
|
5615
5615
|
console.error("Could not generate private and public key, are you running this command using Node.js?\n", error);
|
|
@@ -5621,19 +5621,19 @@ async function generateKeys() {
|
|
|
5621
5621
|
//#region src/cli/index.ts
|
|
5622
5622
|
function getPackageVersion() {
|
|
5623
5623
|
for (const relative of ["..", "../.."]) try {
|
|
5624
|
-
const pkgPath = path.
|
|
5625
|
-
return JSON.parse(
|
|
5624
|
+
const pkgPath = path.resolve(__dirname, relative, "package.json");
|
|
5625
|
+
return JSON.parse(readFileSync(pkgPath, "utf-8")).version;
|
|
5626
5626
|
} catch {}
|
|
5627
5627
|
return "unknown";
|
|
5628
5628
|
}
|
|
5629
5629
|
const version = getPackageVersion();
|
|
5630
5630
|
function detectPackageRunner() {
|
|
5631
5631
|
let dir = process.cwd();
|
|
5632
|
-
const root = path.
|
|
5632
|
+
const root = path.parse(dir).root;
|
|
5633
5633
|
while (dir !== root) {
|
|
5634
|
-
const pkgPath = path.
|
|
5635
|
-
if (
|
|
5636
|
-
const pkg = JSON.parse(
|
|
5634
|
+
const pkgPath = path.join(dir, "package.json");
|
|
5635
|
+
if (existsSync(pkgPath)) try {
|
|
5636
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
5637
5637
|
if (typeof pkg.packageManager === "string") {
|
|
5638
5638
|
const name = pkg.packageManager.split("@")[0];
|
|
5639
5639
|
if (name === "pnpm") return {
|
|
@@ -5650,19 +5650,19 @@ function detectPackageRunner() {
|
|
|
5650
5650
|
};
|
|
5651
5651
|
}
|
|
5652
5652
|
} catch {}
|
|
5653
|
-
if (
|
|
5653
|
+
if (existsSync(path.join(dir, "pnpm-lock.yaml"))) return {
|
|
5654
5654
|
cmd: "pnpm",
|
|
5655
5655
|
args: ["exec"]
|
|
5656
5656
|
};
|
|
5657
|
-
if (
|
|
5657
|
+
if (existsSync(path.join(dir, "bun.lockb")) || existsSync(path.join(dir, "bun.lock"))) return {
|
|
5658
5658
|
cmd: "bunx",
|
|
5659
5659
|
args: []
|
|
5660
5660
|
};
|
|
5661
|
-
if (
|
|
5661
|
+
if (existsSync(path.join(dir, "yarn.lock"))) return {
|
|
5662
5662
|
cmd: "yarn",
|
|
5663
5663
|
args: ["dlx"]
|
|
5664
5664
|
};
|
|
5665
|
-
dir = path.
|
|
5665
|
+
dir = path.dirname(dir);
|
|
5666
5666
|
}
|
|
5667
5667
|
return {
|
|
5668
5668
|
cmd: "npx",
|
|
@@ -5761,14 +5761,14 @@ async function configureKeys(config) {
|
|
|
5761
5761
|
}
|
|
5762
5762
|
function backendEnvVar(config, name) {
|
|
5763
5763
|
const { file, args } = convexCmd("env", "get", ...deploymentArgs(config), name);
|
|
5764
|
-
return
|
|
5764
|
+
return execFileSync(file, args, {
|
|
5765
5765
|
stdio: "pipe",
|
|
5766
5766
|
encoding: "utf-8"
|
|
5767
5767
|
}).slice(0, -1);
|
|
5768
5768
|
}
|
|
5769
5769
|
async function setEnvVar(config, name, value, options) {
|
|
5770
5770
|
const { file, args } = convexCmd("env", "set", ...deploymentArgs(config), "--", name, value);
|
|
5771
|
-
|
|
5771
|
+
execFileSync(file, args, { stdio: options?.hideValue ? "ignore" : "inherit" });
|
|
5772
5772
|
if (options?.hideValue) R.success(`Successfully set ${name} (on ${printDeployment(config)})`);
|
|
5773
5773
|
}
|
|
5774
5774
|
/**
|
|
@@ -5776,16 +5776,16 @@ async function setEnvVar(config, name, value, options) {
|
|
|
5776
5776
|
* This avoids shell-quoting issues with multiline values like private keys.
|
|
5777
5777
|
*/
|
|
5778
5778
|
async function setEnvVarFromFile(config, name, value) {
|
|
5779
|
-
const tmpDir =
|
|
5780
|
-
const tmpFile = path.
|
|
5779
|
+
const tmpDir = mkdtempSync(path.join(tmpdir(), "convex-auth-"));
|
|
5780
|
+
const tmpFile = path.join(tmpDir, `${name}.tmp`);
|
|
5781
5781
|
try {
|
|
5782
|
-
|
|
5782
|
+
writeFileSync(tmpFile, value, "utf-8");
|
|
5783
5783
|
const { file, args } = convexCmd("env", "set", ...deploymentArgs(config), name, "--from-file", tmpFile);
|
|
5784
|
-
|
|
5784
|
+
execFileSync(file, args, { stdio: "ignore" });
|
|
5785
5785
|
R.success(`Successfully set ${name} (on ${printDeployment(config)})`);
|
|
5786
5786
|
} finally {
|
|
5787
5787
|
try {
|
|
5788
|
-
|
|
5788
|
+
unlinkSync(tmpFile);
|
|
5789
5789
|
} catch {}
|
|
5790
5790
|
}
|
|
5791
5791
|
}
|
|
@@ -5837,11 +5837,11 @@ const validTsConfig = `\
|
|
|
5837
5837
|
async function modifyTsConfig(config) {
|
|
5838
5838
|
logStep(config, "Modify tsconfig file");
|
|
5839
5839
|
const projectLevelTsConfigPath = "tsconfig.json";
|
|
5840
|
-
const tsConfigPath = path.
|
|
5841
|
-
if (!
|
|
5842
|
-
if (
|
|
5840
|
+
const tsConfigPath = path.join(config.convexFolderPath, "tsconfig.json");
|
|
5841
|
+
if (!existsSync(tsConfigPath)) {
|
|
5842
|
+
if (existsSync(projectLevelTsConfigPath)) {
|
|
5843
5843
|
if (config.isExpo) {
|
|
5844
|
-
|
|
5844
|
+
writeFileSync(tsConfigPath, validTsConfig);
|
|
5845
5845
|
R.success(`Added ${tsConfigPath}`);
|
|
5846
5846
|
return;
|
|
5847
5847
|
}
|
|
@@ -5849,7 +5849,7 @@ async function modifyTsConfig(config) {
|
|
|
5849
5849
|
R.info(`No ${tsConfigPath} found. Skipping.`);
|
|
5850
5850
|
return;
|
|
5851
5851
|
}
|
|
5852
|
-
const existingTsConfig =
|
|
5852
|
+
const existingTsConfig = readFileSync(tsConfigPath, "utf8");
|
|
5853
5853
|
const moduleResolutionPattern = /"moduleResolution"\s*:\s*"(\w+)"/;
|
|
5854
5854
|
const [, existingModuleResolution] = existingTsConfig.match(moduleResolutionPattern) ?? [];
|
|
5855
5855
|
const skipLibCheckPattern = /"skipLibCheck"\s*:\s*(\w+)/;
|
|
@@ -5869,7 +5869,7 @@ async function modifyTsConfig(config) {
|
|
|
5869
5869
|
\n`));
|
|
5870
5870
|
await promptForConfirmationOrExit("Ready to continue?");
|
|
5871
5871
|
}
|
|
5872
|
-
|
|
5872
|
+
writeFileSync(tsConfigPath, addCompilerOption(addCompilerOption(existingTsConfig, existingModuleResolution, moduleResolutionPattern, "\"moduleResolution\": \"Bundler\""), existingSkipLibCheck, skipLibCheckPattern, "\"skipLibCheck\": true"));
|
|
5873
5873
|
R.success(`Modified ${tsConfigPath}`);
|
|
5874
5874
|
}
|
|
5875
5875
|
function addCompilerOption(tsconfig, existingValue, pattern, optionAndValue) {
|
|
@@ -5889,9 +5889,9 @@ app.use(auth);
|
|
|
5889
5889
|
export default app;
|
|
5890
5890
|
`;
|
|
5891
5891
|
const source = templateToSource(sourceTemplate);
|
|
5892
|
-
const convexConfigPath = path.
|
|
5892
|
+
const convexConfigPath = path.join(config.convexFolderPath, "convex.config");
|
|
5893
5893
|
const existingConfigPath = existingNonEmptySourcePath(convexConfigPath);
|
|
5894
|
-
if (existingConfigPath !== null) if (doesAlreadyMatchTemplate(
|
|
5894
|
+
if (existingConfigPath !== null) if (doesAlreadyMatchTemplate(readFileSync(existingConfigPath, "utf8"), sourceTemplate)) R.success(`The ${existingConfigPath} is already set up.`);
|
|
5895
5895
|
else {
|
|
5896
5896
|
R.info(`You already have a ${existingConfigPath}, make sure it registers the auth component like this:`);
|
|
5897
5897
|
R.message(indent(`\n${source}\n`));
|
|
@@ -5899,7 +5899,7 @@ export default app;
|
|
|
5899
5899
|
}
|
|
5900
5900
|
else {
|
|
5901
5901
|
const newConfigPath = config.usesTypeScript ? `${convexConfigPath}.ts` : `${convexConfigPath}.js`;
|
|
5902
|
-
|
|
5902
|
+
writeFileSync(newConfigPath, source);
|
|
5903
5903
|
R.success(`Created ${newConfigPath}`);
|
|
5904
5904
|
}
|
|
5905
5905
|
}
|
|
@@ -5917,9 +5917,9 @@ export { auth };
|
|
|
5917
5917
|
export const { signIn, signOut, store } = auth;
|
|
5918
5918
|
`;
|
|
5919
5919
|
const source = templateToSource(sourceTemplate);
|
|
5920
|
-
const authPath = path.
|
|
5920
|
+
const authPath = path.join(config.convexFolderPath, "auth");
|
|
5921
5921
|
const existingAuthPath = existingNonEmptySourcePath(authPath);
|
|
5922
|
-
if (existingAuthPath !== null) if (doesAlreadyMatchTemplate(
|
|
5922
|
+
if (existingAuthPath !== null) if (doesAlreadyMatchTemplate(readFileSync(existingAuthPath, "utf8"), sourceTemplate)) R.success(`The ${existingAuthPath} is already set up.`);
|
|
5923
5923
|
else {
|
|
5924
5924
|
R.info(`You already have a ${existingAuthPath}, make sure it initializes auth with \`createAuth\` like this:`);
|
|
5925
5925
|
R.message(indent(`\n${source}\n`));
|
|
@@ -5927,7 +5927,7 @@ export const { signIn, signOut, store } = auth;
|
|
|
5927
5927
|
}
|
|
5928
5928
|
else {
|
|
5929
5929
|
const newAuthPath = config.usesTypeScript ? `${authPath}.ts` : `${authPath}.js`;
|
|
5930
|
-
|
|
5930
|
+
writeFileSync(newAuthPath, source);
|
|
5931
5931
|
R.success(`Created ${newAuthPath}`);
|
|
5932
5932
|
}
|
|
5933
5933
|
}
|
|
@@ -5944,9 +5944,9 @@ auth.http.add(http);
|
|
|
5944
5944
|
export default http;
|
|
5945
5945
|
`;
|
|
5946
5946
|
const source = templateToSource(sourceTemplate);
|
|
5947
|
-
const httpPath = path.
|
|
5947
|
+
const httpPath = path.join(config.convexFolderPath, "http");
|
|
5948
5948
|
const existingHttpPath = existingNonEmptySourcePath(httpPath);
|
|
5949
|
-
if (existingHttpPath !== null) if (doesAlreadyMatchTemplate(
|
|
5949
|
+
if (existingHttpPath !== null) if (doesAlreadyMatchTemplate(readFileSync(existingHttpPath, "utf8"), sourceTemplate)) R.success(`The ${existingHttpPath} is already set up.`);
|
|
5950
5950
|
else {
|
|
5951
5951
|
R.info(`You already have a ${existingHttpPath}, make sure it includes the call to \`auth.http.add\`:`);
|
|
5952
5952
|
R.message(indent(`\n${source}\n`));
|
|
@@ -5954,7 +5954,7 @@ export default http;
|
|
|
5954
5954
|
}
|
|
5955
5955
|
else {
|
|
5956
5956
|
const newHttpPath = config.usesTypeScript ? `${httpPath}.ts` : `${httpPath}.js`;
|
|
5957
|
-
|
|
5957
|
+
writeFileSync(newHttpPath, source);
|
|
5958
5958
|
R.success(`Created ${newHttpPath}`);
|
|
5959
5959
|
}
|
|
5960
5960
|
}
|
|
@@ -6000,17 +6000,17 @@ function existingNonEmptySourcePath(filePath) {
|
|
|
6000
6000
|
return existsAndNotEmpty(`${filePath}.ts`) ? `${filePath}.ts` : existsAndNotEmpty(`${filePath}.js`) ? `${filePath}.js` : null;
|
|
6001
6001
|
}
|
|
6002
6002
|
function existsAndNotEmpty(filePath) {
|
|
6003
|
-
return
|
|
6003
|
+
return existsSync(filePath) && readFileSync(filePath, "utf8").trim() !== "";
|
|
6004
6004
|
}
|
|
6005
6005
|
function logStep(config, message) {
|
|
6006
6006
|
R.step(`Step ${config.step++}: ${message}`);
|
|
6007
6007
|
}
|
|
6008
6008
|
async function checkSourceControl(options) {
|
|
6009
6009
|
if (options.allowDirtyGitState) return;
|
|
6010
|
-
if (
|
|
6010
|
+
if (existsSync(".git")) {
|
|
6011
6011
|
let gitStatus;
|
|
6012
6012
|
try {
|
|
6013
|
-
gitStatus =
|
|
6013
|
+
gitStatus = execFileSync("git", ["status", "--porcelain"], { encoding: "utf-8" });
|
|
6014
6014
|
} catch {
|
|
6015
6015
|
return;
|
|
6016
6016
|
}
|
|
@@ -6026,16 +6026,16 @@ async function checkSourceControl(options) {
|
|
|
6026
6026
|
}
|
|
6027
6027
|
function readPackageJson() {
|
|
6028
6028
|
try {
|
|
6029
|
-
const data =
|
|
6029
|
+
const data = readFileSync("package.json", "utf8");
|
|
6030
6030
|
return JSON.parse(data);
|
|
6031
6031
|
} catch (error) {
|
|
6032
6032
|
logErrorAndExit("`@robelest/convex-auth` must be run from a project directory which includes a valid \"package.json\" file. You can create one by running `npm init`.", error.message);
|
|
6033
6033
|
}
|
|
6034
6034
|
}
|
|
6035
6035
|
function readConvexJson() {
|
|
6036
|
-
if (!
|
|
6036
|
+
if (!existsSync("convex.json")) return {};
|
|
6037
6037
|
try {
|
|
6038
|
-
const data =
|
|
6038
|
+
const data = readFileSync("convex.json", "utf8");
|
|
6039
6039
|
return JSON.parse(data);
|
|
6040
6040
|
} catch (error) {
|
|
6041
6041
|
logErrorAndExit("Could not parse your convex.json. Is it valid JSON?", error.message);
|
|
@@ -6181,4 +6181,5 @@ function indent(string$1) {
|
|
|
6181
6181
|
//#region src/cli/bin.ts
|
|
6182
6182
|
program.parse(process.argv);
|
|
6183
6183
|
|
|
6184
|
-
//#endregion
|
|
6184
|
+
//#endregion
|
|
6185
|
+
export { };
|