@optique/core 1.0.0-dev.908 → 1.0.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/dist/annotation-state.cjs +425 -0
- package/dist/annotation-state.d.cts +24 -0
- package/dist/annotation-state.d.ts +24 -0
- package/dist/annotation-state.js +414 -0
- package/dist/annotations.cjs +2 -248
- package/dist/annotations.d.cts +2 -137
- package/dist/annotations.d.ts +2 -137
- package/dist/annotations.js +2 -238
- package/dist/completion.cjs +611 -100
- package/dist/completion.d.cts +1 -1
- package/dist/completion.d.ts +1 -1
- package/dist/completion.js +611 -100
- package/dist/constructs.cjs +3338 -827
- package/dist/constructs.d.cts +48 -7
- package/dist/constructs.d.ts +48 -7
- package/dist/constructs.js +3338 -827
- package/dist/context.cjs +0 -23
- package/dist/context.d.cts +119 -53
- package/dist/context.d.ts +119 -53
- package/dist/context.js +0 -22
- package/dist/dependency-metadata.cjs +139 -0
- package/dist/dependency-metadata.d.cts +112 -0
- package/dist/dependency-metadata.d.ts +112 -0
- package/dist/dependency-metadata.js +138 -0
- package/dist/dependency-runtime.cjs +698 -0
- package/dist/dependency-runtime.d.cts +149 -0
- package/dist/dependency-runtime.d.ts +149 -0
- package/dist/dependency-runtime.js +687 -0
- package/dist/dependency.cjs +7 -928
- package/dist/dependency.d.cts +2 -794
- package/dist/dependency.d.ts +2 -794
- package/dist/dependency.js +2 -899
- package/dist/displaywidth.cjs +44 -0
- package/dist/displaywidth.js +43 -0
- package/dist/doc.cjs +285 -23
- package/dist/doc.d.cts +57 -2
- package/dist/doc.d.ts +57 -2
- package/dist/doc.js +283 -25
- package/dist/execution-context.cjs +56 -0
- package/dist/execution-context.js +53 -0
- package/dist/extension.cjs +87 -0
- package/dist/extension.d.cts +97 -0
- package/dist/extension.d.ts +97 -0
- package/dist/extension.js +76 -0
- package/dist/facade.cjs +718 -523
- package/dist/facade.d.cts +87 -18
- package/dist/facade.d.ts +87 -18
- package/dist/facade.js +718 -523
- package/dist/index.cjs +14 -29
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +7 -7
- package/dist/input-trace.cjs +56 -0
- package/dist/input-trace.d.cts +77 -0
- package/dist/input-trace.d.ts +77 -0
- package/dist/input-trace.js +55 -0
- package/dist/internal/annotations.cjs +316 -0
- package/dist/internal/annotations.d.cts +140 -0
- package/dist/internal/annotations.d.ts +140 -0
- package/dist/internal/annotations.js +306 -0
- package/dist/internal/dependency.cjs +984 -0
- package/dist/internal/dependency.d.cts +539 -0
- package/dist/internal/dependency.d.ts +539 -0
- package/dist/internal/dependency.js +964 -0
- package/dist/{mode-dispatch.cjs → internal/mode-dispatch.cjs} +1 -3
- package/dist/{mode-dispatch.d.cts → internal/mode-dispatch.d.cts} +3 -7
- package/dist/{mode-dispatch.d.ts → internal/mode-dispatch.d.ts} +3 -7
- package/dist/{mode-dispatch.js → internal/mode-dispatch.js} +1 -3
- package/dist/internal/parser.cjs +728 -0
- package/dist/internal/parser.d.cts +947 -0
- package/dist/internal/parser.d.ts +947 -0
- package/dist/internal/parser.js +711 -0
- package/dist/message.cjs +84 -26
- package/dist/message.d.cts +49 -9
- package/dist/message.d.ts +49 -9
- package/dist/message.js +84 -27
- package/dist/modifiers.cjs +1023 -240
- package/dist/modifiers.d.cts +42 -1
- package/dist/modifiers.d.ts +42 -1
- package/dist/modifiers.js +1023 -240
- package/dist/parser.cjs +11 -463
- package/dist/parser.d.cts +3 -537
- package/dist/parser.d.ts +3 -537
- package/dist/parser.js +2 -433
- package/dist/phase2-seed.cjs +59 -0
- package/dist/phase2-seed.js +56 -0
- package/dist/primitives.cjs +557 -208
- package/dist/primitives.d.cts +10 -14
- package/dist/primitives.d.ts +10 -14
- package/dist/primitives.js +557 -208
- package/dist/program.cjs +5 -1
- package/dist/program.d.cts +5 -3
- package/dist/program.d.ts +5 -3
- package/dist/program.js +6 -1
- package/dist/suggestion.cjs +22 -8
- package/dist/suggestion.js +22 -8
- package/dist/usage-internals.cjs +3 -2
- package/dist/usage-internals.js +4 -2
- package/dist/usage.cjs +195 -40
- package/dist/usage.d.cts +92 -11
- package/dist/usage.d.ts +92 -11
- package/dist/usage.js +194 -41
- package/dist/validate.cjs +170 -0
- package/dist/validate.js +164 -0
- package/dist/valueparser.cjs +1278 -191
- package/dist/valueparser.d.cts +330 -20
- package/dist/valueparser.d.ts +330 -20
- package/dist/valueparser.js +1277 -192
- package/package.json +9 -9
package/dist/primitives.d.cts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { Message } from "./message.cjs";
|
|
2
2
|
import { HiddenVisibility, OptionName, Usage } from "./usage.cjs";
|
|
3
3
|
import { ValueParser, ValueParserResult } from "./valueparser.cjs";
|
|
4
|
-
import {
|
|
5
|
-
import { Mode, Parser } from "./parser.cjs";
|
|
4
|
+
import { Mode, Parser } from "./internal/parser.cjs";
|
|
6
5
|
|
|
7
6
|
//#region src/primitives.d.ts
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
* This extends the normal ValueParserResult to also support DeferredParseState
|
|
11
|
-
* and PendingDependencySourceState.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
type OptionState<T> = ValueParserResult<T> | DeferredParseState<T> | PendingDependencySourceState | undefined;
|
|
7
|
+
/** @internal */
|
|
8
|
+
type OptionState<T> = ValueParserResult<T> | undefined;
|
|
15
9
|
/**
|
|
16
10
|
* Creates a parser that always succeeds without consuming any input and
|
|
17
11
|
* produces a constant value of the type {@link T}.
|
|
@@ -119,7 +113,7 @@ interface OptionErrorOptions {
|
|
|
119
113
|
* @returns A {@link Parser} that can parse the specified options and their
|
|
120
114
|
* values.
|
|
121
115
|
*/
|
|
122
|
-
declare function option<M extends Mode, T>(...args: readonly [...readonly OptionName[], ValueParser<M, T>]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
116
|
+
declare function option<M extends Mode, T>(...args: readonly [OptionName, ...readonly OptionName[], ValueParser<M, T>]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
123
117
|
/**
|
|
124
118
|
* Creates a parser for various styles of command-line options that take an
|
|
125
119
|
* argument value, such as `--option=value`, `-option=value`, `-o value`,
|
|
@@ -133,7 +127,7 @@ declare function option<M extends Mode, T>(...args: readonly [...readonly Option
|
|
|
133
127
|
* @returns A {@link Parser} that can parse the specified options and their
|
|
134
128
|
* values.
|
|
135
129
|
*/
|
|
136
|
-
declare function option<M extends Mode, T>(...args: readonly [...readonly OptionName[], ValueParser<M, T>, OptionOptions]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
130
|
+
declare function option<M extends Mode, T>(...args: readonly [OptionName, ...readonly OptionName[], ValueParser<M, T>, OptionOptions]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
137
131
|
/**
|
|
138
132
|
* Creates a parser for various styles of command-line options that do not
|
|
139
133
|
* take an argument value, such as `--option`, `-o`, or `/option`.
|
|
@@ -141,7 +135,7 @@ declare function option<M extends Mode, T>(...args: readonly [...readonly Option
|
|
|
141
135
|
* @return A {@link Parser} that can parse the specified options as Boolean
|
|
142
136
|
* flags, producing `true` if the option is present.
|
|
143
137
|
*/
|
|
144
|
-
declare function option(...optionNames: readonly OptionName[]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
138
|
+
declare function option(...optionNames: readonly [OptionName, ...readonly OptionName[]]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
145
139
|
/**
|
|
146
140
|
* Creates a parser for various styles of command-line options that take an
|
|
147
141
|
* argument value, such as `--option=value`, `-option=value`, `-o value`,
|
|
@@ -152,7 +146,7 @@ declare function option(...optionNames: readonly OptionName[]): Parser<"sync", b
|
|
|
152
146
|
* @returns A {@link Parser} that can parse the specified options and their
|
|
153
147
|
* values.
|
|
154
148
|
*/
|
|
155
|
-
declare function option(...args: readonly [...readonly OptionName[], OptionOptions]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
149
|
+
declare function option(...args: readonly [OptionName, ...readonly OptionName[], OptionOptions]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
156
150
|
/**
|
|
157
151
|
* Options for the {@link flag} parser.
|
|
158
152
|
*/
|
|
@@ -242,7 +236,7 @@ interface FlagErrorOptions {
|
|
|
242
236
|
* });
|
|
243
237
|
* ```
|
|
244
238
|
*/
|
|
245
|
-
declare function flag(...args: readonly [...readonly OptionName[], FlagOptions] | readonly OptionName[]): Parser<"sync", true, ValueParserResult<true> | undefined>;
|
|
239
|
+
declare function flag(...args: readonly [OptionName, ...readonly OptionName[], FlagOptions] | readonly [OptionName, ...readonly OptionName[]]): Parser<"sync", true, ValueParserResult<true> | undefined>;
|
|
246
240
|
/**
|
|
247
241
|
* Options for the {@link argument} parser.
|
|
248
242
|
*/
|
|
@@ -396,6 +390,8 @@ type CommandState<TState> = undefined | ["matched", string] | ["parsing", TState
|
|
|
396
390
|
* a description for documentation.
|
|
397
391
|
* @returns A {@link Parser} that matches the command name and delegates
|
|
398
392
|
* to the inner parser for the remaining arguments.
|
|
393
|
+
* @throws {TypeError} If `name` is empty, whitespace-only, contains
|
|
394
|
+
* embedded whitespace, or contains control characters.
|
|
399
395
|
*/
|
|
400
396
|
declare function command<M extends Mode, T, TState>(name: string, parser: Parser<M, T, TState>, options?: CommandOptions): Parser<M, T, CommandState<TState>>;
|
|
401
397
|
/**
|
package/dist/primitives.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { Message } from "./message.js";
|
|
2
2
|
import { HiddenVisibility, OptionName, Usage } from "./usage.js";
|
|
3
3
|
import { ValueParser, ValueParserResult } from "./valueparser.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Mode, Parser } from "./parser.js";
|
|
4
|
+
import { Mode, Parser } from "./internal/parser.js";
|
|
6
5
|
|
|
7
6
|
//#region src/primitives.d.ts
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
* This extends the normal ValueParserResult to also support DeferredParseState
|
|
11
|
-
* and PendingDependencySourceState.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
type OptionState<T> = ValueParserResult<T> | DeferredParseState<T> | PendingDependencySourceState | undefined;
|
|
7
|
+
/** @internal */
|
|
8
|
+
type OptionState<T> = ValueParserResult<T> | undefined;
|
|
15
9
|
/**
|
|
16
10
|
* Creates a parser that always succeeds without consuming any input and
|
|
17
11
|
* produces a constant value of the type {@link T}.
|
|
@@ -119,7 +113,7 @@ interface OptionErrorOptions {
|
|
|
119
113
|
* @returns A {@link Parser} that can parse the specified options and their
|
|
120
114
|
* values.
|
|
121
115
|
*/
|
|
122
|
-
declare function option<M extends Mode, T>(...args: readonly [...readonly OptionName[], ValueParser<M, T>]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
116
|
+
declare function option<M extends Mode, T>(...args: readonly [OptionName, ...readonly OptionName[], ValueParser<M, T>]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
123
117
|
/**
|
|
124
118
|
* Creates a parser for various styles of command-line options that take an
|
|
125
119
|
* argument value, such as `--option=value`, `-option=value`, `-o value`,
|
|
@@ -133,7 +127,7 @@ declare function option<M extends Mode, T>(...args: readonly [...readonly Option
|
|
|
133
127
|
* @returns A {@link Parser} that can parse the specified options and their
|
|
134
128
|
* values.
|
|
135
129
|
*/
|
|
136
|
-
declare function option<M extends Mode, T>(...args: readonly [...readonly OptionName[], ValueParser<M, T>, OptionOptions]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
130
|
+
declare function option<M extends Mode, T>(...args: readonly [OptionName, ...readonly OptionName[], ValueParser<M, T>, OptionOptions]): Parser<M, T, ValueParserResult<T> | undefined>;
|
|
137
131
|
/**
|
|
138
132
|
* Creates a parser for various styles of command-line options that do not
|
|
139
133
|
* take an argument value, such as `--option`, `-o`, or `/option`.
|
|
@@ -141,7 +135,7 @@ declare function option<M extends Mode, T>(...args: readonly [...readonly Option
|
|
|
141
135
|
* @return A {@link Parser} that can parse the specified options as Boolean
|
|
142
136
|
* flags, producing `true` if the option is present.
|
|
143
137
|
*/
|
|
144
|
-
declare function option(...optionNames: readonly OptionName[]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
138
|
+
declare function option(...optionNames: readonly [OptionName, ...readonly OptionName[]]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
145
139
|
/**
|
|
146
140
|
* Creates a parser for various styles of command-line options that take an
|
|
147
141
|
* argument value, such as `--option=value`, `-option=value`, `-o value`,
|
|
@@ -152,7 +146,7 @@ declare function option(...optionNames: readonly OptionName[]): Parser<"sync", b
|
|
|
152
146
|
* @returns A {@link Parser} that can parse the specified options and their
|
|
153
147
|
* values.
|
|
154
148
|
*/
|
|
155
|
-
declare function option(...args: readonly [...readonly OptionName[], OptionOptions]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
149
|
+
declare function option(...args: readonly [OptionName, ...readonly OptionName[], OptionOptions]): Parser<"sync", boolean, ValueParserResult<boolean> | undefined>;
|
|
156
150
|
/**
|
|
157
151
|
* Options for the {@link flag} parser.
|
|
158
152
|
*/
|
|
@@ -242,7 +236,7 @@ interface FlagErrorOptions {
|
|
|
242
236
|
* });
|
|
243
237
|
* ```
|
|
244
238
|
*/
|
|
245
|
-
declare function flag(...args: readonly [...readonly OptionName[], FlagOptions] | readonly OptionName[]): Parser<"sync", true, ValueParserResult<true> | undefined>;
|
|
239
|
+
declare function flag(...args: readonly [OptionName, ...readonly OptionName[], FlagOptions] | readonly [OptionName, ...readonly OptionName[]]): Parser<"sync", true, ValueParserResult<true> | undefined>;
|
|
246
240
|
/**
|
|
247
241
|
* Options for the {@link argument} parser.
|
|
248
242
|
*/
|
|
@@ -396,6 +390,8 @@ type CommandState<TState> = undefined | ["matched", string] | ["parsing", TState
|
|
|
396
390
|
* a description for documentation.
|
|
397
391
|
* @returns A {@link Parser} that matches the command name and delegates
|
|
398
392
|
* to the inner parser for the remaining arguments.
|
|
393
|
+
* @throws {TypeError} If `name` is empty, whitespace-only, contains
|
|
394
|
+
* embedded whitespace, or contains control characters.
|
|
399
395
|
*/
|
|
400
396
|
declare function command<M extends Mode, T, TState>(name: string, parser: Parser<M, T, TState>, options?: CommandOptions): Parser<M, T, CommandState<TState>>;
|
|
401
397
|
/**
|