@clerc/core 1.0.0-beta.20 → 1.0.0-beta.22

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +10 -10
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -60,8 +60,8 @@ interface TypeFunction<T = unknown> {
60
60
  * @returns true to stop parsing, false to continue
61
61
  */
62
62
  type IgnoreFunction = (type: typeof KNOWN_FLAG | typeof UNKNOWN_FLAG | typeof PARAMETER, arg: string) => boolean;
63
- type FlagType<T = unknown> = TypeFunction<T> | readonly [TypeFunction<T>];
64
- interface BaseFlagOptions<T extends FlagType = FlagType> {
63
+ type TypeValue<T = unknown> = TypeFunction<T> | readonly [TypeFunction<T>];
64
+ interface BaseFlagOptions<T extends TypeValue = TypeValue> {
65
65
  /**
66
66
  * The type constructor or a function to convert the string value.
67
67
  * To support multiple occurrences of a flag (e.g., --file a --file b), wrap the type in an array: [String], [Number].
@@ -87,7 +87,7 @@ type FlagOptions = (BaseFlagOptions<BooleanConstructor> & {
87
87
  }) | (BaseFlagOptions & {
88
88
  negatable?: never;
89
89
  });
90
- type FlagDefinitionValue = FlagOptions | FlagType;
90
+ type FlagDefinitionValue = FlagOptions | TypeValue;
91
91
  type FlagsDefinition = Record<string, FlagDefinitionValue>;
92
92
  /**
93
93
  * Configuration options for the parser.
@@ -146,10 +146,10 @@ type _InferFlags<T extends FlagsDefinition> = { [K in keyof T]: IsTypeAny<T[K]>
146
146
  type: readonly [BooleanConstructor];
147
147
  } ? number | InferFlagDefault<T[K], never> : T[K] extends ObjectConstructor | {
148
148
  type: ObjectConstructor;
149
- } ? ObjectInputType | InferFlagDefault<T[K], never> : T[K] extends readonly [FlagType<infer U>] | {
150
- type: readonly [FlagType<infer U>];
151
- } ? U[] | InferFlagDefault<T[K], never> : T[K] extends FlagType<infer U> | {
152
- type: FlagType<infer U>;
149
+ } ? ObjectInputType | InferFlagDefault<T[K], never> : T[K] extends readonly [TypeValue<infer U>] | {
150
+ type: readonly [TypeValue<infer U>];
151
+ } ? U[] | InferFlagDefault<T[K], never> : T[K] extends TypeValue<infer U> | {
152
+ type: TypeValue<infer U>;
153
153
  } ? U | InferFlagDefault<T[K], [U] extends [boolean] ? never : T[K] extends {
154
154
  required: true;
155
155
  } ? never : undefined> : never };
@@ -204,7 +204,7 @@ declare function createParser<T extends FlagsDefinition>(options?: ParserOptions
204
204
  };
205
205
  declare const parse: <T extends FlagsDefinition>(args: string[], options?: ParserOptions<T>) => ParsedResult<InferFlags<T>>;
206
206
  declare namespace index_d_exports {
207
- export { BaseFlagOptions, DOUBLE_DASH, Enum, FlagDefaultValue, FlagDefaultValueFunction, FlagDefinitionValue, FlagOptions, FlagType, FlagsDefinition, IgnoreFunction, InferFlags, InvalidSchemaError, KNOWN_FLAG, MissingRequiredFlagError, ObjectInputType, PARAMETER, ParsedResult, ParserOptions, Range, RawInputType, Regex, TypeFunction, UNKNOWN_FLAG, createParser, parse };
207
+ export { BaseFlagOptions, DOUBLE_DASH, Enum, FlagDefaultValue, FlagDefaultValueFunction, FlagDefinitionValue, FlagOptions, FlagsDefinition, IgnoreFunction, InferFlags, InvalidSchemaError, KNOWN_FLAG, MissingRequiredFlagError, ObjectInputType, PARAMETER, ParsedResult, ParserOptions, Range, RawInputType, Regex, TypeFunction, TypeValue, UNKNOWN_FLAG, createParser, parse };
208
208
  }
209
209
  //#endregion
210
210
  //#region src/types/clerc.d.ts
@@ -215,7 +215,7 @@ interface FlagCustomOptions {}
215
215
  type ClercFlagOptions = FlagOptions & {
216
216
  description?: string;
217
217
  } & FlagCustomOptions;
218
- type ClercFlagDefinitionValue = ClercFlagOptions | FlagType;
218
+ type ClercFlagDefinitionValue = ClercFlagOptions | TypeValue;
219
219
  type ClercFlagsDefinition = Record<string, ClercFlagDefinitionValue>;
220
220
  //#endregion
221
221
  //#region src/types/parameters.d.ts
@@ -397,7 +397,7 @@ declare const friendlyErrorPlugin: ({
397
397
  //#endregion
398
398
  //#region ../plugin-help/src/types.d.ts
399
399
  interface Formatters {
400
- formatFlagType: (type: FlagType) => string;
400
+ formatTypeValue: (type: TypeValue) => string;
401
401
  formatFlagDefault: <T>(value: FlagDefaultValue<T>) => string;
402
402
  }
403
403
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/core",
3
- "version": "1.0.0-beta.20",
3
+ "version": "1.0.0-beta.22",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc core",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "lite-emit": "^4.0.0",
48
- "@clerc/parser": "^1.0.0-beta.20"
48
+ "@clerc/parser": "^1.0.0-beta.22"
49
49
  },
50
50
  "devDependencies": {
51
51
  "is-platform": "^1.0.0",
52
- "@clerc/utils": "1.0.0-beta.20"
52
+ "@clerc/utils": "1.0.0-beta.22"
53
53
  }
54
54
  }