@optique/core 1.0.0-dev.1697 → 1.0.0-dev.1701
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 +22 -2
- package/dist/constructs.js +22 -2
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -1627,9 +1627,18 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
1627
1627
|
if (currentContext.buffer.length === 0) {
|
|
1628
1628
|
let allCanComplete = true;
|
|
1629
1629
|
const getFieldState = createFieldStateGetter(currentContext.state);
|
|
1630
|
+
const probeExec = currentContext.exec ? {
|
|
1631
|
+
...currentContext.exec,
|
|
1632
|
+
phase: "parse"
|
|
1633
|
+
} : {
|
|
1634
|
+
usage: [],
|
|
1635
|
+
path: [],
|
|
1636
|
+
trace: void 0,
|
|
1637
|
+
phase: "parse"
|
|
1638
|
+
};
|
|
1630
1639
|
for (const [field, parser] of parserPairs) {
|
|
1631
1640
|
const fieldState = getFieldState(field, parser);
|
|
1632
|
-
const completeResult = parser.complete(fieldState, withChildExecPath(
|
|
1641
|
+
const completeResult = parser.complete(fieldState, withChildExecPath(probeExec, field));
|
|
1633
1642
|
if (!completeResult.success) {
|
|
1634
1643
|
allCanComplete = false;
|
|
1635
1644
|
break;
|
|
@@ -1716,9 +1725,18 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
1716
1725
|
if (currentContext.buffer.length === 0) {
|
|
1717
1726
|
let allCanComplete = true;
|
|
1718
1727
|
const getFieldState = createFieldStateGetter(currentContext.state);
|
|
1728
|
+
const probeExec = currentContext.exec ? {
|
|
1729
|
+
...currentContext.exec,
|
|
1730
|
+
phase: "parse"
|
|
1731
|
+
} : {
|
|
1732
|
+
usage: [],
|
|
1733
|
+
path: [],
|
|
1734
|
+
trace: void 0,
|
|
1735
|
+
phase: "parse"
|
|
1736
|
+
};
|
|
1719
1737
|
for (const [field, parser] of parserPairs) {
|
|
1720
1738
|
const fieldState = getFieldState(field, parser);
|
|
1721
|
-
const completeResult = await parser.complete(fieldState, withChildExecPath(
|
|
1739
|
+
const completeResult = await parser.complete(fieldState, withChildExecPath(probeExec, field));
|
|
1722
1740
|
if (!completeResult.success) {
|
|
1723
1741
|
allCanComplete = false;
|
|
1724
1742
|
break;
|
|
@@ -3825,6 +3843,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3825
3843
|
consumed: defaultResult.consumed
|
|
3826
3844
|
};
|
|
3827
3845
|
}
|
|
3846
|
+
if (!defaultResult.success && defaultResult.consumed > 0) return defaultResult;
|
|
3828
3847
|
}
|
|
3829
3848
|
return {
|
|
3830
3849
|
success: false,
|
|
@@ -3995,6 +4014,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3995
4014
|
consumed: defaultResult.consumed
|
|
3996
4015
|
};
|
|
3997
4016
|
}
|
|
4017
|
+
if (!defaultResult.success && defaultResult.consumed > 0) return defaultResult;
|
|
3998
4018
|
}
|
|
3999
4019
|
return {
|
|
4000
4020
|
success: false,
|
package/dist/constructs.js
CHANGED
|
@@ -1627,9 +1627,18 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
1627
1627
|
if (currentContext.buffer.length === 0) {
|
|
1628
1628
|
let allCanComplete = true;
|
|
1629
1629
|
const getFieldState = createFieldStateGetter(currentContext.state);
|
|
1630
|
+
const probeExec = currentContext.exec ? {
|
|
1631
|
+
...currentContext.exec,
|
|
1632
|
+
phase: "parse"
|
|
1633
|
+
} : {
|
|
1634
|
+
usage: [],
|
|
1635
|
+
path: [],
|
|
1636
|
+
trace: void 0,
|
|
1637
|
+
phase: "parse"
|
|
1638
|
+
};
|
|
1630
1639
|
for (const [field, parser] of parserPairs) {
|
|
1631
1640
|
const fieldState = getFieldState(field, parser);
|
|
1632
|
-
const completeResult = parser.complete(fieldState, withChildExecPath(
|
|
1641
|
+
const completeResult = parser.complete(fieldState, withChildExecPath(probeExec, field));
|
|
1633
1642
|
if (!completeResult.success) {
|
|
1634
1643
|
allCanComplete = false;
|
|
1635
1644
|
break;
|
|
@@ -1716,9 +1725,18 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
1716
1725
|
if (currentContext.buffer.length === 0) {
|
|
1717
1726
|
let allCanComplete = true;
|
|
1718
1727
|
const getFieldState = createFieldStateGetter(currentContext.state);
|
|
1728
|
+
const probeExec = currentContext.exec ? {
|
|
1729
|
+
...currentContext.exec,
|
|
1730
|
+
phase: "parse"
|
|
1731
|
+
} : {
|
|
1732
|
+
usage: [],
|
|
1733
|
+
path: [],
|
|
1734
|
+
trace: void 0,
|
|
1735
|
+
phase: "parse"
|
|
1736
|
+
};
|
|
1719
1737
|
for (const [field, parser] of parserPairs) {
|
|
1720
1738
|
const fieldState = getFieldState(field, parser);
|
|
1721
|
-
const completeResult = await parser.complete(fieldState, withChildExecPath(
|
|
1739
|
+
const completeResult = await parser.complete(fieldState, withChildExecPath(probeExec, field));
|
|
1722
1740
|
if (!completeResult.success) {
|
|
1723
1741
|
allCanComplete = false;
|
|
1724
1742
|
break;
|
|
@@ -3825,6 +3843,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3825
3843
|
consumed: defaultResult.consumed
|
|
3826
3844
|
};
|
|
3827
3845
|
}
|
|
3846
|
+
if (!defaultResult.success && defaultResult.consumed > 0) return defaultResult;
|
|
3828
3847
|
}
|
|
3829
3848
|
return {
|
|
3830
3849
|
success: false,
|
|
@@ -3995,6 +4014,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3995
4014
|
consumed: defaultResult.consumed
|
|
3996
4015
|
};
|
|
3997
4016
|
}
|
|
4017
|
+
if (!defaultResult.success && defaultResult.consumed > 0) return defaultResult;
|
|
3998
4018
|
}
|
|
3999
4019
|
return {
|
|
4000
4020
|
success: false,
|