clerc 1.0.0-beta.1 → 1.0.0-beta.11
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-CYeTv9WL.js +42 -0
- package/dist/index.d.ts +145 -9
- package/dist/index.js +14 -4
- package/package.json +8 -12
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (all, symbols) => {
|
|
7
|
+
let target = {};
|
|
8
|
+
for (var name in all) {
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (symbols) {
|
|
15
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
16
|
+
}
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
22
|
+
key = keys[i];
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
34
|
+
if (symbols) {
|
|
35
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
36
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
37
|
+
}
|
|
38
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { __reExport as n, __export as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as __reExport, t as __export } from "./chunk-CYeTv9WL.js";
|
|
2
|
+
import { Clerc, CreateOptions, Plugin } from "@clerc/core";
|
|
2
3
|
export * from "@clerc/core";
|
|
3
4
|
|
|
4
5
|
//#region ../plugin-completions/src/index.d.ts
|
|
6
|
+
declare module "@clerc/core" {
|
|
7
|
+
interface CommandCustomOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Completions options for the command.
|
|
10
|
+
*/
|
|
11
|
+
completions?: {
|
|
12
|
+
/**
|
|
13
|
+
* Whether to show the command in completions output.
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
show?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
5
21
|
interface CompletionsPluginOptions {
|
|
6
22
|
/**
|
|
7
|
-
* Whether to register the `install
|
|
23
|
+
* Whether to register the `completions install` and `completions uninstall` commands.
|
|
8
24
|
* @default true
|
|
9
25
|
*/
|
|
10
26
|
managementCommands?: boolean;
|
|
@@ -19,23 +35,137 @@ declare const friendlyErrorPlugin: ({
|
|
|
19
35
|
target
|
|
20
36
|
}?: FriendlyErrorPluginOptions) => Plugin;
|
|
21
37
|
//#endregion
|
|
38
|
+
//#region ../parser/src/types.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* Defines how a string input is converted to the target type T.
|
|
41
|
+
*
|
|
42
|
+
* @template T The target type.
|
|
43
|
+
*/
|
|
44
|
+
type FlagTypeFunction<T = unknown> = ((value: string) => T) & {
|
|
45
|
+
/**
|
|
46
|
+
* Optional display name for the type, useful in help output.
|
|
47
|
+
* If provided, this will be shown instead of the function name.
|
|
48
|
+
*/
|
|
49
|
+
displayName?: string;
|
|
50
|
+
};
|
|
51
|
+
type FlagType<T = unknown> = FlagTypeFunction<T> | readonly [FlagTypeFunction<T>];
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../plugin-help/src/types.d.ts
|
|
54
|
+
interface Formatters {
|
|
55
|
+
formatFlagType: (type: FlagType) => string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A group definition as a tuple of [key, displayName].
|
|
59
|
+
* The key is used in help options to assign items to groups.
|
|
60
|
+
* The displayName is shown in the help output.
|
|
61
|
+
*/
|
|
62
|
+
type GroupDefinition = [key: string, name: string];
|
|
63
|
+
/**
|
|
64
|
+
* Options for defining groups in help output.
|
|
65
|
+
*/
|
|
66
|
+
interface GroupsOptions {
|
|
67
|
+
/**
|
|
68
|
+
* Groups for commands.
|
|
69
|
+
* Each group is defined as `[key, name]`.
|
|
70
|
+
*/
|
|
71
|
+
commands?: GroupDefinition[];
|
|
72
|
+
/**
|
|
73
|
+
* Groups for command-specific flags.
|
|
74
|
+
* Each group is defined as `[key, name]`.
|
|
75
|
+
*/
|
|
76
|
+
flags?: GroupDefinition[];
|
|
77
|
+
/**
|
|
78
|
+
* Groups for global flags.
|
|
79
|
+
* Each group is defined as `[key, name]`.
|
|
80
|
+
*/
|
|
81
|
+
globalFlags?: GroupDefinition[];
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region ../plugin-help/src/formatters.d.ts
|
|
85
|
+
declare const defaultFormatters: Formatters;
|
|
86
|
+
//#endregion
|
|
22
87
|
//#region ../plugin-help/src/index.d.ts
|
|
88
|
+
interface HelpOptions {
|
|
89
|
+
/**
|
|
90
|
+
* The group this item belongs to.
|
|
91
|
+
* The group must be defined in the `groups` option of `helpPlugin()`.
|
|
92
|
+
*/
|
|
93
|
+
group?: string;
|
|
94
|
+
}
|
|
95
|
+
interface CommandHelpOptions extends HelpOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Whether to show the command in help output.
|
|
98
|
+
*
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
show?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Notes to show in the help output.
|
|
104
|
+
*/
|
|
105
|
+
notes?: string[];
|
|
106
|
+
/**
|
|
107
|
+
* Examples to show in the help output.
|
|
108
|
+
* Each example is a tuple of `[command, description]`.
|
|
109
|
+
*/
|
|
110
|
+
examples?: [string, string][];
|
|
111
|
+
}
|
|
23
112
|
declare module "@clerc/core" {
|
|
24
113
|
interface CommandCustomOptions {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Help options for the command.
|
|
116
|
+
*/
|
|
117
|
+
help?: CommandHelpOptions;
|
|
118
|
+
}
|
|
119
|
+
interface FlagCustomOptions {
|
|
120
|
+
/**
|
|
121
|
+
* Help options for the flag.
|
|
122
|
+
*/
|
|
123
|
+
help?: HelpOptions;
|
|
30
124
|
}
|
|
31
125
|
}
|
|
32
126
|
interface HelpPluginOptions {
|
|
127
|
+
/**
|
|
128
|
+
* Whether to register the `help` command.
|
|
129
|
+
*
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
33
132
|
command?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Whether to register the `--help` global flag.
|
|
135
|
+
*
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
34
138
|
flag?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Whether to show help when no command is specified.
|
|
141
|
+
*
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
35
144
|
showHelpWhenNoCommandSpecified?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Notes to show in the help output.
|
|
147
|
+
*/
|
|
36
148
|
notes?: string[];
|
|
149
|
+
/**
|
|
150
|
+
* Examples to show in the help output.
|
|
151
|
+
* Each example is a tuple of `[command, description]`.
|
|
152
|
+
*/
|
|
37
153
|
examples?: [string, string][];
|
|
154
|
+
/**
|
|
155
|
+
* A banner to show before the help output.
|
|
156
|
+
*/
|
|
38
157
|
banner?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Custom formatters for rendering help.
|
|
160
|
+
*/
|
|
161
|
+
formatters?: Partial<Formatters>;
|
|
162
|
+
/**
|
|
163
|
+
* Group definitions for commands and flags.
|
|
164
|
+
* Groups allow organizing commands and flags into logical sections in help output.
|
|
165
|
+
* Each group is defined as `[key, name]` where `key` is the identifier used in help options
|
|
166
|
+
* and `name` is the display name shown in help output.
|
|
167
|
+
*/
|
|
168
|
+
groups?: GroupsOptions;
|
|
39
169
|
}
|
|
40
170
|
declare const helpPlugin: ({
|
|
41
171
|
command,
|
|
@@ -43,7 +173,9 @@ declare const helpPlugin: ({
|
|
|
43
173
|
showHelpWhenNoCommandSpecified,
|
|
44
174
|
notes,
|
|
45
175
|
examples,
|
|
46
|
-
banner
|
|
176
|
+
banner,
|
|
177
|
+
formatters,
|
|
178
|
+
groups
|
|
47
179
|
}?: HelpPluginOptions) => Plugin;
|
|
48
180
|
//#endregion
|
|
49
181
|
//#region ../plugin-not-found/src/index.d.ts
|
|
@@ -71,5 +203,9 @@ declare const versionPlugin: ({
|
|
|
71
203
|
command,
|
|
72
204
|
flag
|
|
73
205
|
}?: VersionPluginOptions) => Plugin;
|
|
206
|
+
declare namespace index_d_exports {
|
|
207
|
+
export { Cli, CommandHelpOptions, CompletionsPluginOptions, FriendlyErrorPluginOptions, GroupDefinition, GroupsOptions, HelpOptions, HelpPluginOptions, completionsPlugin, defaultFormatters, friendlyErrorPlugin, helpPlugin, notFoundPlugin, strictFlagsPlugin, versionPlugin };
|
|
208
|
+
}
|
|
209
|
+
declare const Cli: (options?: CreateOptions) => Clerc;
|
|
74
210
|
//#endregion
|
|
75
|
-
export { CompletionsPluginOptions, FriendlyErrorPluginOptions, HelpPluginOptions, completionsPlugin, friendlyErrorPlugin, helpPlugin, notFoundPlugin, strictFlagsPlugin, versionPlugin };
|
|
211
|
+
export { Cli, CommandHelpOptions, CompletionsPluginOptions, FriendlyErrorPluginOptions, type GroupDefinition, type GroupsOptions, HelpOptions, HelpPluginOptions, completionsPlugin, defaultFormatters, friendlyErrorPlugin, helpPlugin, notFoundPlugin, strictFlagsPlugin, versionPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
+
import { n as __reExport, t as __export } from "./chunk-CYeTv9WL.js";
|
|
2
|
+
import { Clerc } from "@clerc/core";
|
|
3
|
+
import { helpPlugin } from "@clerc/plugin-help";
|
|
4
|
+
import { versionPlugin } from "@clerc/plugin-version";
|
|
5
|
+
|
|
1
6
|
export * from "@clerc/core"
|
|
2
7
|
|
|
8
|
+
export * from "@clerc/plugin-help"
|
|
9
|
+
|
|
10
|
+
export * from "@clerc/plugin-version"
|
|
11
|
+
|
|
3
12
|
export * from "@clerc/plugin-completions"
|
|
4
13
|
|
|
5
14
|
export * from "@clerc/plugin-friendly-error"
|
|
6
15
|
|
|
7
|
-
export * from "@clerc/plugin-help"
|
|
8
|
-
|
|
9
16
|
export * from "@clerc/plugin-not-found"
|
|
10
17
|
|
|
11
18
|
export * from "@clerc/plugin-strict-flags"
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
//#region src/index.ts
|
|
21
|
+
var src_exports = /* @__PURE__ */ __export({ Cli: () => Cli });
|
|
22
|
+
const Cli = (options) => Clerc.create(options).use(versionPlugin()).use(helpPlugin());
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Cli };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clerc",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Clerc: The full-featured cli library.",
|
|
@@ -44,16 +44,12 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@clerc/
|
|
48
|
-
"@clerc/plugin-
|
|
49
|
-
"@clerc/
|
|
50
|
-
"@clerc/plugin-
|
|
51
|
-
"@clerc/plugin-
|
|
52
|
-
"@clerc/plugin-
|
|
53
|
-
"@clerc/plugin-
|
|
54
|
-
},
|
|
55
|
-
"scripts": {
|
|
56
|
-
"build": "tsdown",
|
|
57
|
-
"watch": "tsdown --watch"
|
|
47
|
+
"@clerc/plugin-completions": "1.0.0-beta.11",
|
|
48
|
+
"@clerc/plugin-friendly-error": "1.0.0-beta.11",
|
|
49
|
+
"@clerc/core": "1.0.0-beta.11",
|
|
50
|
+
"@clerc/plugin-help": "1.0.0-beta.11",
|
|
51
|
+
"@clerc/plugin-strict-flags": "1.0.0-beta.11",
|
|
52
|
+
"@clerc/plugin-version": "1.0.0-beta.11",
|
|
53
|
+
"@clerc/plugin-not-found": "1.0.0-beta.11"
|
|
58
54
|
}
|
|
59
55
|
}
|