@optique/core 1.3.0-dev.2399 → 1.3.0-dev.2403
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/dependency-runtime.cjs +17 -4
- package/dist/dependency-runtime.d.cts +12 -1
- package/dist/dependency-runtime.d.ts +12 -1
- package/dist/dependency-runtime.js +17 -5
- package/dist/primitives.cjs +9 -11
- package/dist/primitives.js +10 -12
- package/package.json +2 -2
|
@@ -541,6 +541,16 @@ function propagateRuntimeSourceFailures(nodes, runtime) {
|
|
|
541
541
|
runtime.propagateSourceFailure(metadata.derived.dependencyIds, formatDependencyNodeMetavar(node), metadata.source?.sourceId);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Appends the recorded dependency chain to a source failure.
|
|
546
|
+
*
|
|
547
|
+
* @param error The source failure to annotate.
|
|
548
|
+
* @param sourceId The identifier of the failed source.
|
|
549
|
+
* @param runtime The dependency runtime that recorded the failure chain.
|
|
550
|
+
* @returns The annotated failure, or the original failure when no chain exists.
|
|
551
|
+
* @internal
|
|
552
|
+
* @since 1.3.0
|
|
553
|
+
*/
|
|
544
554
|
function includeSourceFailureChain(error, sourceId, runtime) {
|
|
545
555
|
const chain = runtime.getSourceFailureChain(sourceId);
|
|
546
556
|
return chain == null || chain.length < 2 ? error : require_message.message`${error} Dependency chain: ${chain.join(" -> ")}.`;
|
|
@@ -1315,8 +1325,9 @@ function buildRuntimeNodesFromPairs(pairs, state, parentPath) {
|
|
|
1315
1325
|
const nodes = [];
|
|
1316
1326
|
for (const [field, parser] of pairs) {
|
|
1317
1327
|
const fieldState = Object.hasOwn(state, field) ? state[field] : void 0;
|
|
1318
|
-
const
|
|
1319
|
-
const
|
|
1328
|
+
const isDerived = parser.dependencyMetadata?.derived != null;
|
|
1329
|
+
const rawInput = isDerived ? extractRawInputFromState(fieldState) : void 0;
|
|
1330
|
+
const defaultDependencyValues = isDerived ? getDefaultDependencySnapshot(fieldState) : void 0;
|
|
1320
1331
|
nodes.push({
|
|
1321
1332
|
path: [...prefix, field],
|
|
1322
1333
|
parser,
|
|
@@ -1346,8 +1357,9 @@ function buildRuntimeNodesFromArray(parsers, stateArray, parentPath) {
|
|
|
1346
1357
|
for (let i = 0; i < parsers.length; i++) {
|
|
1347
1358
|
const parser = parsers[i];
|
|
1348
1359
|
const elemState = i < stateArray.length ? stateArray[i] : void 0;
|
|
1349
|
-
const
|
|
1350
|
-
const
|
|
1360
|
+
const isDerived = parser.dependencyMetadata?.derived != null;
|
|
1361
|
+
const rawInput = isDerived ? extractRawInputFromState(elemState) : void 0;
|
|
1362
|
+
const defaultDependencyValues = isDerived ? getDefaultDependencySnapshot(elemState) : void 0;
|
|
1351
1363
|
nodes.push({
|
|
1352
1364
|
path: [...prefix, i],
|
|
1353
1365
|
parser,
|
|
@@ -1400,6 +1412,7 @@ exports.effectfulSchedulingNodesKey = effectfulSchedulingNodesKey;
|
|
|
1400
1412
|
exports.extractRawInputFromState = extractRawInputFromState;
|
|
1401
1413
|
exports.fillMissingSourceDefaults = fillMissingSourceDefaults;
|
|
1402
1414
|
exports.fillMissingSourceDefaultsAsync = fillMissingSourceDefaultsAsync;
|
|
1415
|
+
exports.includeSourceFailureChain = includeSourceFailureChain;
|
|
1403
1416
|
exports.orderDependencyNodes = orderDependencyNodes;
|
|
1404
1417
|
exports.recordDerivedRawInput = recordDerivedRawInput;
|
|
1405
1418
|
exports.replayDerivedParser = replayDerivedParser;
|
|
@@ -309,6 +309,17 @@ declare function orderDependencyNodes(nodes: readonly RuntimeNode[]): readonly R
|
|
|
309
309
|
declare function resolveDerivedSourceValues(nodes: readonly RuntimeNode[], runtime: DependencyRuntimeContext, options?: ResolveDerivedSourceValuesOptions): void;
|
|
310
310
|
/** Async version of {@link resolveDerivedSourceValues}. */
|
|
311
311
|
declare function resolveDerivedSourceValuesAsync(nodes: readonly RuntimeNode[], runtime: DependencyRuntimeContext, options?: ResolveDerivedSourceValuesOptions): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Appends the recorded dependency chain to a source failure.
|
|
314
|
+
*
|
|
315
|
+
* @param error The source failure to annotate.
|
|
316
|
+
* @param sourceId The identifier of the failed source.
|
|
317
|
+
* @param runtime The dependency runtime that recorded the failure chain.
|
|
318
|
+
* @returns The annotated failure, or the original failure when no chain exists.
|
|
319
|
+
* @internal
|
|
320
|
+
* @since 1.3.0
|
|
321
|
+
*/
|
|
322
|
+
declare function includeSourceFailureChain(error: Message, sourceId: symbol, runtime: DependencyRuntimeContext): Message;
|
|
312
323
|
/**
|
|
313
324
|
* Fills missing source defaults for source parsers whose state is
|
|
314
325
|
* unpopulated.
|
|
@@ -683,4 +694,4 @@ declare function buildRuntimeNodesFromArray(parsers: ReadonlyArray<{
|
|
|
683
694
|
readonly initialState?: unknown;
|
|
684
695
|
}>, stateArray: readonly unknown[], parentPath?: readonly PropertyKey[]): readonly RuntimeNode[];
|
|
685
696
|
//#endregion
|
|
686
|
-
export { CompleteEffectfulSourcesOptions, DependencyRequest, DependencyResolution, DependencyRuntimeContext, EffectfulSchedulingNodesFn, EffectfulSourceCompletion, EffectfulSourceCompletionResult, ReplayKey, ResolveDerivedSourceValuesOptions, RuntimeNode, SchedulingBarrierContext, SourceDefaultFailure, buildRuntimeNodesFromArray, buildRuntimeNodesFromPairs, collectDemandedDependencyIds, collectExplicitSourceValues, collectExplicitSourceValuesAsync, collectSourcesFromState, completeEffectfulSourcesAsync, createDependencyFingerprint, createDependencyRuntimeContext, createReplayKey, defineForwardedEffectfulSchedulingNodes, derivedRawInputKey, effectfulSchedulingNodesKey, extractRawInputFromState, fillMissingSourceDefaults, fillMissingSourceDefaultsAsync, orderDependencyNodes, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, resolveDerivedSourceValues, resolveDerivedSourceValuesAsync, resolveStateWithRuntime, resolveStateWithRuntimeAsync, serializeSchedulingPath, sourceCollectionExpansionKey, staticSourceScopeKey };
|
|
697
|
+
export { CompleteEffectfulSourcesOptions, DependencyRequest, DependencyResolution, DependencyRuntimeContext, EffectfulSchedulingNodesFn, EffectfulSourceCompletion, EffectfulSourceCompletionResult, ReplayKey, ResolveDerivedSourceValuesOptions, RuntimeNode, SchedulingBarrierContext, SourceDefaultFailure, buildRuntimeNodesFromArray, buildRuntimeNodesFromPairs, collectDemandedDependencyIds, collectExplicitSourceValues, collectExplicitSourceValuesAsync, collectSourcesFromState, completeEffectfulSourcesAsync, createDependencyFingerprint, createDependencyRuntimeContext, createReplayKey, defineForwardedEffectfulSchedulingNodes, derivedRawInputKey, effectfulSchedulingNodesKey, extractRawInputFromState, fillMissingSourceDefaults, fillMissingSourceDefaultsAsync, includeSourceFailureChain, orderDependencyNodes, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, resolveDerivedSourceValues, resolveDerivedSourceValuesAsync, resolveStateWithRuntime, resolveStateWithRuntimeAsync, serializeSchedulingPath, sourceCollectionExpansionKey, staticSourceScopeKey };
|
|
@@ -309,6 +309,17 @@ declare function orderDependencyNodes(nodes: readonly RuntimeNode[]): readonly R
|
|
|
309
309
|
declare function resolveDerivedSourceValues(nodes: readonly RuntimeNode[], runtime: DependencyRuntimeContext, options?: ResolveDerivedSourceValuesOptions): void;
|
|
310
310
|
/** Async version of {@link resolveDerivedSourceValues}. */
|
|
311
311
|
declare function resolveDerivedSourceValuesAsync(nodes: readonly RuntimeNode[], runtime: DependencyRuntimeContext, options?: ResolveDerivedSourceValuesOptions): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Appends the recorded dependency chain to a source failure.
|
|
314
|
+
*
|
|
315
|
+
* @param error The source failure to annotate.
|
|
316
|
+
* @param sourceId The identifier of the failed source.
|
|
317
|
+
* @param runtime The dependency runtime that recorded the failure chain.
|
|
318
|
+
* @returns The annotated failure, or the original failure when no chain exists.
|
|
319
|
+
* @internal
|
|
320
|
+
* @since 1.3.0
|
|
321
|
+
*/
|
|
322
|
+
declare function includeSourceFailureChain(error: Message, sourceId: symbol, runtime: DependencyRuntimeContext): Message;
|
|
312
323
|
/**
|
|
313
324
|
* Fills missing source defaults for source parsers whose state is
|
|
314
325
|
* unpopulated.
|
|
@@ -683,4 +694,4 @@ declare function buildRuntimeNodesFromArray(parsers: ReadonlyArray<{
|
|
|
683
694
|
readonly initialState?: unknown;
|
|
684
695
|
}>, stateArray: readonly unknown[], parentPath?: readonly PropertyKey[]): readonly RuntimeNode[];
|
|
685
696
|
//#endregion
|
|
686
|
-
export { CompleteEffectfulSourcesOptions, DependencyRequest, DependencyResolution, DependencyRuntimeContext, EffectfulSchedulingNodesFn, EffectfulSourceCompletion, EffectfulSourceCompletionResult, ReplayKey, ResolveDerivedSourceValuesOptions, RuntimeNode, SchedulingBarrierContext, SourceDefaultFailure, buildRuntimeNodesFromArray, buildRuntimeNodesFromPairs, collectDemandedDependencyIds, collectExplicitSourceValues, collectExplicitSourceValuesAsync, collectSourcesFromState, completeEffectfulSourcesAsync, createDependencyFingerprint, createDependencyRuntimeContext, createReplayKey, defineForwardedEffectfulSchedulingNodes, derivedRawInputKey, effectfulSchedulingNodesKey, extractRawInputFromState, fillMissingSourceDefaults, fillMissingSourceDefaultsAsync, orderDependencyNodes, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, resolveDerivedSourceValues, resolveDerivedSourceValuesAsync, resolveStateWithRuntime, resolveStateWithRuntimeAsync, serializeSchedulingPath, sourceCollectionExpansionKey, staticSourceScopeKey };
|
|
697
|
+
export { CompleteEffectfulSourcesOptions, DependencyRequest, DependencyResolution, DependencyRuntimeContext, EffectfulSchedulingNodesFn, EffectfulSourceCompletion, EffectfulSourceCompletionResult, ReplayKey, ResolveDerivedSourceValuesOptions, RuntimeNode, SchedulingBarrierContext, SourceDefaultFailure, buildRuntimeNodesFromArray, buildRuntimeNodesFromPairs, collectDemandedDependencyIds, collectExplicitSourceValues, collectExplicitSourceValuesAsync, collectSourcesFromState, completeEffectfulSourcesAsync, createDependencyFingerprint, createDependencyRuntimeContext, createReplayKey, defineForwardedEffectfulSchedulingNodes, derivedRawInputKey, effectfulSchedulingNodesKey, extractRawInputFromState, fillMissingSourceDefaults, fillMissingSourceDefaultsAsync, includeSourceFailureChain, orderDependencyNodes, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, resolveDerivedSourceValues, resolveDerivedSourceValuesAsync, resolveStateWithRuntime, resolveStateWithRuntimeAsync, serializeSchedulingPath, sourceCollectionExpansionKey, staticSourceScopeKey };
|
|
@@ -541,6 +541,16 @@ function propagateRuntimeSourceFailures(nodes, runtime) {
|
|
|
541
541
|
runtime.propagateSourceFailure(metadata.derived.dependencyIds, formatDependencyNodeMetavar(node), metadata.source?.sourceId);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Appends the recorded dependency chain to a source failure.
|
|
546
|
+
*
|
|
547
|
+
* @param error The source failure to annotate.
|
|
548
|
+
* @param sourceId The identifier of the failed source.
|
|
549
|
+
* @param runtime The dependency runtime that recorded the failure chain.
|
|
550
|
+
* @returns The annotated failure, or the original failure when no chain exists.
|
|
551
|
+
* @internal
|
|
552
|
+
* @since 1.3.0
|
|
553
|
+
*/
|
|
544
554
|
function includeSourceFailureChain(error, sourceId, runtime) {
|
|
545
555
|
const chain = runtime.getSourceFailureChain(sourceId);
|
|
546
556
|
return chain == null || chain.length < 2 ? error : message`${error} Dependency chain: ${chain.join(" -> ")}.`;
|
|
@@ -1315,8 +1325,9 @@ function buildRuntimeNodesFromPairs(pairs, state, parentPath) {
|
|
|
1315
1325
|
const nodes = [];
|
|
1316
1326
|
for (const [field, parser] of pairs) {
|
|
1317
1327
|
const fieldState = Object.hasOwn(state, field) ? state[field] : void 0;
|
|
1318
|
-
const
|
|
1319
|
-
const
|
|
1328
|
+
const isDerived = parser.dependencyMetadata?.derived != null;
|
|
1329
|
+
const rawInput = isDerived ? extractRawInputFromState(fieldState) : void 0;
|
|
1330
|
+
const defaultDependencyValues = isDerived ? getDefaultDependencySnapshot(fieldState) : void 0;
|
|
1320
1331
|
nodes.push({
|
|
1321
1332
|
path: [...prefix, field],
|
|
1322
1333
|
parser,
|
|
@@ -1346,8 +1357,9 @@ function buildRuntimeNodesFromArray(parsers, stateArray, parentPath) {
|
|
|
1346
1357
|
for (let i = 0; i < parsers.length; i++) {
|
|
1347
1358
|
const parser = parsers[i];
|
|
1348
1359
|
const elemState = i < stateArray.length ? stateArray[i] : void 0;
|
|
1349
|
-
const
|
|
1350
|
-
const
|
|
1360
|
+
const isDerived = parser.dependencyMetadata?.derived != null;
|
|
1361
|
+
const rawInput = isDerived ? extractRawInputFromState(elemState) : void 0;
|
|
1362
|
+
const defaultDependencyValues = isDerived ? getDefaultDependencySnapshot(elemState) : void 0;
|
|
1351
1363
|
nodes.push({
|
|
1352
1364
|
path: [...prefix, i],
|
|
1353
1365
|
parser,
|
|
@@ -1384,4 +1396,4 @@ function getDefaultDependencySnapshotInner(state, visited) {
|
|
|
1384
1396
|
}
|
|
1385
1397
|
|
|
1386
1398
|
//#endregion
|
|
1387
|
-
export { buildRuntimeNodesFromArray, buildRuntimeNodesFromPairs, collectDemandedDependencyIds, collectExplicitSourceValues, collectExplicitSourceValuesAsync, collectSourcesFromState, completeEffectfulSourcesAsync, createDependencyFingerprint, createDependencyRuntimeContext, createReplayKey, defineForwardedEffectfulSchedulingNodes, derivedRawInputKey, effectfulSchedulingNodesKey, extractRawInputFromState, fillMissingSourceDefaults, fillMissingSourceDefaultsAsync, orderDependencyNodes, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, resolveDerivedSourceValues, resolveDerivedSourceValuesAsync, resolveStateWithRuntime, resolveStateWithRuntimeAsync, serializeSchedulingPath, sourceCollectionExpansionKey, staticSourceScopeKey };
|
|
1399
|
+
export { buildRuntimeNodesFromArray, buildRuntimeNodesFromPairs, collectDemandedDependencyIds, collectExplicitSourceValues, collectExplicitSourceValuesAsync, collectSourcesFromState, completeEffectfulSourcesAsync, createDependencyFingerprint, createDependencyRuntimeContext, createReplayKey, defineForwardedEffectfulSchedulingNodes, derivedRawInputKey, effectfulSchedulingNodesKey, extractRawInputFromState, fillMissingSourceDefaults, fillMissingSourceDefaultsAsync, includeSourceFailureChain, orderDependencyNodes, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, resolveDerivedSourceValues, resolveDerivedSourceValuesAsync, resolveStateWithRuntime, resolveStateWithRuntimeAsync, serializeSchedulingPath, sourceCollectionExpansionKey, staticSourceScopeKey };
|
package/dist/primitives.cjs
CHANGED
|
@@ -36,8 +36,8 @@ function isTerminalValueState(state) {
|
|
|
36
36
|
* execution trace.
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
|
-
function createOptionParseState(parseResult, rawInput) {
|
|
40
|
-
require_dependency_runtime.recordDerivedRawInput(parseResult, rawInput);
|
|
39
|
+
function createOptionParseState(parseResult, rawInput, valueParser) {
|
|
40
|
+
if (require_internal_dependency.isDerivedValueParser(valueParser)) require_dependency_runtime.recordDerivedRawInput(parseResult, rawInput);
|
|
41
41
|
return parseResult;
|
|
42
42
|
}
|
|
43
43
|
function buildTraceEntry(kind, rawInput, consumed, valueParser, parseResult, optionNames$1) {
|
|
@@ -92,9 +92,7 @@ function resolveDerivedCompletionSync(derivedMetadata, state, exec) {
|
|
|
92
92
|
function includeDependencyFailureChain(error, dependencyMetadata, exec) {
|
|
93
93
|
const sourceId = dependencyMetadata?.source?.sourceId;
|
|
94
94
|
if (sourceId == null || exec?.dependencyRuntime == null) return error;
|
|
95
|
-
|
|
96
|
-
if (chain == null || chain.length < 2) return error;
|
|
97
|
-
return require_message.message`${error} Dependency chain: ${chain.join(" -> ")}.`;
|
|
95
|
+
return require_dependency_runtime.includeSourceFailureChain(error, sourceId, exec.dependencyRuntime);
|
|
98
96
|
}
|
|
99
97
|
async function resolveDerivedCompletionAsync(derivedMetadata, state, exec) {
|
|
100
98
|
if (derivedMetadata?.derived == null || exec?.dependencyRuntime == null) return state;
|
|
@@ -507,7 +505,7 @@ function option(...args) {
|
|
|
507
505
|
success: true,
|
|
508
506
|
next: {
|
|
509
507
|
...next,
|
|
510
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
508
|
+
state: createOptionParseState(parseResult, rawInput, syncValueParser),
|
|
511
509
|
buffer: context.buffer.slice(2)
|
|
512
510
|
},
|
|
513
511
|
consumed: context.buffer.slice(0, 2)
|
|
@@ -519,7 +517,7 @@ function option(...args) {
|
|
|
519
517
|
success: true,
|
|
520
518
|
next: {
|
|
521
519
|
...next,
|
|
522
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
520
|
+
state: createOptionParseState(parseResult, rawInput, valueParser),
|
|
523
521
|
buffer: context.buffer.slice(2)
|
|
524
522
|
},
|
|
525
523
|
consumed: context.buffer.slice(0, 2)
|
|
@@ -550,7 +548,7 @@ function option(...args) {
|
|
|
550
548
|
success: true,
|
|
551
549
|
next: {
|
|
552
550
|
...next,
|
|
553
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
551
|
+
state: createOptionParseState(parseResult, rawInput, syncValueParser),
|
|
554
552
|
buffer: context.buffer.slice(1)
|
|
555
553
|
},
|
|
556
554
|
consumed: context.buffer.slice(0, 1)
|
|
@@ -562,7 +560,7 @@ function option(...args) {
|
|
|
562
560
|
success: true,
|
|
563
561
|
next: {
|
|
564
562
|
...next,
|
|
565
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
563
|
+
state: createOptionParseState(parseResult, rawInput, valueParser),
|
|
566
564
|
buffer: context.buffer.slice(1)
|
|
567
565
|
},
|
|
568
566
|
consumed: context.buffer.slice(0, 1)
|
|
@@ -1250,7 +1248,7 @@ function argument(valueParser, options = {}) {
|
|
|
1250
1248
|
next: {
|
|
1251
1249
|
...next,
|
|
1252
1250
|
buffer: context.buffer.slice(i + 1),
|
|
1253
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
1251
|
+
state: createOptionParseState(parseResult, rawInput, syncValueParser),
|
|
1254
1252
|
optionsTerminated
|
|
1255
1253
|
},
|
|
1256
1254
|
consumed: context.buffer.slice(0, i + 1)
|
|
@@ -1263,7 +1261,7 @@ function argument(valueParser, options = {}) {
|
|
|
1263
1261
|
next: {
|
|
1264
1262
|
...next,
|
|
1265
1263
|
buffer: context.buffer.slice(i + 1),
|
|
1266
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
1264
|
+
state: createOptionParseState(parseResult, rawInput, valueParser),
|
|
1267
1265
|
optionsTerminated
|
|
1268
1266
|
},
|
|
1269
1267
|
consumed: context.buffer.slice(0, i + 1)
|
package/dist/primitives.js
CHANGED
|
@@ -4,7 +4,7 @@ import { validateCommandNames, validateOptionNames } from "./validate.js";
|
|
|
4
4
|
import { extractOptionNames, isDocHidden, isSuggestionHidden } from "./usage.js";
|
|
5
5
|
import { dispatchByMode, dispatchIterableByMode, wrapForMode } from "./internal/mode-dispatch.js";
|
|
6
6
|
import { getDefaultValuesFunction, getDependencyIds, getSnapshottedDefaultDependencyValues, isDerivedValueParser, suggestWithDependency } from "./internal/dependency.js";
|
|
7
|
-
import { effectfulSchedulingNodesKey, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, sourceCollectionExpansionKey, staticSourceScopeKey } from "./dependency-runtime.js";
|
|
7
|
+
import { effectfulSchedulingNodesKey, includeSourceFailureChain, recordDerivedRawInput, replayDerivedParser, replayDerivedParserAsync, sourceCollectionExpansionKey, staticSourceScopeKey } from "./dependency-runtime.js";
|
|
8
8
|
import { getWrappedChildParseState, getWrappedChildState, isAnnotationWrappedInitialState, normalizeInjectedAnnotationState } from "./annotation-state.js";
|
|
9
9
|
import { hiddenCommandAliasesKey } from "./internal/command-alias.js";
|
|
10
10
|
import { mergeChildExec, withChildContext, withChildExecPath } from "./execution-context.js";
|
|
@@ -36,8 +36,8 @@ function isTerminalValueState(state) {
|
|
|
36
36
|
* execution trace.
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
|
-
function createOptionParseState(parseResult, rawInput) {
|
|
40
|
-
recordDerivedRawInput(parseResult, rawInput);
|
|
39
|
+
function createOptionParseState(parseResult, rawInput, valueParser) {
|
|
40
|
+
if (isDerivedValueParser(valueParser)) recordDerivedRawInput(parseResult, rawInput);
|
|
41
41
|
return parseResult;
|
|
42
42
|
}
|
|
43
43
|
function buildTraceEntry(kind, rawInput, consumed, valueParser, parseResult, optionNames$1) {
|
|
@@ -92,9 +92,7 @@ function resolveDerivedCompletionSync(derivedMetadata, state, exec) {
|
|
|
92
92
|
function includeDependencyFailureChain(error, dependencyMetadata, exec) {
|
|
93
93
|
const sourceId = dependencyMetadata?.source?.sourceId;
|
|
94
94
|
if (sourceId == null || exec?.dependencyRuntime == null) return error;
|
|
95
|
-
|
|
96
|
-
if (chain == null || chain.length < 2) return error;
|
|
97
|
-
return message`${error} Dependency chain: ${chain.join(" -> ")}.`;
|
|
95
|
+
return includeSourceFailureChain(error, sourceId, exec.dependencyRuntime);
|
|
98
96
|
}
|
|
99
97
|
async function resolveDerivedCompletionAsync(derivedMetadata, state, exec) {
|
|
100
98
|
if (derivedMetadata?.derived == null || exec?.dependencyRuntime == null) return state;
|
|
@@ -507,7 +505,7 @@ function option(...args) {
|
|
|
507
505
|
success: true,
|
|
508
506
|
next: {
|
|
509
507
|
...next,
|
|
510
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
508
|
+
state: createOptionParseState(parseResult, rawInput, syncValueParser),
|
|
511
509
|
buffer: context.buffer.slice(2)
|
|
512
510
|
},
|
|
513
511
|
consumed: context.buffer.slice(0, 2)
|
|
@@ -519,7 +517,7 @@ function option(...args) {
|
|
|
519
517
|
success: true,
|
|
520
518
|
next: {
|
|
521
519
|
...next,
|
|
522
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
520
|
+
state: createOptionParseState(parseResult, rawInput, valueParser),
|
|
523
521
|
buffer: context.buffer.slice(2)
|
|
524
522
|
},
|
|
525
523
|
consumed: context.buffer.slice(0, 2)
|
|
@@ -550,7 +548,7 @@ function option(...args) {
|
|
|
550
548
|
success: true,
|
|
551
549
|
next: {
|
|
552
550
|
...next,
|
|
553
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
551
|
+
state: createOptionParseState(parseResult, rawInput, syncValueParser),
|
|
554
552
|
buffer: context.buffer.slice(1)
|
|
555
553
|
},
|
|
556
554
|
consumed: context.buffer.slice(0, 1)
|
|
@@ -562,7 +560,7 @@ function option(...args) {
|
|
|
562
560
|
success: true,
|
|
563
561
|
next: {
|
|
564
562
|
...next,
|
|
565
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
563
|
+
state: createOptionParseState(parseResult, rawInput, valueParser),
|
|
566
564
|
buffer: context.buffer.slice(1)
|
|
567
565
|
},
|
|
568
566
|
consumed: context.buffer.slice(0, 1)
|
|
@@ -1250,7 +1248,7 @@ function argument(valueParser, options = {}) {
|
|
|
1250
1248
|
next: {
|
|
1251
1249
|
...next,
|
|
1252
1250
|
buffer: context.buffer.slice(i + 1),
|
|
1253
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
1251
|
+
state: createOptionParseState(parseResult, rawInput, syncValueParser),
|
|
1254
1252
|
optionsTerminated
|
|
1255
1253
|
},
|
|
1256
1254
|
consumed: context.buffer.slice(0, i + 1)
|
|
@@ -1263,7 +1261,7 @@ function argument(valueParser, options = {}) {
|
|
|
1263
1261
|
next: {
|
|
1264
1262
|
...next,
|
|
1265
1263
|
buffer: context.buffer.slice(i + 1),
|
|
1266
|
-
state: createOptionParseState(parseResult, rawInput),
|
|
1264
|
+
state: createOptionParseState(parseResult, rawInput, valueParser),
|
|
1267
1265
|
optionsTerminated
|
|
1268
1266
|
},
|
|
1269
1267
|
consumed: context.buffer.slice(0, i + 1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.3.0-dev.
|
|
3
|
+
"version": "1.3.0-dev.2403",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
},
|
|
222
222
|
"sideEffects": false,
|
|
223
223
|
"devDependencies": {
|
|
224
|
-
"@optique/env": "1.3.0-dev.
|
|
224
|
+
"@optique/env": "1.3.0-dev.2403+eb79fb61",
|
|
225
225
|
"@types/node": "^24.0.0",
|
|
226
226
|
"fast-check": "^4.7.0",
|
|
227
227
|
"tsdown": "^0.13.0",
|