@optique/core 1.3.0-dev.2379 → 1.3.0-dev.2381
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 +344 -38
- package/dist/constructs.js +345 -39
- package/dist/dependency-metadata.cjs +13 -1
- package/dist/dependency-metadata.d.cts +20 -1
- package/dist/dependency-metadata.d.ts +20 -1
- package/dist/dependency-metadata.js +13 -1
- package/dist/dependency-runtime.cjs +216 -0
- package/dist/dependency-runtime.d.cts +162 -1
- package/dist/dependency-runtime.d.ts +162 -1
- package/dist/dependency-runtime.js +213 -1
- package/dist/facade.cjs +54 -26
- package/dist/facade.js +55 -27
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/internal/parser.cjs +23 -3
- package/dist/internal/parser.d.cts +80 -3
- package/dist/internal/parser.d.ts +80 -3
- package/dist/internal/parser.js +23 -4
- package/dist/modifiers.cjs +43 -2
- package/dist/modifiers.js +43 -2
- package/dist/parser.d.cts +2 -2
- package/dist/parser.d.ts +2 -2
- package/dist/primitives.cjs +14 -0
- package/dist/primitives.js +15 -1
- package/package.json +2 -2
package/dist/modifiers.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_internal_annotations = require('./internal/annotations.cjs');
|
|
2
2
|
const require_message = require('./message.cjs');
|
|
3
3
|
const require_mode_dispatch = require('./internal/mode-dispatch.cjs');
|
|
4
|
+
const require_dependency_runtime = require('./dependency-runtime.cjs');
|
|
4
5
|
const require_internal_parser = require('./internal/parser.cjs');
|
|
5
6
|
const require_annotation_state = require('./annotation-state.cjs');
|
|
6
7
|
const require_execution_context = require('./execution-context.cjs');
|
|
@@ -456,8 +457,24 @@ function optional(parser) {
|
|
|
456
457
|
}
|
|
457
458
|
if (parser.dependencyMetadata != null) {
|
|
458
459
|
const composed = require_dependency_metadata.composeDependencyMetadata(parser.dependencyMetadata, "optional");
|
|
459
|
-
if (composed != null)
|
|
460
|
+
if (composed != null) {
|
|
461
|
+
const rebound = composed.source?.completeSource == null ? composed : composed.source.preservesSourceValue === false ? {
|
|
462
|
+
...composed,
|
|
463
|
+
source: {
|
|
464
|
+
...composed.source,
|
|
465
|
+
completeSource: void 0
|
|
466
|
+
}
|
|
467
|
+
} : {
|
|
468
|
+
...composed,
|
|
469
|
+
source: {
|
|
470
|
+
...composed.source,
|
|
471
|
+
completeSource: (state, exec) => Promise.resolve(optionalParser.complete(state, exec))
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
optionalParser.dependencyMetadata = rebound;
|
|
475
|
+
}
|
|
460
476
|
}
|
|
477
|
+
require_dependency_runtime.defineForwardedEffectfulSchedulingNodes(optionalParser, parser, (state) => Array.isArray(state) && state.length === 1 ? state[0] : state);
|
|
461
478
|
require_internal_parser.defineParseLanes(optionalParser, adaptOptionalStyleParseLanes(parser));
|
|
462
479
|
require_internal_parser.defineInheritedAnnotationParser(optionalParser);
|
|
463
480
|
require_internal_parser.defineSourceBindingOnlyAnnotationCompletionParser(optionalParser);
|
|
@@ -691,8 +708,24 @@ function withDefault(parser, defaultValue, options) {
|
|
|
691
708
|
value: v
|
|
692
709
|
};
|
|
693
710
|
} });
|
|
694
|
-
if (composed != null)
|
|
711
|
+
if (composed != null) {
|
|
712
|
+
const rebound = composed.source?.completeSource == null ? composed : composed.source.preservesSourceValue === false ? {
|
|
713
|
+
...composed,
|
|
714
|
+
source: {
|
|
715
|
+
...composed.source,
|
|
716
|
+
completeSource: void 0
|
|
717
|
+
}
|
|
718
|
+
} : {
|
|
719
|
+
...composed,
|
|
720
|
+
source: {
|
|
721
|
+
...composed.source,
|
|
722
|
+
completeSource: (state, exec) => Promise.resolve(withDefaultParser.complete(state, exec))
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
withDefaultParser.dependencyMetadata = rebound;
|
|
726
|
+
}
|
|
695
727
|
}
|
|
728
|
+
require_dependency_runtime.defineForwardedEffectfulSchedulingNodes(withDefaultParser, parser, (state) => Array.isArray(state) && state.length === 1 ? state[0] : state);
|
|
696
729
|
require_internal_parser.defineParseLanes(withDefaultParser, adaptOptionalStyleParseLanes(parser));
|
|
697
730
|
require_internal_parser.defineInheritedAnnotationParser(withDefaultParser);
|
|
698
731
|
require_internal_parser.defineSourceBindingOnlyAnnotationCompletionParser(withDefaultParser);
|
|
@@ -884,6 +917,7 @@ function map(parser, transform) {
|
|
|
884
917
|
}
|
|
885
918
|
if (composed != null) mappedParser.dependencyMetadata = composed;
|
|
886
919
|
}
|
|
920
|
+
require_dependency_runtime.defineForwardedEffectfulSchedulingNodes(mappedParser, parser);
|
|
887
921
|
return fluent(mappedParser);
|
|
888
922
|
}
|
|
889
923
|
const deferredValueBrand = Symbol.for("@optique/core/deferredValue");
|
|
@@ -1660,6 +1694,7 @@ function multiple(parser, options = {}) {
|
|
|
1660
1694
|
source: {
|
|
1661
1695
|
...innerSource,
|
|
1662
1696
|
preservesSourceValue: false,
|
|
1697
|
+
completeSource: void 0,
|
|
1663
1698
|
extractSourceValue: (state) => {
|
|
1664
1699
|
if (!Array.isArray(state)) return innerSource.extractSourceValue(state);
|
|
1665
1700
|
const scan = (index) => {
|
|
@@ -1785,6 +1820,11 @@ function nonEmpty(parser) {
|
|
|
1785
1820
|
return lane.parse(context);
|
|
1786
1821
|
}
|
|
1787
1822
|
})));
|
|
1823
|
+
if (parser.dependencyMetadata != null) Object.defineProperty(nonEmptyParser, "dependencyMetadata", {
|
|
1824
|
+
value: parser.dependencyMetadata,
|
|
1825
|
+
configurable: true,
|
|
1826
|
+
enumerable: false
|
|
1827
|
+
});
|
|
1788
1828
|
if ("placeholder" in parser) Object.defineProperty(nonEmptyParser, "placeholder", {
|
|
1789
1829
|
get() {
|
|
1790
1830
|
return parser.placeholder;
|
|
@@ -1809,6 +1849,7 @@ function nonEmpty(parser) {
|
|
|
1809
1849
|
configurable: true,
|
|
1810
1850
|
enumerable: false
|
|
1811
1851
|
});
|
|
1852
|
+
require_dependency_runtime.defineForwardedEffectfulSchedulingNodes(nonEmptyParser, parser);
|
|
1812
1853
|
return fluent(nonEmptyParser);
|
|
1813
1854
|
}
|
|
1814
1855
|
const fluentParserMarker = Symbol.for("@optique/core/fluent");
|
package/dist/modifiers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { annotateFreshArray, annotationKey, getAnnotations, inheritAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper } from "./internal/annotations.js";
|
|
2
2
|
import { formatMessage, message, text } from "./message.js";
|
|
3
3
|
import { dispatchByMode, dispatchIterableByMode, mapModeValue, wrapForMode } from "./internal/mode-dispatch.js";
|
|
4
|
+
import { defineForwardedEffectfulSchedulingNodes } from "./dependency-runtime.js";
|
|
4
5
|
import { defineInheritedAnnotationParser, defineParseLanes, defineSourceBindingOnlyAnnotationCompletionParser, getOwnParseLanes, unmatchedNonCliDependencySourceStateMarker } from "./internal/parser.js";
|
|
5
6
|
import { getDelegatedAnnotationState, hasDelegatedAnnotationCarrier, isAnnotationWrappedInitialState, normalizeDelegatedAnnotationState, normalizeNestedDelegatedAnnotationState } from "./annotation-state.js";
|
|
6
7
|
import { mergeChildExec, withChildContext, withChildExecPath } from "./execution-context.js";
|
|
@@ -456,8 +457,24 @@ function optional(parser) {
|
|
|
456
457
|
}
|
|
457
458
|
if (parser.dependencyMetadata != null) {
|
|
458
459
|
const composed = composeDependencyMetadata(parser.dependencyMetadata, "optional");
|
|
459
|
-
if (composed != null)
|
|
460
|
+
if (composed != null) {
|
|
461
|
+
const rebound = composed.source?.completeSource == null ? composed : composed.source.preservesSourceValue === false ? {
|
|
462
|
+
...composed,
|
|
463
|
+
source: {
|
|
464
|
+
...composed.source,
|
|
465
|
+
completeSource: void 0
|
|
466
|
+
}
|
|
467
|
+
} : {
|
|
468
|
+
...composed,
|
|
469
|
+
source: {
|
|
470
|
+
...composed.source,
|
|
471
|
+
completeSource: (state, exec) => Promise.resolve(optionalParser.complete(state, exec))
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
optionalParser.dependencyMetadata = rebound;
|
|
475
|
+
}
|
|
460
476
|
}
|
|
477
|
+
defineForwardedEffectfulSchedulingNodes(optionalParser, parser, (state) => Array.isArray(state) && state.length === 1 ? state[0] : state);
|
|
461
478
|
defineParseLanes(optionalParser, adaptOptionalStyleParseLanes(parser));
|
|
462
479
|
defineInheritedAnnotationParser(optionalParser);
|
|
463
480
|
defineSourceBindingOnlyAnnotationCompletionParser(optionalParser);
|
|
@@ -691,8 +708,24 @@ function withDefault(parser, defaultValue, options) {
|
|
|
691
708
|
value: v
|
|
692
709
|
};
|
|
693
710
|
} });
|
|
694
|
-
if (composed != null)
|
|
711
|
+
if (composed != null) {
|
|
712
|
+
const rebound = composed.source?.completeSource == null ? composed : composed.source.preservesSourceValue === false ? {
|
|
713
|
+
...composed,
|
|
714
|
+
source: {
|
|
715
|
+
...composed.source,
|
|
716
|
+
completeSource: void 0
|
|
717
|
+
}
|
|
718
|
+
} : {
|
|
719
|
+
...composed,
|
|
720
|
+
source: {
|
|
721
|
+
...composed.source,
|
|
722
|
+
completeSource: (state, exec) => Promise.resolve(withDefaultParser.complete(state, exec))
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
withDefaultParser.dependencyMetadata = rebound;
|
|
726
|
+
}
|
|
695
727
|
}
|
|
728
|
+
defineForwardedEffectfulSchedulingNodes(withDefaultParser, parser, (state) => Array.isArray(state) && state.length === 1 ? state[0] : state);
|
|
696
729
|
defineParseLanes(withDefaultParser, adaptOptionalStyleParseLanes(parser));
|
|
697
730
|
defineInheritedAnnotationParser(withDefaultParser);
|
|
698
731
|
defineSourceBindingOnlyAnnotationCompletionParser(withDefaultParser);
|
|
@@ -884,6 +917,7 @@ function map(parser, transform) {
|
|
|
884
917
|
}
|
|
885
918
|
if (composed != null) mappedParser.dependencyMetadata = composed;
|
|
886
919
|
}
|
|
920
|
+
defineForwardedEffectfulSchedulingNodes(mappedParser, parser);
|
|
887
921
|
return fluent(mappedParser);
|
|
888
922
|
}
|
|
889
923
|
const deferredValueBrand = Symbol.for("@optique/core/deferredValue");
|
|
@@ -1660,6 +1694,7 @@ function multiple(parser, options = {}) {
|
|
|
1660
1694
|
source: {
|
|
1661
1695
|
...innerSource,
|
|
1662
1696
|
preservesSourceValue: false,
|
|
1697
|
+
completeSource: void 0,
|
|
1663
1698
|
extractSourceValue: (state) => {
|
|
1664
1699
|
if (!Array.isArray(state)) return innerSource.extractSourceValue(state);
|
|
1665
1700
|
const scan = (index) => {
|
|
@@ -1785,6 +1820,11 @@ function nonEmpty(parser) {
|
|
|
1785
1820
|
return lane.parse(context);
|
|
1786
1821
|
}
|
|
1787
1822
|
})));
|
|
1823
|
+
if (parser.dependencyMetadata != null) Object.defineProperty(nonEmptyParser, "dependencyMetadata", {
|
|
1824
|
+
value: parser.dependencyMetadata,
|
|
1825
|
+
configurable: true,
|
|
1826
|
+
enumerable: false
|
|
1827
|
+
});
|
|
1788
1828
|
if ("placeholder" in parser) Object.defineProperty(nonEmptyParser, "placeholder", {
|
|
1789
1829
|
get() {
|
|
1790
1830
|
return parser.placeholder;
|
|
@@ -1809,6 +1849,7 @@ function nonEmpty(parser) {
|
|
|
1809
1849
|
configurable: true,
|
|
1810
1850
|
enumerable: false
|
|
1811
1851
|
});
|
|
1852
|
+
defineForwardedEffectfulSchedulingNodes(nonEmptyParser, parser);
|
|
1812
1853
|
return fluent(nonEmptyParser);
|
|
1813
1854
|
}
|
|
1814
1855
|
const fluentParserMarker = Symbol.for("@optique/core/fluent");
|
package/dist/parser.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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 };
|
|
2
|
+
import { CombineModes, DocState, EffectfulCompletionSession, 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 EffectfulCompletionSession, 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 };
|
package/dist/parser.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ParseOptions } from "./internal/annotations.js";
|
|
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.js";
|
|
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 };
|
|
2
|
+
import { CombineModes, DocState, EffectfulCompletionSession, 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.js";
|
|
3
|
+
export { type CombineModes, type DocState, type EffectfulCompletionSession, 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 };
|
package/dist/primitives.cjs
CHANGED
|
@@ -1706,6 +1706,20 @@ function command(name, parser, options = {}) {
|
|
|
1706
1706
|
configurable: true,
|
|
1707
1707
|
enumerable: false
|
|
1708
1708
|
});
|
|
1709
|
+
Object.defineProperty(result, require_dependency_runtime.effectfulSchedulingNodesKey, {
|
|
1710
|
+
value: ((state, parentPath) => {
|
|
1711
|
+
const normalizedState = normalizeCommandState(state);
|
|
1712
|
+
if (normalizedState == null) return [];
|
|
1713
|
+
const innerState = normalizedState[0] === "parsing" ? normalizedState[1] : parser.initialState;
|
|
1714
|
+
return [{
|
|
1715
|
+
path: [...parentPath ?? [], name],
|
|
1716
|
+
parser,
|
|
1717
|
+
state: getCommandChildState(state, innerState, parser)
|
|
1718
|
+
}];
|
|
1719
|
+
}),
|
|
1720
|
+
configurable: true,
|
|
1721
|
+
enumerable: false
|
|
1722
|
+
});
|
|
1709
1723
|
return require_modifiers.fluent(result);
|
|
1710
1724
|
}
|
|
1711
1725
|
/**
|
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 { replayDerivedParser, replayDerivedParserAsync } from "./dependency-runtime.js";
|
|
7
|
+
import { effectfulSchedulingNodesKey, replayDerivedParser, replayDerivedParserAsync } 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";
|
|
@@ -1706,6 +1706,20 @@ function command(name, parser, options = {}) {
|
|
|
1706
1706
|
configurable: true,
|
|
1707
1707
|
enumerable: false
|
|
1708
1708
|
});
|
|
1709
|
+
Object.defineProperty(result, effectfulSchedulingNodesKey, {
|
|
1710
|
+
value: ((state, parentPath) => {
|
|
1711
|
+
const normalizedState = normalizeCommandState(state);
|
|
1712
|
+
if (normalizedState == null) return [];
|
|
1713
|
+
const innerState = normalizedState[0] === "parsing" ? normalizedState[1] : parser.initialState;
|
|
1714
|
+
return [{
|
|
1715
|
+
path: [...parentPath ?? [], name],
|
|
1716
|
+
parser,
|
|
1717
|
+
state: getCommandChildState(state, innerState, parser)
|
|
1718
|
+
}];
|
|
1719
|
+
}),
|
|
1720
|
+
configurable: true,
|
|
1721
|
+
enumerable: false
|
|
1722
|
+
});
|
|
1709
1723
|
return fluent(result);
|
|
1710
1724
|
}
|
|
1711
1725
|
/**
|
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.2381",
|
|
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.2381+b37c0393",
|
|
225
225
|
"@types/node": "^24.0.0",
|
|
226
226
|
"fast-check": "^4.7.0",
|
|
227
227
|
"tsdown": "^0.13.0",
|