@optique/core 1.0.0-dev.921 → 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 -525
- package/dist/facade.d.cts +59 -15
- package/dist/facade.d.ts +59 -15
- package/dist/facade.js +718 -525
- 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 +1270 -187
- package/dist/valueparser.d.cts +320 -14
- package/dist/valueparser.d.ts +320 -14
- package/dist/valueparser.js +1269 -188
- package/package.json +9 -9
package/dist/modifiers.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Message } from "./message.cjs";
|
|
2
|
-
import { Mode, Parser } from "./parser.cjs";
|
|
2
|
+
import { Mode, Parser } from "./internal/parser.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/modifiers.d.ts
|
|
5
5
|
|
|
@@ -123,6 +123,47 @@ declare function withDefault<M extends Mode, TValue, TState, const TDefault = TV
|
|
|
123
123
|
* @param transform A function that transforms the parsed value from type T to type U.
|
|
124
124
|
* @returns A {@link Parser} that produces the transformed value of type U
|
|
125
125
|
* while preserving the original parser's state type and parsing behavior.
|
|
126
|
+
* @throws Any exception thrown by `transform` when completing a non-deferred
|
|
127
|
+
* value. Errors from deferred placeholder transforms are caught and the
|
|
128
|
+
* mapped result falls back to `undefined` with `deferred: true`.
|
|
129
|
+
*
|
|
130
|
+
* ### Deferred prompt interaction
|
|
131
|
+
*
|
|
132
|
+
* During two-phase parsing, `map()` propagates the `deferred` flag from
|
|
133
|
+
* inner results but intentionally drops per-field `deferredKeys`. The
|
|
134
|
+
* inner key set describes the *input* shape, but `transform` produces an
|
|
135
|
+
* arbitrary *output* shape where keys may be renamed, dropped, or reused
|
|
136
|
+
* with different semantics. For `object()` results that are *not*
|
|
137
|
+
* wrapped in `map()`, per-field deferred stripping works normally.
|
|
138
|
+
*
|
|
139
|
+
* Because the `deferred` flag is propagated conservatively, mapped scalar
|
|
140
|
+
* results are treated as missing (`undefined`) during phase-two context
|
|
141
|
+
* collection — even when `transform` only used non-deferred fields.
|
|
142
|
+
* For example, `map(object({ apiKey: prompt(...), mode: option(...) }),
|
|
143
|
+
* v => v.mode)` makes phase-two contexts see `undefined` instead of the
|
|
144
|
+
* real `mode` value. This is the intentional trade-off: the alternative
|
|
145
|
+
* (not propagating `deferred`) would leak placeholder values into context
|
|
146
|
+
* resolution when `transform` *does* use deferred fields. The final
|
|
147
|
+
* parse always produces the correct result regardless.
|
|
148
|
+
*
|
|
149
|
+
* If the transform throws on a deferred placeholder value, the mapped
|
|
150
|
+
* result falls back to `undefined` with `deferred: true`, so the first
|
|
151
|
+
* pass does not abort.
|
|
152
|
+
*
|
|
153
|
+
* ### Transform purity
|
|
154
|
+
*
|
|
155
|
+
* The `transform` function must not mutate its input. Object and array
|
|
156
|
+
* values may be shared placeholder references during deferred prompt
|
|
157
|
+
* resolution, and in-place mutations would corrupt the placeholder for
|
|
158
|
+
* subsequent parses. Always return a new value:
|
|
159
|
+
*
|
|
160
|
+
* ```typescript
|
|
161
|
+
* // ✅ Correct — creates a new object
|
|
162
|
+
* map(parser, v => ({ ...v, host: "override" }))
|
|
163
|
+
*
|
|
164
|
+
* // ❌ Wrong — mutates the input in place
|
|
165
|
+
* map(parser, v => { v.host = "override"; return v; })
|
|
166
|
+
* ```
|
|
126
167
|
*
|
|
127
168
|
* @example
|
|
128
169
|
* ```typescript
|
package/dist/modifiers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Message } from "./message.js";
|
|
2
|
-
import { Mode, Parser } from "./parser.js";
|
|
2
|
+
import { Mode, Parser } from "./internal/parser.js";
|
|
3
3
|
|
|
4
4
|
//#region src/modifiers.d.ts
|
|
5
5
|
|
|
@@ -123,6 +123,47 @@ declare function withDefault<M extends Mode, TValue, TState, const TDefault = TV
|
|
|
123
123
|
* @param transform A function that transforms the parsed value from type T to type U.
|
|
124
124
|
* @returns A {@link Parser} that produces the transformed value of type U
|
|
125
125
|
* while preserving the original parser's state type and parsing behavior.
|
|
126
|
+
* @throws Any exception thrown by `transform` when completing a non-deferred
|
|
127
|
+
* value. Errors from deferred placeholder transforms are caught and the
|
|
128
|
+
* mapped result falls back to `undefined` with `deferred: true`.
|
|
129
|
+
*
|
|
130
|
+
* ### Deferred prompt interaction
|
|
131
|
+
*
|
|
132
|
+
* During two-phase parsing, `map()` propagates the `deferred` flag from
|
|
133
|
+
* inner results but intentionally drops per-field `deferredKeys`. The
|
|
134
|
+
* inner key set describes the *input* shape, but `transform` produces an
|
|
135
|
+
* arbitrary *output* shape where keys may be renamed, dropped, or reused
|
|
136
|
+
* with different semantics. For `object()` results that are *not*
|
|
137
|
+
* wrapped in `map()`, per-field deferred stripping works normally.
|
|
138
|
+
*
|
|
139
|
+
* Because the `deferred` flag is propagated conservatively, mapped scalar
|
|
140
|
+
* results are treated as missing (`undefined`) during phase-two context
|
|
141
|
+
* collection — even when `transform` only used non-deferred fields.
|
|
142
|
+
* For example, `map(object({ apiKey: prompt(...), mode: option(...) }),
|
|
143
|
+
* v => v.mode)` makes phase-two contexts see `undefined` instead of the
|
|
144
|
+
* real `mode` value. This is the intentional trade-off: the alternative
|
|
145
|
+
* (not propagating `deferred`) would leak placeholder values into context
|
|
146
|
+
* resolution when `transform` *does* use deferred fields. The final
|
|
147
|
+
* parse always produces the correct result regardless.
|
|
148
|
+
*
|
|
149
|
+
* If the transform throws on a deferred placeholder value, the mapped
|
|
150
|
+
* result falls back to `undefined` with `deferred: true`, so the first
|
|
151
|
+
* pass does not abort.
|
|
152
|
+
*
|
|
153
|
+
* ### Transform purity
|
|
154
|
+
*
|
|
155
|
+
* The `transform` function must not mutate its input. Object and array
|
|
156
|
+
* values may be shared placeholder references during deferred prompt
|
|
157
|
+
* resolution, and in-place mutations would corrupt the placeholder for
|
|
158
|
+
* subsequent parses. Always return a new value:
|
|
159
|
+
*
|
|
160
|
+
* ```typescript
|
|
161
|
+
* // ✅ Correct — creates a new object
|
|
162
|
+
* map(parser, v => ({ ...v, host: "override" }))
|
|
163
|
+
*
|
|
164
|
+
* // ❌ Wrong — mutates the input in place
|
|
165
|
+
* map(parser, v => { v.host = "override"; return v; })
|
|
166
|
+
* ```
|
|
126
167
|
*
|
|
127
168
|
* @example
|
|
128
169
|
* ```typescript
|