clerc 0.44.0 → 1.0.0-beta.10

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.
@@ -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,7 +1,211 @@
1
- export * from '@clerc/core';
2
- export * from '@clerc/plugin-completions';
3
- export * from '@clerc/plugin-friendly-error';
4
- export * from '@clerc/plugin-help';
5
- export * from '@clerc/plugin-not-found';
6
- export * from '@clerc/plugin-strict-flags';
7
- export * from '@clerc/plugin-version';
1
+ import { n as __reExport, t as __export } from "./chunk-CYeTv9WL.js";
2
+ import { Clerc, CreateOptions, Plugin } from "@clerc/core";
3
+ export * from "@clerc/core";
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
+ }
21
+ interface CompletionsPluginOptions {
22
+ /**
23
+ * Whether to register the `completions install` and `completions uninstall` commands.
24
+ * @default true
25
+ */
26
+ managementCommands?: boolean;
27
+ }
28
+ declare const completionsPlugin: (options?: CompletionsPluginOptions) => Plugin;
29
+ //#endregion
30
+ //#region ../plugin-friendly-error/src/index.d.ts
31
+ interface FriendlyErrorPluginOptions {
32
+ target?: (str: string) => void;
33
+ }
34
+ declare const friendlyErrorPlugin: ({
35
+ target
36
+ }?: FriendlyErrorPluginOptions) => Plugin;
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
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
+ }
112
+ declare module "@clerc/core" {
113
+ interface CommandCustomOptions {
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;
124
+ }
125
+ }
126
+ interface HelpPluginOptions {
127
+ /**
128
+ * Whether to register the `help` command.
129
+ *
130
+ * @default true
131
+ */
132
+ command?: boolean;
133
+ /**
134
+ * Whether to register the `--help` global flag.
135
+ *
136
+ * @default true
137
+ */
138
+ flag?: boolean;
139
+ /**
140
+ * Whether to show help when no command is specified.
141
+ *
142
+ * @default true
143
+ */
144
+ showHelpWhenNoCommandSpecified?: boolean;
145
+ /**
146
+ * Notes to show in the help output.
147
+ */
148
+ notes?: string[];
149
+ /**
150
+ * Examples to show in the help output.
151
+ * Each example is a tuple of `[command, description]`.
152
+ */
153
+ examples?: [string, string][];
154
+ /**
155
+ * A banner to show before the help output.
156
+ */
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;
169
+ }
170
+ declare const helpPlugin: ({
171
+ command,
172
+ flag,
173
+ showHelpWhenNoCommandSpecified,
174
+ notes,
175
+ examples,
176
+ banner,
177
+ formatters,
178
+ groups
179
+ }?: HelpPluginOptions) => Plugin;
180
+ //#endregion
181
+ //#region ../plugin-not-found/src/index.d.ts
182
+ declare const notFoundPlugin: () => Plugin;
183
+ //#endregion
184
+ //#region ../plugin-strict-flags/src/index.d.ts
185
+ declare const strictFlagsPlugin: () => Plugin;
186
+ //#endregion
187
+ //#region ../plugin-version/src/index.d.ts
188
+ interface VersionPluginOptions {
189
+ /**
190
+ * Whether to register the version command.
191
+ *
192
+ * @default true
193
+ */
194
+ command?: boolean;
195
+ /**
196
+ * Whether to register the global version flag.
197
+ *
198
+ * @default true
199
+ */
200
+ flag?: boolean;
201
+ }
202
+ declare const versionPlugin: ({
203
+ command,
204
+ flag
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;
210
+ //#endregion
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,7 +1,25 @@
1
- export * from '@clerc/core';
2
- export * from '@clerc/plugin-completions';
3
- export * from '@clerc/plugin-friendly-error';
4
- export * from '@clerc/plugin-help';
5
- export * from '@clerc/plugin-not-found';
6
- export * from '@clerc/plugin-strict-flags';
7
- export * from '@clerc/plugin-version';
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
+
6
+ export * from "@clerc/core"
7
+
8
+ export * from "@clerc/plugin-help"
9
+
10
+ export * from "@clerc/plugin-version"
11
+
12
+ export * from "@clerc/plugin-completions"
13
+
14
+ export * from "@clerc/plugin-friendly-error"
15
+
16
+ export * from "@clerc/plugin-not-found"
17
+
18
+ export * from "@clerc/plugin-strict-flags"
19
+
20
+ //#region src/index.ts
21
+ var src_exports = /* @__PURE__ */ __export({ Cli: () => Cli });
22
+ const Cli = (options) => Clerc.create(options).use(versionPlugin()).use(helpPlugin());
23
+
24
+ //#endregion
25
+ export { Cli };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clerc",
3
- "version": "0.44.0",
3
+ "version": "1.0.0-beta.10",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc: The full-featured cli library.",
@@ -24,13 +24,10 @@
24
24
  "license": "MIT",
25
25
  "sideEffects": false,
26
26
  "exports": {
27
- ".": {
28
- "types": "./dist/index.d.ts",
29
- "import": "./dist/index.js"
30
- }
27
+ ".": "./dist/index.js"
31
28
  },
32
- "main": "dist/index.js",
33
- "module": "dist/index.js",
29
+ "main": "./dist/index.js",
30
+ "module": "./dist/index.js",
34
31
  "types": "dist/index.d.ts",
35
32
  "typesVersions": {
36
33
  "*": {
@@ -47,16 +44,12 @@
47
44
  "access": "public"
48
45
  },
49
46
  "dependencies": {
50
- "@clerc/core": "0.44.0",
51
- "@clerc/plugin-not-found": "0.44.0",
52
- "@clerc/plugin-friendly-error": "0.44.0",
53
- "@clerc/plugin-version": "0.44.0",
54
- "@clerc/plugin-strict-flags": "0.44.0",
55
- "@clerc/plugin-help": "0.44.0",
56
- "@clerc/plugin-completions": "0.44.0"
57
- },
58
- "scripts": {
59
- "build": "pkgroll",
60
- "watch": "pkgroll --watch"
47
+ "@clerc/core": "1.0.0-beta.10",
48
+ "@clerc/plugin-completions": "1.0.0-beta.10",
49
+ "@clerc/plugin-friendly-error": "1.0.0-beta.10",
50
+ "@clerc/plugin-not-found": "1.0.0-beta.10",
51
+ "@clerc/plugin-version": "1.0.0-beta.10",
52
+ "@clerc/plugin-help": "1.0.0-beta.10",
53
+ "@clerc/plugin-strict-flags": "1.0.0-beta.10"
61
54
  }
62
55
  }