@optique/core 1.0.0-dev.1903 → 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 +66 -31
  2. package/dist/annotation-state.d.cts +24 -0
  3. package/dist/annotation-state.d.ts +24 -0
  4. package/dist/annotation-state.js +65 -31
  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 +67 -95
  58. package/dist/modifiers.d.cts +1 -1
  59. package/dist/modifiers.d.ts +1 -1
  60. package/dist/modifiers.js +51 -79
  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
package/dist/parser.d.cts CHANGED
@@ -1,991 +1,3 @@
1
- import { ParseOptions } from "./annotations.cjs";
2
- import { Message } from "./message.cjs";
3
- import { Usage } from "./usage.cjs";
4
- import { DocFragments, DocPage } from "./doc.cjs";
5
- import { DependencyRegistryLike } from "./registry-types.cjs";
6
- import { DeferredMap, ValueParserResult } from "./valueparser.cjs";
7
- import { ParserDependencyMetadata } from "./dependency-metadata.cjs";
8
- import { DependencyRuntimeContext, RuntimeNode } from "./dependency-runtime.cjs";
9
- import { InputTrace } from "./input-trace.cjs";
10
- import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, GroupOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.cjs";
11
- import { MultipleErrorOptions, MultipleOptions, WithDefaultError, WithDefaultOptions, map, multiple, nonEmpty, optional, withDefault } from "./modifiers.cjs";
12
- import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, fail, flag, option, passThrough } from "./primitives.cjs";
13
-
14
- //#region src/parser.d.ts
15
-
16
- /**
17
- * Represents the execution mode for parsers.
18
- *
19
- * - `"sync"`: Synchronous execution where methods return values directly.
20
- * - `"async"`: Asynchronous execution where methods return Promises or
21
- * AsyncIterables.
22
- *
23
- * @since 0.9.0
24
- */
25
- type Mode = "sync" | "async";
26
- /**
27
- * Wraps a value type based on the execution mode.
28
- *
29
- * - In sync mode: Returns `T` directly.
30
- * - In async mode: Returns `Promise<T>`.
31
- *
32
- * @template M The execution mode.
33
- * @template T The value type to wrap.
34
- * @since 0.9.0
35
- */
36
- type ModeValue<M extends Mode, T> = M extends "async" ? Promise<T> : T;
37
- /**
38
- * Wraps an iterable type based on the execution mode.
39
- *
40
- * - In sync mode: Returns `Iterable<T>`.
41
- * - In async mode: Returns `AsyncIterable<T>`.
42
- *
43
- * @template M The execution mode.
44
- * @template T The element type.
45
- * @since 0.9.0
46
- */
47
- type ModeIterable<M extends Mode, T> = M extends "async" ? AsyncIterable<T> : Iterable<T>;
48
- /**
49
- * Combines multiple modes into a single mode.
50
- * If any mode is `"async"`, the result is `"async"`; otherwise `"sync"`.
51
- *
52
- * @template T A tuple of Mode types.
53
- * @since 0.9.0
54
- */
55
- type CombineModes<T extends readonly Mode[]> = "async" extends T[number] ? "async" : "sync";
56
- /**
57
- * Represents the state passed to getDocFragments.
58
- * Can be either the actual parser state or an explicit indicator
59
- * that no state is available.
60
- * @template TState The type of the actual state when available.
61
- * @since 0.3.0
62
- */
63
- type DocState<TState> = {
64
- readonly kind: "available";
65
- readonly state: TState;
66
- } | {
67
- readonly kind: "unavailable";
68
- };
69
- /**
70
- * Parser interface for command-line argument parsing.
71
- * @template M The execution mode of the parser (`"sync"` or `"async"`).
72
- * @template TValue The type of the value returned by the parser.
73
- * @template TState The type of the state used during parsing.
74
- * @since 0.9.0 Added the `M` type parameter for sync/async mode support.
75
- */
76
- interface Parser<M extends Mode = "sync", TValue = unknown, TState = unknown> {
77
- /**
78
- * A type tag for the result value of this parser, used for type inference.
79
- * Usually this is an empty array at runtime, but it does not matter
80
- * what it contains.
81
- * @internal
82
- */
83
- readonly $valueType: readonly TValue[];
84
- /**
85
- * A type tag for the state of this parser, used for type inference.
86
- * Usually this is an empty array at runtime, but it does not matter
87
- * what it contains.
88
- * @internal
89
- */
90
- readonly $stateType: readonly TState[];
91
- /**
92
- * The execution mode of this parser.
93
- *
94
- * - `"sync"`: All methods return values directly.
95
- * - `"async"`: Methods return Promises or AsyncIterables.
96
- *
97
- * @since 0.9.0
98
- */
99
- readonly $mode: M;
100
- /**
101
- * The priority of this parser, which determines the order in which
102
- * parsers are applied when multiple parsers are available. The greater
103
- * the number, the higher the priority.
104
- */
105
- readonly priority: number;
106
- /**
107
- * The usage information for this parser, which describes how
108
- * to use it in command-line interfaces.
109
- */
110
- readonly usage: Usage;
111
- /**
112
- * Names that this parser could match at the first buffer position.
113
- * Used by `runParser()` to detect collisions with built-in meta
114
- * features (help, version, completion).
115
- *
116
- * Each built-in combinator computes this from its structural semantics.
117
- * Custom parser implementations must include every fixed token that
118
- * the parser accepts at `argv[0]` — command names, option names, and
119
- * literal values alike. For example, a parser whose usage declares
120
- * `{ type: "literal", value: "serve" }` should include `"serve"` in
121
- * this set. Parsers that accept *any* token (like `argument()`) should
122
- * return an empty set and set {@link acceptingAnyToken} to `true`
123
- * instead.
124
- *
125
- * @since 1.0.0
126
- */
127
- readonly leadingNames: ReadonlySet<string>;
128
- /**
129
- * Whether this parser unconditionally consumes any positional token at
130
- * the first buffer position. A parser with this flag accepts any
131
- * non-option token but may still reject option-like tokens (those
132
- * starting with `"-"`).
133
- *
134
- * In shared-buffer compositions (`tuple()`, `object()`, `merge()`,
135
- * `concat()`), a catch-all parser blocks positional names (command
136
- * names) from lower-priority siblings but does not block option-like
137
- * names. In `conditional()`, option-like names from the default
138
- * branch remain reachable even when the discriminator is a catch-all.
139
- *
140
- * Only `argument()` is inherently accepting-any-token; combinators
141
- * like `or()` and `map()` propagate this from their children.
142
- * Wrappers that can succeed without consuming (`optional()`,
143
- * `withDefault()`, `multiple()` with `min = 0`) always set this
144
- * to `false`.
145
- *
146
- * @since 1.0.0
147
- */
148
- readonly acceptingAnyToken: boolean;
149
- /**
150
- * The initial state for this parser. This is used to initialize the
151
- * state when parsing starts.
152
- */
153
- readonly initialState: TState;
154
- /**
155
- * Internal marker for wrappers whose `{ hasCliValue: false }` states should
156
- * be treated as unmatched dependency-source states during completion-time
157
- * Phase 1.
158
- *
159
- * @internal
160
- */
161
- readonly [unmatchedNonCliDependencySourceStateMarker]?: true;
162
- /**
163
- * Parses the input context and returns a result indicating
164
- * whether the parsing was successful or not.
165
- * @param context The context of the parser, which includes the input buffer
166
- * and the current state.
167
- * @returns A result object indicating success or failure.
168
- * In async mode, returns a Promise that resolves to the result.
169
- */
170
- parse(context: ParserContext<TState>): ModeValue<M, ParserResult<TState>>;
171
- /**
172
- * Transforms a {@link TState} into a {@link TValue}, if applicable.
173
- * If the transformation is not applicable, it should return
174
- * a `ValueParserResult` with `success: false` and an appropriate error
175
- * message.
176
- * @param state The current state of the parser, which may contain accumulated
177
- * data or context needed to produce the final value.
178
- * @param exec Optional shared execution context. When provided, gives the
179
- * parser access to cross-cutting runtime data such as the current
180
- * execution phase and dependency registry.
181
- * @returns A result object indicating success or failure of
182
- * the transformation. If successful, it should contain
183
- * the parsed value of type {@link TValue}. If not applicable,
184
- * it should return an error message.
185
- * In async mode, returns a Promise that resolves to the result.
186
- * @since 1.0.0 Added optional `exec` parameter.
187
- */
188
- complete(state: TState, exec?: ExecutionContext): ModeValue<M, ValueParserResult<TValue>>;
189
- /**
190
- * Generates next-step suggestions based on the current context
191
- * and an optional prefix. This can be used to provide shell completion
192
- * suggestions or to guide users in constructing valid commands.
193
- * @param context The context of the parser, which includes the input buffer
194
- * and the current state.
195
- * @param prefix A prefix string that can be used to filter suggestions.
196
- * Can be an empty string if no prefix is provided.
197
- * @returns An iterable of {@link Suggestion} objects, each containing
198
- * a suggestion text and an optional description.
199
- * In async mode, returns an AsyncIterable.
200
- * @since 0.6.0
201
- */
202
- suggest(context: ParserContext<TState>, prefix: string): ModeIterable<M, Suggestion>;
203
- /**
204
- * Generates a documentation fragment for this parser, which can be used
205
- * to describe the parser's usage, description, and default value.
206
- * @param state The current state of the parser, wrapped in a DocState
207
- * to indicate whether the actual state is available or not.
208
- * @param defaultValue An optional default value that can be used
209
- * to provide a default value in the documentation.
210
- * @returns {@link DocFragments} object containing documentation
211
- * fragments for this parser.
212
- */
213
- getDocFragments(state: DocState<TState>, defaultValue?: TValue): DocFragments;
214
- /**
215
- * A type-appropriate default value used as a stand-in during deferred
216
- * prompt resolution. When present, combinators like `prompt()` use this
217
- * value instead of an internal sentinel during two-phase parsing, so that
218
- * `map()` transforms and two-pass contexts always receive a valid value
219
- * of type {@link TValue}.
220
- *
221
- * This property is set automatically by `option()` and `argument()` from
222
- * the underlying {@link ValueParser}'s `placeholder`, and propagated by
223
- * combinators like `map()`, `optional()`, and `withDefault()`.
224
- *
225
- * @since 1.0.0
226
- */
227
- readonly placeholder?: TValue;
228
- /**
229
- * Optional predicate that determines whether completion should be
230
- * deferred for the given parser state.
231
- *
232
- * When present, combinator wrappers ({@link optional}, {@link withDefault},
233
- * {@link group}) forward this field to the outer parser. This enables
234
- * packages like *\@optique/inquirer* to detect when interactive prompting
235
- * should be deferred until an outer context (like a configuration file
236
- * source) has resolved.
237
- *
238
- * @param state The current parser state.
239
- * @param exec Optional shared execution context.
240
- * @returns `true` if completion should be deferred.
241
- * @since 1.0.0
242
- * @since 1.0.0 Added optional `exec` parameter.
243
- */
244
- shouldDeferCompletion?(state: TState, exec?: ExecutionContext): boolean;
245
- /**
246
- * Normalizes a parsed value according to the underlying value parser's
247
- * configuration. When present, {@link withDefault} calls this method
248
- * on default values so that runtime defaults match the representation
249
- * that the value parser's `parse()` would produce.
250
- *
251
- * Primitive parsers ({@link option}, {@link argument}) implement this
252
- * by delegating to {@link ValueParser.normalize}. Combinator wrappers
253
- * ({@link optional}, {@link withDefault}) forward it from inner parsers.
254
- *
255
- * Exclusive combinators ({@link or}, `longestMatch()`) and
256
- * multi-source combinators (`merge()`) intentionally do *not*
257
- * implement this method because the active branch or key ownership
258
- * is unknown at default time.
259
- *
260
- * @param value The value to normalize.
261
- * @returns The normalized value.
262
- * @since 1.0.0
263
- */
264
- normalizeValue?(value: TValue): TValue;
265
- /**
266
- * Optionally re-validates a value as if it had been parsed from CLI
267
- * input, surfacing any constraint violations from the underlying value
268
- * parser (e.g., regex patterns, numeric bounds, `choice()` values).
269
- *
270
- * Wrappers like `bindEnv()` and `bindConfig()` call this on fallback
271
- * values — environment variables parsed by a looser env parser,
272
- * configured defaults, and values loaded from config files — so that
273
- * those values obey the same validation semantics as CLI input.
274
- * Without it, parser constraints can be silently bypassed through
275
- * fallback paths.
276
- *
277
- * Built-in primitive parsers ({@link option}, {@link argument})
278
- * implement this method by round-tripping the value through the inner
279
- * {@link ValueParser.format} and {@link ValueParser.parse} calls: the
280
- * value is serialized back to a string and re-parsed, which re-runs
281
- * every constraint check. Combinator wrappers ({@link optional},
282
- * {@link withDefault}) forward this method from their inner parser.
283
- * {@link map} intentionally does *not* forward it because the mapping
284
- * function is one-way: the mapped output type no longer corresponds
285
- * to the inner parser's constraints. Exclusive combinators
286
- * ({@link or}, `longestMatch()`) and multi-source combinators
287
- * (`merge()`, `concat()`) intentionally do not implement this method
288
- * because the active branch or key ownership is unknown at validation
289
- * time.
290
- *
291
- * Implementations must wrap any *exception* thrown by `format()` in
292
- * `try`/`catch` and return the original value as a successful
293
- * {@link ValueParserResult}. This specifically protects
294
- * dependency-derived parsers whose factory cannot run without the
295
- * current dependency value, and custom value parsers whose `format()`
296
- * intentionally throws for unsupported inputs. Values that
297
- * `format()` successfully serializes to a string are always re-parsed,
298
- * and any resulting parse failure is propagated — they represent the
299
- * bug class this method exists to surface.
300
- *
301
- * @param value The candidate value to validate.
302
- * @returns A {@link ValueParserResult} indicating success (with the
303
- * possibly-canonicalized value) or failure (with an error
304
- * message). In async mode, returns a `Promise` resolving to
305
- * the result.
306
- * @since 1.0.0
307
- */
308
- validateValue?(value: TValue): ModeValue<M, ValueParserResult<TValue>>;
309
- /**
310
- * Internal dependency metadata describing this parser's dependency
311
- * capabilities. Used by the dependency runtime to resolve dependencies
312
- * without relying on state-shape protocols.
313
- * @internal
314
- */
315
- readonly dependencyMetadata?: ParserDependencyMetadata;
316
- /**
317
- * Internal hook for top-level suggest-time dependency seeding.
318
- *
319
- * Wrapper parsers can expose the active parser/state pairs that should be
320
- * scanned when `suggestSync()` or `suggestAsync()` builds a fresh dependency
321
- * runtime. When omitted, only this parser's own dependency source metadata
322
- * is considered.
323
- *
324
- * @param state The current parser state.
325
- * @param path The path to this parser within the parse tree.
326
- * @returns Runtime nodes to seed into the suggestion-time dependency runtime.
327
- * @internal
328
- */
329
- getSuggestRuntimeNodes?(state: TState, path: readonly PropertyKey[]): readonly RuntimeNode[];
330
- }
331
- /**
332
- * Parser-local frame data containing the input buffer and parser state.
333
- * This represents the per-parser progress during parsing, separated from
334
- * cross-cutting execution context.
335
- * @template TState The type of the state used during parsing.
336
- * @since 1.0.0
337
- */
338
- interface ParseFrame<TState> {
339
- /**
340
- * The array of input strings that the parser is currently processing.
341
- */
342
- readonly buffer: readonly string[];
343
- /**
344
- * The current state of the parser, which is used to track
345
- * the progress of parsing and any accumulated data.
346
- */
347
- readonly state: TState;
348
- /**
349
- * A flag indicating whether no more options should be parsed and instead
350
- * the remaining input should be treated as positional arguments.
351
- */
352
- readonly optionsTerminated: boolean;
353
- }
354
- /**
355
- * The phase of the execution pipeline.
356
- * @since 1.0.0
357
- */
358
- type ExecutionPhase = "parse" | "precomplete" | "resolve" | "complete" | "suggest";
359
- /**
360
- * Shared execution context carrying cross-cutting runtime data.
361
- * This includes information that is shared across all parsers in a parse
362
- * tree, such as usage information, dependency registries, and the current
363
- * execution phase.
364
- * @since 1.0.0
365
- */
366
- interface ExecutionContext {
367
- /**
368
- * Usage information for the entire parser tree.
369
- */
370
- readonly usage: Usage;
371
- /**
372
- * The current phase of the execution pipeline.
373
- */
374
- readonly phase: ExecutionPhase;
375
- /**
376
- * The path from the root to the current parser in the parse tree.
377
- * Used by constructs to track the current position during dependency
378
- * resolution and completion.
379
- */
380
- readonly path: readonly PropertyKey[];
381
- /**
382
- * Matched command names in parse order.
383
- *
384
- * This is tracked separately from {@link path} because parse-tree paths also
385
- * include object fields and other wrapper segments. Runners use it to
386
- * recover subcommand help context from partial parses.
387
- *
388
- * @internal
389
- */
390
- readonly commandPath?: readonly string[];
391
- /**
392
- * Immutable trace of raw primitive inputs recorded during parsing.
393
- *
394
- * Primitives append trace entries keyed by {@link path}, allowing later
395
- * completion phases to replay derived parsers with the resolved
396
- * dependency values.
397
- *
398
- * @internal
399
- */
400
- readonly trace?: InputTrace;
401
- /**
402
- * A registry containing resolved dependency values from DependencySource
403
- * parsers.
404
- * @since 0.10.0
405
- */
406
- readonly dependencyRegistry?: DependencyRegistryLike;
407
- /**
408
- * The dependency runtime context for dependency resolution.
409
- * Coexists with `dependencyRegistry` during the transition period.
410
- * @internal
411
- */
412
- readonly dependencyRuntime?: DependencyRuntimeContext;
413
- /**
414
- * Immutable map of pre-completed results from the parent construct's
415
- * Phase 1, keyed by field name. Each construct passes its own
416
- * `preCompleteAndRegisterDependencies` results directly to children
417
- * in Phase 3. Children read it in their own Phase 1 to avoid
418
- * re-evaluating non-idempotent default thunks, but never write to
419
- * it — this prevents sibling completions from leaking into each
420
- * other.
421
- *
422
- * Field-name keying naturally handles parser reuse across different
423
- * fields (e.g., `merge(object({a: shared}), object({b: shared}))`)
424
- * because each field maps to its own result regardless of whether
425
- * the underlying parser instance is the same.
426
- *
427
- * @see https://github.com/dahlia/optique/issues/762
428
- * @internal
429
- */
430
- readonly preCompletedByParser?: ReadonlyMap<string | symbol, unknown>;
431
- /**
432
- * Field names that should be ignored when a construct seeds dependency
433
- * sources from child state during completion.
434
- *
435
- * Used by outer `merge()` completions to suppress ambiguous duplicate
436
- * keys while still allowing the child parser to finish its own value
437
- * completion.
438
- *
439
- * @internal
440
- */
441
- readonly excludedSourceFields?: ReadonlySet<string | symbol>;
442
- }
443
- /**
444
- * Internal marker for wrappers whose `{ hasCliValue: false }` states should
445
- * be treated as unmatched dependency-source states during completion-time
446
- * Phase 1.
447
- *
448
- * Wrappers like `bindEnv()` and `bindConfig()` opt in because their missing
449
- * CLI states still carry enough fallback context to pre-complete exactly
450
- * once. Wrappers like `prompt()` intentionally do not opt in because
451
- * prompted values are not yet registered as dependency sources.
452
- *
453
- * @internal
454
- */
455
- declare const unmatchedNonCliDependencySourceStateMarker: unique symbol;
456
- /**
457
- * Internal marker for parsers that want parent-state annotations injected
458
- * directly into rebuilt child states instead of relying on structural
459
- * inheritance.
460
- *
461
- * Wrappers like `bindConfig()`, `bindEnv()`, and `prompt()` opt in because
462
- * their fallback contracts depend on carrying annotations through wrapper
463
- * state objects during parse, complete, and suggest.
464
- *
465
- * @internal
466
- */
467
- declare const inheritParentAnnotationsKey: unique symbol;
468
- /**
469
- * Internal marker for wrapper parsers that should only treat annotation-only
470
- * primitive wrapper states as completable when a nested source-binding wrapper
471
- * produced them.
472
- *
473
- * @internal
474
- */
475
- declare const annotationWrapperRequiresSourceBindingKey: unique symbol;
476
- /**
477
- * The context of the parser, which includes the input buffer and the state.
478
- *
479
- * `ParserContext` provides structured access to shared execution context
480
- * via {@link exec}, and flat access to all fields for backward
481
- * compatibility.
482
- *
483
- * @template TState The type of the state used during parsing.
484
- */
485
- interface ParserContext<TState> {
486
- /**
487
- * Shared execution context (usage, phase, path, dependencyRegistry).
488
- *
489
- * Present when the context was created via {@link createParserContext}.
490
- * Later runtime work will make this field required.
491
- *
492
- * @since 1.0.0
493
- */
494
- readonly exec?: ExecutionContext;
495
- /**
496
- * Immutable trace of raw primitive inputs recorded during parsing.
497
- *
498
- * Preserved as a flat compatibility field so wrapper parsers can forward
499
- * trace data even when they rebuild the parser context without {@link exec}.
500
- *
501
- * @since 1.0.0
502
- */
503
- readonly trace?: InputTrace;
504
- /**
505
- * The array of input strings that the parser is currently processing.
506
- */
507
- readonly buffer: readonly string[];
508
- /**
509
- * The current state of the parser, which is used to track
510
- * the progress of parsing and any accumulated data.
511
- */
512
- readonly state: TState;
513
- /**
514
- * A flag indicating whether no more options should be parsed and instead
515
- * the remaining input should be treated as positional arguments.
516
- * This is typically set when the parser encounters a `--` in the input,
517
- * which is a common convention in command-line interfaces to indicate
518
- * that no further options should be processed.
519
- */
520
- readonly optionsTerminated: boolean;
521
- /**
522
- * Usage information for the entire parser tree.
523
- * Used to provide better error messages with suggestions for typos.
524
- * When a parser encounters an invalid option or command, it can use
525
- * this information to suggest similar valid options.
526
- * @since 0.7.0
527
- */
528
- readonly usage: Usage;
529
- /**
530
- * A registry containing resolved dependency values from DependencySource parsers.
531
- * This is used during shell completion to provide suggestions based on
532
- * the actual dependency values that have been parsed, rather than defaults.
533
- * @since 0.10.0
534
- */
535
- readonly dependencyRegistry?: DependencyRegistryLike;
536
- }
537
- /**
538
- * Creates a {@link ParserContext} from a {@link ParseFrame} and an
539
- * {@link ExecutionContext}. The returned object provides both structured
540
- * access (`frame`, `exec`) and flat access (`buffer`, `state`, etc.)
541
- * for backward compatibility.
542
- *
543
- * @template TState The type of the state used during parsing.
544
- * @param frame Parser-local frame data.
545
- * @param exec Shared execution context.
546
- * @returns A {@link ParserContext} instance.
547
- * @since 1.0.0
548
- */
549
- declare function createParserContext<TState>(frame: ParseFrame<TState>, exec: ExecutionContext): ParserContext<TState>;
550
- /**
551
- * Represents a suggestion for command-line completion or guidance.
552
- * @since 0.6.0
553
- */
554
- type Suggestion = {
555
- /**
556
- * A literal text suggestion.
557
- */
558
- readonly kind: "literal";
559
- /**
560
- * The suggestion text that can be used for completion or guidance.
561
- */
562
- readonly text: string;
563
- /**
564
- * An optional description providing additional context
565
- * or information about the suggestion.
566
- */
567
- readonly description?: Message;
568
- } | {
569
- /**
570
- * A file system completion suggestion that uses native shell completion.
571
- */
572
- readonly kind: "file";
573
- /**
574
- * The current prefix/pattern for fallback when native completion is unavailable.
575
- */
576
- readonly pattern?: string;
577
- /**
578
- * The type of file system entries to complete.
579
- */
580
- readonly type: "file" | "directory" | "any";
581
- /**
582
- * File extensions to filter by (e.g., [".ts", ".js"]).
583
- */
584
- readonly extensions?: readonly string[];
585
- /**
586
- * Whether to include hidden files (those starting with a dot).
587
- */
588
- readonly includeHidden?: boolean;
589
- /**
590
- * An optional description providing additional context
591
- * or information about the suggestion.
592
- */
593
- readonly description?: Message;
594
- };
595
- /**
596
- * A discriminated union type representing the result of a parser operation.
597
- * It can either indicate a successful parse with the next state and context,
598
- * or a failure with an error message.
599
- * @template TState The type of the state after parsing. It should match with
600
- * the `TState` type of the {@link Parser} interface.
601
- */
602
- type ParserResult<TState> = {
603
- /**
604
- * Indicates that the parsing operation was successful.
605
- */
606
- readonly success: true;
607
- /**
608
- * The next context after parsing, which includes the updated input buffer.
609
- */
610
- readonly next: ParserContext<TState>;
611
- /**
612
- * The input elements consumed by the parser during this operation.
613
- */
614
- readonly consumed: readonly string[];
615
- /**
616
- * When `true`, indicates that this success is tentative or
617
- * speculative: the parser matched something but the match has not
618
- * been confirmed yet. This covers two cases:
619
- *
620
- * - A zero-consuming discriminator resolved to a branch key, but
621
- * the selected sub-parser has not consumed any input yet.
622
- * - A {@link conditional} parser speculatively committed to a
623
- * named branch that consumed tokens, before the discriminator
624
- * has had a chance to confirm the choice. In this case the
625
- * marker stays set across subsequent parse calls until
626
- * `complete()` verifies the speculative selection.
627
- *
628
- * Outer combinators should not treat provisional successes as
629
- * definitive. For example, {@link or} should still allow a
630
- * definitive branch to take priority, and a definitive
631
- * zero-consuming fallback must not be displaced by a provisional
632
- * consuming hit. {@link longestMatch} may still prefer a longer
633
- * provisional match over a shorter definitive one; when match
634
- * lengths are equal, definitive results take priority over
635
- * provisional ones.
636
- *
637
- * @since 1.0.0
638
- */
639
- readonly provisional?: true;
640
- } | {
641
- /**
642
- * Indicates that the parsing operation failed.
643
- */
644
- readonly success: false;
645
- /**
646
- * The number of the consumed input elements.
647
- */
648
- readonly consumed: number;
649
- /**
650
- * The error message describing why the parsing failed.
651
- */
652
- readonly error: Message;
653
- };
654
- /**
655
- * Infers the result value type of a {@link Parser}.
656
- * @template T The {@link Parser} to infer the result value type from.
657
- */
658
- type InferValue<T extends Parser<Mode, unknown, unknown>> = T["$valueType"][number];
659
- /**
660
- * Infers the execution mode of a {@link Parser}.
661
- * @template T The {@link Parser} to infer the execution mode from.
662
- * @since 0.9.0
663
- */
664
- type InferMode<T extends Parser<Mode, unknown, unknown>> = T["$mode"];
665
- /**
666
- * The result type of a whole parser operation, which can either be a successful
667
- * result with a value of type `T`, or a failure with an error message.
668
- * @template T The type of the value produced by the parser.
669
- */
670
- type Result<T> = {
671
- /**
672
- * Indicates that the parsing operation was successful.
673
- */
674
- success: true;
675
- /**
676
- * The successfully parsed value of type {@link T}.
677
- * This is the final result of the parsing operation after all parsers
678
- * have been applied and completed.
679
- */
680
- value: T;
681
- /**
682
- * When `true`, indicates that the value contains deferred prompt
683
- * placeholders. Propagated from {@link ValueParserResult.deferred}.
684
- * @since 1.0.0
685
- */
686
- deferred?: true;
687
- /**
688
- * Property keys (object field names or array indices) whose values are
689
- * deferred placeholders.
690
- * Propagated from {@link ValueParserResult.deferredKeys}.
691
- * @since 1.0.0
692
- */
693
- deferredKeys?: DeferredMap;
694
- } | {
695
- /**
696
- * Indicates that the parsing operation failed.
697
- */
698
- success: false;
699
- /**
700
- * The error message describing why the parsing failed.
701
- */
702
- error: Message;
703
- };
704
- /**
705
- * Parses an array of command-line arguments using the provided combined parser.
706
- * This function processes the input arguments, applying the parser to each
707
- * argument until all arguments are consumed or an error occurs.
708
- *
709
- * This function only accepts synchronous parsers. For asynchronous parsers,
710
- * use {@link parseAsync}.
711
- *
712
- * @template T The type of the value produced by the parser.
713
- * @param parser The combined {@link Parser} to use for parsing the input
714
- * arguments. Must be a synchronous parser.
715
- * @param args The array of command-line arguments to parse. Usually this is
716
- * `process.argv.slice(2)` in Node.js or `Deno.args` in Deno.
717
- * @param options Optional {@link ParseOptions} for customizing parsing behavior.
718
- * @returns A {@link Result} object indicating whether the parsing was
719
- * successful or not. If successful, it contains the parsed value of
720
- * type `T`. If not, it contains an error message describing the
721
- * failure.
722
- * @throws {TypeError} When a synchronous dependency source extractor returns a
723
- * thenable during completion-time dependency seeding.
724
- * @since 0.9.0 Renamed from the original `parse` function which now delegates
725
- * to this for sync parsers.
726
- * @since 0.10.0 Added optional `options` parameter for annotations support.
727
- */
728
- declare function parseSync<T>(parser: Parser<"sync", T, unknown>, args: readonly string[], options?: ParseOptions): Result<T>;
729
- /**
730
- * Parses an array of command-line arguments using the provided combined parser.
731
- * This function processes the input arguments, applying the parser to each
732
- * argument until all arguments are consumed or an error occurs.
733
- *
734
- * This function accepts any parser (sync or async) and always returns a Promise.
735
- * For synchronous parsing with sync parsers, use {@link parseSync} instead.
736
- *
737
- * @template T The type of the value produced by the parser.
738
- * @param parser The combined {@link Parser} to use for parsing the input
739
- * arguments.
740
- * @param args The array of command-line arguments to parse. Usually this is
741
- * `process.argv.slice(2)` in Node.js or `Deno.args` in Deno.
742
- * @param options Optional {@link ParseOptions} for customizing parsing behavior.
743
- * @returns A Promise that resolves to a {@link Result} object indicating
744
- * whether the parsing was successful or not.
745
- * @since 0.9.0
746
- * @since 0.10.0 Added optional `options` parameter for annotations support.
747
- */
748
- declare function parseAsync<T>(parser: Parser<Mode, T, unknown>, args: readonly string[], options?: ParseOptions): Promise<Result<T>>;
749
- /**
750
- * Parses an array of command-line arguments using the provided combined parser.
751
- * This function processes the input arguments, applying the parser to each
752
- * argument until all arguments are consumed or an error occurs.
753
- *
754
- * The return type depends on the parser's mode:
755
- * - Sync parsers return `Result<T>` directly.
756
- * - Async parsers return `Promise<Result<T>>`.
757
- *
758
- * For explicit control, use {@link parseSync} or {@link parseAsync}.
759
- *
760
- * @template M The execution mode of the parser.
761
- * @template T The type of the value produced by the parser.
762
- * @param parser The combined {@link Parser} to use for parsing the input
763
- * arguments.
764
- * @param args The array of command-line arguments to parse. Usually this is
765
- * `process.argv.slice(2)` in Node.js or `Deno.args` in Deno.
766
- * @param options Optional {@link ParseOptions} for customizing parsing behavior.
767
- * @returns A {@link Result} object (for sync) or Promise thereof (for async)
768
- * indicating whether the parsing was successful or not.
769
- * @throws {TypeError} When a synchronous dependency source extractor returns a
770
- * thenable during completion-time dependency seeding.
771
- * @since 0.10.0 Added optional `options` parameter for annotations support.
772
- */
773
- declare function parse<M extends Mode, T>(parser: Parser<M, T, unknown>, args: readonly string[], options?: ParseOptions): ModeValue<M, Result<T>>;
774
- /**
775
- * Generates command-line suggestions based on current parsing state.
776
- * This function processes the input arguments up to the last argument,
777
- * then calls the parser's suggest method with the remaining prefix.
778
- *
779
- * This function only accepts synchronous parsers. For asynchronous parsers,
780
- * use {@link suggestAsync}.
781
- *
782
- * @template T The type of the value produced by the parser.
783
- * @param parser The {@link Parser} to use for generating suggestions.
784
- * Must be a synchronous parser.
785
- * @param args The array of command-line arguments including the partial
786
- * argument to complete. The last element is treated as
787
- * the prefix for suggestions.
788
- * @param options Optional {@link ParseOptions} for customizing parsing behavior.
789
- * @returns An array of {@link Suggestion} objects containing completion
790
- * candidates.
791
- * @example
792
- * ```typescript
793
- * const parser = object({
794
- * verbose: option("-v", "--verbose"),
795
- * format: option("-f", "--format", choice(["json", "yaml"]))
796
- * });
797
- *
798
- * // Get suggestions for options starting with "--"
799
- * const suggestions = suggestSync(parser, ["--"]);
800
- * // Returns: [{ text: "--verbose" }, { text: "--format" }]
801
- *
802
- * // Get suggestions after parsing some arguments
803
- * const suggestions2 = suggestSync(parser, ["-v", "--format="]);
804
- * // Returns: [{ text: "--format=json" }, { text: "--format=yaml" }]
805
- * ```
806
- * @throws {TypeError} When a synchronous dependency source extractor returns a
807
- * thenable during suggestion seeding.
808
- * @since 0.6.0
809
- * @since 0.9.0 Renamed from the original `suggest` function.
810
- * @since 0.10.0 Added optional `options` parameter for annotations support.
811
- */
812
- declare function suggestSync<T>(parser: Parser<"sync", T, unknown>, args: readonly [string, ...readonly string[]], options?: ParseOptions): readonly Suggestion[];
813
- /**
814
- * Returns suggest-time runtime nodes for a parser, falling back to the
815
- * parser's own source metadata when it does not expose a custom hook.
816
- *
817
- * @param parser The parser whose suggest-time runtime nodes should be resolved.
818
- * @param state The current parser state.
819
- * @param path The path to this parser within the parse tree.
820
- * @returns The runtime nodes used to seed suggest-time dependency resolution.
821
- * @internal
822
- */
823
- declare function getParserSuggestRuntimeNodes<TState>(parser: Parser<Mode, unknown, TState>, state: TState, path: readonly PropertyKey[]): readonly RuntimeNode[];
824
- /**
825
- * Returns wrapper-aware suggest-time runtime nodes for parsers that delegate
826
- * to an inner parser while also exposing their own source metadata.
827
- *
828
- * The inner parser's nodes are always preserved so nested wrappers and
829
- * constructs can continue to seed the dependency runtime recursively. When
830
- * the outer parser itself owns source metadata, its `(path, parser, state)`
831
- * node is appended so outer precedence rules still apply.
832
- *
833
- * @internal
834
- */
835
- declare function getDelegatingSuggestRuntimeNodes<TInnerState>(innerParser: Parser<Mode, unknown, TInnerState>, outerParser: Parser<Mode, unknown, unknown>, state: unknown, path: readonly PropertyKey[], innerState: TInnerState, outerPosition?: "append" | "prepend"): readonly RuntimeNode[];
836
- /**
837
- * Composes source metadata for a wrapper parser while preserving any derived
838
- * or transform capabilities from the inner parser unchanged.
839
- *
840
- * @internal
841
- */
842
- declare function composeWrappedSourceMetadata(dependencyMetadata: ParserDependencyMetadata | undefined, wrapSource: (source: NonNullable<ParserDependencyMetadata["source"]>) => NonNullable<ParserDependencyMetadata["source"]>): ParserDependencyMetadata | undefined;
843
- /**
844
- * Marks a parser as inheriting parent-state annotations through wrapper-state
845
- * reconstruction.
846
- *
847
- * @internal
848
- */
849
- declare function defineInheritedAnnotationParser(parser: object): void;
850
- /**
851
- * Marks a wrapper parser as requiring a real source-binding state before
852
- * annotation-only primitive wrappers should trigger completion.
853
- *
854
- * @internal
855
- */
856
- declare function defineSourceBindingOnlyAnnotationCompletionParser(parser: object): void;
857
- /**
858
- * Generates command-line suggestions based on current parsing state.
859
- * This function processes the input arguments up to the last argument,
860
- * then calls the parser's suggest method with the remaining prefix.
861
- *
862
- * This function accepts any parser (sync or async) and always returns a Promise.
863
- * For synchronous suggestion generation with sync parsers, use
864
- * {@link suggestSync} instead.
865
- *
866
- * @template T The type of the value produced by the parser.
867
- * @param parser The {@link Parser} to use for generating suggestions.
868
- * @param args The array of command-line arguments including the partial
869
- * argument to complete. The last element is treated as
870
- * the prefix for suggestions.
871
- * @param options Optional {@link ParseOptions} for customizing parsing behavior.
872
- * @returns A Promise that resolves to an array of {@link Suggestion} objects
873
- * containing completion candidates.
874
- * @since 0.9.0
875
- * @since 0.10.0 Added optional `options` parameter for annotations support.
876
- */
877
- declare function suggestAsync<T>(parser: Parser<Mode, T, unknown>, args: readonly [string, ...readonly string[]], options?: ParseOptions): Promise<readonly Suggestion[]>;
878
- /**
879
- * Generates command-line suggestions based on current parsing state.
880
- * This function processes the input arguments up to the last argument,
881
- * then calls the parser's suggest method with the remaining prefix.
882
- *
883
- * The return type depends on the parser's mode:
884
- * - Sync parsers return `readonly Suggestion[]` directly.
885
- * - Async parsers return `Promise<readonly Suggestion[]>`.
886
- *
887
- * For explicit control, use {@link suggestSync} or {@link suggestAsync}.
888
- *
889
- * @template M The execution mode of the parser.
890
- * @template T The type of the value produced by the parser.
891
- * @param parser The {@link Parser} to use for generating suggestions.
892
- * @param args The array of command-line arguments including the partial
893
- * argument to complete. The last element is treated as
894
- * the prefix for suggestions.
895
- * @param options Optional {@link ParseOptions} for customizing parsing behavior.
896
- * @returns An array of {@link Suggestion} objects (for sync) or Promise thereof
897
- * (for async) containing completion candidates.
898
- * @throws {TypeError} When a synchronous dependency source extractor returns a
899
- * thenable during suggestion seeding.
900
- * @since 0.6.0
901
- * @since 0.10.0 Added optional `options` parameter for annotations support.
902
- */
903
- declare function suggest<M extends Mode, T>(parser: Parser<M, T, unknown>, args: readonly [string, ...readonly string[]], options?: ParseOptions): ModeValue<M, readonly Suggestion[]>;
904
- /**
905
- * Generates a documentation page for a synchronous parser.
906
- *
907
- * This is the sync-specific version of {@link getDocPage}. It only accepts
908
- * sync parsers and returns the documentation page directly (not wrapped
909
- * in a Promise).
910
- *
911
- * @param parser The sync parser to generate documentation for.
912
- * @param argsOrOptions Optional array of command-line arguments for context,
913
- * or a {@link ParseOptions} object for annotations. When a
914
- * `ParseOptions` is passed here, the `options` parameter is ignored.
915
- * @param options Optional {@link ParseOptions} for customizing parsing
916
- * behavior. Only used when `argsOrOptions` is an array or omitted.
917
- * @returns A {@link DocPage} or `undefined`.
918
- * @since 0.9.0
919
- * @since 0.10.0 Added optional `options` parameter for annotations support.
920
- * @since 1.0.0 The second parameter now also accepts a `ParseOptions` object
921
- * directly.
922
- */
923
- declare function getDocPageSync(parser: Parser<"sync", unknown, unknown>, argsOrOptions?: readonly string[] | ParseOptions, options?: ParseOptions): DocPage | undefined;
924
- /**
925
- * Generates a documentation page for any parser, returning a Promise.
926
- *
927
- * This function accepts parsers of any mode (sync or async) and always
928
- * returns a Promise. Use this when working with parsers that may contain
929
- * async value parsers.
930
- *
931
- * @param parser The parser to generate documentation for.
932
- * @param argsOrOptions Optional array of command-line arguments for context,
933
- * or a {@link ParseOptions} object for annotations. When a
934
- * `ParseOptions` is passed here, the `options` parameter is ignored.
935
- * @param options Optional {@link ParseOptions} for customizing parsing
936
- * behavior. Only used when `argsOrOptions` is an array or omitted.
937
- * @returns A Promise of {@link DocPage} or `undefined`.
938
- * @since 0.9.0
939
- * @since 0.10.0 Added optional `options` parameter for annotations support.
940
- * @since 1.0.0 The second parameter now also accepts a `ParseOptions` object
941
- * directly.
942
- */
943
- declare function getDocPageAsync(parser: Parser<Mode, unknown, unknown>, argsOrOptions?: readonly string[] | ParseOptions, options?: ParseOptions): Promise<DocPage | undefined>;
944
- /**
945
- * Generates a documentation page for a parser based on its current state after
946
- * attempting to parse the provided arguments. This function is useful for
947
- * creating help documentation that reflects the current parsing context.
948
- *
949
- * The function works by:
950
- * 1. Attempting to parse the provided arguments to determine the current state
951
- * 2. Generating documentation fragments from the parser's current state
952
- * 3. Organizing fragments into entries and sections
953
- * 4. Resolving command usage terms based on parsed arguments
954
- *
955
- * For sync parsers, returns the documentation page directly.
956
- * For async parsers, returns a Promise of the documentation page.
957
- *
958
- * @param parser The parser to generate documentation for
959
- * @param argsOrOptions Optional array of command-line arguments that have been
960
- * parsed so far, or a {@link ParseOptions} object for annotations.
961
- * When a `ParseOptions` is passed here, the `options` parameter is
962
- * ignored. Defaults to an empty array when omitted.
963
- * @param options Optional {@link ParseOptions} for customizing parsing
964
- * behavior. Only used when `argsOrOptions` is an array or omitted.
965
- * @returns For sync parsers, returns a {@link DocPage} directly.
966
- * For async parsers, returns a Promise of {@link DocPage}.
967
- * Returns `undefined` if no documentation can be generated.
968
- *
969
- * @example
970
- * ```typescript
971
- * const parser = object({
972
- * verbose: option("-v", "--verbose"),
973
- * port: option("-p", "--port", integer())
974
- * });
975
- *
976
- * // Get documentation for sync parser
977
- * const rootDoc = getDocPage(parser);
978
- *
979
- * // Get documentation for async parser
980
- * const asyncDoc = await getDocPage(asyncParser);
981
- * ```
982
- * @since 0.9.0 Updated to support async parsers.
983
- * @since 0.10.0 Added optional `options` parameter for annotations support.
984
- * @since 1.0.0 The second parameter now also accepts a `ParseOptions` object
985
- * directly.
986
- */
987
- declare function getDocPage(parser: Parser<"sync", unknown, unknown>, argsOrOptions?: readonly string[] | ParseOptions, options?: ParseOptions): DocPage | undefined;
988
- declare function getDocPage(parser: Parser<"async", unknown, unknown>, argsOrOptions?: readonly string[] | ParseOptions, options?: ParseOptions): Promise<DocPage | undefined>;
989
- declare function getDocPage<M extends Mode>(parser: Parser<M, unknown, unknown>, argsOrOptions?: readonly string[] | ParseOptions, options?: ParseOptions): ModeValue<M, DocPage | undefined>;
990
- //#endregion
991
- export { ArgumentErrorOptions, ArgumentOptions, CombineModes, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DocState, DuplicateOptionError, ExecutionContext, ExecutionPhase, FlagErrorOptions, FlagOptions, GroupOptions, InferMode, InferValue, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionOptions, OptionState, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, Result, Suggestion, TupleOptions, WithDefaultError, WithDefaultOptions, annotationWrapperRequiresSourceBindingKey, argument, command, composeWrappedSourceMetadata, concat, conditional, constant, createParserContext, defineInheritedAnnotationParser, defineSourceBindingOnlyAnnotationCompletionParser, fail, flag, getDelegatingSuggestRuntimeNodes, getDocPage, getDocPageAsync, getDocPageSync, getParserSuggestRuntimeNodes, group, inheritParentAnnotationsKey, longestMatch, map, merge, multiple, nonEmpty, object, option, optional, or, parse, parseAsync, parseSync, passThrough, suggest, suggestAsync, suggestSync, tuple, unmatchedNonCliDependencySourceStateMarker, withDefault };
1
+ import { ParseOptions } from "./internal/annotations.cjs";
2
+ import { CombineModes, DocState, ExecutionContext, ExecutionPhase, InferMode, InferValue, Mode, ModeIterable, ModeValue, ParseFrame, Parser, ParserContext, ParserResult, Result, Suggestion, createParserContext, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync } from "./internal/parser.cjs";
3
+ export { type CombineModes, type DocState, type ExecutionContext, type ExecutionPhase, type InferMode, type InferValue, type Mode, type ModeIterable, type ModeValue, type ParseFrame, type ParseOptions, type Parser, type ParserContext, type ParserResult, type Result, type Suggestion, createParserContext, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync };