@optique/core 1.0.0-dev.1901 → 1.0.0-dev.1970

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.
Files changed (77) hide show
  1. package/dist/annotation-state.cjs +115 -60
  2. package/dist/annotation-state.d.cts +24 -0
  3. package/dist/annotation-state.d.ts +24 -0
  4. package/dist/annotation-state.js +114 -60
  5. package/dist/annotations.cjs +2 -267
  6. package/dist/annotations.d.cts +2 -152
  7. package/dist/annotations.d.ts +2 -152
  8. package/dist/annotations.js +2 -256
  9. package/dist/completion.d.cts +1 -1
  10. package/dist/completion.d.ts +1 -1
  11. package/dist/constructs.cjs +206 -238
  12. package/dist/constructs.d.cts +1 -1
  13. package/dist/constructs.d.ts +1 -1
  14. package/dist/constructs.js +96 -128
  15. package/dist/context.d.cts +1 -1
  16. package/dist/context.d.ts +1 -1
  17. package/dist/dependency-metadata.cjs +1 -1
  18. package/dist/dependency-metadata.d.cts +1 -1
  19. package/dist/dependency-metadata.d.ts +1 -1
  20. package/dist/dependency-metadata.js +1 -1
  21. package/dist/dependency-runtime.cjs +2 -2
  22. package/dist/dependency-runtime.js +2 -2
  23. package/dist/dependency.cjs +7 -1111
  24. package/dist/dependency.d.cts +2 -838
  25. package/dist/dependency.d.ts +2 -838
  26. package/dist/dependency.js +2 -1078
  27. package/dist/execution-context.cjs +56 -0
  28. package/dist/execution-context.js +53 -0
  29. package/dist/extension.cjs +87 -0
  30. package/dist/extension.d.cts +97 -0
  31. package/dist/extension.d.ts +97 -0
  32. package/dist/extension.js +76 -0
  33. package/dist/facade.cjs +19 -19
  34. package/dist/facade.d.cts +1 -1
  35. package/dist/facade.d.ts +1 -1
  36. package/dist/facade.js +19 -19
  37. package/dist/index.cjs +4 -41
  38. package/dist/index.d.cts +7 -7
  39. package/dist/index.d.ts +7 -7
  40. package/dist/index.js +5 -5
  41. package/dist/internal/annotations.cjs +316 -0
  42. package/dist/internal/annotations.d.cts +140 -0
  43. package/dist/internal/annotations.d.ts +140 -0
  44. package/dist/internal/annotations.js +306 -0
  45. package/dist/internal/dependency.cjs +984 -0
  46. package/dist/internal/dependency.d.cts +539 -0
  47. package/dist/internal/dependency.d.ts +539 -0
  48. package/dist/internal/dependency.js +964 -0
  49. package/dist/{mode-dispatch.cjs → internal/mode-dispatch.cjs} +1 -3
  50. package/dist/{mode-dispatch.d.cts → internal/mode-dispatch.d.cts} +3 -7
  51. package/dist/{mode-dispatch.d.ts → internal/mode-dispatch.d.ts} +3 -7
  52. package/dist/{mode-dispatch.js → internal/mode-dispatch.js} +1 -3
  53. package/dist/internal/parser.cjs +728 -0
  54. package/dist/internal/parser.d.cts +947 -0
  55. package/dist/internal/parser.d.ts +947 -0
  56. package/dist/internal/parser.js +711 -0
  57. package/dist/modifiers.cjs +108 -125
  58. package/dist/modifiers.d.cts +1 -1
  59. package/dist/modifiers.d.ts +1 -1
  60. package/dist/modifiers.js +92 -109
  61. package/dist/parser.cjs +11 -743
  62. package/dist/parser.d.cts +3 -991
  63. package/dist/parser.d.ts +3 -991
  64. package/dist/parser.js +2 -704
  65. package/dist/phase2-seed.cjs +4 -4
  66. package/dist/phase2-seed.js +4 -4
  67. package/dist/primitives.cjs +39 -74
  68. package/dist/primitives.d.cts +1 -1
  69. package/dist/primitives.d.ts +1 -1
  70. package/dist/primitives.js +26 -61
  71. package/dist/program.d.cts +1 -1
  72. package/dist/program.d.ts +1 -1
  73. package/dist/valueparser.cjs +23 -23
  74. package/dist/valueparser.d.cts +3 -3
  75. package/dist/valueparser.d.ts +3 -3
  76. package/dist/valueparser.js +23 -23
  77. package/package.json +9 -9
@@ -6,12 +6,12 @@ const require_nonempty = require('./nonempty.cjs');
6
6
  * A predicate function that checks if an object is a {@link ValueParser}.
7
7
  * @param object The object to check.
8
8
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
9
- * @throws {TypeError} If the object looks like a value parser (has `$mode`,
9
+ * @throws {TypeError} If the object looks like a value parser (has `mode`,
10
10
  * `metavar`, `parse`, and `format`) but is missing the required
11
11
  * `placeholder` property.
12
12
  */
13
13
  function isValueParser(object) {
14
- if (typeof object !== "object" || object == null || !("$mode" in object) || object.$mode !== "sync" && object.$mode !== "async") return false;
14
+ if (typeof object !== "object" || object == null || !("mode" in object) || object.mode !== "sync" && object.mode !== "async") return false;
15
15
  const hasMetavar = "metavar" in object && typeof object.metavar === "string";
16
16
  const hasParse = "parse" in object && typeof object.parse === "function";
17
17
  const hasFormat = "format" in object && typeof object.format === "function";
@@ -56,7 +56,7 @@ function choice(choices, options = {}) {
56
56
  const numberStrings = numberChoices.map((v) => Object.is(v, -0) ? "-0" : String(v));
57
57
  const frozenNumberChoices = Object.freeze(numberChoices);
58
58
  return {
59
- $mode: "sync",
59
+ mode: "sync",
60
60
  metavar,
61
61
  placeholder: choices[0],
62
62
  choices: frozenNumberChoices,
@@ -138,7 +138,7 @@ function choice(choices, options = {}) {
138
138
  }
139
139
  const stringInvalidChoice = stringOptions.errors?.invalidChoice;
140
140
  return {
141
- $mode: "sync",
141
+ mode: "sync",
142
142
  metavar,
143
143
  placeholder: choices[0],
144
144
  choices: stringChoices,
@@ -300,7 +300,7 @@ function string(options = {}) {
300
300
  const patternFlags = options.pattern?.flags ?? null;
301
301
  const patternMismatch = options.errors?.patternMismatch;
302
302
  return {
303
- $mode: "sync",
303
+ mode: "sync",
304
304
  metavar,
305
305
  placeholder: options.placeholder ?? "",
306
306
  parse(input) {
@@ -373,7 +373,7 @@ function integer(options) {
373
373
  const metavar$1 = options.metavar ?? "INTEGER";
374
374
  require_nonempty.ensureNonEmptyString(metavar$1);
375
375
  return {
376
- $mode: "sync",
376
+ mode: "sync",
377
377
  metavar: metavar$1,
378
378
  placeholder: options?.placeholder ?? (options?.min != null && options.min > 0n ? options.min : options?.max != null && options.max < 0n ? options.max : 0n),
379
379
  parse(input) {
@@ -417,7 +417,7 @@ function integer(options) {
417
417
  };
418
418
  }
419
419
  return {
420
- $mode: "sync",
420
+ mode: "sync",
421
421
  metavar,
422
422
  placeholder: options?.placeholder ?? (firstAllowed > 0 ? firstAllowed : lastAllowed < 0 ? lastAllowed : 0),
423
423
  parse(input) {
@@ -468,7 +468,7 @@ function float(options = {}) {
468
468
  const metavar = options.metavar ?? "NUMBER";
469
469
  require_nonempty.ensureNonEmptyString(metavar);
470
470
  return {
471
- $mode: "sync",
471
+ mode: "sync",
472
472
  metavar,
473
473
  placeholder: options?.placeholder ?? (options?.min != null && options.min > 0 ? options.min : options?.max != null && options.max < 0 ? options.max : 0),
474
474
  parse(input) {
@@ -553,7 +553,7 @@ function url(options = {}) {
553
553
  const invalidUrl = options.errors?.invalidUrl;
554
554
  const disallowedProtocol = options.errors?.disallowedProtocol;
555
555
  return {
556
- $mode: "sync",
556
+ mode: "sync",
557
557
  metavar,
558
558
  get placeholder() {
559
559
  return new URL(`${allowedProtocols?.[0] ?? "http:"}//0.invalid`);
@@ -625,7 +625,7 @@ function locale(options = {}) {
625
625
  const metavar = options.metavar ?? "LOCALE";
626
626
  require_nonempty.ensureNonEmptyString(metavar);
627
627
  return {
628
- $mode: "sync",
628
+ mode: "sync",
629
629
  metavar,
630
630
  placeholder: new Intl.Locale("und"),
631
631
  parse(input) {
@@ -921,7 +921,7 @@ function uuid(options = {}) {
921
921
  const disallowedVersion = options.errors?.disallowedVersion;
922
922
  const invalidVariant = options.errors?.invalidVariant;
923
923
  return {
924
- $mode: "sync",
924
+ mode: "sync",
925
925
  metavar,
926
926
  placeholder: "00000000-0000-0000-0000-000000000000",
927
927
  parse(input) {
@@ -1029,7 +1029,7 @@ function port(options) {
1029
1029
  if (min$1 > max$1) throw new RangeError(`Expected min to be less than or equal to max, but got min: ${min$1} and max: ${max$1}.`);
1030
1030
  if (options.disallowWellKnown && min$1 < 1024n && max$1 < 1024n) throw new RangeError(`disallowWellKnown is incompatible with the configured port range: all ports ${min$1}..${max$1} are well-known.`);
1031
1031
  return {
1032
- $mode: "sync",
1032
+ mode: "sync",
1033
1033
  metavar: metavar$1,
1034
1034
  placeholder: options.placeholder ?? (options.disallowWellKnown && min$1 < 1024n ? 1024n > min$1 ? 1024n : min$1 : min$1),
1035
1035
  parse(input) {
@@ -1069,7 +1069,7 @@ function port(options) {
1069
1069
  if (min > max) throw new RangeError(`Expected min to be less than or equal to max, but got min: ${min} and max: ${max}.`);
1070
1070
  if (options?.disallowWellKnown && min < 1024 && max < 1024) throw new RangeError(`disallowWellKnown is incompatible with the configured port range: all ports ${min}..${max} are well-known.`);
1071
1071
  return {
1072
- $mode: "sync",
1072
+ mode: "sync",
1073
1073
  metavar,
1074
1074
  placeholder: options?.placeholder ?? (options?.disallowWellKnown && min < 1024 ? Math.max(1024, min) : min),
1075
1075
  parse(input) {
@@ -1163,7 +1163,7 @@ function ipv4(options) {
1163
1163
  const allowBroadcast = options?.allowBroadcast ?? true;
1164
1164
  const allowZero = options?.allowZero ?? true;
1165
1165
  return {
1166
- $mode: "sync",
1166
+ mode: "sync",
1167
1167
  metavar,
1168
1168
  placeholder: allowZero ? "0.0.0.0" : allowLoopback ? "127.0.0.1" : "192.0.2.1",
1169
1169
  parse(input) {
@@ -1280,7 +1280,7 @@ function hostname(options) {
1280
1280
  const maxLength = options?.maxLength ?? 253;
1281
1281
  if (!Number.isInteger(maxLength) || maxLength < 1) throw new RangeError("maxLength must be an integer greater than or equal to 1.");
1282
1282
  return {
1283
- $mode: "sync",
1283
+ mode: "sync",
1284
1284
  metavar,
1285
1285
  placeholder: options?.placeholder ?? (allowLocalhost ? maxLength >= 9 ? "localhost" : "a.bc" : maxLength >= 11 ? "example.com" : "a.bc"),
1286
1286
  parse(input) {
@@ -1500,7 +1500,7 @@ function email(options) {
1500
1500
  return result;
1501
1501
  }
1502
1502
  return {
1503
- $mode: "sync",
1503
+ mode: "sync",
1504
1504
  metavar,
1505
1505
  placeholder: options?.placeholder ?? (options?.allowMultiple ? [`user@${options?.allowedDomains?.[0] ?? "example.com"}`] : `user@${options?.allowedDomains?.[0] ?? "example.com"}`),
1506
1506
  parse(input) {
@@ -1735,7 +1735,7 @@ function socketAddress(options) {
1735
1735
  }
1736
1736
  }
1737
1737
  return {
1738
- $mode: "sync",
1738
+ mode: "sync",
1739
1739
  metavar,
1740
1740
  get placeholder() {
1741
1741
  return {
@@ -1973,7 +1973,7 @@ function portRange(options) {
1973
1973
  errors: options?.errors
1974
1974
  });
1975
1975
  return {
1976
- $mode: "sync",
1976
+ mode: "sync",
1977
1977
  metavar,
1978
1978
  get placeholder() {
1979
1979
  return isBigInt ? {
@@ -2181,7 +2181,7 @@ function macAddress(options) {
2181
2181
  return joinOctets(octets, sep);
2182
2182
  }
2183
2183
  const parserObj = {
2184
- $mode: "sync",
2184
+ mode: "sync",
2185
2185
  metavar,
2186
2186
  get placeholder() {
2187
2187
  const octets = [
@@ -2374,7 +2374,7 @@ function domain(options) {
2374
2374
  const subdomainsNotAllowed = options?.errors?.subdomainsNotAllowed;
2375
2375
  const tldNotAllowed = options?.errors?.tldNotAllowed;
2376
2376
  const domainParserObj = {
2377
- $mode: "sync",
2377
+ mode: "sync",
2378
2378
  metavar,
2379
2379
  placeholder: options?.placeholder ?? `example.${allowedTldsLower?.[0] ?? "com"}`,
2380
2380
  parse(input) {
@@ -2658,7 +2658,7 @@ function ipv6(options) {
2658
2658
  const errors = options?.errors;
2659
2659
  const metavar = options?.metavar ?? "IPV6";
2660
2660
  const ipv6ParserObj = {
2661
- $mode: "sync",
2661
+ mode: "sync",
2662
2662
  metavar,
2663
2663
  placeholder: allowZero ? "::" : allowLoopback ? "::1" : "2001:db8::1",
2664
2664
  parse(input) {
@@ -3137,7 +3137,7 @@ function ip(options) {
3137
3137
  zeroNotAllowed: errors?.zeroNotAllowed
3138
3138
  } : void 0;
3139
3139
  const ipParserObj = {
3140
- $mode: "sync",
3140
+ mode: "sync",
3141
3141
  metavar,
3142
3142
  placeholder: version === 6 ? ipv6Parser.placeholder : ipv4Parser.placeholder,
3143
3143
  parse(input) {
@@ -3316,7 +3316,7 @@ function cidr(options) {
3316
3316
  zeroNotAllowed: errors?.zeroNotAllowed
3317
3317
  } : void 0;
3318
3318
  const cidrParserObj = {
3319
- $mode: "sync",
3319
+ mode: "sync",
3320
3320
  metavar,
3321
3321
  get placeholder() {
3322
3322
  return version === 6 || version === "both" && (minPrefix ?? 0) > 32 ? {
@@ -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 { Mode, ModeIterable, ModeValue, Suggestion } from "./internal/parser.cjs";
4
4
 
5
5
  //#region src/valueparser.d.ts
6
6
 
@@ -23,7 +23,7 @@ interface ValueParser<M extends Mode = "sync", T = unknown> {
23
23
  *
24
24
  * @since 0.9.0
25
25
  */
26
- readonly $mode: M;
26
+ readonly mode: M;
27
27
  /**
28
28
  * The metavariable name for this parser. Used in help messages
29
29
  * to indicate what kind of value this parser expects. Usually
@@ -279,7 +279,7 @@ type ChoiceOptions = ChoiceOptionsString;
279
279
  * A predicate function that checks if an object is a {@link ValueParser}.
280
280
  * @param object The object to check.
281
281
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
282
- * @throws {TypeError} If the object looks like a value parser (has `$mode`,
282
+ * @throws {TypeError} If the object looks like a value parser (has `mode`,
283
283
  * `metavar`, `parse`, and `format`) but is missing the required
284
284
  * `placeholder` property.
285
285
  */
@@ -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 { Mode, ModeIterable, ModeValue, Suggestion } from "./internal/parser.js";
4
4
 
5
5
  //#region src/valueparser.d.ts
6
6
 
@@ -23,7 +23,7 @@ interface ValueParser<M extends Mode = "sync", T = unknown> {
23
23
  *
24
24
  * @since 0.9.0
25
25
  */
26
- readonly $mode: M;
26
+ readonly mode: M;
27
27
  /**
28
28
  * The metavariable name for this parser. Used in help messages
29
29
  * to indicate what kind of value this parser expects. Usually
@@ -279,7 +279,7 @@ type ChoiceOptions = ChoiceOptionsString;
279
279
  * A predicate function that checks if an object is a {@link ValueParser}.
280
280
  * @param object The object to check.
281
281
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
282
- * @throws {TypeError} If the object looks like a value parser (has `$mode`,
282
+ * @throws {TypeError} If the object looks like a value parser (has `mode`,
283
283
  * `metavar`, `parse`, and `format`) but is missing the required
284
284
  * `placeholder` property.
285
285
  */
@@ -6,12 +6,12 @@ import { ensureNonEmptyString, isNonEmptyString } from "./nonempty.js";
6
6
  * A predicate function that checks if an object is a {@link ValueParser}.
7
7
  * @param object The object to check.
8
8
  * @return `true` if the object is a {@link ValueParser}, `false` otherwise.
9
- * @throws {TypeError} If the object looks like a value parser (has `$mode`,
9
+ * @throws {TypeError} If the object looks like a value parser (has `mode`,
10
10
  * `metavar`, `parse`, and `format`) but is missing the required
11
11
  * `placeholder` property.
12
12
  */
13
13
  function isValueParser(object) {
14
- if (typeof object !== "object" || object == null || !("$mode" in object) || object.$mode !== "sync" && object.$mode !== "async") return false;
14
+ if (typeof object !== "object" || object == null || !("mode" in object) || object.mode !== "sync" && object.mode !== "async") return false;
15
15
  const hasMetavar = "metavar" in object && typeof object.metavar === "string";
16
16
  const hasParse = "parse" in object && typeof object.parse === "function";
17
17
  const hasFormat = "format" in object && typeof object.format === "function";
@@ -56,7 +56,7 @@ function choice(choices, options = {}) {
56
56
  const numberStrings = numberChoices.map((v) => Object.is(v, -0) ? "-0" : String(v));
57
57
  const frozenNumberChoices = Object.freeze(numberChoices);
58
58
  return {
59
- $mode: "sync",
59
+ mode: "sync",
60
60
  metavar,
61
61
  placeholder: choices[0],
62
62
  choices: frozenNumberChoices,
@@ -138,7 +138,7 @@ function choice(choices, options = {}) {
138
138
  }
139
139
  const stringInvalidChoice = stringOptions.errors?.invalidChoice;
140
140
  return {
141
- $mode: "sync",
141
+ mode: "sync",
142
142
  metavar,
143
143
  placeholder: choices[0],
144
144
  choices: stringChoices,
@@ -300,7 +300,7 @@ function string(options = {}) {
300
300
  const patternFlags = options.pattern?.flags ?? null;
301
301
  const patternMismatch = options.errors?.patternMismatch;
302
302
  return {
303
- $mode: "sync",
303
+ mode: "sync",
304
304
  metavar,
305
305
  placeholder: options.placeholder ?? "",
306
306
  parse(input) {
@@ -373,7 +373,7 @@ function integer(options) {
373
373
  const metavar$1 = options.metavar ?? "INTEGER";
374
374
  ensureNonEmptyString(metavar$1);
375
375
  return {
376
- $mode: "sync",
376
+ mode: "sync",
377
377
  metavar: metavar$1,
378
378
  placeholder: options?.placeholder ?? (options?.min != null && options.min > 0n ? options.min : options?.max != null && options.max < 0n ? options.max : 0n),
379
379
  parse(input) {
@@ -417,7 +417,7 @@ function integer(options) {
417
417
  };
418
418
  }
419
419
  return {
420
- $mode: "sync",
420
+ mode: "sync",
421
421
  metavar,
422
422
  placeholder: options?.placeholder ?? (firstAllowed > 0 ? firstAllowed : lastAllowed < 0 ? lastAllowed : 0),
423
423
  parse(input) {
@@ -468,7 +468,7 @@ function float(options = {}) {
468
468
  const metavar = options.metavar ?? "NUMBER";
469
469
  ensureNonEmptyString(metavar);
470
470
  return {
471
- $mode: "sync",
471
+ mode: "sync",
472
472
  metavar,
473
473
  placeholder: options?.placeholder ?? (options?.min != null && options.min > 0 ? options.min : options?.max != null && options.max < 0 ? options.max : 0),
474
474
  parse(input) {
@@ -553,7 +553,7 @@ function url(options = {}) {
553
553
  const invalidUrl = options.errors?.invalidUrl;
554
554
  const disallowedProtocol = options.errors?.disallowedProtocol;
555
555
  return {
556
- $mode: "sync",
556
+ mode: "sync",
557
557
  metavar,
558
558
  get placeholder() {
559
559
  return new URL(`${allowedProtocols?.[0] ?? "http:"}//0.invalid`);
@@ -625,7 +625,7 @@ function locale(options = {}) {
625
625
  const metavar = options.metavar ?? "LOCALE";
626
626
  ensureNonEmptyString(metavar);
627
627
  return {
628
- $mode: "sync",
628
+ mode: "sync",
629
629
  metavar,
630
630
  placeholder: new Intl.Locale("und"),
631
631
  parse(input) {
@@ -921,7 +921,7 @@ function uuid(options = {}) {
921
921
  const disallowedVersion = options.errors?.disallowedVersion;
922
922
  const invalidVariant = options.errors?.invalidVariant;
923
923
  return {
924
- $mode: "sync",
924
+ mode: "sync",
925
925
  metavar,
926
926
  placeholder: "00000000-0000-0000-0000-000000000000",
927
927
  parse(input) {
@@ -1029,7 +1029,7 @@ function port(options) {
1029
1029
  if (min$1 > max$1) throw new RangeError(`Expected min to be less than or equal to max, but got min: ${min$1} and max: ${max$1}.`);
1030
1030
  if (options.disallowWellKnown && min$1 < 1024n && max$1 < 1024n) throw new RangeError(`disallowWellKnown is incompatible with the configured port range: all ports ${min$1}..${max$1} are well-known.`);
1031
1031
  return {
1032
- $mode: "sync",
1032
+ mode: "sync",
1033
1033
  metavar: metavar$1,
1034
1034
  placeholder: options.placeholder ?? (options.disallowWellKnown && min$1 < 1024n ? 1024n > min$1 ? 1024n : min$1 : min$1),
1035
1035
  parse(input) {
@@ -1069,7 +1069,7 @@ function port(options) {
1069
1069
  if (min > max) throw new RangeError(`Expected min to be less than or equal to max, but got min: ${min} and max: ${max}.`);
1070
1070
  if (options?.disallowWellKnown && min < 1024 && max < 1024) throw new RangeError(`disallowWellKnown is incompatible with the configured port range: all ports ${min}..${max} are well-known.`);
1071
1071
  return {
1072
- $mode: "sync",
1072
+ mode: "sync",
1073
1073
  metavar,
1074
1074
  placeholder: options?.placeholder ?? (options?.disallowWellKnown && min < 1024 ? Math.max(1024, min) : min),
1075
1075
  parse(input) {
@@ -1163,7 +1163,7 @@ function ipv4(options) {
1163
1163
  const allowBroadcast = options?.allowBroadcast ?? true;
1164
1164
  const allowZero = options?.allowZero ?? true;
1165
1165
  return {
1166
- $mode: "sync",
1166
+ mode: "sync",
1167
1167
  metavar,
1168
1168
  placeholder: allowZero ? "0.0.0.0" : allowLoopback ? "127.0.0.1" : "192.0.2.1",
1169
1169
  parse(input) {
@@ -1280,7 +1280,7 @@ function hostname(options) {
1280
1280
  const maxLength = options?.maxLength ?? 253;
1281
1281
  if (!Number.isInteger(maxLength) || maxLength < 1) throw new RangeError("maxLength must be an integer greater than or equal to 1.");
1282
1282
  return {
1283
- $mode: "sync",
1283
+ mode: "sync",
1284
1284
  metavar,
1285
1285
  placeholder: options?.placeholder ?? (allowLocalhost ? maxLength >= 9 ? "localhost" : "a.bc" : maxLength >= 11 ? "example.com" : "a.bc"),
1286
1286
  parse(input) {
@@ -1500,7 +1500,7 @@ function email(options) {
1500
1500
  return result;
1501
1501
  }
1502
1502
  return {
1503
- $mode: "sync",
1503
+ mode: "sync",
1504
1504
  metavar,
1505
1505
  placeholder: options?.placeholder ?? (options?.allowMultiple ? [`user@${options?.allowedDomains?.[0] ?? "example.com"}`] : `user@${options?.allowedDomains?.[0] ?? "example.com"}`),
1506
1506
  parse(input) {
@@ -1735,7 +1735,7 @@ function socketAddress(options) {
1735
1735
  }
1736
1736
  }
1737
1737
  return {
1738
- $mode: "sync",
1738
+ mode: "sync",
1739
1739
  metavar,
1740
1740
  get placeholder() {
1741
1741
  return {
@@ -1973,7 +1973,7 @@ function portRange(options) {
1973
1973
  errors: options?.errors
1974
1974
  });
1975
1975
  return {
1976
- $mode: "sync",
1976
+ mode: "sync",
1977
1977
  metavar,
1978
1978
  get placeholder() {
1979
1979
  return isBigInt ? {
@@ -2181,7 +2181,7 @@ function macAddress(options) {
2181
2181
  return joinOctets(octets, sep);
2182
2182
  }
2183
2183
  const parserObj = {
2184
- $mode: "sync",
2184
+ mode: "sync",
2185
2185
  metavar,
2186
2186
  get placeholder() {
2187
2187
  const octets = [
@@ -2374,7 +2374,7 @@ function domain(options) {
2374
2374
  const subdomainsNotAllowed = options?.errors?.subdomainsNotAllowed;
2375
2375
  const tldNotAllowed = options?.errors?.tldNotAllowed;
2376
2376
  const domainParserObj = {
2377
- $mode: "sync",
2377
+ mode: "sync",
2378
2378
  metavar,
2379
2379
  placeholder: options?.placeholder ?? `example.${allowedTldsLower?.[0] ?? "com"}`,
2380
2380
  parse(input) {
@@ -2658,7 +2658,7 @@ function ipv6(options) {
2658
2658
  const errors = options?.errors;
2659
2659
  const metavar = options?.metavar ?? "IPV6";
2660
2660
  const ipv6ParserObj = {
2661
- $mode: "sync",
2661
+ mode: "sync",
2662
2662
  metavar,
2663
2663
  placeholder: allowZero ? "::" : allowLoopback ? "::1" : "2001:db8::1",
2664
2664
  parse(input) {
@@ -3137,7 +3137,7 @@ function ip(options) {
3137
3137
  zeroNotAllowed: errors?.zeroNotAllowed
3138
3138
  } : void 0;
3139
3139
  const ipParserObj = {
3140
- $mode: "sync",
3140
+ mode: "sync",
3141
3141
  metavar,
3142
3142
  placeholder: version === 6 ? ipv6Parser.placeholder : ipv4Parser.placeholder,
3143
3143
  parse(input) {
@@ -3316,7 +3316,7 @@ function cidr(options) {
3316
3316
  zeroNotAllowed: errors?.zeroNotAllowed
3317
3317
  } : void 0;
3318
3318
  const cidrParserObj = {
3319
- $mode: "sync",
3319
+ mode: "sync",
3320
3320
  metavar,
3321
3321
  get placeholder() {
3322
3322
  return version === 6 || version === "both" && (minPrefix ?? 0) > 32 ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.0-dev.1901+a2ce4da0",
3
+ "version": "1.0.0-dev.1970+0182ae32",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -99,6 +99,14 @@
99
99
  "import": "./dist/doc.js",
100
100
  "require": "./dist/doc.cjs"
101
101
  },
102
+ "./extension": {
103
+ "types": {
104
+ "import": "./dist/extension.d.ts",
105
+ "require": "./dist/extension.d.cts"
106
+ },
107
+ "import": "./dist/extension.js",
108
+ "require": "./dist/extension.cjs"
109
+ },
102
110
  "./facade": {
103
111
  "types": {
104
112
  "import": "./dist/facade.d.ts",
@@ -115,14 +123,6 @@
115
123
  "import": "./dist/message.js",
116
124
  "require": "./dist/message.cjs"
117
125
  },
118
- "./mode-dispatch": {
119
- "types": {
120
- "import": "./dist/mode-dispatch.d.ts",
121
- "require": "./dist/mode-dispatch.d.cts"
122
- },
123
- "import": "./dist/mode-dispatch.js",
124
- "require": "./dist/mode-dispatch.cjs"
125
- },
126
126
  "./modifiers": {
127
127
  "types": {
128
128
  "import": "./dist/modifiers.d.ts",