@gunshi/definition 0.34.0 → 0.35.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.26.1/node_modules/args-tokens/lib/parser-DT7Ztcch.d.ts
1
+ //#region ../../node_modules/.pnpm/args-tokens@0.27.0/node_modules/args-tokens/lib/parser-DT7Ztcch.d.ts
2
2
  //#region src/parser.d.ts
3
3
  /**
4
4
  * Entry point of argument parser.
@@ -55,13 +55,13 @@ interface ArgToken {
55
55
  * Parser Options.
56
56
  */
57
57
  //#endregion
58
- //#region ../../node_modules/.pnpm/args-tokens@0.26.1/node_modules/args-tokens/lib/resolver.d.ts
58
+ //#region ../../node_modules/.pnpm/args-tokens@0.27.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.
62
62
  *
63
63
  * This schema is similar to the schema of Node.js `util.parseArgs` but with extended features:
64
- * - Additional `required` and `description` properties
64
+ * - Additional `required`, `description`, and `hidden` properties
65
65
  * - Extended `type` support: 'string', 'boolean', 'number', 'enum', 'positional', 'custom'
66
66
  * - Simplified `default` property (single type, not union types)
67
67
  *
@@ -166,6 +166,25 @@ interface ArgSchema {
166
166
  * ```
167
167
  */
168
168
  description?: string;
169
+ /**
170
+ * Hide the argument from generated help or usage output.
171
+ *
172
+ * This is metadata for renderers. It does not affect parsing, validation,
173
+ * required checks, defaults, conflicts, or resolved values.
174
+ *
175
+ * @example
176
+ * Hidden compatibility option:
177
+ * ```ts
178
+ * {
179
+ * legacy: {
180
+ * type: 'string',
181
+ * hidden: true,
182
+ * description: 'Deprecated compatibility option'
183
+ * }
184
+ * }
185
+ * ```
186
+ */
187
+ hidden?: boolean;
169
188
  /**
170
189
  * Marks the argument as required.
171
190
  *
@@ -1560,7 +1579,7 @@ type DefineWithTypesReturn<DefaultExtensions extends ExtendContext, DefaultArgs
1560
1579
  /**
1561
1580
  * Define a {@link Command | command} with types
1562
1581
  *
1563
- * This helper function allows specifying the type parameter of {@link GunshiParams}
1582
+ * This helper function allows specifying the type parameter of {@link GunshiParamsConstraint}
1564
1583
  * while inferring the {@link Args} type, {@link ExtendContext} type from the definition.
1565
1584
  *
1566
1585
  * @example
@@ -1580,7 +1599,7 @@ type DefineWithTypesReturn<DefaultExtensions extends ExtendContext, DefaultArgs
1580
1599
  * })
1581
1600
  * ```
1582
1601
  *
1583
- * @typeParam G - A {@link GunshiParams} type
1602
+ * @typeParam G - A {@link GunshiParamsConstraint} type
1584
1603
  *
1585
1604
  * @returns A function that takes a command definition via {@link define}
1586
1605
  *
@@ -1636,30 +1655,39 @@ declare function lazy<A extends Args>(loader: CommandLoader<{
1636
1655
  * }, testDefinition)
1637
1656
  * ```
1638
1657
  *
1639
- * @typeParam A - An {@link Args} type
1640
- * @typeParam D - A partial {@link Command} definition type
1658
+ * @typeParam D - A partial {@link Command} definition type with required `args`
1641
1659
  *
1642
1660
  * @param loader - A {@link CommandLoader | command loader} function that returns a command definition
1643
- * @param definition - An optional {@link Command | command} definition
1661
+ * @param definition - A {@link Command | command} definition
1644
1662
  * @returns A {@link LazyCommand | lazy command} that can be executed later
1645
1663
  */
1646
- declare function lazy<G extends GunshiParamsConstraint = DefaultGunshiParams, A extends ExtractArgs<G> = ExtractArgs<G>, D extends Partial<Command<{
1647
- args: A;
1648
- extensions: {};
1649
- }>> = Partial<Command<{
1650
- args: A;
1664
+ declare function lazy<D extends {
1665
+ args: Args;
1666
+ } & Partial<Command<{
1667
+ args: D['args'];
1651
1668
  extensions: {};
1652
1669
  }>>>(loader: CommandLoader<{
1653
- args: A;
1670
+ args: D['args'];
1654
1671
  extensions: {};
1655
1672
  }>, definition: D): LazyCommand<{
1656
- args: A;
1673
+ args: D['args'];
1657
1674
  extensions: {};
1658
1675
  }, D>;
1676
+ /**
1677
+ * Define a {@link LazyCommand | lazy command} with explicit Gunshi parameters and optional definition.
1678
+ *
1679
+ * @typeParam G - A {@link GunshiParamsConstraint}
1680
+ * @typeParam D - A partial {@link Command} definition type
1681
+ *
1682
+ * @param loader - A {@link CommandLoader | command loader} function that returns a command definition
1683
+ * @param definition - An optional {@link Command | command} definition
1684
+ * @returns A {@link LazyCommand | lazy command} that can be executed later
1685
+ */
1686
+ declare function lazy<G extends GunshiParamsConstraint = DefaultGunshiParams, D extends Partial<Command<G>> = Partial<Command<G>>>(loader: CommandLoader<G>, definition?: D): LazyCommand<G, D>;
1659
1687
  /**
1660
1688
  * Return type for lazyWithTypes
1661
1689
  *
1662
- * @typeParam FullG - The normalized {@link GunshiParams} type
1690
+ * @typeParam FullG - The normalized {@link GunshiParamsConstraint} type
1663
1691
  *
1664
1692
  * @internal
1665
1693
  */
@@ -1667,7 +1695,7 @@ type LazyWithTypesReturn<FullG extends GunshiParamsConstraint> = <D extends Part
1667
1695
  /**
1668
1696
  * Define a {@link LazyCommand | lazy command} with specific type parameters.
1669
1697
  *
1670
- * This helper function allows specifying the type parameter of {@link GunshiParams}
1698
+ * This helper function allows specifying the type parameter of {@link GunshiParamsConstraint}
1671
1699
  * while inferring the {@link Args} type, {@link ExtendContext} type from the definition.
1672
1700
  *
1673
1701
  * @example
@@ -1692,7 +1720,7 @@ type LazyWithTypesReturn<FullG extends GunshiParamsConstraint> = <D extends Part
1692
1720
  * )
1693
1721
  * ```
1694
1722
  *
1695
- * @typeParam G - A {@link GunshiParams} type
1723
+ * @typeParam G - A {@link GunshiParamsConstraint} type
1696
1724
  *
1697
1725
  * @returns A function that takes a lazy command definition via {@link lazy}
1698
1726
  *
package/lib/index.js CHANGED
@@ -181,7 +181,7 @@ function define(definition) {
181
181
  /**
182
182
  * Define a {@link Command | command} with types
183
183
  *
184
- * This helper function allows specifying the type parameter of {@link GunshiParams}
184
+ * This helper function allows specifying the type parameter of {@link GunshiParamsConstraint}
185
185
  * while inferring the {@link Args} type, {@link ExtendContext} type from the definition.
186
186
  *
187
187
  * @example
@@ -201,7 +201,7 @@ function define(definition) {
201
201
  * })
202
202
  * ```
203
203
  *
204
- * @typeParam G - A {@link GunshiParams} type
204
+ * @typeParam G - A {@link GunshiParamsConstraint} type
205
205
  *
206
206
  * @returns A function that takes a command definition via {@link define}
207
207
  *
@@ -237,7 +237,7 @@ function lazy(loader, definition) {
237
237
  /**
238
238
  * Define a {@link LazyCommand | lazy command} with specific type parameters.
239
239
  *
240
- * This helper function allows specifying the type parameter of {@link GunshiParams}
240
+ * This helper function allows specifying the type parameter of {@link GunshiParamsConstraint}
241
241
  * while inferring the {@link Args} type, {@link ExtendContext} type from the definition.
242
242
  *
243
243
  * @example
@@ -262,7 +262,7 @@ function lazy(loader, definition) {
262
262
  * )
263
263
  * ```
264
264
  *
265
- * @typeParam G - A {@link GunshiParams} type
265
+ * @typeParam G - A {@link GunshiParamsConstraint} type
266
266
  *
267
267
  * @returns A function that takes a lazy command definition via {@link lazy}
268
268
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gunshi/definition",
3
3
  "description": "utilities for gunshi command definition",
4
- "version": "0.34.0",
4
+ "version": "0.35.0",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -57,7 +57,7 @@
57
57
  "jsr-exports-lint": "^0.4.2",
58
58
  "publint": "^0.3.20",
59
59
  "tsdown": "0.21.0",
60
- "gunshi": "0.34.0"
60
+ "gunshi": "0.35.0"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "tsdown",