@optique/core 1.3.0-dev.2534 → 1.3.0-dev.2536

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/doc.cjs CHANGED
@@ -193,7 +193,8 @@ function defaultSectionOrder(a, b) {
193
193
  * control characters, or if `maxWidth` is not a finite integer.
194
194
  * @throws {RangeError} If any entry needs a description column and `maxWidth`
195
195
  * is too small to fit the minimum layout (less than `termIndent + 4`), or if
196
- * `showChoices.maxItems` is less than `1`.
196
+ * `showChoices.maxItems` is less than `1`, or if a theme color is invalid
197
+ * (even when colors are disabled).
197
198
  *
198
199
  * @example
199
200
  * ```typescript
package/dist/doc.d.cts CHANGED
@@ -339,7 +339,8 @@ interface DocPageFormatOptions {
339
339
  * control characters, or if `maxWidth` is not a finite integer.
340
340
  * @throws {RangeError} If any entry needs a description column and `maxWidth`
341
341
  * is too small to fit the minimum layout (less than `termIndent + 4`), or if
342
- * `showChoices.maxItems` is less than `1`.
342
+ * `showChoices.maxItems` is less than `1`, or if a theme color is invalid
343
+ * (even when colors are disabled).
343
344
  *
344
345
  * @example
345
346
  * ```typescript
package/dist/doc.d.ts CHANGED
@@ -339,7 +339,8 @@ interface DocPageFormatOptions {
339
339
  * control characters, or if `maxWidth` is not a finite integer.
340
340
  * @throws {RangeError} If any entry needs a description column and `maxWidth`
341
341
  * is too small to fit the minimum layout (less than `termIndent + 4`), or if
342
- * `showChoices.maxItems` is less than `1`.
342
+ * `showChoices.maxItems` is less than `1`, or if a theme color is invalid
343
+ * (even when colors are disabled).
343
344
  *
344
345
  * @example
345
346
  * ```typescript
package/dist/doc.js CHANGED
@@ -193,7 +193,8 @@ function defaultSectionOrder(a, b) {
193
193
  * control characters, or if `maxWidth` is not a finite integer.
194
194
  * @throws {RangeError} If any entry needs a description column and `maxWidth`
195
195
  * is too small to fit the minimum layout (less than `termIndent + 4`), or if
196
- * `showChoices.maxItems` is less than `1`.
196
+ * `showChoices.maxItems` is less than `1`, or if a theme color is invalid
197
+ * (even when colors are disabled).
197
198
  *
198
199
  * @example
199
200
  * ```typescript
package/dist/facade.cjs CHANGED
@@ -531,10 +531,12 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
531
531
  const callOnCompletion = (code) => onCompletion(code);
532
532
  if (!shellName) {
533
533
  const error = require_message.message`Missing shell name for completion.`;
534
- stderr(`${errorLabel()}${formatMessage(error, {
534
+ const prefix = errorLabel();
535
+ stderr(`${prefix}${formatMessage(error, {
535
536
  colors,
536
537
  quotes: !colors,
537
- maxWidth
538
+ maxWidth,
539
+ initialWidth: require_displaywidth.getDisplayWidth(prefix.split("\n").at(-1) ?? "")
538
540
  })}\n`);
539
541
  if (completionParser) {
540
542
  const displayName = isOptionMode ? completionOptionDisplayName ?? "--completion" : completionCommandDisplayName ?? "completion";
@@ -563,10 +565,12 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
563
565
  available.push(require_message.value(name));
564
566
  }
565
567
  const error = require_message.message`Unsupported shell ${shellName}. Available shells: ${available}.`;
566
- stderr(`${errorLabel()}${formatMessage(error, {
568
+ const prefix = errorLabel();
569
+ stderr(`${prefix}${formatMessage(error, {
567
570
  colors,
568
571
  quotes: !colors,
569
- maxWidth
572
+ maxWidth,
573
+ initialWidth: require_displaywidth.getDisplayWidth(prefix.split("\n").at(-1) ?? "")
570
574
  })}`);
571
575
  return require_mode_dispatch.dispatchByMode(parser.mode, () => {
572
576
  const result = callOnError(1, error);
@@ -1053,12 +1057,14 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
1053
1057
  maxWidth: maxWidth == null ? void 0 : maxWidth - usageLabelWidth(),
1054
1058
  expandCommands: true
1055
1059
  }), usageLabelWidth())}`);
1060
+ const prefix = errorLabel();
1056
1061
  const errorMessage = formatMessage(validationError, {
1062
+ initialWidth: require_displaywidth.getDisplayWidth(prefix.split("\n").at(-1) ?? ""),
1057
1063
  maxWidth,
1058
1064
  colors,
1059
1065
  quotes: !colors
1060
1066
  });
1061
- stderr(`${errorLabel()}${errorMessage}`);
1067
+ stderr(`${prefix}${errorMessage}`);
1062
1068
  return onError(1, validationError);
1063
1069
  };
1064
1070
  const displayHelp = (doc) => {
@@ -1171,12 +1177,14 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
1171
1177
  maxWidth: maxWidth == null ? void 0 : maxWidth - usageLabelWidth(),
1172
1178
  expandCommands: true
1173
1179
  }), usageLabelWidth())}`);
1180
+ const prefix = errorLabel();
1174
1181
  const errorMessage = formatMessage(classified.error, {
1182
+ initialWidth: require_displaywidth.getDisplayWidth(prefix.split("\n").at(-1) ?? ""),
1175
1183
  maxWidth,
1176
1184
  colors,
1177
1185
  quotes: !colors
1178
1186
  });
1179
- stderr(`${errorLabel()}${errorMessage}`);
1187
+ stderr(`${prefix}${errorMessage}`);
1180
1188
  return onError(1, classified.error);
1181
1189
  };
1182
1190
  if (aboveError === "help") {
package/dist/facade.js CHANGED
@@ -531,10 +531,12 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
531
531
  const callOnCompletion = (code) => onCompletion(code);
532
532
  if (!shellName) {
533
533
  const error = message`Missing shell name for completion.`;
534
- stderr(`${errorLabel()}${formatMessage(error, {
534
+ const prefix = errorLabel();
535
+ stderr(`${prefix}${formatMessage(error, {
535
536
  colors,
536
537
  quotes: !colors,
537
- maxWidth
538
+ maxWidth,
539
+ initialWidth: getDisplayWidth(prefix.split("\n").at(-1) ?? "")
538
540
  })}\n`);
539
541
  if (completionParser) {
540
542
  const displayName = isOptionMode ? completionOptionDisplayName ?? "--completion" : completionCommandDisplayName ?? "completion";
@@ -563,10 +565,12 @@ function handleCompletion(completionArgs, programName, parser, completionParser,
563
565
  available.push(value(name));
564
566
  }
565
567
  const error = message`Unsupported shell ${shellName}. Available shells: ${available}.`;
566
- stderr(`${errorLabel()}${formatMessage(error, {
568
+ const prefix = errorLabel();
569
+ stderr(`${prefix}${formatMessage(error, {
567
570
  colors,
568
571
  quotes: !colors,
569
- maxWidth
572
+ maxWidth,
573
+ initialWidth: getDisplayWidth(prefix.split("\n").at(-1) ?? "")
570
574
  })}`);
571
575
  return dispatchByMode(parser.mode, () => {
572
576
  const result = callOnError(1, error);
@@ -1053,12 +1057,14 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
1053
1057
  maxWidth: maxWidth == null ? void 0 : maxWidth - usageLabelWidth(),
1054
1058
  expandCommands: true
1055
1059
  }), usageLabelWidth())}`);
1060
+ const prefix = errorLabel();
1056
1061
  const errorMessage = formatMessage(validationError, {
1062
+ initialWidth: getDisplayWidth(prefix.split("\n").at(-1) ?? ""),
1057
1063
  maxWidth,
1058
1064
  colors,
1059
1065
  quotes: !colors
1060
1066
  });
1061
- stderr(`${errorLabel()}${errorMessage}`);
1067
+ stderr(`${prefix}${errorMessage}`);
1062
1068
  return onError(1, validationError);
1063
1069
  };
1064
1070
  const displayHelp = (doc) => {
@@ -1171,12 +1177,14 @@ function runParser(parserOrProgram, programNameOrArgs, argsOrOptions, optionsPar
1171
1177
  maxWidth: maxWidth == null ? void 0 : maxWidth - usageLabelWidth(),
1172
1178
  expandCommands: true
1173
1179
  }), usageLabelWidth())}`);
1180
+ const prefix = errorLabel();
1174
1181
  const errorMessage = formatMessage(classified.error, {
1182
+ initialWidth: getDisplayWidth(prefix.split("\n").at(-1) ?? ""),
1175
1183
  maxWidth,
1176
1184
  colors,
1177
1185
  quotes: !colors
1178
1186
  });
1179
- stderr(`${errorLabel()}${errorMessage}`);
1187
+ stderr(`${prefix}${errorMessage}`);
1180
1188
  return onError(1, classified.error);
1181
1189
  };
1182
1190
  if (aboveError === "help") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.3.0-dev.2534",
3
+ "version": "1.3.0-dev.2536",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -237,7 +237,7 @@
237
237
  },
238
238
  "sideEffects": false,
239
239
  "devDependencies": {
240
- "@optique/env": "1.3.0-dev.2534+0daf40ee",
240
+ "@optique/env": "1.3.0-dev.2536+22f9c880",
241
241
  "@types/node": "^24.0.0",
242
242
  "fast-check": "^4.7.0",
243
243
  "tsdown": "^0.13.0",