@optique/core 0.9.0-dev.215 → 0.9.0-dev.224

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.
@@ -8,7 +8,7 @@ const require_nonempty = require('./nonempty.cjs');
8
8
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
9
9
  */
10
10
  function isValueParser(object) {
11
- return typeof object === "object" && object != null && "$mode" in object && (object.$mode === "sync" || object.$mode === "async") && "metavar" in object && typeof object.metavar === "string" && "parse" in object && typeof object.parse === "function" && "format" in object && typeof object.format === "function";
11
+ return typeof object === "object" && object != null && "metavar" in object && typeof object.metavar === "string" && "parse" in object && typeof object.parse === "function" && "format" in object && typeof object.format === "function";
12
12
  }
13
13
  /**
14
14
  * Implementation of the choice parser for both string and number types.
@@ -21,7 +21,6 @@ function choice(choices, options = {}) {
21
21
  const numberChoices = choices;
22
22
  const numberOptions = options;
23
23
  return {
24
- $mode: "sync",
25
24
  metavar,
26
25
  parse(input) {
27
26
  const parsed = Number(input);
@@ -54,7 +53,6 @@ function choice(choices, options = {}) {
54
53
  const stringOptions = options;
55
54
  const normalizedValues = stringOptions.caseInsensitive ? stringChoices.map((v) => v.toLowerCase()) : stringChoices;
56
55
  return {
57
- $mode: "sync",
58
56
  metavar,
59
57
  parse(input) {
60
58
  const normalizedInput = stringOptions.caseInsensitive ? input.toLowerCase() : input;
@@ -101,12 +99,8 @@ function formatNumberChoiceError(input, choices, options) {
101
99
  * Formats default error message for choice parser.
102
100
  */
103
101
  function formatDefaultChoiceError(input, choices) {
104
- let choicesList = [];
105
- for (let i = 0; i < choices.length; i++) {
106
- if (i > 0) choicesList = [...choicesList, ...require_message.message`, `];
107
- choicesList = [...choicesList, ...require_message.message`${String(choices[i])}`];
108
- }
109
- return require_message.message`Expected one of ${choicesList}, but got ${input}.`;
102
+ const choiceStrings = choices.map((c) => String(c));
103
+ return require_message.message`Expected one of ${require_message.valueSet(choiceStrings, { locale: "en-US" })}, but got ${input}.`;
110
104
  }
111
105
  /**
112
106
  * Creates a {@link ValueParser} for strings.
@@ -126,7 +120,6 @@ function string(options = {}) {
126
120
  const metavar = options.metavar ?? "STRING";
127
121
  require_nonempty.ensureNonEmptyString(metavar);
128
122
  return {
129
- $mode: "sync",
130
123
  metavar,
131
124
  parse(input) {
132
125
  if (options.pattern != null && !options.pattern.test(input)) return {
@@ -181,7 +174,6 @@ function integer(options) {
181
174
  const metavar$1 = options.metavar ?? "INTEGER";
182
175
  require_nonempty.ensureNonEmptyString(metavar$1);
183
176
  return {
184
- $mode: "sync",
185
177
  metavar: metavar$1,
186
178
  parse(input) {
187
179
  let value;
@@ -215,7 +207,6 @@ function integer(options) {
215
207
  const metavar = options?.metavar ?? "INTEGER";
216
208
  require_nonempty.ensureNonEmptyString(metavar);
217
209
  return {
218
- $mode: "sync",
219
210
  metavar,
220
211
  parse(input) {
221
212
  if (!input.match(/^-?\d+$/)) return {
@@ -255,7 +246,6 @@ function float(options = {}) {
255
246
  const metavar = options.metavar ?? "NUMBER";
256
247
  require_nonempty.ensureNonEmptyString(metavar);
257
248
  return {
258
- $mode: "sync",
259
249
  metavar,
260
250
  parse(input) {
261
251
  let value;
@@ -305,7 +295,6 @@ function url(options = {}) {
305
295
  const metavar = options.metavar ?? "URL";
306
296
  require_nonempty.ensureNonEmptyString(metavar);
307
297
  return {
308
- $mode: "sync",
309
298
  metavar,
310
299
  parse(input) {
311
300
  if (!URL.canParse(input)) return {
@@ -350,7 +339,6 @@ function locale(options = {}) {
350
339
  const metavar = options.metavar ?? "LOCALE";
351
340
  require_nonempty.ensureNonEmptyString(metavar);
352
341
  return {
353
- $mode: "sync",
354
342
  metavar,
355
343
  parse(input) {
356
344
  let locale$1;
@@ -620,7 +608,6 @@ function uuid(options = {}) {
620
608
  const metavar = options.metavar ?? "UUID";
621
609
  require_nonempty.ensureNonEmptyString(metavar);
622
610
  return {
623
- $mode: "sync",
624
611
  metavar,
625
612
  parse(input) {
626
613
  if (!uuidRegex.test(input)) return {
@@ -1,6 +1,6 @@
1
1
  import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonempty.cjs";
2
2
  import { Message } from "./message.cjs";
3
- import { Mode, ModeIterable, ModeValue, Suggestion } from "./parser.cjs";
3
+ import { Suggestion } from "./parser.cjs";
4
4
 
5
5
  //#region src/valueparser.d.ts
6
6
 
@@ -10,20 +10,9 @@ import { Mode, ModeIterable, ModeValue, Suggestion } from "./parser.cjs";
10
10
  * A `ValueParser` is responsible for converting string input (typically from
11
11
  * CLI arguments or option values) into strongly-typed values of type {@link T}.
12
12
  *
13
- * @template M The execution mode of the parser (`"sync"` or `"async"`).
14
13
  * @template T The type of value this parser produces.
15
- * @since 0.9.0 Added the `M` type parameter for sync/async mode support.
16
14
  */
17
- interface ValueParser<M extends Mode = "sync", T = unknown> {
18
- /**
19
- * The execution mode of this value parser.
20
- *
21
- * - `"sync"`: The `parse` method returns values directly.
22
- * - `"async"`: The `parse` method returns Promises.
23
- *
24
- * @since 0.9.0
25
- */
26
- readonly $mode: M;
15
+ interface ValueParser<T> {
27
16
  /**
28
17
  * The metavariable name for this parser. Used in help messages
29
18
  * to indicate what kind of value this parser expects. Usually
@@ -36,10 +25,9 @@ interface ValueParser<M extends Mode = "sync", T = unknown> {
36
25
  * @param input The string input to parse
37
26
  * (e.g., the `value` part of `--option=value`).
38
27
  * @returns A result object indicating success or failure with an error
39
- * message. In async mode, returns a Promise that resolves to
40
- * the result.
28
+ * message.
41
29
  */
42
- parse(input: string): ModeValue<M, ValueParserResult<T>>;
30
+ parse(input: string): ValueParserResult<T>;
43
31
  /**
44
32
  * Formats a value of type {@link T} into a string representation.
45
33
  * This is useful for displaying the value in help messages or
@@ -55,10 +43,9 @@ interface ValueParser<M extends Mode = "sync", T = unknown> {
55
43
  *
56
44
  * @param prefix The current input prefix to complete.
57
45
  * @returns An iterable of suggestion objects.
58
- * In async mode, returns an AsyncIterable.
59
46
  * @since 0.6.0
60
47
  */
61
- suggest?(prefix: string): ModeIterable<M, Suggestion>;
48
+ suggest?(prefix: string): Iterable<Suggestion>;
62
49
  }
63
50
  /**
64
51
  * Result type returned by {@link ValueParser#parse}.
@@ -184,7 +171,7 @@ type ChoiceOptions = ChoiceOptionsString;
184
171
  * @param object The object to check.
185
172
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
186
173
  */
187
- declare function isValueParser<M extends Mode, T>(object: unknown): object is ValueParser<M, T>;
174
+ declare function isValueParser<T>(object: unknown): object is ValueParser<T>;
188
175
  /**
189
176
  * Creates a {@link ValueParser} that accepts one of multiple
190
177
  * string values, so-called enumerated values.
@@ -197,7 +184,7 @@ declare function isValueParser<M extends Mode, T>(object: unknown): object is Va
197
184
  * @returns A {@link ValueParser} that checks if the input matches one of the
198
185
  * specified values.
199
186
  */
200
- declare function choice<const T extends string>(choices: readonly T[], options?: ChoiceOptionsString): ValueParser<"sync", T>;
187
+ declare function choice<const T extends string>(choices: readonly T[], options?: ChoiceOptionsString): ValueParser<T>;
201
188
  /**
202
189
  * Creates a {@link ValueParser} that accepts one of multiple
203
190
  * number values.
@@ -211,7 +198,7 @@ declare function choice<const T extends string>(choices: readonly T[], options?:
211
198
  * specified values.
212
199
  * @since 0.9.0
213
200
  */
214
- declare function choice<const T extends number>(choices: readonly T[], options?: ChoiceOptionsNumber): ValueParser<"sync", T>;
201
+ declare function choice<const T extends number>(choices: readonly T[], options?: ChoiceOptionsNumber): ValueParser<T>;
215
202
  /**
216
203
  * Creates a {@link ValueParser} for strings.
217
204
  *
@@ -226,7 +213,7 @@ declare function choice<const T extends number>(choices: readonly T[], options?:
226
213
  * @returns A {@link ValueParser} that parses strings according to the
227
214
  * specified options.
228
215
  */
229
- declare function string(options?: StringOptions): ValueParser<"sync", string>;
216
+ declare function string(options?: StringOptions): ValueParser<string>;
230
217
  /**
231
218
  * Options for creating an integer parser that returns a JavaScript `number`.
232
219
  *
@@ -338,14 +325,14 @@ interface IntegerOptionsBigInt {
338
325
  * @param options Configuration options for the integer parser.
339
326
  * @returns A {@link ValueParser} that parses strings into numbers.
340
327
  */
341
- declare function integer(options?: IntegerOptionsNumber): ValueParser<"sync", number>;
328
+ declare function integer(options?: IntegerOptionsNumber): ValueParser<number>;
342
329
  /**
343
330
  * Creates a ValueParser for integers that returns `bigint` values.
344
331
  *
345
332
  * @param options Configuration options for the `bigint` parser.
346
333
  * @returns A {@link ValueParser} that parses strings into `bigint` values.
347
334
  */
348
- declare function integer(options: IntegerOptionsBigInt): ValueParser<"sync", bigint>;
335
+ declare function integer(options: IntegerOptionsBigInt): ValueParser<bigint>;
349
336
  /**
350
337
  * Options for creating a {@link float} parser.
351
338
  */
@@ -415,7 +402,7 @@ interface FloatOptions {
415
402
  * @returns A {@link ValueParser} that parses strings into floating-point
416
403
  * numbers.
417
404
  */
418
- declare function float(options?: FloatOptions): ValueParser<"sync", number>;
405
+ declare function float(options?: FloatOptions): ValueParser<number>;
419
406
  /**
420
407
  * Options for creating a {@link url} parser.
421
408
  */
@@ -462,7 +449,7 @@ interface UrlOptions {
462
449
  * @param options Configuration options for the URL parser.
463
450
  * @returns A {@link ValueParser} that converts string input to `URL` objects.
464
451
  */
465
- declare function url(options?: UrlOptions): ValueParser<"sync", URL>;
452
+ declare function url(options?: UrlOptions): ValueParser<URL>;
466
453
  /**
467
454
  * Options for creating a {@link locale} parser.
468
455
  */
@@ -497,7 +484,7 @@ interface LocaleOptions {
497
484
  * @returns A {@link ValueParser} that converts string input to `Intl.Locale`
498
485
  * objects.
499
486
  */
500
- declare function locale(options?: LocaleOptions): ValueParser<"sync", Intl.Locale>;
487
+ declare function locale(options?: LocaleOptions): ValueParser<Intl.Locale>;
501
488
  /**
502
489
  * Type representing a UUID string.
503
490
  *
@@ -554,6 +541,6 @@ interface UuidOptions {
554
541
  * @returns A {@link ValueParser} that converts string input to {@link Uuid}
555
542
  * strings.
556
543
  */
557
- declare function uuid(options?: UuidOptions): ValueParser<"sync", Uuid>;
544
+ declare function uuid(options?: UuidOptions): ValueParser<Uuid>;
558
545
  //#endregion
559
- export { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, type Mode, type ModeIterable, type ModeValue, type NonEmptyString, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, ensureNonEmptyString, float, integer, isNonEmptyString, isValueParser, locale, string, url, uuid };
546
+ export { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, type NonEmptyString, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, ensureNonEmptyString, float, integer, isNonEmptyString, isValueParser, locale, string, url, uuid };
@@ -1,6 +1,6 @@
1
1
  import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonempty.js";
2
2
  import { Message } from "./message.js";
3
- import { Mode, ModeIterable, ModeValue, Suggestion } from "./parser.js";
3
+ import { Suggestion } from "./parser.js";
4
4
 
5
5
  //#region src/valueparser.d.ts
6
6
 
@@ -10,20 +10,9 @@ import { Mode, ModeIterable, ModeValue, Suggestion } from "./parser.js";
10
10
  * A `ValueParser` is responsible for converting string input (typically from
11
11
  * CLI arguments or option values) into strongly-typed values of type {@link T}.
12
12
  *
13
- * @template M The execution mode of the parser (`"sync"` or `"async"`).
14
13
  * @template T The type of value this parser produces.
15
- * @since 0.9.0 Added the `M` type parameter for sync/async mode support.
16
14
  */
17
- interface ValueParser<M extends Mode = "sync", T = unknown> {
18
- /**
19
- * The execution mode of this value parser.
20
- *
21
- * - `"sync"`: The `parse` method returns values directly.
22
- * - `"async"`: The `parse` method returns Promises.
23
- *
24
- * @since 0.9.0
25
- */
26
- readonly $mode: M;
15
+ interface ValueParser<T> {
27
16
  /**
28
17
  * The metavariable name for this parser. Used in help messages
29
18
  * to indicate what kind of value this parser expects. Usually
@@ -36,10 +25,9 @@ interface ValueParser<M extends Mode = "sync", T = unknown> {
36
25
  * @param input The string input to parse
37
26
  * (e.g., the `value` part of `--option=value`).
38
27
  * @returns A result object indicating success or failure with an error
39
- * message. In async mode, returns a Promise that resolves to
40
- * the result.
28
+ * message.
41
29
  */
42
- parse(input: string): ModeValue<M, ValueParserResult<T>>;
30
+ parse(input: string): ValueParserResult<T>;
43
31
  /**
44
32
  * Formats a value of type {@link T} into a string representation.
45
33
  * This is useful for displaying the value in help messages or
@@ -55,10 +43,9 @@ interface ValueParser<M extends Mode = "sync", T = unknown> {
55
43
  *
56
44
  * @param prefix The current input prefix to complete.
57
45
  * @returns An iterable of suggestion objects.
58
- * In async mode, returns an AsyncIterable.
59
46
  * @since 0.6.0
60
47
  */
61
- suggest?(prefix: string): ModeIterable<M, Suggestion>;
48
+ suggest?(prefix: string): Iterable<Suggestion>;
62
49
  }
63
50
  /**
64
51
  * Result type returned by {@link ValueParser#parse}.
@@ -184,7 +171,7 @@ type ChoiceOptions = ChoiceOptionsString;
184
171
  * @param object The object to check.
185
172
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
186
173
  */
187
- declare function isValueParser<M extends Mode, T>(object: unknown): object is ValueParser<M, T>;
174
+ declare function isValueParser<T>(object: unknown): object is ValueParser<T>;
188
175
  /**
189
176
  * Creates a {@link ValueParser} that accepts one of multiple
190
177
  * string values, so-called enumerated values.
@@ -197,7 +184,7 @@ declare function isValueParser<M extends Mode, T>(object: unknown): object is Va
197
184
  * @returns A {@link ValueParser} that checks if the input matches one of the
198
185
  * specified values.
199
186
  */
200
- declare function choice<const T extends string>(choices: readonly T[], options?: ChoiceOptionsString): ValueParser<"sync", T>;
187
+ declare function choice<const T extends string>(choices: readonly T[], options?: ChoiceOptionsString): ValueParser<T>;
201
188
  /**
202
189
  * Creates a {@link ValueParser} that accepts one of multiple
203
190
  * number values.
@@ -211,7 +198,7 @@ declare function choice<const T extends string>(choices: readonly T[], options?:
211
198
  * specified values.
212
199
  * @since 0.9.0
213
200
  */
214
- declare function choice<const T extends number>(choices: readonly T[], options?: ChoiceOptionsNumber): ValueParser<"sync", T>;
201
+ declare function choice<const T extends number>(choices: readonly T[], options?: ChoiceOptionsNumber): ValueParser<T>;
215
202
  /**
216
203
  * Creates a {@link ValueParser} for strings.
217
204
  *
@@ -226,7 +213,7 @@ declare function choice<const T extends number>(choices: readonly T[], options?:
226
213
  * @returns A {@link ValueParser} that parses strings according to the
227
214
  * specified options.
228
215
  */
229
- declare function string(options?: StringOptions): ValueParser<"sync", string>;
216
+ declare function string(options?: StringOptions): ValueParser<string>;
230
217
  /**
231
218
  * Options for creating an integer parser that returns a JavaScript `number`.
232
219
  *
@@ -338,14 +325,14 @@ interface IntegerOptionsBigInt {
338
325
  * @param options Configuration options for the integer parser.
339
326
  * @returns A {@link ValueParser} that parses strings into numbers.
340
327
  */
341
- declare function integer(options?: IntegerOptionsNumber): ValueParser<"sync", number>;
328
+ declare function integer(options?: IntegerOptionsNumber): ValueParser<number>;
342
329
  /**
343
330
  * Creates a ValueParser for integers that returns `bigint` values.
344
331
  *
345
332
  * @param options Configuration options for the `bigint` parser.
346
333
  * @returns A {@link ValueParser} that parses strings into `bigint` values.
347
334
  */
348
- declare function integer(options: IntegerOptionsBigInt): ValueParser<"sync", bigint>;
335
+ declare function integer(options: IntegerOptionsBigInt): ValueParser<bigint>;
349
336
  /**
350
337
  * Options for creating a {@link float} parser.
351
338
  */
@@ -415,7 +402,7 @@ interface FloatOptions {
415
402
  * @returns A {@link ValueParser} that parses strings into floating-point
416
403
  * numbers.
417
404
  */
418
- declare function float(options?: FloatOptions): ValueParser<"sync", number>;
405
+ declare function float(options?: FloatOptions): ValueParser<number>;
419
406
  /**
420
407
  * Options for creating a {@link url} parser.
421
408
  */
@@ -462,7 +449,7 @@ interface UrlOptions {
462
449
  * @param options Configuration options for the URL parser.
463
450
  * @returns A {@link ValueParser} that converts string input to `URL` objects.
464
451
  */
465
- declare function url(options?: UrlOptions): ValueParser<"sync", URL>;
452
+ declare function url(options?: UrlOptions): ValueParser<URL>;
466
453
  /**
467
454
  * Options for creating a {@link locale} parser.
468
455
  */
@@ -497,7 +484,7 @@ interface LocaleOptions {
497
484
  * @returns A {@link ValueParser} that converts string input to `Intl.Locale`
498
485
  * objects.
499
486
  */
500
- declare function locale(options?: LocaleOptions): ValueParser<"sync", Intl.Locale>;
487
+ declare function locale(options?: LocaleOptions): ValueParser<Intl.Locale>;
501
488
  /**
502
489
  * Type representing a UUID string.
503
490
  *
@@ -554,6 +541,6 @@ interface UuidOptions {
554
541
  * @returns A {@link ValueParser} that converts string input to {@link Uuid}
555
542
  * strings.
556
543
  */
557
- declare function uuid(options?: UuidOptions): ValueParser<"sync", Uuid>;
544
+ declare function uuid(options?: UuidOptions): ValueParser<Uuid>;
558
545
  //#endregion
559
- export { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, type Mode, type ModeIterable, type ModeValue, type NonEmptyString, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, ensureNonEmptyString, float, integer, isNonEmptyString, isValueParser, locale, string, url, uuid };
546
+ export { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, FloatOptions, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, type NonEmptyString, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, choice, ensureNonEmptyString, float, integer, isNonEmptyString, isValueParser, locale, string, url, uuid };
@@ -1,4 +1,4 @@
1
- import { message, text } from "./message.js";
1
+ import { message, text, valueSet } from "./message.js";
2
2
  import { ensureNonEmptyString, isNonEmptyString } from "./nonempty.js";
3
3
 
4
4
  //#region src/valueparser.ts
@@ -8,7 +8,7 @@ import { ensureNonEmptyString, isNonEmptyString } from "./nonempty.js";
8
8
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
9
9
  */
10
10
  function isValueParser(object) {
11
- return typeof object === "object" && object != null && "$mode" in object && (object.$mode === "sync" || object.$mode === "async") && "metavar" in object && typeof object.metavar === "string" && "parse" in object && typeof object.parse === "function" && "format" in object && typeof object.format === "function";
11
+ return typeof object === "object" && object != null && "metavar" in object && typeof object.metavar === "string" && "parse" in object && typeof object.parse === "function" && "format" in object && typeof object.format === "function";
12
12
  }
13
13
  /**
14
14
  * Implementation of the choice parser for both string and number types.
@@ -21,7 +21,6 @@ function choice(choices, options = {}) {
21
21
  const numberChoices = choices;
22
22
  const numberOptions = options;
23
23
  return {
24
- $mode: "sync",
25
24
  metavar,
26
25
  parse(input) {
27
26
  const parsed = Number(input);
@@ -54,7 +53,6 @@ function choice(choices, options = {}) {
54
53
  const stringOptions = options;
55
54
  const normalizedValues = stringOptions.caseInsensitive ? stringChoices.map((v) => v.toLowerCase()) : stringChoices;
56
55
  return {
57
- $mode: "sync",
58
56
  metavar,
59
57
  parse(input) {
60
58
  const normalizedInput = stringOptions.caseInsensitive ? input.toLowerCase() : input;
@@ -101,12 +99,8 @@ function formatNumberChoiceError(input, choices, options) {
101
99
  * Formats default error message for choice parser.
102
100
  */
103
101
  function formatDefaultChoiceError(input, choices) {
104
- let choicesList = [];
105
- for (let i = 0; i < choices.length; i++) {
106
- if (i > 0) choicesList = [...choicesList, ...message`, `];
107
- choicesList = [...choicesList, ...message`${String(choices[i])}`];
108
- }
109
- return message`Expected one of ${choicesList}, but got ${input}.`;
102
+ const choiceStrings = choices.map((c) => String(c));
103
+ return message`Expected one of ${valueSet(choiceStrings, { locale: "en-US" })}, but got ${input}.`;
110
104
  }
111
105
  /**
112
106
  * Creates a {@link ValueParser} for strings.
@@ -126,7 +120,6 @@ function string(options = {}) {
126
120
  const metavar = options.metavar ?? "STRING";
127
121
  ensureNonEmptyString(metavar);
128
122
  return {
129
- $mode: "sync",
130
123
  metavar,
131
124
  parse(input) {
132
125
  if (options.pattern != null && !options.pattern.test(input)) return {
@@ -181,7 +174,6 @@ function integer(options) {
181
174
  const metavar$1 = options.metavar ?? "INTEGER";
182
175
  ensureNonEmptyString(metavar$1);
183
176
  return {
184
- $mode: "sync",
185
177
  metavar: metavar$1,
186
178
  parse(input) {
187
179
  let value;
@@ -215,7 +207,6 @@ function integer(options) {
215
207
  const metavar = options?.metavar ?? "INTEGER";
216
208
  ensureNonEmptyString(metavar);
217
209
  return {
218
- $mode: "sync",
219
210
  metavar,
220
211
  parse(input) {
221
212
  if (!input.match(/^-?\d+$/)) return {
@@ -255,7 +246,6 @@ function float(options = {}) {
255
246
  const metavar = options.metavar ?? "NUMBER";
256
247
  ensureNonEmptyString(metavar);
257
248
  return {
258
- $mode: "sync",
259
249
  metavar,
260
250
  parse(input) {
261
251
  let value;
@@ -305,7 +295,6 @@ function url(options = {}) {
305
295
  const metavar = options.metavar ?? "URL";
306
296
  ensureNonEmptyString(metavar);
307
297
  return {
308
- $mode: "sync",
309
298
  metavar,
310
299
  parse(input) {
311
300
  if (!URL.canParse(input)) return {
@@ -350,7 +339,6 @@ function locale(options = {}) {
350
339
  const metavar = options.metavar ?? "LOCALE";
351
340
  ensureNonEmptyString(metavar);
352
341
  return {
353
- $mode: "sync",
354
342
  metavar,
355
343
  parse(input) {
356
344
  let locale$1;
@@ -620,7 +608,6 @@ function uuid(options = {}) {
620
608
  const metavar = options.metavar ?? "UUID";
621
609
  ensureNonEmptyString(metavar);
622
610
  return {
623
- $mode: "sync",
624
611
  metavar,
625
612
  parse(input) {
626
613
  if (!uuidRegex.test(input)) return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.9.0-dev.215+13b302c0",
3
+ "version": "0.9.0-dev.224+d01487f2",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",