@optique/core 1.0.0-dev.555 → 1.0.0-dev.557
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/annotations.cjs +19 -0
- package/dist/annotations.d.cts +13 -1
- package/dist/annotations.d.ts +13 -1
- package/dist/annotations.js +19 -1
- package/dist/constructs.cjs +3 -2
- package/dist/constructs.d.cts +28 -3
- package/dist/constructs.d.ts +28 -3
- package/dist/constructs.js +3 -2
- package/dist/facade.cjs +2 -3
- package/dist/facade.js +2 -3
- package/dist/mode-dispatch.cjs +8 -1
- package/dist/mode-dispatch.d.cts +55 -0
- package/dist/mode-dispatch.d.ts +55 -0
- package/dist/mode-dispatch.js +7 -1
- package/dist/modifiers.cjs +2 -9
- package/dist/modifiers.js +1 -8
- package/dist/primitives.cjs +13 -17
- package/dist/primitives.js +9 -13
- package/package.json +9 -1
package/dist/annotations.cjs
CHANGED
|
@@ -59,6 +59,24 @@ function getAnnotations(state) {
|
|
|
59
59
|
return void 0;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
+
* Reattaches annotations to a freshly created array state.
|
|
63
|
+
*
|
|
64
|
+
* Array spread copies elements but drops symbol properties, so parsers that
|
|
65
|
+
* rebuild array states need to copy annotations back explicitly.
|
|
66
|
+
*
|
|
67
|
+
* @param source The original state that may carry annotations.
|
|
68
|
+
* @param target The freshly created array state.
|
|
69
|
+
* @returns The target array, with annotations copied when available.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
function annotateFreshArray(source, target) {
|
|
73
|
+
const annotations = getAnnotations(source);
|
|
74
|
+
if (annotations === void 0) return target;
|
|
75
|
+
const annotated = target;
|
|
76
|
+
annotated[annotationKey] = annotations;
|
|
77
|
+
return annotated;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
62
80
|
* Propagates annotations from one parser state to another.
|
|
63
81
|
*
|
|
64
82
|
* This is mainly used by parsers that rebuild array states with spread syntax.
|
|
@@ -212,6 +230,7 @@ function isInjectedAnnotationWrapper(value) {
|
|
|
212
230
|
}
|
|
213
231
|
|
|
214
232
|
//#endregion
|
|
233
|
+
exports.annotateFreshArray = annotateFreshArray;
|
|
215
234
|
exports.annotationKey = annotationKey;
|
|
216
235
|
exports.annotationStateValueKey = annotationStateValueKey;
|
|
217
236
|
exports.annotationWrapperKey = annotationWrapperKey;
|
package/dist/annotations.d.cts
CHANGED
|
@@ -68,6 +68,18 @@ interface ParseOptions {
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
declare function getAnnotations(state: unknown): Annotations | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Reattaches annotations to a freshly created array state.
|
|
73
|
+
*
|
|
74
|
+
* Array spread copies elements but drops symbol properties, so parsers that
|
|
75
|
+
* rebuild array states need to copy annotations back explicitly.
|
|
76
|
+
*
|
|
77
|
+
* @param source The original state that may carry annotations.
|
|
78
|
+
* @param target The freshly created array state.
|
|
79
|
+
* @returns The target array, with annotations copied when available.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
declare function annotateFreshArray<T>(source: unknown, target: readonly T[]): readonly T[];
|
|
71
83
|
/**
|
|
72
84
|
* Propagates annotations from one parser state to another.
|
|
73
85
|
*
|
|
@@ -115,4 +127,4 @@ declare function unwrapInjectedAnnotationWrapper<T>(value: T): T;
|
|
|
115
127
|
*/
|
|
116
128
|
declare function isInjectedAnnotationWrapper(value: unknown): boolean;
|
|
117
129
|
//#endregion
|
|
118
|
-
export { Annotations, ParseOptions, annotationKey, annotationStateValueKey, annotationWrapperKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
|
|
130
|
+
export { Annotations, ParseOptions, annotateFreshArray, annotationKey, annotationStateValueKey, annotationWrapperKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
|
package/dist/annotations.d.ts
CHANGED
|
@@ -68,6 +68,18 @@ interface ParseOptions {
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
declare function getAnnotations(state: unknown): Annotations | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Reattaches annotations to a freshly created array state.
|
|
73
|
+
*
|
|
74
|
+
* Array spread copies elements but drops symbol properties, so parsers that
|
|
75
|
+
* rebuild array states need to copy annotations back explicitly.
|
|
76
|
+
*
|
|
77
|
+
* @param source The original state that may carry annotations.
|
|
78
|
+
* @param target The freshly created array state.
|
|
79
|
+
* @returns The target array, with annotations copied when available.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
declare function annotateFreshArray<T>(source: unknown, target: readonly T[]): readonly T[];
|
|
71
83
|
/**
|
|
72
84
|
* Propagates annotations from one parser state to another.
|
|
73
85
|
*
|
|
@@ -115,4 +127,4 @@ declare function unwrapInjectedAnnotationWrapper<T>(value: T): T;
|
|
|
115
127
|
*/
|
|
116
128
|
declare function isInjectedAnnotationWrapper(value: unknown): boolean;
|
|
117
129
|
//#endregion
|
|
118
|
-
export { Annotations, ParseOptions, annotationKey, annotationStateValueKey, annotationWrapperKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
|
|
130
|
+
export { Annotations, ParseOptions, annotateFreshArray, annotationKey, annotationStateValueKey, annotationWrapperKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
|
package/dist/annotations.js
CHANGED
|
@@ -58,6 +58,24 @@ function getAnnotations(state) {
|
|
|
58
58
|
return void 0;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
+
* Reattaches annotations to a freshly created array state.
|
|
62
|
+
*
|
|
63
|
+
* Array spread copies elements but drops symbol properties, so parsers that
|
|
64
|
+
* rebuild array states need to copy annotations back explicitly.
|
|
65
|
+
*
|
|
66
|
+
* @param source The original state that may carry annotations.
|
|
67
|
+
* @param target The freshly created array state.
|
|
68
|
+
* @returns The target array, with annotations copied when available.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
function annotateFreshArray(source, target) {
|
|
72
|
+
const annotations = getAnnotations(source);
|
|
73
|
+
if (annotations === void 0) return target;
|
|
74
|
+
const annotated = target;
|
|
75
|
+
annotated[annotationKey] = annotations;
|
|
76
|
+
return annotated;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
61
79
|
* Propagates annotations from one parser state to another.
|
|
62
80
|
*
|
|
63
81
|
* This is mainly used by parsers that rebuild array states with spread syntax.
|
|
@@ -211,4 +229,4 @@ function isInjectedAnnotationWrapper(value) {
|
|
|
211
229
|
}
|
|
212
230
|
|
|
213
231
|
//#endregion
|
|
214
|
-
export { annotationKey, annotationStateValueKey, annotationWrapperKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
|
|
232
|
+
export { annotateFreshArray, annotationKey, annotationStateValueKey, annotationWrapperKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
|
package/dist/constructs.cjs
CHANGED
|
@@ -1436,9 +1436,10 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
1436
1436
|
function merge(...args) {
|
|
1437
1437
|
const label = typeof args[0] === "string" ? args[0] : void 0;
|
|
1438
1438
|
const lastArg = args[args.length - 1];
|
|
1439
|
-
const
|
|
1439
|
+
const hasOptions = lastArg != null && typeof lastArg === "object" && !("$valueType" in lastArg);
|
|
1440
|
+
const options = hasOptions ? lastArg : {};
|
|
1440
1441
|
const startIndex = typeof args[0] === "string" ? 1 : 0;
|
|
1441
|
-
const endIndex =
|
|
1442
|
+
const endIndex = hasOptions ? args.length - 1 : args.length;
|
|
1442
1443
|
const rawParsers = args.slice(startIndex, endIndex);
|
|
1443
1444
|
const combinedMode = rawParsers.some((p) => p.$mode === "async") ? "async" : "sync";
|
|
1444
1445
|
const isAsync = combinedMode === "async";
|
package/dist/constructs.d.cts
CHANGED
|
@@ -127,8 +127,9 @@ type OrArityGuard<TParsers extends readonly unknown[]> = IsTuple<TParsers> exten
|
|
|
127
127
|
* @template TStateB The type of the state used by the second parser.
|
|
128
128
|
* @param a The first {@link Parser} to try.
|
|
129
129
|
* @param b The second {@link Parser} to try.
|
|
130
|
-
* @
|
|
131
|
-
*
|
|
130
|
+
* @return A {@link Parser} that tries to parse using the provided parsers
|
|
131
|
+
* in order, returning the result of the first successful parser.
|
|
132
|
+
* @since 0.3.0
|
|
132
133
|
*/
|
|
133
134
|
declare function or<MA extends Mode, MB extends Mode, TA, TB, TStateA, TStateB>(a: Parser<MA, TA, TStateA>, b: Parser<MB, TB, TStateB>): Parser<CombineModes<readonly [MA, MB]>, TA | TB, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>]>;
|
|
134
135
|
/**
|
|
@@ -149,6 +150,7 @@ declare function or<MA extends Mode, MB extends Mode, TA, TB, TStateA, TStateB>(
|
|
|
149
150
|
* @param c The third {@link Parser} to try.
|
|
150
151
|
* @return A {@link Parser} that tries to parse using the provided parsers
|
|
151
152
|
* in order, returning the result of the first successful parser.
|
|
153
|
+
* @since 0.3.0
|
|
152
154
|
*/
|
|
153
155
|
declare function or<MA extends Mode, MB extends Mode, MC extends Mode, TA, TB, TC, TStateA, TStateB, TStateC>(a: Parser<MA, TA, TStateA>, b: Parser<MB, TB, TStateB>, c: Parser<MC, TC, TStateC>): Parser<CombineModes<readonly [MA, MB, MC]>, TA | TB | TC, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>]>;
|
|
154
156
|
/**
|
|
@@ -173,6 +175,7 @@ declare function or<MA extends Mode, MB extends Mode, MC extends Mode, TA, TB, T
|
|
|
173
175
|
* @param d The fourth {@link Parser} to try.
|
|
174
176
|
* @return A {@link Parser} that tries to parse using the provided parsers
|
|
175
177
|
* in order, returning the result of the first successful parser.
|
|
178
|
+
* @since 0.3.0
|
|
176
179
|
*/
|
|
177
180
|
declare function or<MA extends Mode, MB extends Mode, MC extends Mode, MD extends Mode, TA, TB, TC, TD, TStateA, TStateB, TStateC, TStateD>(a: Parser<MA, TA, TStateA>, b: Parser<MB, TB, TStateB>, c: Parser<MC, TC, TStateC>, d: Parser<MD, TD, TStateD>): Parser<CombineModes<readonly [MA, MB, MC, MD]>, TA | TB | TC | TD, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>]>;
|
|
178
181
|
/**
|
|
@@ -779,7 +782,7 @@ interface LongestMatchOptions {
|
|
|
779
782
|
errors?: LongestMatchErrorOptions;
|
|
780
783
|
}
|
|
781
784
|
/**
|
|
782
|
-
* Options for customizing error messages in the {@link
|
|
785
|
+
* Options for customizing error messages in the {@link longestMatch} parser.
|
|
783
786
|
* @since 0.5.0
|
|
784
787
|
*/
|
|
785
788
|
interface LongestMatchErrorOptions {
|
|
@@ -883,6 +886,28 @@ declare function longestMatch<const TParsers extends readonly Parser<Mode, unkno
|
|
|
883
886
|
* @since 0.3.0
|
|
884
887
|
*/
|
|
885
888
|
declare function longestMatch<const TParsers extends readonly Parser<Mode, unknown, unknown>[]>(...parsers: TParsers & LongestMatchArityGuard<TParsers>): Parser<CombineModes<{ readonly [K in keyof TParsers]: ExtractMode<TParsers[K]> }>, InferValue<TParsers[number]>, LongestMatchState<TParsers>>;
|
|
889
|
+
/**
|
|
890
|
+
* Creates a parser that selects the successful branch that consumed
|
|
891
|
+
* the most input tokens from a homogeneous parser list.
|
|
892
|
+
*
|
|
893
|
+
* This overload is intended for spread arrays whose element types are
|
|
894
|
+
* homogeneous enough that callers only need the shared value type.
|
|
895
|
+
*
|
|
896
|
+
* @param parsers Parsers to evaluate and compare by consumed input.
|
|
897
|
+
* @returns A parser that preserves the shared parser mode and value type.
|
|
898
|
+
* @since 1.0.0
|
|
899
|
+
*/
|
|
900
|
+
declare function longestMatch<M extends Mode, TValue, TState, const TParsers extends readonly Parser<M, TValue, TState>[]>(...parsers: TParsers & LongestMatchArityGuard<TParsers>): Parser<M, TValue, unknown>;
|
|
901
|
+
/**
|
|
902
|
+
* Creates a parser that selects the successful branch that consumed
|
|
903
|
+
* the most input tokens from a homogeneous parser list, with custom
|
|
904
|
+
* error options.
|
|
905
|
+
*
|
|
906
|
+
* @param rest Parsers to compare, followed by error customization options.
|
|
907
|
+
* @returns A parser that preserves the shared parser mode and value type.
|
|
908
|
+
* @since 1.0.0
|
|
909
|
+
*/
|
|
910
|
+
declare function longestMatch<M extends Mode, TValue, TState, const TParsers extends readonly Parser<M, TValue, TState>[]>(...rest: [...parsers: TParsers, options: LongestMatchTailOptions] & LongestMatchArityGuard<TParsers>): Parser<M, TValue, unknown>;
|
|
886
911
|
/**
|
|
887
912
|
* Options for the {@link object} parser.
|
|
888
913
|
* @since 0.5.0
|
package/dist/constructs.d.ts
CHANGED
|
@@ -127,8 +127,9 @@ type OrArityGuard<TParsers extends readonly unknown[]> = IsTuple<TParsers> exten
|
|
|
127
127
|
* @template TStateB The type of the state used by the second parser.
|
|
128
128
|
* @param a The first {@link Parser} to try.
|
|
129
129
|
* @param b The second {@link Parser} to try.
|
|
130
|
-
* @
|
|
131
|
-
*
|
|
130
|
+
* @return A {@link Parser} that tries to parse using the provided parsers
|
|
131
|
+
* in order, returning the result of the first successful parser.
|
|
132
|
+
* @since 0.3.0
|
|
132
133
|
*/
|
|
133
134
|
declare function or<MA extends Mode, MB extends Mode, TA, TB, TStateA, TStateB>(a: Parser<MA, TA, TStateA>, b: Parser<MB, TB, TStateB>): Parser<CombineModes<readonly [MA, MB]>, TA | TB, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>]>;
|
|
134
135
|
/**
|
|
@@ -149,6 +150,7 @@ declare function or<MA extends Mode, MB extends Mode, TA, TB, TStateA, TStateB>(
|
|
|
149
150
|
* @param c The third {@link Parser} to try.
|
|
150
151
|
* @return A {@link Parser} that tries to parse using the provided parsers
|
|
151
152
|
* in order, returning the result of the first successful parser.
|
|
153
|
+
* @since 0.3.0
|
|
152
154
|
*/
|
|
153
155
|
declare function or<MA extends Mode, MB extends Mode, MC extends Mode, TA, TB, TC, TStateA, TStateB, TStateC>(a: Parser<MA, TA, TStateA>, b: Parser<MB, TB, TStateB>, c: Parser<MC, TC, TStateC>): Parser<CombineModes<readonly [MA, MB, MC]>, TA | TB | TC, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>]>;
|
|
154
156
|
/**
|
|
@@ -173,6 +175,7 @@ declare function or<MA extends Mode, MB extends Mode, MC extends Mode, TA, TB, T
|
|
|
173
175
|
* @param d The fourth {@link Parser} to try.
|
|
174
176
|
* @return A {@link Parser} that tries to parse using the provided parsers
|
|
175
177
|
* in order, returning the result of the first successful parser.
|
|
178
|
+
* @since 0.3.0
|
|
176
179
|
*/
|
|
177
180
|
declare function or<MA extends Mode, MB extends Mode, MC extends Mode, MD extends Mode, TA, TB, TC, TD, TStateA, TStateB, TStateC, TStateD>(a: Parser<MA, TA, TStateA>, b: Parser<MB, TB, TStateB>, c: Parser<MC, TC, TStateC>, d: Parser<MD, TD, TStateD>): Parser<CombineModes<readonly [MA, MB, MC, MD]>, TA | TB | TC | TD, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>]>;
|
|
178
181
|
/**
|
|
@@ -779,7 +782,7 @@ interface LongestMatchOptions {
|
|
|
779
782
|
errors?: LongestMatchErrorOptions;
|
|
780
783
|
}
|
|
781
784
|
/**
|
|
782
|
-
* Options for customizing error messages in the {@link
|
|
785
|
+
* Options for customizing error messages in the {@link longestMatch} parser.
|
|
783
786
|
* @since 0.5.0
|
|
784
787
|
*/
|
|
785
788
|
interface LongestMatchErrorOptions {
|
|
@@ -883,6 +886,28 @@ declare function longestMatch<const TParsers extends readonly Parser<Mode, unkno
|
|
|
883
886
|
* @since 0.3.0
|
|
884
887
|
*/
|
|
885
888
|
declare function longestMatch<const TParsers extends readonly Parser<Mode, unknown, unknown>[]>(...parsers: TParsers & LongestMatchArityGuard<TParsers>): Parser<CombineModes<{ readonly [K in keyof TParsers]: ExtractMode<TParsers[K]> }>, InferValue<TParsers[number]>, LongestMatchState<TParsers>>;
|
|
889
|
+
/**
|
|
890
|
+
* Creates a parser that selects the successful branch that consumed
|
|
891
|
+
* the most input tokens from a homogeneous parser list.
|
|
892
|
+
*
|
|
893
|
+
* This overload is intended for spread arrays whose element types are
|
|
894
|
+
* homogeneous enough that callers only need the shared value type.
|
|
895
|
+
*
|
|
896
|
+
* @param parsers Parsers to evaluate and compare by consumed input.
|
|
897
|
+
* @returns A parser that preserves the shared parser mode and value type.
|
|
898
|
+
* @since 1.0.0
|
|
899
|
+
*/
|
|
900
|
+
declare function longestMatch<M extends Mode, TValue, TState, const TParsers extends readonly Parser<M, TValue, TState>[]>(...parsers: TParsers & LongestMatchArityGuard<TParsers>): Parser<M, TValue, unknown>;
|
|
901
|
+
/**
|
|
902
|
+
* Creates a parser that selects the successful branch that consumed
|
|
903
|
+
* the most input tokens from a homogeneous parser list, with custom
|
|
904
|
+
* error options.
|
|
905
|
+
*
|
|
906
|
+
* @param rest Parsers to compare, followed by error customization options.
|
|
907
|
+
* @returns A parser that preserves the shared parser mode and value type.
|
|
908
|
+
* @since 1.0.0
|
|
909
|
+
*/
|
|
910
|
+
declare function longestMatch<M extends Mode, TValue, TState, const TParsers extends readonly Parser<M, TValue, TState>[]>(...rest: [...parsers: TParsers, options: LongestMatchTailOptions] & LongestMatchArityGuard<TParsers>): Parser<M, TValue, unknown>;
|
|
886
911
|
/**
|
|
887
912
|
* Options for the {@link object} parser.
|
|
888
913
|
* @since 0.5.0
|
package/dist/constructs.js
CHANGED
|
@@ -1436,9 +1436,10 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
1436
1436
|
function merge(...args) {
|
|
1437
1437
|
const label = typeof args[0] === "string" ? args[0] : void 0;
|
|
1438
1438
|
const lastArg = args[args.length - 1];
|
|
1439
|
-
const
|
|
1439
|
+
const hasOptions = lastArg != null && typeof lastArg === "object" && !("$valueType" in lastArg);
|
|
1440
|
+
const options = hasOptions ? lastArg : {};
|
|
1440
1441
|
const startIndex = typeof args[0] === "string" ? 1 : 0;
|
|
1441
|
-
const endIndex =
|
|
1442
|
+
const endIndex = hasOptions ? args.length - 1 : args.length;
|
|
1442
1443
|
const rawParsers = args.slice(startIndex, endIndex);
|
|
1443
1444
|
const combinedMode = rawParsers.some((p) => p.$mode === "async") ? "async" : "sync";
|
|
1444
1445
|
const isAsync = combinedMode === "async";
|
package/dist/facade.cjs
CHANGED
|
@@ -339,7 +339,6 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
339
339
|
const hasHelpOption = helpOptionNames.some((n) => args.includes(n));
|
|
340
340
|
const hasHelpCommand = args.length > 0 && helpCommandNames.includes(args[0]);
|
|
341
341
|
const hasCompletionCommand = args.length > 0 && completionCommandNames.includes(args[0]);
|
|
342
|
-
if (hasVersionOption && hasHelpOption && !hasVersionCommand && !hasHelpCommand) {}
|
|
343
342
|
if (hasVersionCommand && hasHelpOption && parsedValue.helpFlag) return {
|
|
344
343
|
type: "help",
|
|
345
344
|
commands: [args[0]]
|
|
@@ -360,8 +359,8 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
360
359
|
if ((hasVersionOption || hasVersionCommand) && (parsedValue.version || parsedValue.versionFlag)) return { type: "version" };
|
|
361
360
|
if (parsedValue.completion && parsedValue.completionData) return {
|
|
362
361
|
type: "completion",
|
|
363
|
-
shell: parsedValue.completionData.shell
|
|
364
|
-
args: parsedValue.completionData.args
|
|
362
|
+
shell: parsedValue.completionData.shell ?? "",
|
|
363
|
+
args: parsedValue.completionData.args ?? []
|
|
365
364
|
};
|
|
366
365
|
return {
|
|
367
366
|
type: "success",
|
package/dist/facade.js
CHANGED
|
@@ -339,7 +339,6 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
339
339
|
const hasHelpOption = helpOptionNames.some((n) => args.includes(n));
|
|
340
340
|
const hasHelpCommand = args.length > 0 && helpCommandNames.includes(args[0]);
|
|
341
341
|
const hasCompletionCommand = args.length > 0 && completionCommandNames.includes(args[0]);
|
|
342
|
-
if (hasVersionOption && hasHelpOption && !hasVersionCommand && !hasHelpCommand) {}
|
|
343
342
|
if (hasVersionCommand && hasHelpOption && parsedValue.helpFlag) return {
|
|
344
343
|
type: "help",
|
|
345
344
|
commands: [args[0]]
|
|
@@ -360,8 +359,8 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
360
359
|
if ((hasVersionOption || hasVersionCommand) && (parsedValue.version || parsedValue.versionFlag)) return { type: "version" };
|
|
361
360
|
if (parsedValue.completion && parsedValue.completionData) return {
|
|
362
361
|
type: "completion",
|
|
363
|
-
shell: parsedValue.completionData.shell
|
|
364
|
-
args: parsedValue.completionData.args
|
|
362
|
+
shell: parsedValue.completionData.shell ?? "",
|
|
363
|
+
args: parsedValue.completionData.args ?? []
|
|
365
364
|
};
|
|
366
365
|
return {
|
|
367
366
|
type: "success",
|
package/dist/mode-dispatch.cjs
CHANGED
|
@@ -18,6 +18,11 @@ function dispatchByMode(mode, syncFn, asyncFn) {
|
|
|
18
18
|
if (mode === "async") return asyncFn();
|
|
19
19
|
return syncFn();
|
|
20
20
|
}
|
|
21
|
+
function wrapForMode(mode, value) {
|
|
22
|
+
if (mode === "async") return Promise.resolve(value);
|
|
23
|
+
if (value instanceof Promise) throw new TypeError("Synchronous mode cannot wrap Promise value.");
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
21
26
|
/**
|
|
22
27
|
* Maps a mode-wrapped value while preserving its execution mode.
|
|
23
28
|
*
|
|
@@ -30,6 +35,7 @@ function dispatchByMode(mode, syncFn, asyncFn) {
|
|
|
30
35
|
*/
|
|
31
36
|
function mapModeValue(mode, value, mapFn) {
|
|
32
37
|
if (mode === "async") return Promise.resolve(value).then(mapFn);
|
|
38
|
+
if (value instanceof Promise) throw new TypeError("Synchronous mode cannot map Promise value.");
|
|
33
39
|
return mapFn(value);
|
|
34
40
|
}
|
|
35
41
|
/**
|
|
@@ -50,4 +56,5 @@ function dispatchIterableByMode(mode, syncFn, asyncFn) {
|
|
|
50
56
|
//#endregion
|
|
51
57
|
exports.dispatchByMode = dispatchByMode;
|
|
52
58
|
exports.dispatchIterableByMode = dispatchIterableByMode;
|
|
53
|
-
exports.mapModeValue = mapModeValue;
|
|
59
|
+
exports.mapModeValue = mapModeValue;
|
|
60
|
+
exports.wrapForMode = wrapForMode;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Mode, ModeIterable, ModeValue } from "./parser.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/mode-dispatch.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Dispatches to sync or async implementation based on mode.
|
|
7
|
+
*
|
|
8
|
+
* This function encapsulates the necessary type assertions when branching
|
|
9
|
+
* on runtime mode values. TypeScript cannot narrow `ModeValue<M, T>` based
|
|
10
|
+
* on `mode === "async"` checks, so we must use type assertions.
|
|
11
|
+
*
|
|
12
|
+
* @param mode The execution mode.
|
|
13
|
+
* @param syncFn Function to call for sync execution.
|
|
14
|
+
* @param asyncFn Function to call for async execution.
|
|
15
|
+
* @returns The result with correct mode wrapping.
|
|
16
|
+
* @internal
|
|
17
|
+
* @since 0.10.0
|
|
18
|
+
*/
|
|
19
|
+
declare function dispatchByMode<M extends Mode, T>(mode: M, syncFn: () => T, asyncFn: () => Promise<T>): ModeValue<M, T>;
|
|
20
|
+
/**
|
|
21
|
+
* Wraps a value so it matches the parser execution mode.
|
|
22
|
+
*
|
|
23
|
+
* @param mode The execution mode.
|
|
24
|
+
* @param value The value to wrap.
|
|
25
|
+
* @returns The wrapped value with correct mode semantics.
|
|
26
|
+
* @internal
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
*/
|
|
29
|
+
declare function wrapForMode<T>(mode: "sync", value: T | Promise<T>): T;
|
|
30
|
+
declare function wrapForMode<T>(mode: "async", value: T | Promise<T>): Promise<T>;
|
|
31
|
+
declare function wrapForMode<M extends Mode, T>(mode: M, value: T | Promise<T>): ModeValue<M, T>;
|
|
32
|
+
/**
|
|
33
|
+
* Maps a mode-wrapped value while preserving its execution mode.
|
|
34
|
+
*
|
|
35
|
+
* @param mode The execution mode.
|
|
36
|
+
* @param value The mode-wrapped value to transform.
|
|
37
|
+
* @param mapFn Mapping function applied to the unwrapped value.
|
|
38
|
+
* @returns The mapped value with correct mode wrapping.
|
|
39
|
+
* @internal
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
*/
|
|
42
|
+
declare function mapModeValue<M extends Mode, T, U>(mode: M, value: ModeValue<M, T>, mapFn: (value: T) => U): ModeValue<M, U>;
|
|
43
|
+
/**
|
|
44
|
+
* Dispatches iterable to sync or async implementation based on mode.
|
|
45
|
+
*
|
|
46
|
+
* @param mode The execution mode.
|
|
47
|
+
* @param syncFn Function returning sync iterable.
|
|
48
|
+
* @param asyncFn Function returning async iterable.
|
|
49
|
+
* @returns The iterable with correct mode wrapping.
|
|
50
|
+
* @internal
|
|
51
|
+
* @since 0.10.0
|
|
52
|
+
*/
|
|
53
|
+
declare function dispatchIterableByMode<M extends Mode, T>(mode: M, syncFn: () => Iterable<T>, asyncFn: () => AsyncIterable<T>): ModeIterable<M, T>;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { dispatchByMode, dispatchIterableByMode, mapModeValue, wrapForMode };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Mode, ModeIterable, ModeValue } from "./parser.js";
|
|
2
|
+
|
|
3
|
+
//#region src/mode-dispatch.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Dispatches to sync or async implementation based on mode.
|
|
7
|
+
*
|
|
8
|
+
* This function encapsulates the necessary type assertions when branching
|
|
9
|
+
* on runtime mode values. TypeScript cannot narrow `ModeValue<M, T>` based
|
|
10
|
+
* on `mode === "async"` checks, so we must use type assertions.
|
|
11
|
+
*
|
|
12
|
+
* @param mode The execution mode.
|
|
13
|
+
* @param syncFn Function to call for sync execution.
|
|
14
|
+
* @param asyncFn Function to call for async execution.
|
|
15
|
+
* @returns The result with correct mode wrapping.
|
|
16
|
+
* @internal
|
|
17
|
+
* @since 0.10.0
|
|
18
|
+
*/
|
|
19
|
+
declare function dispatchByMode<M extends Mode, T>(mode: M, syncFn: () => T, asyncFn: () => Promise<T>): ModeValue<M, T>;
|
|
20
|
+
/**
|
|
21
|
+
* Wraps a value so it matches the parser execution mode.
|
|
22
|
+
*
|
|
23
|
+
* @param mode The execution mode.
|
|
24
|
+
* @param value The value to wrap.
|
|
25
|
+
* @returns The wrapped value with correct mode semantics.
|
|
26
|
+
* @internal
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
*/
|
|
29
|
+
declare function wrapForMode<T>(mode: "sync", value: T | Promise<T>): T;
|
|
30
|
+
declare function wrapForMode<T>(mode: "async", value: T | Promise<T>): Promise<T>;
|
|
31
|
+
declare function wrapForMode<M extends Mode, T>(mode: M, value: T | Promise<T>): ModeValue<M, T>;
|
|
32
|
+
/**
|
|
33
|
+
* Maps a mode-wrapped value while preserving its execution mode.
|
|
34
|
+
*
|
|
35
|
+
* @param mode The execution mode.
|
|
36
|
+
* @param value The mode-wrapped value to transform.
|
|
37
|
+
* @param mapFn Mapping function applied to the unwrapped value.
|
|
38
|
+
* @returns The mapped value with correct mode wrapping.
|
|
39
|
+
* @internal
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
*/
|
|
42
|
+
declare function mapModeValue<M extends Mode, T, U>(mode: M, value: ModeValue<M, T>, mapFn: (value: T) => U): ModeValue<M, U>;
|
|
43
|
+
/**
|
|
44
|
+
* Dispatches iterable to sync or async implementation based on mode.
|
|
45
|
+
*
|
|
46
|
+
* @param mode The execution mode.
|
|
47
|
+
* @param syncFn Function returning sync iterable.
|
|
48
|
+
* @param asyncFn Function returning async iterable.
|
|
49
|
+
* @returns The iterable with correct mode wrapping.
|
|
50
|
+
* @internal
|
|
51
|
+
* @since 0.10.0
|
|
52
|
+
*/
|
|
53
|
+
declare function dispatchIterableByMode<M extends Mode, T>(mode: M, syncFn: () => Iterable<T>, asyncFn: () => AsyncIterable<T>): ModeIterable<M, T>;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { dispatchByMode, dispatchIterableByMode, mapModeValue, wrapForMode };
|
package/dist/mode-dispatch.js
CHANGED
|
@@ -17,6 +17,11 @@ function dispatchByMode(mode, syncFn, asyncFn) {
|
|
|
17
17
|
if (mode === "async") return asyncFn();
|
|
18
18
|
return syncFn();
|
|
19
19
|
}
|
|
20
|
+
function wrapForMode(mode, value) {
|
|
21
|
+
if (mode === "async") return Promise.resolve(value);
|
|
22
|
+
if (value instanceof Promise) throw new TypeError("Synchronous mode cannot wrap Promise value.");
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
20
25
|
/**
|
|
21
26
|
* Maps a mode-wrapped value while preserving its execution mode.
|
|
22
27
|
*
|
|
@@ -29,6 +34,7 @@ function dispatchByMode(mode, syncFn, asyncFn) {
|
|
|
29
34
|
*/
|
|
30
35
|
function mapModeValue(mode, value, mapFn) {
|
|
31
36
|
if (mode === "async") return Promise.resolve(value).then(mapFn);
|
|
37
|
+
if (value instanceof Promise) throw new TypeError("Synchronous mode cannot map Promise value.");
|
|
32
38
|
return mapFn(value);
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
@@ -47,4 +53,4 @@ function dispatchIterableByMode(mode, syncFn, asyncFn) {
|
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
//#endregion
|
|
50
|
-
export { dispatchByMode, dispatchIterableByMode, mapModeValue };
|
|
56
|
+
export { dispatchByMode, dispatchIterableByMode, mapModeValue, wrapForMode };
|
package/dist/modifiers.cjs
CHANGED
|
@@ -411,13 +411,6 @@ function multiple(parser, options = {}) {
|
|
|
411
411
|
const syncParser = parser;
|
|
412
412
|
const { min = 0, max = Infinity } = options;
|
|
413
413
|
const unwrapInjectedWrapper = require_annotations.unwrapInjectedAnnotationWrapper;
|
|
414
|
-
const annotateFreshArray = (source, target) => {
|
|
415
|
-
const annotations = require_annotations.getAnnotations(source);
|
|
416
|
-
if (annotations === void 0) return target;
|
|
417
|
-
const annotated = target;
|
|
418
|
-
annotated[require_annotations.annotationKey] = annotations;
|
|
419
|
-
return annotated;
|
|
420
|
-
};
|
|
421
414
|
const completeSyncWithUnwrappedFallback = (state) => {
|
|
422
415
|
try {
|
|
423
416
|
return syncParser.complete(state);
|
|
@@ -488,7 +481,7 @@ function multiple(parser, options = {}) {
|
|
|
488
481
|
success: true,
|
|
489
482
|
next: {
|
|
490
483
|
...result.next,
|
|
491
|
-
state: annotateFreshArray(context.state, [...added ? context.state : context.state.slice(0, -1), nextItemState])
|
|
484
|
+
state: require_annotations.annotateFreshArray(context.state, [...added ? context.state : context.state.slice(0, -1), nextItemState])
|
|
492
485
|
},
|
|
493
486
|
consumed: result.consumed
|
|
494
487
|
};
|
|
@@ -515,7 +508,7 @@ function multiple(parser, options = {}) {
|
|
|
515
508
|
success: true,
|
|
516
509
|
next: {
|
|
517
510
|
...result.next,
|
|
518
|
-
state: annotateFreshArray(context.state, [...added ? context.state : context.state.slice(0, -1), nextItemState])
|
|
511
|
+
state: require_annotations.annotateFreshArray(context.state, [...added ? context.state : context.state.slice(0, -1), nextItemState])
|
|
519
512
|
},
|
|
520
513
|
consumed: result.consumed
|
|
521
514
|
};
|
package/dist/modifiers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { annotateFreshArray, inheritAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper } from "./annotations.js";
|
|
2
2
|
import { formatMessage, message, text } from "./message.js";
|
|
3
3
|
import { createDependencySourceState, dependencyId, isDependencySourceState, isPendingDependencySourceState, isWrappedDependencySource, transformsDependencyValue, transformsDependencyValueMarker, wrappedDependencySourceMarker } from "./dependency.js";
|
|
4
4
|
import { dispatchByMode, dispatchIterableByMode, mapModeValue } from "./mode-dispatch.js";
|
|
@@ -411,13 +411,6 @@ function multiple(parser, options = {}) {
|
|
|
411
411
|
const syncParser = parser;
|
|
412
412
|
const { min = 0, max = Infinity } = options;
|
|
413
413
|
const unwrapInjectedWrapper = unwrapInjectedAnnotationWrapper;
|
|
414
|
-
const annotateFreshArray = (source, target) => {
|
|
415
|
-
const annotations = getAnnotations(source);
|
|
416
|
-
if (annotations === void 0) return target;
|
|
417
|
-
const annotated = target;
|
|
418
|
-
annotated[annotationKey] = annotations;
|
|
419
|
-
return annotated;
|
|
420
|
-
};
|
|
421
414
|
const completeSyncWithUnwrappedFallback = (state) => {
|
|
422
415
|
try {
|
|
423
416
|
return syncParser.complete(state);
|
package/dist/primitives.cjs
CHANGED
|
@@ -401,11 +401,14 @@ function option(...args) {
|
|
|
401
401
|
const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
|
|
402
402
|
for (const prefix of prefixes) {
|
|
403
403
|
if (!context.buffer[0].startsWith(prefix)) continue;
|
|
404
|
-
if (context.state?.success && (valueParser != null || context.state.value))
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
404
|
+
if (context.state?.success && (valueParser != null || context.state.value)) {
|
|
405
|
+
const optionName$1 = prefix.slice(0, -1);
|
|
406
|
+
return {
|
|
407
|
+
success: false,
|
|
408
|
+
consumed: 1,
|
|
409
|
+
error: options.errors?.duplicate ? typeof options.errors.duplicate === "function" ? options.errors.duplicate(prefix) : options.errors.duplicate : require_message.message`${require_message.optionName(optionName$1)} cannot be used multiple times.`
|
|
410
|
+
};
|
|
411
|
+
}
|
|
409
412
|
const rawInput = context.buffer[0].slice(prefix.length);
|
|
410
413
|
if (valueParser == null) return {
|
|
411
414
|
success: false,
|
|
@@ -1116,13 +1119,6 @@ function passThrough(options = {}) {
|
|
|
1116
1119
|
const format = options.format ?? "equalsOnly";
|
|
1117
1120
|
const optionPattern = /^-[a-z0-9-]|^--[a-z0-9-]+/i;
|
|
1118
1121
|
const equalsOptionPattern = /^--[a-z0-9-]+=/i;
|
|
1119
|
-
const annotateFreshArray = (source, target) => {
|
|
1120
|
-
const annotations = require_annotations.getAnnotations(source);
|
|
1121
|
-
if (annotations === void 0) return target;
|
|
1122
|
-
const annotated = target;
|
|
1123
|
-
annotated[require_annotations.annotationKey] = annotations;
|
|
1124
|
-
return annotated;
|
|
1125
|
-
};
|
|
1126
1122
|
return {
|
|
1127
1123
|
$valueType: [],
|
|
1128
1124
|
$stateType: [],
|
|
@@ -1147,7 +1143,7 @@ function passThrough(options = {}) {
|
|
|
1147
1143
|
next: {
|
|
1148
1144
|
...context,
|
|
1149
1145
|
buffer: [],
|
|
1150
|
-
state: annotateFreshArray(context.state, [...context.state, ...captured])
|
|
1146
|
+
state: require_annotations.annotateFreshArray(context.state, [...context.state, ...captured])
|
|
1151
1147
|
},
|
|
1152
1148
|
consumed: captured
|
|
1153
1149
|
};
|
|
@@ -1168,7 +1164,7 @@ function passThrough(options = {}) {
|
|
|
1168
1164
|
next: {
|
|
1169
1165
|
...context,
|
|
1170
1166
|
buffer: context.buffer.slice(1),
|
|
1171
|
-
state: annotateFreshArray(context.state, [...context.state, token])
|
|
1167
|
+
state: require_annotations.annotateFreshArray(context.state, [...context.state, token])
|
|
1172
1168
|
},
|
|
1173
1169
|
consumed: [token]
|
|
1174
1170
|
};
|
|
@@ -1184,7 +1180,7 @@ function passThrough(options = {}) {
|
|
|
1184
1180
|
next: {
|
|
1185
1181
|
...context,
|
|
1186
1182
|
buffer: context.buffer.slice(1),
|
|
1187
|
-
state: annotateFreshArray(context.state, [...context.state, token])
|
|
1183
|
+
state: require_annotations.annotateFreshArray(context.state, [...context.state, token])
|
|
1188
1184
|
},
|
|
1189
1185
|
consumed: [token]
|
|
1190
1186
|
};
|
|
@@ -1194,7 +1190,7 @@ function passThrough(options = {}) {
|
|
|
1194
1190
|
next: {
|
|
1195
1191
|
...context,
|
|
1196
1192
|
buffer: context.buffer.slice(2),
|
|
1197
|
-
state: annotateFreshArray(context.state, [
|
|
1193
|
+
state: require_annotations.annotateFreshArray(context.state, [
|
|
1198
1194
|
...context.state,
|
|
1199
1195
|
token,
|
|
1200
1196
|
nextToken
|
|
@@ -1207,7 +1203,7 @@ function passThrough(options = {}) {
|
|
|
1207
1203
|
next: {
|
|
1208
1204
|
...context,
|
|
1209
1205
|
buffer: context.buffer.slice(1),
|
|
1210
|
-
state: annotateFreshArray(context.state, [...context.state, token])
|
|
1206
|
+
state: require_annotations.annotateFreshArray(context.state, [...context.state, token])
|
|
1211
1207
|
},
|
|
1212
1208
|
consumed: [token]
|
|
1213
1209
|
};
|
package/dist/primitives.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { annotateFreshArray, getAnnotations } from "./annotations.js";
|
|
2
2
|
import { message, metavar, optionName, optionNames, text, valueSet } from "./message.js";
|
|
3
3
|
import { createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, dependencyId, getDefaultValuesFunction, getDependencyIds, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isPendingDependencySourceState, suggestWithDependency } from "./dependency.js";
|
|
4
4
|
import { dispatchIterableByMode } from "./mode-dispatch.js";
|
|
@@ -401,11 +401,14 @@ function option(...args) {
|
|
|
401
401
|
const prefixes = optionNames$1.filter((name) => name.startsWith("--") || name.startsWith("/") || name.startsWith("-") && name.length > 2).map((name) => name.startsWith("/") ? `${name}:` : `${name}=`);
|
|
402
402
|
for (const prefix of prefixes) {
|
|
403
403
|
if (!context.buffer[0].startsWith(prefix)) continue;
|
|
404
|
-
if (context.state?.success && (valueParser != null || context.state.value))
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
404
|
+
if (context.state?.success && (valueParser != null || context.state.value)) {
|
|
405
|
+
const optionName$1 = prefix.slice(0, -1);
|
|
406
|
+
return {
|
|
407
|
+
success: false,
|
|
408
|
+
consumed: 1,
|
|
409
|
+
error: options.errors?.duplicate ? typeof options.errors.duplicate === "function" ? options.errors.duplicate(prefix) : options.errors.duplicate : message`${optionName(optionName$1)} cannot be used multiple times.`
|
|
410
|
+
};
|
|
411
|
+
}
|
|
409
412
|
const rawInput = context.buffer[0].slice(prefix.length);
|
|
410
413
|
if (valueParser == null) return {
|
|
411
414
|
success: false,
|
|
@@ -1116,13 +1119,6 @@ function passThrough(options = {}) {
|
|
|
1116
1119
|
const format = options.format ?? "equalsOnly";
|
|
1117
1120
|
const optionPattern = /^-[a-z0-9-]|^--[a-z0-9-]+/i;
|
|
1118
1121
|
const equalsOptionPattern = /^--[a-z0-9-]+=/i;
|
|
1119
|
-
const annotateFreshArray = (source, target) => {
|
|
1120
|
-
const annotations = getAnnotations(source);
|
|
1121
|
-
if (annotations === void 0) return target;
|
|
1122
|
-
const annotated = target;
|
|
1123
|
-
annotated[annotationKey] = annotations;
|
|
1124
|
-
return annotated;
|
|
1125
|
-
};
|
|
1126
1122
|
return {
|
|
1127
1123
|
$valueType: [],
|
|
1128
1124
|
$stateType: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.557+7de4cc60",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -115,6 +115,14 @@
|
|
|
115
115
|
"import": "./dist/message.js",
|
|
116
116
|
"require": "./dist/message.cjs"
|
|
117
117
|
},
|
|
118
|
+
"./mode-dispatch": {
|
|
119
|
+
"types": {
|
|
120
|
+
"import": "./dist/mode-dispatch.d.ts",
|
|
121
|
+
"require": "./dist/mode-dispatch.d.cts"
|
|
122
|
+
},
|
|
123
|
+
"import": "./dist/mode-dispatch.js",
|
|
124
|
+
"require": "./dist/mode-dispatch.cjs"
|
|
125
|
+
},
|
|
118
126
|
"./modifiers": {
|
|
119
127
|
"types": {
|
|
120
128
|
"import": "./dist/modifiers.d.ts",
|