@optique/core 1.0.0-dev.1726 → 1.0.0-dev.1730
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/constructs.cjs +5 -1
- package/dist/constructs.d.cts +1 -1
- package/dist/constructs.d.ts +1 -1
- package/dist/constructs.js +5 -1
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -4450,6 +4450,10 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4450
4450
|
};
|
|
4451
4451
|
} else if (defaultBranch === void 0) return deferredDiscriminatorResult;
|
|
4452
4452
|
}
|
|
4453
|
+
if (defaultBranch !== void 0 && (exec?.phase === "parse" || exec?.phase === "suggest")) return {
|
|
4454
|
+
success: true,
|
|
4455
|
+
value: [void 0, void 0]
|
|
4456
|
+
};
|
|
4453
4457
|
if (defaultBranch !== void 0) {
|
|
4454
4458
|
const branchState = getAnnotatedChildState(state, state.branchState ?? defaultBranch.initialState, defaultBranch);
|
|
4455
4459
|
const defaultResult = unwrapCompleteResult(await defaultBranch.complete(branchState, withChildExecPath(exec, "_branch")));
|
|
@@ -4477,7 +4481,6 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4477
4481
|
const runtime = require_dependency_runtime.createDependencyRuntimeContext(exec?.dependencyRegistry?.clone());
|
|
4478
4482
|
await require_dependency_runtime.collectExplicitSourceValuesAsync(require_dependency_runtime.buildRuntimeNodesFromPairs([["_discriminator", discriminator], ["_branch", branchParser]], combinedState, exec?.path), runtime);
|
|
4479
4483
|
require_dependency_runtime.collectSourcesFromState(combinedState, runtime);
|
|
4480
|
-
const resolvedBranchState = getAnnotatedChildState(state, await require_dependency_runtime.resolveStateWithRuntimeAsync(state.branchState, runtime), branchParser);
|
|
4481
4484
|
const completionExec = {
|
|
4482
4485
|
...exec ?? {
|
|
4483
4486
|
usage: branchParser.usage,
|
|
@@ -4519,6 +4522,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4519
4522
|
error: options?.errors?.branchMismatch ? options.errors.branchMismatch(resolvedKey, speculativeKey) : require_message.message`Branch mismatch: tokens for ${speculativeKey} were consumed, but the discriminator resolved to ${resolvedKey}.`
|
|
4520
4523
|
};
|
|
4521
4524
|
}
|
|
4525
|
+
const resolvedBranchState = getAnnotatedChildState(state, await require_dependency_runtime.resolveStateWithRuntimeAsync(state.branchState, runtime), branchParser);
|
|
4522
4526
|
const branchResult = unwrapCompleteResult(await branchParser.complete(resolvedBranchState, withChildExecPath(completionExec, "_branch")));
|
|
4523
4527
|
if (!branchResult.success) {
|
|
4524
4528
|
if (discriminatorValue !== void 0 && options?.errors?.branchError) return {
|
package/dist/constructs.d.cts
CHANGED
|
@@ -1343,7 +1343,7 @@ interface ConditionalErrorOptions {
|
|
|
1343
1343
|
* Receives both the discriminator value the parser actually
|
|
1344
1344
|
* resolved to (`discriminatorValue`) and the speculative key the
|
|
1345
1345
|
* branch tokens were committed to (`speculativeKey`).
|
|
1346
|
-
* @since 0.
|
|
1346
|
+
* @since 1.0.1
|
|
1347
1347
|
*/
|
|
1348
1348
|
readonly branchMismatch?: (discriminatorValue: string, speculativeKey: string) => Message;
|
|
1349
1349
|
}
|
package/dist/constructs.d.ts
CHANGED
|
@@ -1343,7 +1343,7 @@ interface ConditionalErrorOptions {
|
|
|
1343
1343
|
* Receives both the discriminator value the parser actually
|
|
1344
1344
|
* resolved to (`discriminatorValue`) and the speculative key the
|
|
1345
1345
|
* branch tokens were committed to (`speculativeKey`).
|
|
1346
|
-
* @since 0.
|
|
1346
|
+
* @since 1.0.1
|
|
1347
1347
|
*/
|
|
1348
1348
|
readonly branchMismatch?: (discriminatorValue: string, speculativeKey: string) => Message;
|
|
1349
1349
|
}
|
package/dist/constructs.js
CHANGED
|
@@ -4450,6 +4450,10 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4450
4450
|
};
|
|
4451
4451
|
} else if (defaultBranch === void 0) return deferredDiscriminatorResult;
|
|
4452
4452
|
}
|
|
4453
|
+
if (defaultBranch !== void 0 && (exec?.phase === "parse" || exec?.phase === "suggest")) return {
|
|
4454
|
+
success: true,
|
|
4455
|
+
value: [void 0, void 0]
|
|
4456
|
+
};
|
|
4453
4457
|
if (defaultBranch !== void 0) {
|
|
4454
4458
|
const branchState = getAnnotatedChildState(state, state.branchState ?? defaultBranch.initialState, defaultBranch);
|
|
4455
4459
|
const defaultResult = unwrapCompleteResult(await defaultBranch.complete(branchState, withChildExecPath(exec, "_branch")));
|
|
@@ -4477,7 +4481,6 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4477
4481
|
const runtime = createDependencyRuntimeContext(exec?.dependencyRegistry?.clone());
|
|
4478
4482
|
await collectExplicitSourceValuesAsync(buildRuntimeNodesFromPairs([["_discriminator", discriminator], ["_branch", branchParser]], combinedState, exec?.path), runtime);
|
|
4479
4483
|
collectSourcesFromState(combinedState, runtime);
|
|
4480
|
-
const resolvedBranchState = getAnnotatedChildState(state, await resolveStateWithRuntimeAsync(state.branchState, runtime), branchParser);
|
|
4481
4484
|
const completionExec = {
|
|
4482
4485
|
...exec ?? {
|
|
4483
4486
|
usage: branchParser.usage,
|
|
@@ -4519,6 +4522,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4519
4522
|
error: options?.errors?.branchMismatch ? options.errors.branchMismatch(resolvedKey, speculativeKey) : message`Branch mismatch: tokens for ${speculativeKey} were consumed, but the discriminator resolved to ${resolvedKey}.`
|
|
4520
4523
|
};
|
|
4521
4524
|
}
|
|
4525
|
+
const resolvedBranchState = getAnnotatedChildState(state, await resolveStateWithRuntimeAsync(state.branchState, runtime), branchParser);
|
|
4522
4526
|
const branchResult = unwrapCompleteResult(await branchParser.complete(resolvedBranchState, withChildExecPath(completionExec, "_branch")));
|
|
4523
4527
|
if (!branchResult.success) {
|
|
4524
4528
|
if (discriminatorValue !== void 0 && options?.errors?.branchError) return {
|