@clerc/core 0.43.0 → 0.44.0
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/index.d.ts +18 -1
- package/dist/index.js +9 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -149,6 +149,22 @@ type HandlerInCommand<C extends HandlerContext> = (ctx: {
|
|
|
149
149
|
[K in keyof C]: C[K];
|
|
150
150
|
}) => void;
|
|
151
151
|
type FallbackType<T, U> = {} extends T ? U : T;
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated This is a typo. Use `InterceptorContext` instead.
|
|
154
|
+
*/
|
|
155
|
+
type InspectorContext<C extends Commands = Commands> = InterceptorContext<C>;
|
|
156
|
+
/**
|
|
157
|
+
* @deprecated This is a typo. Use `Interceptor` instead.
|
|
158
|
+
*/
|
|
159
|
+
type Inspector<C extends Commands = Commands> = Interceptor<C>;
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated This is a typo. Use `InspectorFn` instead.
|
|
162
|
+
*/
|
|
163
|
+
type InspectorFn<C extends Commands = Commands> = InterceptorFn<C>;
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated This is a typo. Use `InspectorObject` instead.
|
|
166
|
+
*/
|
|
167
|
+
type InspectorObject<C extends Commands = Commands> = InterceptorObject<C>;
|
|
152
168
|
type InterceptorContext<C extends Commands = Commands> = HandlerContext<C> & {
|
|
153
169
|
flags: FallbackType<TypeFlag<NonNullable<C[keyof C]["flags"]>>["flags"], Dict<any>>;
|
|
154
170
|
};
|
|
@@ -325,6 +341,7 @@ declare class Clerc<C extends Commands = {}, GF extends GlobalFlagOptions = {}>
|
|
|
325
341
|
* @param options
|
|
326
342
|
* @returns
|
|
327
343
|
*/
|
|
344
|
+
command<C extends CommandWithHandler<any, any>[]>(c: [...C]): this;
|
|
328
345
|
command<N extends string | RootType, O extends CommandOptions<[...P], A, F>, P extends string[] = string[], A extends MaybeArray$1<string | RootType> = MaybeArray$1<string | RootType>, F extends Flags = Flags>(c: CommandWithHandler<N, O & CommandOptions<[...P], A, F>>): this & Clerc<C & Record<N, Command<N, O>>, GF>;
|
|
329
346
|
command<N extends string | RootType, O extends CommandOptions<[...P], A, F>, P extends string[] = string[], A extends MaybeArray$1<string | RootType> = MaybeArray$1<string | RootType>, F extends Flags = Flags>(name: N, description: string, options?: O & CommandOptions<[...P], A, F>): this & Clerc<C & Record<N, Command<N, O>>, GF>;
|
|
330
347
|
/**
|
|
@@ -478,4 +495,4 @@ declare const formatCommandName: (name: string | string[] | RootType) => string;
|
|
|
478
495
|
declare const detectLocale: () => string;
|
|
479
496
|
declare const stripFlags: (argv: string[]) => string[];
|
|
480
497
|
|
|
481
|
-
export { Clerc, Command, CommandAlias, CommandCustomProperties, CommandExistsError, CommandNameConflictError, CommandOptions, CommandType, CommandWithHandler, Commands, DescriptionNotSetError, FallbackType, Flag, FlagOptions, Flags, GlobalFlagOption, GlobalFlagOptions, Handler, HandlerContext, HandlerInCommand, I18N, Interceptor, InterceptorContext, InterceptorFn, InterceptorObject, InvalidCommandNameError, LocaleNotCalledFirstError, Locales, MakeEventMap, NoCommandGivenError, NoSuchCommandError, ParseOptions, Plugin, Root, RootType, ScriptNameNotSetError, TranslateFn, VersionNotSetError, compose, defineCommand, defineHandler, defineInspector, defineInterceptor, definePlugin, detectLocale, formatCommandName, isValidName, resolveArgv, resolveCommand, resolveFlattenCommands, stripFlags, withBrackets };
|
|
498
|
+
export { Clerc, Command, CommandAlias, CommandCustomProperties, CommandExistsError, CommandNameConflictError, CommandOptions, CommandType, CommandWithHandler, Commands, DescriptionNotSetError, FallbackType, Flag, FlagOptions, Flags, GlobalFlagOption, GlobalFlagOptions, Handler, HandlerContext, HandlerInCommand, I18N, Inspector, InspectorContext, InspectorFn, InspectorObject, Interceptor, InterceptorContext, InterceptorFn, InterceptorObject, InvalidCommandNameError, LocaleNotCalledFirstError, Locales, MakeEventMap, NoCommandGivenError, NoSuchCommandError, ParseOptions, Plugin, Root, RootType, ScriptNameNotSetError, TranslateFn, VersionNotSetError, compose, defineCommand, defineHandler, defineInspector, defineInterceptor, definePlugin, detectLocale, formatCommandName, isValidName, resolveArgv, resolveCommand, resolveFlattenCommands, stripFlags, withBrackets };
|
package/dist/index.js
CHANGED
|
@@ -497,7 +497,15 @@ const _Clerc = class _Clerc {
|
|
|
497
497
|
return this;
|
|
498
498
|
}
|
|
499
499
|
command(nameOrCommand, description, options = {}) {
|
|
500
|
-
__privateMethod(this, _callWithErrorHandling, callWithErrorHandling_fn).call(this, () =>
|
|
500
|
+
__privateMethod(this, _callWithErrorHandling, callWithErrorHandling_fn).call(this, () => {
|
|
501
|
+
if (Array.isArray(nameOrCommand)) {
|
|
502
|
+
for (const command of nameOrCommand) {
|
|
503
|
+
__privateMethod(this, _command, command_fn).call(this, command);
|
|
504
|
+
}
|
|
505
|
+
} else {
|
|
506
|
+
__privateMethod(this, _command, command_fn).call(this, nameOrCommand, description, options);
|
|
507
|
+
}
|
|
508
|
+
});
|
|
501
509
|
return this;
|
|
502
510
|
}
|
|
503
511
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Clerc core",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"lite-emit": "^2.3.0",
|
|
53
53
|
"type-fest": "^4.3.1",
|
|
54
54
|
"type-flag": "^3.0.0",
|
|
55
|
-
"@clerc/utils": "0.
|
|
55
|
+
"@clerc/utils": "0.44.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "pkgroll",
|