@gunshi/bone 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 +6 -7
- package/lib/index.js +20 -8
- package/package.json +6 -6
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
|
*
|
|
@@ -717,7 +716,7 @@ type ExtendContext = Record<string, unknown>;
|
|
|
717
716
|
*
|
|
718
717
|
* @since v0.27.0
|
|
719
718
|
*/
|
|
720
|
-
interface GunshiParams<P
|
|
719
|
+
interface GunshiParams<P extends {
|
|
721
720
|
args?: Args;
|
|
722
721
|
extensions?: ExtendContext;
|
|
723
722
|
} = {
|
|
@@ -727,13 +726,13 @@ interface GunshiParams<P$1 extends {
|
|
|
727
726
|
/**
|
|
728
727
|
* Command argument definitions.
|
|
729
728
|
*/
|
|
730
|
-
args: P
|
|
729
|
+
args: P extends {
|
|
731
730
|
args: infer A extends Args;
|
|
732
731
|
} ? A : Args;
|
|
733
732
|
/**
|
|
734
733
|
* Command context extensions.
|
|
735
734
|
*/
|
|
736
|
-
extensions: P
|
|
735
|
+
extensions: P extends {
|
|
737
736
|
extensions: infer E extends ExtendContext;
|
|
738
737
|
} ? E : {};
|
|
739
738
|
}
|
package/lib/index.js
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.js
|
|
2
2
|
const HYPHEN_CHAR = "-";
|
|
3
3
|
const HYPHEN_CODE = HYPHEN_CHAR.codePointAt(0);
|
|
4
4
|
const EQUAL_CHAR = "=";
|
|
@@ -42,11 +42,11 @@ function parseArgs(args, options = {}) {
|
|
|
42
42
|
kind: "option-terminator",
|
|
43
43
|
index
|
|
44
44
|
});
|
|
45
|
-
const mapped = remainings.map((arg
|
|
45
|
+
const mapped = remainings.map((arg) => {
|
|
46
46
|
return {
|
|
47
47
|
kind: "positional",
|
|
48
48
|
index: ++index,
|
|
49
|
-
value: arg
|
|
49
|
+
value: arg
|
|
50
50
|
};
|
|
51
51
|
});
|
|
52
52
|
tokens.push(...mapped);
|
|
@@ -196,7 +196,7 @@ function hasOptionValue(value) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
//#endregion
|
|
199
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.23.
|
|
199
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.23.1/node_modules/args-tokens/lib/utils-CxvkckUD.js
|
|
200
200
|
/**
|
|
201
201
|
* Entry point of utils.
|
|
202
202
|
*
|
|
@@ -219,7 +219,16 @@ function kebabnize(str) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
//#endregion
|
|
222
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.23.
|
|
222
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.23.1/node_modules/args-tokens/lib/resolver.js
|
|
223
|
+
/**
|
|
224
|
+
* Entry point of argument options resolver.
|
|
225
|
+
*
|
|
226
|
+
* @module
|
|
227
|
+
*/
|
|
228
|
+
/**
|
|
229
|
+
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
230
|
+
* @license MIT
|
|
231
|
+
*/
|
|
223
232
|
const SKIP_POSITIONAL_DEFAULT = -1;
|
|
224
233
|
/**
|
|
225
234
|
* Resolve command line arguments.
|
|
@@ -262,7 +271,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
262
271
|
let currentShortOption;
|
|
263
272
|
const expandableShortOptions = [];
|
|
264
273
|
function toShortValue() {
|
|
265
|
-
if (expandableShortOptions.length === 0) return
|
|
274
|
+
if (expandableShortOptions.length === 0) return;
|
|
266
275
|
else {
|
|
267
276
|
const value = expandableShortOptions.map((token) => token.name).join("");
|
|
268
277
|
expandableShortOptions.length = 0;
|
|
@@ -369,11 +378,14 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
369
378
|
if (remainingPositionals.length > 0) {
|
|
370
379
|
values[rawArg] = remainingPositionals.map((p) => p.value);
|
|
371
380
|
positionalsCount += remainingPositionals.length;
|
|
381
|
+
explicit[rawArg] = true;
|
|
372
382
|
} else if (schema.required) errors.push(createRequireError(arg, schema));
|
|
373
383
|
} else {
|
|
374
384
|
const positional = positionalTokens[positionalsCount];
|
|
375
|
-
if (positional != null)
|
|
376
|
-
|
|
385
|
+
if (positional != null) {
|
|
386
|
+
values[rawArg] = positional.value;
|
|
387
|
+
explicit[rawArg] = true;
|
|
388
|
+
} else errors.push(createRequireError(arg, schema));
|
|
377
389
|
positionalsCount++;
|
|
378
390
|
}
|
|
379
391
|
continue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gunshi/bone",
|
|
3
3
|
"description": "gunshi minimum",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"deno": "^2.
|
|
54
|
+
"deno": "^2.6.3",
|
|
55
55
|
"jsr": "^0.13.5",
|
|
56
56
|
"jsr-exports-lint": "^0.4.1",
|
|
57
57
|
"publint": "^0.3.16",
|
|
58
58
|
"tsdown": "0.15.12",
|
|
59
|
-
"@gunshi/definition": "0.27.
|
|
60
|
-
"@gunshi/plugin-
|
|
61
|
-
"@gunshi/plugin-
|
|
62
|
-
"gunshi": "0.27.
|
|
59
|
+
"@gunshi/definition": "0.27.6",
|
|
60
|
+
"@gunshi/plugin-global": "0.27.6",
|
|
61
|
+
"@gunshi/plugin-renderer": "0.27.6",
|
|
62
|
+
"gunshi": "0.27.6"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsdown",
|