gunshi 0.29.5 → 0.30.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/bone.d.ts CHANGED
@@ -46,5 +46,12 @@ declare function cli<E extends ExtendContext = ExtendContext, G extends GunshiPa
46
46
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
47
47
  */
48
48
  declare function cli<G extends GunshiParams = DefaultGunshiParams>(args: string[], entry: Command<G> | CommandRunner<G> | LazyCommand<G>, options?: CliOptions<G>): Promise<string | undefined>;
49
+ //#endregion
50
+ //#region src/bone.d.ts
51
+ /**
52
+ * @author kazuya kawaguchi (a.k.a. kazupon)
53
+ * @license MIT
54
+ */
55
+
49
56
  //#endregion
50
57
  export { ArgSchema, ArgToken, ArgValues, Args, Awaitable, CliOptions, Command, CommandCallMode, CommandContext, CommandContextCore, CommandContextExtension, CommandDecorator, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandRunner, Commandable, DefaultGunshiParams, ExtendContext, ExtractArgExplicitlyProvided, ExtractArgs, ExtractExtensions, GunshiParams, GunshiParamsConstraint, LazyCommand, NormalizeToGunshiParams, Prettify, RendererDecorator, RenderingOptions, SubCommandable, ValidationErrorsDecorator, cli };
package/lib/bone.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as cliCore } from "./core-CDWBHGHv.js";
1
+ import { t as cliCore } from "./core-BQot-D_g.js";
2
2
  //#region src/cli/bone.ts
3
3
  /**
4
4
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -18,4 +18,10 @@ async function cli(args, entry, options = {}) {
18
18
  return cliCore(args, entry, options, []);
19
19
  }
20
20
  //#endregion
21
+ //#region src/bone.ts
22
+ /**
23
+ * @author kazuya kawaguchi (a.k.a. kazupon)
24
+ * @license MIT
25
+ */
26
+ //#endregion
21
27
  export { cli };
@@ -1,6 +1,6 @@
1
- import { t as cliCore } from "./core-CDWBHGHv.js";
2
- import { t as plugin } from "./core-x8spYr6g.js";
3
- import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-D_ZSzQUF.js";
1
+ import { t as plugin } from "./core-D1daCTTE.js";
2
+ import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-Dwp0BoQ5.js";
3
+ import { t as cliCore } from "./core-BQot-D_g.js";
4
4
  //#region ../plugin-global/src/types.ts
5
5
  /**
6
6
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -45,6 +45,10 @@ const decorator = (baseRunner) => async (ctx) => {
45
45
  //#endregion
46
46
  //#region ../plugin-global/src/extension.ts
47
47
  /**
48
+ * @author kazuya kawaguchi (a.k.a. kazupon)
49
+ * @license MIT
50
+ */
51
+ /**
48
52
  * Extends the command context for global options plugin.
49
53
  *
50
54
  * @param ctx - The {@linkcode CommandContextCore | command context} core
@@ -154,4 +158,10 @@ async function cli(args, entry, options = {}) {
154
158
  return cliCore(args, entry, options, [global(), renderer()]);
155
159
  }
156
160
  //#endregion
161
+ //#region src/cli.ts
162
+ /**
163
+ * @author kazuya kawaguchi (a.k.a. kazupon)
164
+ * @license MIT
165
+ */
166
+ //#endregion
157
167
  export { cli as t };
@@ -635,5 +635,12 @@ declare function merge<T extends Args[]>(...schemas: T): MergeArgs<T>;
635
635
  */
636
636
  declare function extend<T extends Args, U extends Args>(base: T, overrides: U): Omit<T, keyof U> & U;
637
637
  //#endregion
638
+ //#endregion
639
+ //#region src/combinators.d.ts
640
+ /**
641
+ * @author kazuya kawaguchi (a.k.a. kazupon)
642
+ * @license MIT
643
+ */
644
+
638
645
  //#endregion
639
646
  export { type BaseOptions, type BooleanOptions, type Combinator, type CombinatorOptions, type CombinatorSchema, type FloatOptions, type IntegerOptions, type NumberOptions, type StringOptions, args, boolean, choice, combinator, describe, extend, float, integer, map, merge, multiple, number, positional, required, short, string, unrequired, withDefault };
@@ -517,4 +517,10 @@ function extend(base, overrides) {
517
517
  return result;
518
518
  }
519
519
  //#endregion
520
+ //#region src/combinators.ts
521
+ /**
522
+ * @author kazuya kawaguchi (a.k.a. kazupon)
523
+ * @license MIT
524
+ */
525
+ //#endregion
520
526
  export { args, boolean, choice, combinator, describe, extend, float, integer, map, merge, multiple, number, positional, required, short, string, unrequired, withDefault };
@@ -1,4 +1,8 @@
1
1
  //#region src/constants.ts
2
+ /**
3
+ * @author kazuya kawaguchi (a.k.a. kazupon)
4
+ * @license MIT
5
+ */
2
6
  const ANONYMOUS_COMMAND_NAME = "(anonymous)";
3
7
  /**
4
8
  * A no-operation function.
package/lib/context.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as log, i as isLazyCommand, n as deepFreeze, t as create } from "./utils-1JDAM4DH.js";
2
- import { n as CLI_OPTIONS_DEFAULT, r as NOOP, t as ANONYMOUS_COMMAND_NAME } from "./constants-Bum1xzqZ.js";
1
+ import { n as CLI_OPTIONS_DEFAULT, r as NOOP, t as ANONYMOUS_COMMAND_NAME } from "./constants-D_ixLD32.js";
2
+ import { a as log, i as isLazyCommand, n as deepFreeze, t as create } from "./utils-CMJNteYK.js";
3
3
  //#region src/context.ts
4
4
  /**
5
5
  * The entry for gunshi context.
@@ -22,7 +22,7 @@ import { n as CLI_OPTIONS_DEFAULT, r as NOOP, t as ANONYMOUS_COMMAND_NAME } from
22
22
  * @param param - A {@link CommandContextParams | parameters} to create a command context.
23
23
  * @returns A {@link CommandContext | command context}, which is readonly.
24
24
  */
25
- async function createCommandContext({ args = {}, explicit = {}, values = {}, positionals = [], rest = [], argv = [], tokens = [], command = {}, extensions = {}, cliOptions = {}, callMode = "entry", commandPath = [], omitted = false, validationError = void 0 }) {
25
+ async function createCommandContext({ args = {}, explicit = {}, values = {}, positionals = [], rest = [], argv = [], tokens = [], command = {}, extensions = {}, cliOptions = {}, callMode = "entry", commandPath = [], omitted = false, validationError }) {
26
26
  /**
27
27
  * normailize the options schema and values, to avoid prototype pollution
28
28
  */
@@ -1,5 +1,5 @@
1
- import { i as isLazyCommand, o as resolveLazyCommand, r as getCommandSubCommands, s as kebabnize, t as create } from "./utils-1JDAM4DH.js";
2
- import { n as CLI_OPTIONS_DEFAULT, r as NOOP } from "./constants-Bum1xzqZ.js";
1
+ import { n as CLI_OPTIONS_DEFAULT, r as NOOP } from "./constants-D_ixLD32.js";
2
+ import { i as isLazyCommand, o as resolveLazyCommand, r as getCommandSubCommands, s as kebabnize, t as create } from "./utils-CMJNteYK.js";
3
3
  import { createCommandContext } from "./context.js";
4
4
  //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/parser.js
5
5
  const HYPHEN_CHAR = "-";
@@ -498,7 +498,17 @@ function checkConflicts(args, explicit, toKebab, actualInputNames) {
498
498
  return [];
499
499
  }
500
500
  //#endregion
501
+ //#region ../../node_modules/.pnpm/args-tokens@0.24.3/node_modules/args-tokens/lib/index.js
502
+ /**
503
+ * @author kazuya kawaguchi (a.k.a. kazupon)
504
+ * @license MIT
505
+ */
506
+ //#endregion
501
507
  //#region src/decorators.ts
508
+ /**
509
+ * @author kazuya kawaguchi (a.k.a. kazupon)
510
+ * @license MIT
511
+ */
502
512
  const EMPTY_RENDERER = () => Promise.resolve("");
503
513
  /**
504
514
  * Factory function for creating a decorators manager.
@@ -564,6 +574,10 @@ function createDecorators() {
564
574
  //#endregion
565
575
  //#region src/plugin/context.ts
566
576
  /**
577
+ * @author kazuya kawaguchi (a.k.a. kazupon)
578
+ * @license MIT
579
+ */
580
+ /**
567
581
  * Factory function for creating a plugin context.
568
582
  *
569
583
  * @typeParam G - A type extending {@linkcode GunshiParams} to specify the shape of command parameters.
@@ -618,6 +632,10 @@ function createPluginContext(decorators, initialSubCommands) {
618
632
  //#endregion
619
633
  //#region src/plugin/dependency.ts
620
634
  /**
635
+ * @author kazuya kawaguchi (a.k.a. kazupon)
636
+ * @license MIT
637
+ */
638
+ /**
621
639
  * Resolve plugin dependencies using topological sort
622
640
  *
623
641
  * @param plugins - Array of plugins to resolve
@@ -1,4 +1,8 @@
1
1
  //#region src/plugin/core.ts
2
+ /**
3
+ * @author kazuya kawaguchi (a.k.a. kazupon)
4
+ * @license MIT
5
+ */
2
6
  const NOOP_EXTENSION = () => {
3
7
  return Object.create(null);
4
8
  };
package/lib/definition.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import { createCommandContext } from "./context.js";
2
2
  //#region src/definition.ts
3
3
  /**
4
+ * @author kazuya kawaguchi (a.k.a. kazupon)
5
+ * @license MIT
6
+ */
7
+ /**
4
8
  * Define a {@link Command | command}.
5
9
  *
6
10
  * @typeParam G - A {@link GunshiParamsConstraint} type
package/lib/generator.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as create } from "./utils-1JDAM4DH.js";
2
- import { t as cli } from "./cli-COx8zjEj.js";
1
+ import { t as create } from "./utils-CMJNteYK.js";
2
+ import { t as cli } from "./cli-BIViXHPa.js";
3
3
  //#region src/generator.ts
4
4
  /**
5
5
  * The entry for usage generator.
package/lib/index.d.ts CHANGED
@@ -5,6 +5,10 @@ import { define, defineWithTypes, lazy, lazyWithTypes } from "./definition.js";
5
5
  import { t as ANONYMOUS_COMMAND_NAME } from "./constants-BKVrvh3H.js";
6
6
 
7
7
  //#region ../plugin-i18n/src/types.d.ts
8
+ /**
9
+ * @author kazuya kawaguchi (a.k.a. kazupon)
10
+ * @license MIT
11
+ */
8
12
 
9
13
  /**
10
14
  * Translation adapter factory options.
@@ -174,5 +178,12 @@ declare function cli<G extends GunshiParams = DefaultGunshiParams>(args: string[
174
178
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
175
179
  */
176
180
  declare function cli(args: string[], entry: SubCommandable, options?: CliOptions): Promise<string | undefined>;
181
+ //#endregion
182
+ //#region src/index.d.ts
183
+ /**
184
+ * @author kazuya kawaguchi (a.k.a. kazupon)
185
+ * @license MIT
186
+ */
187
+
177
188
  //#endregion
178
189
  export { ANONYMOUS_COMMAND_NAME, ArgSchema, ArgToken, ArgValues, Args, Awaitable, CliOptions, Command, CommandCallMode, CommandContext, CommandContextCore, CommandContextExtension, type CommandContextParams, CommandDecorator, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandRunner, Commandable, DefaultGunshiParams, DefaultTranslation, ExtendContext, ExtractArgExplicitlyProvided, ExtractArgs, ExtractExtensions, GunshiParams, GunshiParamsConstraint, LazyCommand, NormalizeToGunshiParams, type OnPluginExtension, type Plugin, type PluginContext, type PluginDependency, type PluginExtension, type PluginFunction, type PluginOptions, type PluginWithExtension, type PluginWithoutExtension, Prettify, RendererDecorator, RenderingOptions, SubCommandable, ValidationErrorsDecorator, cli, createCommandContext, define, defineWithTypes, lazy, lazyWithTypes, parseArgs, plugin, resolveArgs };
package/lib/index.js CHANGED
@@ -1,12 +1,16 @@
1
- import { n as resolveArgs, r as parseArgs } from "./core-CDWBHGHv.js";
2
- import { t as ANONYMOUS_COMMAND_NAME } from "./constants-Bum1xzqZ.js";
1
+ import { t as ANONYMOUS_COMMAND_NAME } from "./constants-D_ixLD32.js";
3
2
  import { createCommandContext } from "./context.js";
3
+ import { t as plugin } from "./core-D1daCTTE.js";
4
+ import { a as namespacedId } from "./src-Dwp0BoQ5.js";
5
+ import { n as resolveArgs, r as parseArgs } from "./core-BQot-D_g.js";
6
+ import { t as cli } from "./cli-BIViXHPa.js";
4
7
  import { define, defineWithTypes, lazy, lazyWithTypes } from "./definition.js";
5
- import { t as plugin } from "./core-x8spYr6g.js";
6
- import { a as namespacedId } from "./src-D_ZSzQUF.js";
7
- import { t as cli } from "./cli-COx8zjEj.js";
8
8
  //#region ../plugin-i18n/src/translation.ts
9
9
  /**
10
+ * @author kazuya kawaguchi (a.k.a. kazupon)
11
+ * @license MIT
12
+ */
13
+ /**
10
14
  * Default implementation of {@linkcode TranslationAdapter}.
11
15
  */
12
16
  var DefaultTranslation = class {
@@ -68,7 +72,21 @@ var DefaultTranslation = class {
68
72
  });
69
73
  }
70
74
  };
75
+ /**
76
+ * @author kazuya kawaguchi (a.k.a. kazupon)
77
+ * @license MIT
78
+ */
71
79
  namespacedId("i18n");
80
+ /**
81
+ * @author kazuya kawaguchi (a.k.a. kazupon)
82
+ * @license MIT
83
+ */
72
84
  "_".codePointAt(0);
73
85
  //#endregion
86
+ //#region src/index.ts
87
+ /**
88
+ * @author kazuya kawaguchi (a.k.a. kazupon)
89
+ * @license MIT
90
+ */
91
+ //#endregion
74
92
  export { ANONYMOUS_COMMAND_NAME, DefaultTranslation, cli, createCommandContext, define, defineWithTypes, lazy, lazyWithTypes, parseArgs, plugin, resolveArgs };
package/lib/plugin.d.ts CHANGED
@@ -2,4 +2,12 @@ import { i as Args, n as ArgSchema, o as ArgToken, r as ArgValues } from "./reso
2
2
  import { A as PluginDependency, C as Prettify, D as ValidationErrorsDecorator, F as PluginWithoutExtension, I as plugin, L as PluginContext, M as PluginFunction, N as PluginOptions, O as OnPluginExtension, P as PluginWithExtension, S as NormalizeToGunshiParams, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, f as CommandRunner, h as ExtendContext, j as PluginExtension, k as Plugin, m as DefaultGunshiParams, o as CommandContextCore, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as RendererDecorator, x as LazyCommand, y as GunshiParams } from "./types-FFgtdrno.js";
3
3
  import { CommandContextParams, createCommandContext } from "./context.js";
4
4
  import { n as CLI_OPTIONS_DEFAULT, t as ANONYMOUS_COMMAND_NAME } from "./constants-BKVrvh3H.js";
5
+
6
+ //#region src/plugin.d.ts
7
+ /**
8
+ * @author kazuya kawaguchi (a.k.a. kazupon)
9
+ * @license MIT
10
+ */
11
+
12
+ //#endregion
5
13
  export { ANONYMOUS_COMMAND_NAME, type ArgSchema, type ArgToken, type ArgValues, type Args, type Awaitable, CLI_OPTIONS_DEFAULT, type Command, type CommandContext, type CommandContextCore, type CommandContextExtension, type CommandContextParams, type CommandDecorator, type CommandExamplesFetcher, type CommandRunner, type DefaultGunshiParams, type ExtendContext, type ExtractArgs, type ExtractExtensions, type GunshiParams, type GunshiParamsConstraint, type LazyCommand, type NormalizeToGunshiParams, type OnPluginExtension, type Plugin, type PluginContext, type PluginDependency, type PluginExtension, type PluginFunction, type PluginOptions, type PluginWithExtension, type PluginWithoutExtension, type Prettify, type RendererDecorator, type ValidationErrorsDecorator, createCommandContext, plugin };
package/lib/plugin.js CHANGED
@@ -1,4 +1,10 @@
1
- import { n as CLI_OPTIONS_DEFAULT, t as ANONYMOUS_COMMAND_NAME } from "./constants-Bum1xzqZ.js";
1
+ import { n as CLI_OPTIONS_DEFAULT, t as ANONYMOUS_COMMAND_NAME } from "./constants-D_ixLD32.js";
2
2
  import { createCommandContext } from "./context.js";
3
- import { t as plugin } from "./core-x8spYr6g.js";
3
+ import { t as plugin } from "./core-D1daCTTE.js";
4
+ //#region src/plugin.ts
5
+ /**
6
+ * @author kazuya kawaguchi (a.k.a. kazupon)
7
+ * @license MIT
8
+ */
9
+ //#endregion
4
10
  export { ANONYMOUS_COMMAND_NAME, CLI_OPTIONS_DEFAULT, createCommandContext, plugin };
package/lib/renderer.d.ts CHANGED
@@ -32,5 +32,12 @@ declare function renderUsage<G extends GunshiParams = DefaultGunshiParams>(ctx:
32
32
  * @returns A rendered validation error.
33
33
  */
34
34
  declare function renderValidationErrors<G extends GunshiParams = DefaultGunshiParams>(_ctx: CommandContext<G>, error: AggregateError): Promise<string>;
35
+ //#endregion
36
+ //#region src/renderer.d.ts
37
+ /**
38
+ * @author kazuya kawaguchi (a.k.a. kazupon)
39
+ * @license MIT
40
+ */
41
+
35
42
  //#endregion
36
43
  export { renderHeader, renderUsage, renderValidationErrors };
package/lib/renderer.js CHANGED
@@ -1,2 +1,8 @@
1
- import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-D_ZSzQUF.js";
1
+ import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-Dwp0BoQ5.js";
2
+ //#region src/renderer.ts
3
+ /**
4
+ * @author kazuya kawaguchi (a.k.a. kazupon)
5
+ * @license MIT
6
+ */
7
+ //#endregion
2
8
  export { renderHeader, renderUsage, renderValidationErrors };
@@ -1,6 +1,10 @@
1
- import { o as resolveLazyCommand, s as kebabnize } from "./utils-1JDAM4DH.js";
2
- import "./constants-Bum1xzqZ.js";
3
- import { t as plugin } from "./core-x8spYr6g.js";
1
+ import "./constants-D_ixLD32.js";
2
+ import { o as resolveLazyCommand, s as kebabnize } from "./utils-CMJNteYK.js";
3
+ import { t as plugin } from "./core-D1daCTTE.js";
4
+ /**
5
+ * @author kazuya kawaguchi (a.k.a. kazupon)
6
+ * @license MIT
7
+ */
4
8
  const BUILD_IN_PREFIX_AND_KEY_SEPARATOR = `_:`;
5
9
  const ARG_PREFIX_AND_KEY_SEPARATOR = `arg:`;
6
10
  const COMMON_ARGS = {
@@ -160,8 +164,18 @@ function localizable(ctx, cmd, translate) {
160
164
  return localize;
161
165
  }
162
166
  //#endregion
167
+ //#region ../shared/src/index.ts
168
+ /**
169
+ * @author kazuya kawaguchi (a.k.a. kazupon)
170
+ * @license MIT
171
+ */
172
+ //#endregion
163
173
  //#region ../plugin-renderer/src/header.ts
164
174
  /**
175
+ * @author kazuya kawaguchi (a.k.a. kazupon)
176
+ * @license MIT
177
+ */
178
+ /**
165
179
  * Render the header.
166
180
  *
167
181
  * @param ctx - A {@link CommandContext | command context}
@@ -488,6 +502,10 @@ function generatePositionalSymbols(args) {
488
502
  //#endregion
489
503
  //#region ../plugin-renderer/src/validation.ts
490
504
  /**
505
+ * @author kazuya kawaguchi (a.k.a. kazupon)
506
+ * @license MIT
507
+ */
508
+ /**
491
509
  * Render the validation errors.
492
510
  *
493
511
  * @param _ctx - A {@link CommandContext | command context}
@@ -22,6 +22,10 @@ function kebabnize(str) {
22
22
  //#endregion
23
23
  //#region src/utils.ts
24
24
  /**
25
+ * @author kazuya kawaguchi (a.k.a. kazupon)
26
+ * @license MIT
27
+ */
28
+ /**
25
29
  * Check if the given command is a {@link LazyCommand}.
26
30
  *
27
31
  * @param cmd - A command to check
package/lib/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as log, i as isLazyCommand, n as deepFreeze, o as resolveLazyCommand, r as getCommandSubCommands, s as kebabnize, t as create } from "./utils-1JDAM4DH.js";
1
+ import { a as log, i as isLazyCommand, n as deepFreeze, o as resolveLazyCommand, r as getCommandSubCommands, s as kebabnize, t as create } from "./utils-CMJNteYK.js";
2
2
  export { create, deepFreeze, getCommandSubCommands, isLazyCommand, kebabnize, log, resolveLazyCommand };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gunshi",
3
3
  "description": "Modern javascript command-line library",
4
- "version": "0.29.5",
4
+ "version": "0.30.0",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "engines": {
31
- "node": ">= 20"
31
+ "node": ">= 22"
32
32
  },
33
33
  "type": "module",
34
34
  "files": [
@@ -103,17 +103,17 @@
103
103
  },
104
104
  "devDependencies": {
105
105
  "args-tokens": "^0.24.3",
106
- "deno": "^2.7.11",
106
+ "deno": "^2.7.14",
107
107
  "jsr": "^0.14.3",
108
108
  "jsr-exports-lint": "^0.4.2",
109
- "publint": "^0.3.18",
110
- "tsdown": "0.15.12",
111
- "zod": "^4.3.6",
112
- "@gunshi/plugin-global": "0.29.5",
113
- "@gunshi/plugin-renderer": "0.29.5",
114
- "@gunshi/plugin-i18n": "0.29.5",
115
- "@gunshi/shared": "0.29.5",
116
- "@gunshi/resources": "0.29.5"
109
+ "publint": "^0.3.20",
110
+ "tsdown": "0.21.0",
111
+ "zod": "^4.4.3",
112
+ "@gunshi/resources": "0.30.0",
113
+ "@gunshi/plugin-global": "0.30.0",
114
+ "@gunshi/plugin-i18n": "0.30.0",
115
+ "@gunshi/shared": "0.30.0",
116
+ "@gunshi/plugin-renderer": "0.30.0"
117
117
  },
118
118
  "scripts": {
119
119
  "build": "tsdown",