@clerc/core
Advanced tools
Comparing version 0.24.0 to 0.25.0
@@ -0,3 +1,4 @@ | ||
import { LiteralUnion, OmitIndexSignature } from 'type-fest'; | ||
import * as _clerc_utils from '@clerc/utils'; | ||
import { Dict, MaybeArray as MaybeArray$1, Equals, CamelCase, LiteralUnion } from '@clerc/utils'; | ||
import { Dict, MaybeArray as MaybeArray$1, Equals, CamelCase } from '@clerc/utils'; | ||
@@ -112,9 +113,13 @@ declare const DOUBLE_DASH = "--"; | ||
}; | ||
type TypeFlagWithDefault<C extends Command> = TypeFlag<NonNullable<C["flags"]>>; | ||
type Raw<C extends Command> = TypeFlagWithDefault<C> & { | ||
type FallbackFlags<C extends Command> = Equals<NonNullableFlag<C>["flags"], {}> extends true ? Dict<any> : NonNullableFlag<C>["flags"]; | ||
type NonNullableFlag<C extends Command> = TypeFlag<NonNullable<C["flags"]>>; | ||
type ParseFlag<C extends CommandRecord, N extends keyof C> = N extends keyof C ? OmitIndexSignature<NonNullableFlag<C[N]>["flags"]> : FallbackFlags<C[N]>["flags"]; | ||
type ParseRaw<C extends Command> = NonNullableFlag<C> & { | ||
flags: FallbackFlags<C>; | ||
parameters: string[]; | ||
mergedFlags: TypeFlagWithDefault<C>["flags"] & TypeFlagWithDefault<C>["unknownFlags"]; | ||
mergedFlags: FallbackFlags<C> & NonNullableFlag<C>["unknownFlags"]; | ||
}; | ||
type ParseParameters<C extends CommandRecord = CommandRecord, N extends keyof C = keyof C> = Equals<TransformParameters<C[N]>, {}> extends true ? N extends keyof C ? TransformParameters<C[N]> : Dict<string | string[] | undefined> : TransformParameters<C[N]>; | ||
interface HandlerContext<C extends CommandRecord = CommandRecord, N extends keyof C = keyof C> { | ||
name?: N; | ||
name?: LiteralUnion<N, string>; | ||
called?: string | RootType; | ||
@@ -125,11 +130,11 @@ resolved: boolean; | ||
raw: { | ||
[K in keyof Raw<C[N]>]: Raw<C[N]>[K]; | ||
[K in keyof ParseRaw<C[N]>]: ParseRaw<C[N]>[K]; | ||
}; | ||
parameters: Equals<{ | ||
[K in keyof TransformParameters<C[N]>]: TransformParameters<C[N]>[K]; | ||
}, {}> extends true ? Dict<string | string[] | undefined> : { | ||
[K in keyof TransformParameters<C[N]>]: TransformParameters<C[N]>[K]; | ||
parameters: { | ||
[K in keyof ParseParameters<C, N>]: ParseParameters<C, N>[K]; | ||
}; | ||
unknownFlags: ParsedFlags["unknownFlags"]; | ||
flags: Equals<TypeFlagWithDefault<C[N]>["flags"], {}> extends true ? Dict<any> : TypeFlagWithDefault<C[N]>["flags"]; | ||
flags: { | ||
[K in keyof ParseFlag<C, N>]: ParseFlag<C, N>[K]; | ||
}; | ||
cli: Clerc<C>; | ||
@@ -136,0 +141,0 @@ } |
{ | ||
"name": "@clerc/core", | ||
"version": "0.24.0", | ||
"version": "0.25.0", | ||
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)", | ||
@@ -52,4 +52,5 @@ "description": "Clerc core", | ||
"lite-emit": "^1.4.0", | ||
"type-fest": "^3.5.1", | ||
"type-flag": "^3.0.0", | ||
"@clerc/utils": "0.24.0" | ||
"@clerc/utils": "0.25.0" | ||
}, | ||
@@ -56,0 +57,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45082
1145
5
+ Addedtype-fest@^3.5.1
+ Added@clerc/utils@0.25.0(transitive)
+ Addedtype-fest@3.13.1(transitive)
- Removed@clerc/utils@0.24.0(transitive)
Updated@clerc/utils@0.25.0