@gunshi/bone 0.30.7 → 0.31.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/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/parser-D95CJBHr.d.ts
1
+ //#region ../../node_modules/.pnpm/args-tokens@0.25.0/node_modules/args-tokens/lib/parser-D95CJBHr.d.ts
2
2
  //#region src/parser.d.ts
3
3
  /**
4
4
  * Entry point of argument parser.
@@ -55,7 +55,7 @@ interface ArgToken {
55
55
  * Parser Options.
56
56
  */
57
57
  //#endregion
58
- //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/resolver.d.ts
58
+ //#region ../../node_modules/.pnpm/args-tokens@0.25.0/node_modules/args-tokens/lib/resolver.d.ts
59
59
  //#region src/resolver.d.ts
60
60
  /**
61
61
  * An argument schema definition for command-line argument parsing.
package/lib/index.js CHANGED
@@ -1,4 +1,12 @@
1
- //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/parser.js
1
+ //#region ../../node_modules/.pnpm/args-tokens@0.25.0/node_modules/args-tokens/lib/parser.js
2
+ /**
3
+ * forked from `nodejs/node` (`pkgjs/parseargs`)
4
+ * repository url: https://github.com/nodejs/node (https://github.com/pkgjs/parseargs)
5
+ * code url: https://github.com/nodejs/node/blob/main/lib/internal/util/parse_args/parse_args.js
6
+ *
7
+ * @author kazuya kawaguchi (a.k.a. kazupon)
8
+ * @license MIT
9
+ */
2
10
  const HYPHEN_CHAR = "-";
3
11
  const HYPHEN_CODE = HYPHEN_CHAR.codePointAt(0);
4
12
  const EQUAL_CHAR = "=";
@@ -195,7 +203,7 @@ function hasOptionValue(value) {
195
203
  return !(value == null) && value.codePointAt(0) !== HYPHEN_CODE;
196
204
  }
197
205
  //#endregion
198
- //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/utils.js
206
+ //#region ../../node_modules/.pnpm/args-tokens@0.25.0/node_modules/args-tokens/lib/utils.js
199
207
  /**
200
208
  * Entry point of utils.
201
209
  *
@@ -217,7 +225,7 @@ function kebabnize(str) {
217
225
  return str.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase());
218
226
  }
219
227
  //#endregion
220
- //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/resolver.js
228
+ //#region ../../node_modules/.pnpm/args-tokens@0.25.0/node_modules/args-tokens/lib/resolver.js
221
229
  /**
222
230
  * Entry point of argument options resolver.
223
231
  *
@@ -276,14 +284,14 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
276
284
  return value;
277
285
  }
278
286
  }
279
- function applyLongOptionValue(value = void 0) {
287
+ function applyLongOptionValue(value) {
280
288
  if (currentLongOption) {
281
289
  currentLongOption.value = value;
282
290
  optionTokens.push({ ...currentLongOption });
283
291
  currentLongOption = void 0;
284
292
  }
285
293
  }
286
- function applyShortOptionValue(value = void 0) {
294
+ function applyShortOptionValue(value) {
287
295
  if (currentShortOption) {
288
296
  currentShortOption.value = value || toShortValue();
289
297
  optionTokens.push({ ...currentShortOption });
@@ -517,7 +525,11 @@ function checkConflicts(args, explicit, toKebab, actualInputNames) {
517
525
  return [];
518
526
  }
519
527
  //#endregion
520
- //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/index.js
528
+ //#region ../../node_modules/.pnpm/args-tokens@0.25.0/node_modules/args-tokens/lib/index.js
529
+ /**
530
+ * @author kazuya kawaguchi (a.k.a. kazupon)
531
+ * @license MIT
532
+ */
521
533
  /**
522
534
  * @author kazuya kawaguchi (a.k.a. kazupon)
523
535
  * @license MIT
@@ -939,16 +951,16 @@ async function cliCore(argv, entry, options, plugins) {
939
951
  const resolved = resolveCommandTree(tokens, entry, cliOptions);
940
952
  const { commandName: name, command, callMode, commandPath, depth, levelSubCommands } = resolved;
941
953
  if (!command) throw new Error(`Command not found: ${name || ""}`);
942
- const args = resolveArguments(pluginContext, getCommandArgs(command));
954
+ if (levelSubCommands) cliOptions.subCommands = levelSubCommands;
955
+ const resolvedCommand = isLazyCommand(command) ? await resolveLazyCommand(command, name, true) : command;
956
+ const args = resolveArguments(pluginContext, getCommandArgs(resolvedCommand));
943
957
  const skipPositional = depth > 0 ? depth - 1 : -1;
944
958
  const { explicit, values, positionals, rest, error } = resolveArgs(args, tokens, {
945
959
  shortGrouping: true,
946
- toKebab: command.toKebab,
960
+ toKebab: resolvedCommand.toKebab,
947
961
  skipPositional
948
962
  });
949
963
  const omitted = resolved.omitted;
950
- if (levelSubCommands) cliOptions.subCommands = levelSubCommands;
951
- const resolvedCommand = isLazyCommand(command) ? await resolveLazyCommand(command, name, true) : command;
952
964
  return await executeCommand(resolvedCommand, await createCommandContext({
953
965
  args,
954
966
  explicit,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gunshi/bone",
3
3
  "description": "gunshi minimum",
4
- "version": "0.30.7",
4
+ "version": "0.31.0",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -56,10 +56,10 @@
56
56
  "jsr-exports-lint": "^0.4.2",
57
57
  "publint": "^0.3.20",
58
58
  "tsdown": "0.21.0",
59
- "@gunshi/plugin-global": "0.30.7",
60
- "gunshi": "0.30.7",
61
- "@gunshi/plugin-renderer": "0.30.7",
62
- "@gunshi/definition": "0.30.7"
59
+ "@gunshi/definition": "0.31.0",
60
+ "@gunshi/plugin-global": "0.31.0",
61
+ "gunshi": "0.31.0",
62
+ "@gunshi/plugin-renderer": "0.31.0"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "tsdown",