@gunshi/shared 0.27.4 → 0.27.6
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/lib/index.d.ts +17 -18
- package/lib/index.js +1 -1
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.23.
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.23.1/node_modules/args-tokens/lib/parser.d.ts
|
|
2
2
|
//#region src/parser.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Entry point of argument parser.
|
|
@@ -55,9 +55,8 @@ interface ArgToken {
|
|
|
55
55
|
* Parser Options.
|
|
56
56
|
*/
|
|
57
57
|
//#endregion
|
|
58
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.23.
|
|
58
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.23.1/node_modules/args-tokens/lib/resolver.d.ts
|
|
59
59
|
//#region src/resolver.d.ts
|
|
60
|
-
|
|
61
60
|
/**
|
|
62
61
|
* An argument schema definition for command-line argument parsing.
|
|
63
62
|
*
|
|
@@ -504,7 +503,7 @@ type ResolveArgValues<A extends Args, V extends Record<keyof A, unknown>> = { -r
|
|
|
504
503
|
*
|
|
505
504
|
* @internal
|
|
506
505
|
*/
|
|
507
|
-
type FilterArgs<A extends Args, V extends Record<keyof A, unknown>, K
|
|
506
|
+
type FilterArgs<A extends Args, V extends Record<keyof A, unknown>, K extends keyof ArgSchema> = { [Arg in keyof A as A[Arg][K] extends {} ? Arg : never]: V[Arg] };
|
|
508
507
|
/**
|
|
509
508
|
* Filters positional arguments from the argument schema.
|
|
510
509
|
*
|
|
@@ -582,7 +581,7 @@ type ExtendContext = Record<string, unknown>;
|
|
|
582
581
|
*
|
|
583
582
|
* @since v0.27.0
|
|
584
583
|
*/
|
|
585
|
-
interface GunshiParams<P
|
|
584
|
+
interface GunshiParams<P extends {
|
|
586
585
|
args?: Args;
|
|
587
586
|
extensions?: ExtendContext;
|
|
588
587
|
} = {
|
|
@@ -592,13 +591,13 @@ interface GunshiParams<P$1 extends {
|
|
|
592
591
|
/**
|
|
593
592
|
* Command argument definitions.
|
|
594
593
|
*/
|
|
595
|
-
args: P
|
|
594
|
+
args: P extends {
|
|
596
595
|
args: infer A extends Args;
|
|
597
596
|
} ? A : Args;
|
|
598
597
|
/**
|
|
599
598
|
* Command context extensions.
|
|
600
599
|
*/
|
|
601
|
-
extensions: P
|
|
600
|
+
extensions: P extends {
|
|
602
601
|
extensions: infer E extends ExtendContext;
|
|
603
602
|
} ? E : {};
|
|
604
603
|
}
|
|
@@ -985,7 +984,7 @@ type CommandExamplesFetcher<G extends GunshiParamsConstraint = DefaultGunshiPara
|
|
|
985
984
|
*/
|
|
986
985
|
type CommandRunner<G extends GunshiParamsConstraint = DefaultGunshiParams> = (ctx: Readonly<CommandContext<G>>) => Awaitable<string | void>;
|
|
987
986
|
//#endregion
|
|
988
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.23.
|
|
987
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.23.1/node_modules/args-tokens/lib/utils.d.ts
|
|
989
988
|
//#region src/utils.d.ts
|
|
990
989
|
/**
|
|
991
990
|
* Entry point of utils.
|
|
@@ -1111,9 +1110,9 @@ type CommandBuiltinKeys = GenerateNamespacedKey<BuiltinResourceKeys>;
|
|
|
1111
1110
|
* Command i18n option keys.
|
|
1112
1111
|
* The command i18n option keys are used by the i18n plugin for translation.
|
|
1113
1112
|
*/
|
|
1114
|
-
type CommandArgKeys<A extends Args, C = {}, K
|
|
1113
|
+
type CommandArgKeys<A extends Args, C = {}, K extends string = GenerateNamespacedKey<Extract<KeyOfArgs<RemovedIndex<A>>, string>, typeof ARG_PREFIX>> = C extends {
|
|
1115
1114
|
name: infer N;
|
|
1116
|
-
} ? (N extends string ? GenerateNamespacedKey<K
|
|
1115
|
+
} ? (N extends string ? GenerateNamespacedKey<K, N> : K) : K;
|
|
1117
1116
|
/**
|
|
1118
1117
|
* Resolve translation keys for command context.
|
|
1119
1118
|
*/
|
|
@@ -1131,8 +1130,8 @@ interface Translation<A extends Args, C = {},
|
|
|
1131
1130
|
// for CommandContext
|
|
1132
1131
|
E extends Record<string, string> = {},
|
|
1133
1132
|
// for extended resources
|
|
1134
|
-
K
|
|
1135
|
-
(key: K
|
|
1133
|
+
K = ResolveTranslationKeys<A, C, E>> {
|
|
1134
|
+
(key: K, values?: Record<string, unknown>): string;
|
|
1136
1135
|
}
|
|
1137
1136
|
//#endregion
|
|
1138
1137
|
//#region src/localization.d.ts
|
|
@@ -1146,7 +1145,7 @@ K$1 = ResolveTranslationKeys<A, C, E>> {
|
|
|
1146
1145
|
interface Localization<A extends Args, C = {},
|
|
1147
1146
|
// for CommandContext
|
|
1148
1147
|
E extends Record<string, string> = {}> {
|
|
1149
|
-
<K
|
|
1148
|
+
<K = ResolveTranslationKeys<A, C, E>>(key: K, values?: Record<string, unknown>): Promise<string>;
|
|
1150
1149
|
}
|
|
1151
1150
|
/**
|
|
1152
1151
|
* Create a localizable function for a command.
|
|
@@ -1166,7 +1165,7 @@ declare function localizable<A extends Args, C = {},
|
|
|
1166
1165
|
// for CommandContext
|
|
1167
1166
|
E extends Record<string, string> = {},
|
|
1168
1167
|
// for extended resources
|
|
1169
|
-
K
|
|
1168
|
+
K = ResolveTranslationKeys<A, C, E>>(ctx: CommandContext, cmd: Command, translate?: Translation<A, C, E, K>): Localization<A, C, E>;
|
|
1170
1169
|
//#endregion
|
|
1171
1170
|
//#region ../resources/locales/en-US.d.ts
|
|
1172
1171
|
declare let COMMAND: string;
|
|
@@ -1197,7 +1196,7 @@ declare namespace __json_default_export {
|
|
|
1197
1196
|
* @param key - The built-in key to resolve.
|
|
1198
1197
|
* @returns Prefixed built-in key.
|
|
1199
1198
|
*/
|
|
1200
|
-
declare function resolveBuiltInKey<K
|
|
1199
|
+
declare function resolveBuiltInKey<K extends string = CommandBuiltinResourceKeys>(key: K): GenerateNamespacedKey<K>;
|
|
1201
1200
|
/**
|
|
1202
1201
|
* Resolve a namespaced key for argument resources.
|
|
1203
1202
|
*
|
|
@@ -1210,7 +1209,7 @@ declare function resolveBuiltInKey<K$1 extends string = CommandBuiltinResourceKe
|
|
|
1210
1209
|
* @param name - The command name.
|
|
1211
1210
|
* @returns Prefixed argument key.
|
|
1212
1211
|
*/
|
|
1213
|
-
declare function resolveArgKey<A extends Args = DefaultGunshiParams['args'], K
|
|
1212
|
+
declare function resolveArgKey<A extends Args = DefaultGunshiParams['args'], K extends string = KeyOfArgs<RemovedIndex<A>>>(key: K, name?: string): string;
|
|
1214
1213
|
/**
|
|
1215
1214
|
* Resolve a namespaced key for non-built-in resources.
|
|
1216
1215
|
*
|
|
@@ -1222,7 +1221,7 @@ declare function resolveArgKey<A extends Args = DefaultGunshiParams['args'], K$1
|
|
|
1222
1221
|
* @param name - The command name.
|
|
1223
1222
|
* @returns Prefixed non-built-in key.
|
|
1224
1223
|
*/
|
|
1225
|
-
declare function resolveKey<T extends Record<string, string> = {}, K
|
|
1224
|
+
declare function resolveKey<T extends Record<string, string> = {}, K extends string = (keyof T extends string ? keyof T : string)>(key: K, name?: string): string;
|
|
1226
1225
|
/**
|
|
1227
1226
|
* Resolve command examples.
|
|
1228
1227
|
*
|
|
@@ -1241,7 +1240,7 @@ declare function resolveExamples<G extends GunshiParamsConstraint = DefaultGunsh
|
|
|
1241
1240
|
* @param id - A plugin id to generate a namespaced key.
|
|
1242
1241
|
* @returns A namespaced key for the plugin.
|
|
1243
1242
|
*/
|
|
1244
|
-
declare function namespacedId<K
|
|
1243
|
+
declare function namespacedId<K extends string>(id: K): GenerateNamespacedKey<K, typeof PLUGIN_PREFIX>;
|
|
1245
1244
|
/**
|
|
1246
1245
|
* Generate a short and long option pair for command arguments.
|
|
1247
1246
|
*
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gunshi/shared",
|
|
3
3
|
"description": "shared utils for gunshi",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"deno": "^2.
|
|
53
|
+
"deno": "^2.6.3",
|
|
54
54
|
"jsr": "^0.13.5",
|
|
55
55
|
"jsr-exports-lint": "^0.4.1",
|
|
56
56
|
"publint": "^0.3.16",
|
|
57
57
|
"tsdown": "0.15.12",
|
|
58
|
-
"@gunshi/resources": "0.27.
|
|
59
|
-
"gunshi": "0.27.
|
|
58
|
+
"@gunshi/resources": "0.27.6",
|
|
59
|
+
"gunshi": "0.27.6"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsdown",
|