@optique/run 1.3.0-dev.2534 → 1.3.0-dev.2538

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/dist/print.cjs CHANGED
@@ -12,6 +12,8 @@ const __optique_core_internal_terminal = require_rolldown_runtime.__toESM(requir
12
12
  *
13
13
  * @param message The structured message to print.
14
14
  * @param options Optional formatting options to override defaults.
15
+ * @throws {TypeError} If initialWidth is not a finite integer.
16
+ * @throws {RangeError} If initialWidth is negative or a theme color is invalid.
15
17
  *
16
18
  * @example
17
19
  * ```typescript
@@ -71,7 +73,9 @@ function printError(message, options = {}) {
71
73
  * operations or when you want to override the automatic terminal detection.
72
74
  *
73
75
  * @param options Formatting options for the printer.
74
- * @returns A printer function that can be called with messages.
76
+ * @returns A printer function that can be called with messages. The returned
77
+ * function validates initialWidth and theme colors when formatting a message
78
+ * and can throw the exceptions documented on {@link Printer}.
75
79
  *
76
80
  * @example
77
81
  * ```typescript
package/dist/print.d.cts CHANGED
@@ -52,6 +52,8 @@ interface PrinterOptions extends MessageFormatOptions {
52
52
  /**
53
53
  * A printer function that outputs formatted messages.
54
54
  * @param message The structured message to print.
55
+ * @throws {TypeError} If the configured initialWidth is not a finite integer.
56
+ * @throws {RangeError} If initialWidth is negative or a theme color is invalid.
55
57
  * @since 0.3.0
56
58
  */
57
59
  type Printer = (message: Message) => void;
@@ -64,6 +66,8 @@ type Printer = (message: Message) => void;
64
66
  *
65
67
  * @param message The structured message to print.
66
68
  * @param options Optional formatting options to override defaults.
69
+ * @throws {TypeError} If initialWidth is not a finite integer.
70
+ * @throws {RangeError} If initialWidth is negative or a theme color is invalid.
67
71
  *
68
72
  * @example
69
73
  * ```typescript
@@ -119,7 +123,9 @@ declare function printError(message: Message, options?: PrintErrorOptions): void
119
123
  * operations or when you want to override the automatic terminal detection.
120
124
  *
121
125
  * @param options Formatting options for the printer.
122
- * @returns A printer function that can be called with messages.
126
+ * @returns A printer function that can be called with messages. The returned
127
+ * function validates initialWidth and theme colors when formatting a message
128
+ * and can throw the exceptions documented on {@link Printer}.
123
129
  *
124
130
  * @example
125
131
  * ```typescript
package/dist/print.d.ts CHANGED
@@ -52,6 +52,8 @@ interface PrinterOptions extends MessageFormatOptions {
52
52
  /**
53
53
  * A printer function that outputs formatted messages.
54
54
  * @param message The structured message to print.
55
+ * @throws {TypeError} If the configured initialWidth is not a finite integer.
56
+ * @throws {RangeError} If initialWidth is negative or a theme color is invalid.
55
57
  * @since 0.3.0
56
58
  */
57
59
  type Printer = (message: Message) => void;
@@ -64,6 +66,8 @@ type Printer = (message: Message) => void;
64
66
  *
65
67
  * @param message The structured message to print.
66
68
  * @param options Optional formatting options to override defaults.
69
+ * @throws {TypeError} If initialWidth is not a finite integer.
70
+ * @throws {RangeError} If initialWidth is negative or a theme color is invalid.
67
71
  *
68
72
  * @example
69
73
  * ```typescript
@@ -119,7 +123,9 @@ declare function printError(message: Message, options?: PrintErrorOptions): void
119
123
  * operations or when you want to override the automatic terminal detection.
120
124
  *
121
125
  * @param options Formatting options for the printer.
122
- * @returns A printer function that can be called with messages.
126
+ * @returns A printer function that can be called with messages. The returned
127
+ * function validates initialWidth and theme colors when formatting a message
128
+ * and can throw the exceptions documented on {@link Printer}.
123
129
  *
124
130
  * @example
125
131
  * ```typescript
package/dist/print.js CHANGED
@@ -11,6 +11,8 @@ import { getDisplayWidth, renderTerminalTerm, resolveMessageFormatter } from "@o
11
11
  *
12
12
  * @param message The structured message to print.
13
13
  * @param options Optional formatting options to override defaults.
14
+ * @throws {TypeError} If initialWidth is not a finite integer.
15
+ * @throws {RangeError} If initialWidth is negative or a theme color is invalid.
14
16
  *
15
17
  * @example
16
18
  * ```typescript
@@ -70,7 +72,9 @@ function printError(message, options = {}) {
70
72
  * operations or when you want to override the automatic terminal detection.
71
73
  *
72
74
  * @param options Formatting options for the printer.
73
- * @returns A printer function that can be called with messages.
75
+ * @returns A printer function that can be called with messages. The returned
76
+ * function validates initialWidth and theme colors when formatting a message
77
+ * and can throw the exceptions documented on {@link Printer}.
74
78
  *
75
79
  * @example
76
80
  * ```typescript
package/dist/run.d.cts CHANGED
@@ -338,6 +338,8 @@ type AcceptExactOptionalRunOptions<TOptions> = [TOptions] extends [RunOptions |
338
338
  * @param parser The command-line parser to execute.
339
339
  * @param options Configuration options for customizing behavior.
340
340
  * See {@link RunOptions} for available settings.
341
+ * @throws {RangeError} If rendering help or errors encounters an invalid theme
342
+ * color, even when colors are disabled.
341
343
  * @returns The parsed result if successful. On help display or parse errors,
342
344
  * the function will call `process.exit()` and not return.
343
345
  *
@@ -417,6 +419,8 @@ declare function run<T extends Parser<Mode, unknown, unknown>>(parser: T, option
417
419
  * @template T The sync parser type being executed.
418
420
  * @param parser The synchronous command-line parser to execute.
419
421
  * @param options Configuration options for customizing behavior.
422
+ * @throws {RangeError} If rendering help or errors encounters an invalid theme
423
+ * color, even when colors are disabled.
420
424
  * @returns The parsed result if successful.
421
425
  * @throws {TypeError} If an async parser (or a {@link Program} wrapping one)
422
426
  * is passed at runtime. Use {@link run} or {@link runAsync} instead.
@@ -442,6 +446,8 @@ declare function runSync<T extends Parser<"sync", unknown, unknown>>(parser: T,
442
446
  * @template T The parser type being executed.
443
447
  * @param parser The command-line parser to execute.
444
448
  * @param options Configuration options for customizing behavior.
449
+ * @throws {RangeError} If rendering help or errors encounters an invalid theme
450
+ * color, even when colors are disabled.
445
451
  * @returns A Promise of the parsed result if successful.
446
452
  * @since 0.9.0
447
453
  */
package/dist/run.d.ts CHANGED
@@ -338,6 +338,8 @@ type AcceptExactOptionalRunOptions<TOptions> = [TOptions] extends [RunOptions |
338
338
  * @param parser The command-line parser to execute.
339
339
  * @param options Configuration options for customizing behavior.
340
340
  * See {@link RunOptions} for available settings.
341
+ * @throws {RangeError} If rendering help or errors encounters an invalid theme
342
+ * color, even when colors are disabled.
341
343
  * @returns The parsed result if successful. On help display or parse errors,
342
344
  * the function will call `process.exit()` and not return.
343
345
  *
@@ -417,6 +419,8 @@ declare function run<T extends Parser<Mode, unknown, unknown>>(parser: T, option
417
419
  * @template T The sync parser type being executed.
418
420
  * @param parser The synchronous command-line parser to execute.
419
421
  * @param options Configuration options for customizing behavior.
422
+ * @throws {RangeError} If rendering help or errors encounters an invalid theme
423
+ * color, even when colors are disabled.
420
424
  * @returns The parsed result if successful.
421
425
  * @throws {TypeError} If an async parser (or a {@link Program} wrapping one)
422
426
  * is passed at runtime. Use {@link run} or {@link runAsync} instead.
@@ -442,6 +446,8 @@ declare function runSync<T extends Parser<"sync", unknown, unknown>>(parser: T,
442
446
  * @template T The parser type being executed.
443
447
  * @param parser The command-line parser to execute.
444
448
  * @param options Configuration options for customizing behavior.
449
+ * @throws {RangeError} If rendering help or errors encounters an invalid theme
450
+ * color, even when colors are disabled.
445
451
  * @returns A Promise of the parsed result if successful.
446
452
  * @since 0.9.0
447
453
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/run",
3
- "version": "1.3.0-dev.2534",
3
+ "version": "1.3.0-dev.2538",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -76,11 +76,11 @@
76
76
  },
77
77
  "sideEffects": false,
78
78
  "dependencies": {
79
- "@optique/core": "1.3.0-dev.2534+0daf40ee"
79
+ "@optique/core": "1.3.0-dev.2538+8e1487d7"
80
80
  },
81
81
  "devDependencies": {
82
- "@optique/config": "1.3.0-dev.2534+0daf40ee",
83
- "@optique/env": "1.3.0-dev.2534+0daf40ee",
82
+ "@optique/config": "1.3.0-dev.2538+8e1487d7",
83
+ "@optique/env": "1.3.0-dev.2538+8e1487d7",
84
84
  "@types/node": "^24.0.0",
85
85
  "fast-check": "^4.7.0",
86
86
  "tsdown": "^0.13.0",