convoker 0.3.3 → 0.3.4
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/chunk-z5eko27R.mjs +13 -0
- package/dist/color-BuHvMolk.d.mts +158 -0
- package/dist/color-OlJQTTxb.mjs +172 -0
- package/dist/color.d.mts +2 -0
- package/dist/color.mjs +4 -0
- package/dist/command-BXmfoT-l.d.mts +331 -0
- package/dist/command-D2UiQBNA.mjs +583 -0
- package/dist/command.d.mts +5 -0
- package/dist/command.mjs +10 -0
- package/dist/error-C1S1gs8L.mjs +115 -0
- package/dist/error.d.mts +5 -0
- package/dist/error.mjs +3 -0
- package/dist/index-Dikc5KAP.d.mts +199 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.mjs +10 -0
- package/dist/input-B12iaqb8.d.mts +187 -0
- package/dist/input-DRy_sVxZ.mjs +174 -0
- package/dist/input.d.mts +3 -0
- package/dist/input.mjs +5 -0
- package/dist/prompt/index.d.mts +5 -0
- package/dist/prompt/index.mjs +8 -0
- package/dist/prompt/raw.d.mts +2 -0
- package/dist/prompt/raw.mjs +4 -0
- package/dist/prompt-Cvufljin.mjs +248 -0
- package/dist/raw--889icsd.mjs +105 -0
- package/dist/raw-BqvlveTU.d.mts +37 -0
- package/dist/standard-schema-DBXbMy6L.mjs +17 -0
- package/dist/standard-schema-DLeKaehR.d.mts +58 -0
- package/dist/utils-ChmY93uA.mjs +45 -0
- package/package.json +20 -19
- package/dist/color.d.ts +0 -153
- package/dist/color.js +0 -143
- package/dist/command.d.ts +0 -218
- package/dist/command.js +0 -531
- package/dist/error.d.ts +0 -107
- package/dist/error.js +0 -100
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/input.d.ts +0 -182
- package/dist/input.js +0 -185
- package/dist/log.d.ts +0 -61
- package/dist/log.js +0 -216
- package/dist/prompt/index.d.ts +0 -193
- package/dist/prompt/index.js +0 -273
- package/dist/prompt/raw.d.ts +0 -32
- package/dist/prompt/raw.js +0 -105
- package/dist/standard-schema.d.ts +0 -62
- package/dist/standard-schema.js +0 -16
- package/dist/utils.d.ts +0 -30
- package/dist/utils.js +0 -56
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (all) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
return target;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __export as t };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
declare namespace color_d_exports {
|
|
2
|
+
export { DEFAULT_THEME, Theme, bgBlack, bgBlue, bgBlueBright, bgCyan, bgCyanBright, bgGray, bgGreen, bgGreenBright, bgMagenta, bgMagentaBright, bgRed, bgRedBright, bgWhite, bgWhiteBright, bgYellow, bgYellowBright, black, blue, blueBright, bold, createAnsiColor, cyan, cyanBright, defineTheme, dim, gray, green, greenBright, hidden, inverse, italic, magenta, magentaBright, overline, red, redBright, reset, strikethrough, supportsColor, underline, white, whiteBright, yellow, yellowBright };
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* If the runtime supports color.
|
|
6
|
+
*/
|
|
7
|
+
declare const supportsColor: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a function that wraps a string in ANSI codes.
|
|
10
|
+
* @param open The opening ANSI code.
|
|
11
|
+
* @param close The closing ANSI code.
|
|
12
|
+
* @returns A function that wraps the string in ANSI codes.
|
|
13
|
+
*/
|
|
14
|
+
declare function createAnsiColor(open: number, close: number): (input: any) => string;
|
|
15
|
+
declare const reset: (input: any) => string;
|
|
16
|
+
declare const bold: (input: any) => string;
|
|
17
|
+
declare const dim: (input: any) => string;
|
|
18
|
+
declare const italic: (input: any) => string;
|
|
19
|
+
declare const underline: (input: any) => string;
|
|
20
|
+
declare const overline: (input: any) => string;
|
|
21
|
+
declare const inverse: (input: any) => string;
|
|
22
|
+
declare const hidden: (input: any) => string;
|
|
23
|
+
declare const strikethrough: (input: any) => string;
|
|
24
|
+
declare const black: (input: any) => string;
|
|
25
|
+
declare const red: (input: any) => string;
|
|
26
|
+
declare const green: (input: any) => string;
|
|
27
|
+
declare const yellow: (input: any) => string;
|
|
28
|
+
declare const blue: (input: any) => string;
|
|
29
|
+
declare const magenta: (input: any) => string;
|
|
30
|
+
declare const cyan: (input: any) => string;
|
|
31
|
+
declare const white: (input: any) => string;
|
|
32
|
+
declare const gray: (input: any) => string;
|
|
33
|
+
declare const bgBlack: (input: any) => string;
|
|
34
|
+
declare const bgRed: (input: any) => string;
|
|
35
|
+
declare const bgGreen: (input: any) => string;
|
|
36
|
+
declare const bgYellow: (input: any) => string;
|
|
37
|
+
declare const bgBlue: (input: any) => string;
|
|
38
|
+
declare const bgMagenta: (input: any) => string;
|
|
39
|
+
declare const bgCyan: (input: any) => string;
|
|
40
|
+
declare const bgWhite: (input: any) => string;
|
|
41
|
+
declare const bgGray: (input: any) => string;
|
|
42
|
+
declare const redBright: (input: any) => string;
|
|
43
|
+
declare const greenBright: (input: any) => string;
|
|
44
|
+
declare const yellowBright: (input: any) => string;
|
|
45
|
+
declare const blueBright: (input: any) => string;
|
|
46
|
+
declare const magentaBright: (input: any) => string;
|
|
47
|
+
declare const cyanBright: (input: any) => string;
|
|
48
|
+
declare const whiteBright: (input: any) => string;
|
|
49
|
+
declare const bgRedBright: (input: any) => string;
|
|
50
|
+
declare const bgGreenBright: (input: any) => string;
|
|
51
|
+
declare const bgYellowBright: (input: any) => string;
|
|
52
|
+
declare const bgBlueBright: (input: any) => string;
|
|
53
|
+
declare const bgMagentaBright: (input: any) => string;
|
|
54
|
+
declare const bgCyanBright: (input: any) => string;
|
|
55
|
+
declare const bgWhiteBright: (input: any) => string;
|
|
56
|
+
/**
|
|
57
|
+
* A theme.
|
|
58
|
+
*/
|
|
59
|
+
interface Theme {
|
|
60
|
+
/**
|
|
61
|
+
* Wraps a string in a background ANSI code.
|
|
62
|
+
* @param a The string to wrap.
|
|
63
|
+
*/
|
|
64
|
+
background?(a: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Wraps a string in a foreground ANSI code.
|
|
67
|
+
* @param a The string to wrap.
|
|
68
|
+
*/
|
|
69
|
+
foreground?(a: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Wraps a string in a primary ANSI code.
|
|
72
|
+
* @param a The string to wrap.
|
|
73
|
+
*/
|
|
74
|
+
primary(a: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Wraps a string in a secondary ANSI code.
|
|
77
|
+
* @param a The string to wrap.
|
|
78
|
+
*/
|
|
79
|
+
secondary(a: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Wraps a string in a accent ANSI code.
|
|
82
|
+
* @param a The string to wrap.
|
|
83
|
+
*/
|
|
84
|
+
accent?(a: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Wraps a string in a success ANSI code.
|
|
87
|
+
* @param a The string to wrap.
|
|
88
|
+
*/
|
|
89
|
+
success(a: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Wraps a string in a warning ANSI code.
|
|
92
|
+
* @param a The string to wrap.
|
|
93
|
+
*/
|
|
94
|
+
warning(a: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Wraps a string in a error ANSI code.
|
|
97
|
+
* @param a The string to wrap.
|
|
98
|
+
*/
|
|
99
|
+
error(a: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Wraps a string in a info ANSI code.
|
|
102
|
+
* @param a The string to wrap.
|
|
103
|
+
*/
|
|
104
|
+
info?(a: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Set of symbols for logging.
|
|
107
|
+
*/
|
|
108
|
+
symbols?: {
|
|
109
|
+
/**
|
|
110
|
+
* Success message symbol.
|
|
111
|
+
*/
|
|
112
|
+
success: string;
|
|
113
|
+
/**
|
|
114
|
+
* Error message symbol.
|
|
115
|
+
*/
|
|
116
|
+
error: string;
|
|
117
|
+
/**
|
|
118
|
+
* Warning message symbol.
|
|
119
|
+
*/
|
|
120
|
+
warning: string;
|
|
121
|
+
/**
|
|
122
|
+
* Information message symbol.
|
|
123
|
+
*/
|
|
124
|
+
info?: string;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Optional styles.
|
|
128
|
+
*/
|
|
129
|
+
styles?: {
|
|
130
|
+
/**
|
|
131
|
+
* Wraps a string in a bold ANSI code.
|
|
132
|
+
* @param a The string to wrap.
|
|
133
|
+
*/
|
|
134
|
+
bold?(a: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* Wraps a string in an italic ANSI code.
|
|
137
|
+
* @param a The string to wrap.
|
|
138
|
+
*/
|
|
139
|
+
italic?(a: string): string;
|
|
140
|
+
/**
|
|
141
|
+
* Wraps a string in an underline ANSI code.
|
|
142
|
+
* @param a The string to wrap.
|
|
143
|
+
*/
|
|
144
|
+
underline?(a: string): string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The default theme.
|
|
149
|
+
*/
|
|
150
|
+
declare const DEFAULT_THEME: Theme;
|
|
151
|
+
/**
|
|
152
|
+
* Defines a theme.
|
|
153
|
+
* @param theme The (partial) theme.
|
|
154
|
+
* @returns The theme, merged with the default theme.
|
|
155
|
+
*/
|
|
156
|
+
declare function defineTheme(theme: Partial<Theme>): Theme;
|
|
157
|
+
//#endregion
|
|
158
|
+
export { green as A, reset as B, color_d_exports as C, defineTheme as D, cyanBright as E, magenta as F, whiteBright as G, supportsColor as H, magentaBright as I, yellow as K, overline as L, hidden as M, inverse as N, dim as O, italic as P, red as R, bold as S, cyan as T, underline as U, strikethrough as V, white as W, bgYellow as _, bgBlueBright as a, blue as b, bgGray as c, bgMagenta as d, bgMagentaBright as f, bgWhiteBright as g, bgWhite as h, bgBlue as i, greenBright as j, gray as k, bgGreen as l, bgRedBright as m, Theme as n, bgCyan as o, bgRed as p, yellowBright as q, bgBlack as r, bgCyanBright as s, DEFAULT_THEME as t, bgGreenBright as u, bgYellowBright as v, createAnsiColor as w, blueBright as x, black as y, redBright as z };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { t as __export } from "./chunk-z5eko27R.mjs";
|
|
2
|
+
import { i as merge } from "./utils-ChmY93uA.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/color.ts
|
|
5
|
+
var color_exports = /* @__PURE__ */ __export({
|
|
6
|
+
DEFAULT_THEME: () => DEFAULT_THEME,
|
|
7
|
+
bgBlack: () => bgBlack,
|
|
8
|
+
bgBlue: () => bgBlue,
|
|
9
|
+
bgBlueBright: () => bgBlueBright,
|
|
10
|
+
bgCyan: () => bgCyan,
|
|
11
|
+
bgCyanBright: () => bgCyanBright,
|
|
12
|
+
bgGray: () => bgGray,
|
|
13
|
+
bgGreen: () => bgGreen,
|
|
14
|
+
bgGreenBright: () => bgGreenBright,
|
|
15
|
+
bgMagenta: () => bgMagenta,
|
|
16
|
+
bgMagentaBright: () => bgMagentaBright,
|
|
17
|
+
bgRed: () => bgRed,
|
|
18
|
+
bgRedBright: () => bgRedBright,
|
|
19
|
+
bgWhite: () => bgWhite,
|
|
20
|
+
bgWhiteBright: () => bgWhiteBright,
|
|
21
|
+
bgYellow: () => bgYellow,
|
|
22
|
+
bgYellowBright: () => bgYellowBright,
|
|
23
|
+
black: () => black,
|
|
24
|
+
blue: () => blue,
|
|
25
|
+
blueBright: () => blueBright,
|
|
26
|
+
bold: () => bold,
|
|
27
|
+
createAnsiColor: () => createAnsiColor,
|
|
28
|
+
cyan: () => cyan,
|
|
29
|
+
cyanBright: () => cyanBright,
|
|
30
|
+
defineTheme: () => defineTheme,
|
|
31
|
+
dim: () => dim,
|
|
32
|
+
gray: () => gray,
|
|
33
|
+
green: () => green,
|
|
34
|
+
greenBright: () => greenBright,
|
|
35
|
+
hidden: () => hidden,
|
|
36
|
+
inverse: () => inverse,
|
|
37
|
+
italic: () => italic,
|
|
38
|
+
magenta: () => magenta,
|
|
39
|
+
magentaBright: () => magentaBright,
|
|
40
|
+
overline: () => overline,
|
|
41
|
+
red: () => red,
|
|
42
|
+
redBright: () => redBright,
|
|
43
|
+
reset: () => reset,
|
|
44
|
+
strikethrough: () => strikethrough,
|
|
45
|
+
supportsColor: () => supportsColor,
|
|
46
|
+
underline: () => underline,
|
|
47
|
+
white: () => white,
|
|
48
|
+
whiteBright: () => whiteBright,
|
|
49
|
+
yellow: () => yellow,
|
|
50
|
+
yellowBright: () => yellowBright
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Detects if the runtime supports colored output.
|
|
54
|
+
* @returns If the runtime supports colored output.
|
|
55
|
+
*/
|
|
56
|
+
function detectColorSupport() {
|
|
57
|
+
if (typeof window !== "undefined" && typeof window.document !== "undefined") return false;
|
|
58
|
+
const env = typeof process !== "undefined" ? process.env ?? {} : {};
|
|
59
|
+
if ("NO_COLOR" in env) return false;
|
|
60
|
+
if ("FORCE_COLOR" in env) return true;
|
|
61
|
+
if ("CI" in env) {
|
|
62
|
+
if ([
|
|
63
|
+
"TRAVIS",
|
|
64
|
+
"CIRCLECI",
|
|
65
|
+
"APPVEYOR",
|
|
66
|
+
"GITLAB_CI",
|
|
67
|
+
"GITHUB_ACTIONS",
|
|
68
|
+
"BUILDKITE",
|
|
69
|
+
"DRONE"
|
|
70
|
+
].some((k) => k in env) || env.CI_NAME === "codeship") return true;
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (typeof Deno !== "undefined" && Deno.noColor !== void 0) return !Deno.noColor;
|
|
74
|
+
if (typeof process !== "undefined" && process.stdout) {
|
|
75
|
+
const term = env.TERM || "";
|
|
76
|
+
if ((env.COLORTERM || "").length > 0) return true;
|
|
77
|
+
if (term === "dumb") return false;
|
|
78
|
+
return /(color|ansi|cygwin|xterm|vt100)/i.test(term);
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* If the runtime supports color.
|
|
84
|
+
*/
|
|
85
|
+
const supportsColor = detectColorSupport();
|
|
86
|
+
/**
|
|
87
|
+
* Creates a function that wraps a string in ANSI codes.
|
|
88
|
+
* @param open The opening ANSI code.
|
|
89
|
+
* @param close The closing ANSI code.
|
|
90
|
+
* @returns A function that wraps the string in ANSI codes.
|
|
91
|
+
*/
|
|
92
|
+
function createAnsiColor(open, close) {
|
|
93
|
+
const openCode = `\u001b[${open}m`;
|
|
94
|
+
const closeCode = `\u001b[${close}m`;
|
|
95
|
+
if (!supportsColor) return (input) => input + "";
|
|
96
|
+
return (input) => {
|
|
97
|
+
if (!input) return openCode + closeCode;
|
|
98
|
+
return openCode + (input + "").replace(new RegExp(`\u001b\\[${close}m`, "g"), closeCode + openCode) + closeCode;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const reset = createAnsiColor(0, 0);
|
|
102
|
+
const bold = createAnsiColor(1, 22);
|
|
103
|
+
const dim = createAnsiColor(2, 22);
|
|
104
|
+
const italic = createAnsiColor(3, 23);
|
|
105
|
+
const underline = createAnsiColor(4, 24);
|
|
106
|
+
const overline = createAnsiColor(53, 55);
|
|
107
|
+
const inverse = createAnsiColor(7, 27);
|
|
108
|
+
const hidden = createAnsiColor(8, 28);
|
|
109
|
+
const strikethrough = createAnsiColor(9, 29);
|
|
110
|
+
const black = createAnsiColor(30, 39);
|
|
111
|
+
const red = createAnsiColor(31, 39);
|
|
112
|
+
const green = createAnsiColor(32, 39);
|
|
113
|
+
const yellow = createAnsiColor(33, 39);
|
|
114
|
+
const blue = createAnsiColor(34, 39);
|
|
115
|
+
const magenta = createAnsiColor(35, 39);
|
|
116
|
+
const cyan = createAnsiColor(36, 39);
|
|
117
|
+
const white = createAnsiColor(37, 39);
|
|
118
|
+
const gray = createAnsiColor(90, 39);
|
|
119
|
+
const bgBlack = createAnsiColor(40, 49);
|
|
120
|
+
const bgRed = createAnsiColor(41, 49);
|
|
121
|
+
const bgGreen = createAnsiColor(42, 49);
|
|
122
|
+
const bgYellow = createAnsiColor(43, 49);
|
|
123
|
+
const bgBlue = createAnsiColor(44, 49);
|
|
124
|
+
const bgMagenta = createAnsiColor(45, 49);
|
|
125
|
+
const bgCyan = createAnsiColor(46, 49);
|
|
126
|
+
const bgWhite = createAnsiColor(47, 49);
|
|
127
|
+
const bgGray = createAnsiColor(100, 49);
|
|
128
|
+
const redBright = createAnsiColor(91, 39);
|
|
129
|
+
const greenBright = createAnsiColor(92, 39);
|
|
130
|
+
const yellowBright = createAnsiColor(93, 39);
|
|
131
|
+
const blueBright = createAnsiColor(94, 39);
|
|
132
|
+
const magentaBright = createAnsiColor(95, 39);
|
|
133
|
+
const cyanBright = createAnsiColor(96, 39);
|
|
134
|
+
const whiteBright = createAnsiColor(97, 39);
|
|
135
|
+
const bgRedBright = createAnsiColor(101, 49);
|
|
136
|
+
const bgGreenBright = createAnsiColor(102, 49);
|
|
137
|
+
const bgYellowBright = createAnsiColor(103, 49);
|
|
138
|
+
const bgBlueBright = createAnsiColor(104, 49);
|
|
139
|
+
const bgMagentaBright = createAnsiColor(105, 49);
|
|
140
|
+
const bgCyanBright = createAnsiColor(106, 49);
|
|
141
|
+
const bgWhiteBright = createAnsiColor(107, 49);
|
|
142
|
+
/**
|
|
143
|
+
* The default theme.
|
|
144
|
+
*/
|
|
145
|
+
const DEFAULT_THEME = {
|
|
146
|
+
primary: cyan,
|
|
147
|
+
secondary: gray,
|
|
148
|
+
success: green,
|
|
149
|
+
warning: yellow,
|
|
150
|
+
error: red,
|
|
151
|
+
symbols: {
|
|
152
|
+
success: "✔",
|
|
153
|
+
error: "✖",
|
|
154
|
+
warning: "⚠"
|
|
155
|
+
},
|
|
156
|
+
styles: {
|
|
157
|
+
bold,
|
|
158
|
+
italic,
|
|
159
|
+
underline
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Defines a theme.
|
|
164
|
+
* @param theme The (partial) theme.
|
|
165
|
+
* @returns The theme, merged with the default theme.
|
|
166
|
+
*/
|
|
167
|
+
function defineTheme(theme) {
|
|
168
|
+
return merge(DEFAULT_THEME, theme);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
export { greenBright as A, strikethrough as B, createAnsiColor as C, dim as D, defineTheme as E, magentaBright as F, yellow as G, underline as H, overline as I, yellowBright as K, red as L, inverse as M, italic as N, gray as O, magenta as P, redBright as R, color_exports as S, cyanBright as T, white as U, supportsColor as V, whiteBright as W, bgYellowBright as _, bgCyan as a, blueBright as b, bgGreen as c, bgMagentaBright as d, bgRed as f, bgYellow as g, bgWhiteBright as h, bgBlueBright as i, hidden as j, green as k, bgGreenBright as l, bgWhite as m, bgBlack as n, bgCyanBright as o, bgRedBright as p, bgBlue as r, bgGray as s, DEFAULT_THEME as t, bgMagenta as u, black as v, cyan as w, bold as x, blue as y, reset as z };
|
package/dist/color.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as green, B as reset, D as defineTheme, E as cyanBright, F as magenta, G as whiteBright, H as supportsColor, I as magentaBright, K as yellow, L as overline, M as hidden, N as inverse, O as dim, P as italic, R as red, S as bold, T as cyan, U as underline, V as strikethrough, W as white, _ as bgYellow, a as bgBlueBright, b as blue, c as bgGray, d as bgMagenta, f as bgMagentaBright, g as bgWhiteBright, h as bgWhite, i as bgBlue, j as greenBright, k as gray, l as bgGreen, m as bgRedBright, n as Theme, o as bgCyan, p as bgRed, q as yellowBright, r as bgBlack, s as bgCyanBright, t as DEFAULT_THEME, u as bgGreenBright, v as bgYellowBright, w as createAnsiColor, x as blueBright, y as black, z as redBright } from "./color-BuHvMolk.mjs";
|
|
2
|
+
export { DEFAULT_THEME, Theme, bgBlack, bgBlue, bgBlueBright, bgCyan, bgCyanBright, bgGray, bgGreen, bgGreenBright, bgMagenta, bgMagentaBright, bgRed, bgRedBright, bgWhite, bgWhiteBright, bgYellow, bgYellowBright, black, blue, blueBright, bold, createAnsiColor, cyan, cyanBright, defineTheme, dim, gray, green, greenBright, hidden, inverse, italic, magenta, magentaBright, overline, red, redBright, reset, strikethrough, supportsColor, underline, white, whiteBright, yellow, yellowBright };
|
package/dist/color.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./utils-ChmY93uA.mjs";
|
|
2
|
+
import { A as greenBright, B as strikethrough, C as createAnsiColor, D as dim, E as defineTheme, F as magentaBright, G as yellow, H as underline, I as overline, K as yellowBright, L as red, M as inverse, N as italic, O as gray, P as magenta, R as redBright, T as cyanBright, U as white, V as supportsColor, W as whiteBright, _ as bgYellowBright, a as bgCyan, b as blueBright, c as bgGreen, d as bgMagentaBright, f as bgRed, g as bgYellow, h as bgWhiteBright, i as bgBlueBright, j as hidden, k as green, l as bgGreenBright, m as bgWhite, n as bgBlack, o as bgCyanBright, p as bgRedBright, r as bgBlue, s as bgGray, t as DEFAULT_THEME, u as bgMagenta, v as black, w as cyan, x as bold, y as blue, z as reset } from "./color-OlJQTTxb.mjs";
|
|
3
|
+
|
|
4
|
+
export { DEFAULT_THEME, bgBlack, bgBlue, bgBlueBright, bgCyan, bgCyanBright, bgGray, bgGreen, bgGreenBright, bgMagenta, bgMagentaBright, bgRed, bgRedBright, bgWhite, bgWhiteBright, bgYellow, bgYellowBright, black, blue, blueBright, bold, createAnsiColor, cyan, cyanBright, defineTheme, dim, gray, green, greenBright, hidden, inverse, italic, magenta, magentaBright, overline, red, redBright, reset, strikethrough, supportsColor, underline, white, whiteBright, yellow, yellowBright };
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { n as Theme } from "./color-BuHvMolk.mjs";
|
|
2
|
+
import { i as Input, o as Option, r as InferInput, s as Positional } from "./input-B12iaqb8.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/error.d.ts
|
|
5
|
+
declare namespace error_d_exports {
|
|
6
|
+
export { ConvokerError, HelpAskedError, InputValidationError, MissingRequiredArgumentError, MissingRequiredOptionError, TooManyArgumentsError, UnknownOptionError };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Thrown when the command fails to validate an input.
|
|
10
|
+
*/
|
|
11
|
+
declare class InputValidationError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* A list of messages.
|
|
14
|
+
*/
|
|
15
|
+
messages: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new input validation error.
|
|
18
|
+
* @param messages The messages.
|
|
19
|
+
*/
|
|
20
|
+
constructor(messages: string[]);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A Convoker-related error. These are usually handled by default.
|
|
24
|
+
*/
|
|
25
|
+
declare class ConvokerError extends Error {
|
|
26
|
+
/**
|
|
27
|
+
* The command this error happened on.
|
|
28
|
+
*/
|
|
29
|
+
command: Command<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new Convoker error.
|
|
32
|
+
* @param message The message.
|
|
33
|
+
* @param command The command.
|
|
34
|
+
*/
|
|
35
|
+
constructor(message: string, command: Command<any>);
|
|
36
|
+
/**
|
|
37
|
+
* Prints the error's message.
|
|
38
|
+
*/
|
|
39
|
+
print(): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* When the user asks for help.
|
|
43
|
+
*/
|
|
44
|
+
declare class HelpAskedError extends ConvokerError {
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new help asked error.
|
|
47
|
+
* @param command The command.
|
|
48
|
+
*/
|
|
49
|
+
constructor(command: Command<any>);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* When you pass too many arguments.
|
|
53
|
+
*/
|
|
54
|
+
declare class TooManyArgumentsError extends ConvokerError {
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new too many arguments error.
|
|
57
|
+
* @param command The command.
|
|
58
|
+
*/
|
|
59
|
+
constructor(command: Command<any>);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* When you pass an unknown option, when unknown options aren't allowed.
|
|
63
|
+
*/
|
|
64
|
+
declare class UnknownOptionError extends ConvokerError {
|
|
65
|
+
/**
|
|
66
|
+
* The option key.
|
|
67
|
+
*/
|
|
68
|
+
key: string;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new unknown option error.
|
|
71
|
+
* @param command The command.
|
|
72
|
+
* @param key The key.
|
|
73
|
+
*/
|
|
74
|
+
constructor(command: Command<any>, key: string);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* When a required option is missing.
|
|
78
|
+
*/
|
|
79
|
+
declare class MissingRequiredOptionError extends ConvokerError {
|
|
80
|
+
/**
|
|
81
|
+
* The option key.
|
|
82
|
+
*/
|
|
83
|
+
key: string;
|
|
84
|
+
/**
|
|
85
|
+
* The option entry.
|
|
86
|
+
*/
|
|
87
|
+
entry: Option<any, any, any>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a new missing required option error.
|
|
90
|
+
* @param command The command.
|
|
91
|
+
* @param key The key.
|
|
92
|
+
* @param entry The entry.
|
|
93
|
+
*/
|
|
94
|
+
constructor(command: Command<any>, key: string, entry: Option<any, any, any>);
|
|
95
|
+
}
|
|
96
|
+
declare class MissingRequiredArgumentError extends ConvokerError {
|
|
97
|
+
/**
|
|
98
|
+
* The argument key.
|
|
99
|
+
*/
|
|
100
|
+
key: string;
|
|
101
|
+
/**
|
|
102
|
+
* The argument entry.
|
|
103
|
+
*/
|
|
104
|
+
entry: Positional<any, any, any>;
|
|
105
|
+
/**
|
|
106
|
+
* Creates a new missing required argument error.
|
|
107
|
+
* @param command The command.
|
|
108
|
+
* @param key The key.
|
|
109
|
+
* @param entry The entry.
|
|
110
|
+
*/
|
|
111
|
+
constructor(command: Command<any>, key: string, entry: Positional<any, any, any>);
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/command.d.ts
|
|
115
|
+
/**
|
|
116
|
+
* What the command is an alias for.
|
|
117
|
+
*/
|
|
118
|
+
interface CommandAlias<T extends Input = Input> {
|
|
119
|
+
/**
|
|
120
|
+
* A pointer to the command.
|
|
121
|
+
*/
|
|
122
|
+
command: Command<T>;
|
|
123
|
+
/**
|
|
124
|
+
* The name of the command this is an alias for.
|
|
125
|
+
*/
|
|
126
|
+
alias?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The result of the `Command.parse` function.
|
|
130
|
+
*/
|
|
131
|
+
interface ParseResult<T extends Input> {
|
|
132
|
+
/**
|
|
133
|
+
* A pointer to the command to run.
|
|
134
|
+
*/
|
|
135
|
+
command: Command<T>;
|
|
136
|
+
/**
|
|
137
|
+
* The input to pass into the command.
|
|
138
|
+
*/
|
|
139
|
+
input: InferInput<T>;
|
|
140
|
+
/**
|
|
141
|
+
* Errors collected during parsing.
|
|
142
|
+
*/
|
|
143
|
+
errors: ConvokerError[];
|
|
144
|
+
/**
|
|
145
|
+
* If this should result in displaying the version of the command.
|
|
146
|
+
*/
|
|
147
|
+
isVersion: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* If this should result in displaying a help screen.
|
|
150
|
+
*/
|
|
151
|
+
isHelp: boolean;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Command action function.
|
|
155
|
+
*/
|
|
156
|
+
type ActionFn<T extends Input> = (input: InferInput<T>) => any | Promise<any>;
|
|
157
|
+
/**
|
|
158
|
+
* Command middleware function.
|
|
159
|
+
*/
|
|
160
|
+
type MiddlewareFn<T extends Input = Input> = (input: InferInput<T>, next: () => Promise<any>) => any | Promise<any>;
|
|
161
|
+
/**
|
|
162
|
+
* Command error handler.
|
|
163
|
+
*/
|
|
164
|
+
type ErrorFn<T extends Input> = (command: Command<T>, errors: Error[], input: Partial<InferInput<T>>) => void | Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Builder for commands.
|
|
167
|
+
*/
|
|
168
|
+
type Builder = (c: Command<any>) => Command<any> | void;
|
|
169
|
+
/**
|
|
170
|
+
* A command.
|
|
171
|
+
*/
|
|
172
|
+
declare class Command<T extends Input = Input> {
|
|
173
|
+
/**
|
|
174
|
+
* The names (aliases) of this command.
|
|
175
|
+
*/
|
|
176
|
+
$names: string[];
|
|
177
|
+
/**
|
|
178
|
+
* The description of this command.
|
|
179
|
+
*/
|
|
180
|
+
$description: string | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* The theme of this command
|
|
183
|
+
*/
|
|
184
|
+
$theme: Theme | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* The version of this command.
|
|
187
|
+
*/
|
|
188
|
+
$version: string | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* The children of this command.
|
|
191
|
+
*/
|
|
192
|
+
$children: Map<string, CommandAlias>;
|
|
193
|
+
/**
|
|
194
|
+
* The parent of this command.
|
|
195
|
+
*/
|
|
196
|
+
$parent: Command<any> | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* If this command allows unknown options.
|
|
199
|
+
*/
|
|
200
|
+
$allowUnknownOptions: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* If you should be able to surpass the amount of positional arguments defined in the input.
|
|
203
|
+
*/
|
|
204
|
+
$allowSurpassArgLimit: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* The input this command takes.
|
|
207
|
+
*/
|
|
208
|
+
$input: T;
|
|
209
|
+
/**
|
|
210
|
+
* The action function of this command.
|
|
211
|
+
*/
|
|
212
|
+
$fn: ActionFn<T> | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* The middlewares associated with this command.
|
|
215
|
+
*/
|
|
216
|
+
$middlewares: MiddlewareFn<T>[];
|
|
217
|
+
/**
|
|
218
|
+
* The error handler of this command.
|
|
219
|
+
*/
|
|
220
|
+
$errorFn: ErrorFn<T> | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Creates a new command.
|
|
223
|
+
* @param names The names (aliases).
|
|
224
|
+
* @param desc The description.
|
|
225
|
+
* @param version The version.
|
|
226
|
+
*/
|
|
227
|
+
constructor(names: string | string[], desc?: string, version?: string);
|
|
228
|
+
/**
|
|
229
|
+
* Adds a set of aliases to this command.
|
|
230
|
+
* @param aliases The aliases to add.
|
|
231
|
+
* @returns this
|
|
232
|
+
*/
|
|
233
|
+
alias(...aliases: string[]): this;
|
|
234
|
+
/**
|
|
235
|
+
* Adds a description to this command.
|
|
236
|
+
* @param desc The description.
|
|
237
|
+
* @returns this
|
|
238
|
+
*/
|
|
239
|
+
description(desc: string): this;
|
|
240
|
+
/**
|
|
241
|
+
* Adds a version to this command.
|
|
242
|
+
* @param version The version.
|
|
243
|
+
* @returns this
|
|
244
|
+
*/
|
|
245
|
+
version(version: string): this;
|
|
246
|
+
/**
|
|
247
|
+
* Sets the input for this command.
|
|
248
|
+
* @param version The input.
|
|
249
|
+
* @returns this
|
|
250
|
+
*/
|
|
251
|
+
input<TInput extends Input>(input: TInput): Command<TInput>;
|
|
252
|
+
/**
|
|
253
|
+
* Adds a chain of middlewares.
|
|
254
|
+
* @param fns The middlewares to use.
|
|
255
|
+
* @returns this
|
|
256
|
+
*/
|
|
257
|
+
use(...fns: MiddlewareFn<T>[]): this;
|
|
258
|
+
/**
|
|
259
|
+
* Sets the action function for this command.
|
|
260
|
+
* @param fn The action.
|
|
261
|
+
* @returns this
|
|
262
|
+
*/
|
|
263
|
+
action(fn: ActionFn<T>): this;
|
|
264
|
+
/**
|
|
265
|
+
* Sets the error function for this command.
|
|
266
|
+
* @param fn The error handler.
|
|
267
|
+
* @returns this
|
|
268
|
+
*/
|
|
269
|
+
error(fn: ErrorFn<T>): this;
|
|
270
|
+
/**
|
|
271
|
+
* Adds an existing command to this.
|
|
272
|
+
* @param command The command.
|
|
273
|
+
* @returns this
|
|
274
|
+
*/
|
|
275
|
+
add(command: Command<any>): this;
|
|
276
|
+
/**
|
|
277
|
+
* Creates a new subcommand and adds it.
|
|
278
|
+
* @param names The aliases of the subcommand.
|
|
279
|
+
* @param builder A builder to create the command.
|
|
280
|
+
*/
|
|
281
|
+
subCommand(names: string | string[], builder: Builder): this;
|
|
282
|
+
/**
|
|
283
|
+
* Creates a new subcommand and adds it.
|
|
284
|
+
* @param names The aliases of the subcommand.
|
|
285
|
+
* @param desc The description of the subcommand.
|
|
286
|
+
* @param version The version of the subcommand.
|
|
287
|
+
*/
|
|
288
|
+
subCommand(names: string | string[], desc?: string, version?: string): Command<any>;
|
|
289
|
+
/**
|
|
290
|
+
* Allows unknown options.
|
|
291
|
+
* @returns this
|
|
292
|
+
*/
|
|
293
|
+
allowUnknownOptions(): this;
|
|
294
|
+
/**
|
|
295
|
+
* Parses a set of command-line arguments.
|
|
296
|
+
* @param argv The arguments to parse.
|
|
297
|
+
* @returns A parse result.
|
|
298
|
+
*/
|
|
299
|
+
parse(argv: string[]): Promise<ParseResult<T>>;
|
|
300
|
+
private buildInputMap;
|
|
301
|
+
/**
|
|
302
|
+
* Allows surpassing the amount of arguments specified.
|
|
303
|
+
* @returns this
|
|
304
|
+
*/
|
|
305
|
+
allowSurpassArgLimit(): this;
|
|
306
|
+
/**
|
|
307
|
+
* Gets the full command path (name including parents).
|
|
308
|
+
* @returns The full command path.
|
|
309
|
+
*/
|
|
310
|
+
fullCommandPath(): string;
|
|
311
|
+
/**
|
|
312
|
+
* The default error screen.
|
|
313
|
+
* @param errors The errors.
|
|
314
|
+
*/
|
|
315
|
+
defaultErrorScreen(errors: Error[]): void;
|
|
316
|
+
/**
|
|
317
|
+
* Handles a set of errors.
|
|
318
|
+
* @param errors The errors to handle.
|
|
319
|
+
* @param input The parsed input, if possible.
|
|
320
|
+
* @returns this
|
|
321
|
+
*/
|
|
322
|
+
handleErrors(errors: Error[], input?: Partial<InferInput<T>>): Promise<this>;
|
|
323
|
+
/**
|
|
324
|
+
* Runs a command.
|
|
325
|
+
* @param argv The arguments to run the command with. Defaults to your runtime's `argv` equivalent.
|
|
326
|
+
* @returns this
|
|
327
|
+
*/
|
|
328
|
+
run(argv?: string[]): Promise<this>;
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
export { ErrorFn as a, ConvokerError as c, MissingRequiredArgumentError as d, MissingRequiredOptionError as f, error_d_exports as h, CommandAlias as i, HelpAskedError as l, UnknownOptionError as m, Builder as n, MiddlewareFn as o, TooManyArgumentsError as p, Command as r, ParseResult as s, ActionFn as t, InputValidationError as u };
|