@optique/core 1.4.0-dev.2623 → 1.4.0-dev.2627
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 +31 -12
- package/dist/constructs.js +31 -12
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.js +1 -1
- package/package.json +2 -2
package/dist/constructs.cjs
CHANGED
|
@@ -4147,12 +4147,19 @@ function seq(...rawArgs) {
|
|
|
4147
4147
|
}
|
|
4148
4148
|
return require_short_option.combinedOptionScope(parsers.slice(0, end), parsers.slice(0, end).map((_, index) => index));
|
|
4149
4149
|
};
|
|
4150
|
-
const seqScope = require_short_option.selectableOptionScope(
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4150
|
+
const seqScope = require_short_option.selectableOptionScope((selections, arities, context, path = []) => {
|
|
4151
|
+
const initialContext = {
|
|
4152
|
+
state: context == null ? initialState : require_internal_annotations.inheritAnnotations(context.state, initialState),
|
|
4153
|
+
buffer: context?.buffer ?? [],
|
|
4154
|
+
usage: context?.usage ?? [],
|
|
4155
|
+
optionsTerminated: context?.optionsTerminated ?? false,
|
|
4156
|
+
exec: context?.exec == null ? void 0 : {
|
|
4157
|
+
...context.exec,
|
|
4158
|
+
path
|
|
4159
|
+
}
|
|
4160
|
+
};
|
|
4161
|
+
return reachableSeqScope(initialContext)(selections, arities, context, path);
|
|
4162
|
+
});
|
|
4156
4163
|
const parseSync = (context) => {
|
|
4157
4164
|
let currentContext = context;
|
|
4158
4165
|
const allConsumed = [];
|
|
@@ -6426,11 +6433,13 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
6426
6433
|
}
|
|
6427
6434
|
const discriminatorConsumed = discriminatorResult.success ? discriminatorResult.consumed.length : discriminatorResult.consumed;
|
|
6428
6435
|
if (syncDefaultBranch !== void 0) {
|
|
6429
|
-
const
|
|
6436
|
+
const defaultContext = require_short_option.forkOptionScope(context);
|
|
6437
|
+
optionScope.select(defaultContext, syncDefaultBranch);
|
|
6438
|
+
const defaultResult = syncDefaultBranch.parse(withChildContext$1(defaultContext, "_branch", state.branchState ?? syncDefaultBranch.initialState, syncDefaultBranch, syncDefaultBranch.usage));
|
|
6430
6439
|
if (defaultResult.success && (defaultResult.consumed.length > 0 || discriminatorConsumed === 0 && context.buffer.length === 0)) {
|
|
6431
6440
|
const mergedExec = require_execution_context.mergeChildExec(context.exec, defaultResult.next.exec);
|
|
6432
6441
|
const commitDefault = defaultResult.consumed.length > 0 || context.buffer.length === 0;
|
|
6433
|
-
if (commitDefault)
|
|
6442
|
+
if (commitDefault) require_short_option.adoptOptionScope(context, defaultResult.next);
|
|
6434
6443
|
return {
|
|
6435
6444
|
success: true,
|
|
6436
6445
|
...defaultResult.provisional ? { provisional: true } : {},
|
|
@@ -6682,11 +6691,13 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
6682
6691
|
}
|
|
6683
6692
|
const discriminatorConsumed = discriminatorResult.success ? discriminatorResult.consumed.length : discriminatorResult.consumed;
|
|
6684
6693
|
if (defaultBranch !== void 0) {
|
|
6685
|
-
const
|
|
6694
|
+
const defaultContext = require_short_option.forkOptionScope(context);
|
|
6695
|
+
optionScope.select(defaultContext, defaultBranch);
|
|
6696
|
+
const defaultResult = await defaultBranch.parse(withChildContext$1(defaultContext, "_branch", state.branchState ?? defaultBranch.initialState, defaultBranch, defaultBranch.usage));
|
|
6686
6697
|
if (defaultResult.success && (defaultResult.consumed.length > 0 || discriminatorConsumed === 0 && context.buffer.length === 0)) {
|
|
6687
6698
|
const mergedExec = require_execution_context.mergeChildExec(context.exec, defaultResult.next.exec);
|
|
6688
6699
|
const commitDefault = defaultResult.consumed.length > 0 || context.buffer.length === 0;
|
|
6689
|
-
if (commitDefault)
|
|
6700
|
+
if (commitDefault) require_short_option.adoptOptionScope(context, defaultResult.next);
|
|
6690
6701
|
return {
|
|
6691
6702
|
success: true,
|
|
6692
6703
|
...defaultResult.provisional ? { provisional: true } : {},
|
|
@@ -7348,7 +7359,11 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
7348
7359
|
const branchContext = require_short_option.forkOptionScope(suggestContext);
|
|
7349
7360
|
optionScope.select(branchContext, resolvedBranch);
|
|
7350
7361
|
yield* resolvedBranch.suggest(withChildContext$1(branchContext, "_branch", state.branchState ?? resolvedBranch.initialState, resolvedBranch), prefix);
|
|
7351
|
-
} else if (syncDefaultBranch !== void 0)
|
|
7362
|
+
} else if (syncDefaultBranch !== void 0) {
|
|
7363
|
+
const defaultContext = require_short_option.forkOptionScope(suggestContext);
|
|
7364
|
+
optionScope.select(defaultContext, syncDefaultBranch);
|
|
7365
|
+
yield* syncDefaultBranch.suggest(withChildContext$1(defaultContext, "_branch", state.branchState ?? syncDefaultBranch.initialState, syncDefaultBranch), prefix);
|
|
7366
|
+
}
|
|
7352
7367
|
} else {
|
|
7353
7368
|
const branchParser = state.selectedBranch.kind === "default" ? syncDefaultBranch : syncBranches[state.selectedBranch.key];
|
|
7354
7369
|
const runtime = require_dependency_runtime.createDependencyRuntimeContext(context.dependencyRegistry?.clone());
|
|
@@ -7408,7 +7423,11 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
7408
7423
|
}
|
|
7409
7424
|
}
|
|
7410
7425
|
if (!discResolved) {
|
|
7411
|
-
if (defaultBranch !== void 0)
|
|
7426
|
+
if (defaultBranch !== void 0) {
|
|
7427
|
+
const defaultContext = require_short_option.forkOptionScope(suggestContext);
|
|
7428
|
+
optionScope.select(defaultContext, defaultBranch);
|
|
7429
|
+
yield* defaultBranch.suggest(withChildContext$1(defaultContext, "_branch", state.branchState ?? defaultBranch.initialState, defaultBranch), prefix);
|
|
7430
|
+
}
|
|
7412
7431
|
}
|
|
7413
7432
|
} else {
|
|
7414
7433
|
const branchParser = state.selectedBranch.kind === "default" ? defaultBranch : branches[state.selectedBranch.key];
|
package/dist/constructs.js
CHANGED
|
@@ -4147,12 +4147,19 @@ function seq(...rawArgs) {
|
|
|
4147
4147
|
}
|
|
4148
4148
|
return combinedOptionScope(parsers.slice(0, end), parsers.slice(0, end).map((_, index) => index));
|
|
4149
4149
|
};
|
|
4150
|
-
const seqScope = selectableOptionScope(
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4150
|
+
const seqScope = selectableOptionScope((selections, arities, context, path = []) => {
|
|
4151
|
+
const initialContext = {
|
|
4152
|
+
state: context == null ? initialState : inheritAnnotations(context.state, initialState),
|
|
4153
|
+
buffer: context?.buffer ?? [],
|
|
4154
|
+
usage: context?.usage ?? [],
|
|
4155
|
+
optionsTerminated: context?.optionsTerminated ?? false,
|
|
4156
|
+
exec: context?.exec == null ? void 0 : {
|
|
4157
|
+
...context.exec,
|
|
4158
|
+
path
|
|
4159
|
+
}
|
|
4160
|
+
};
|
|
4161
|
+
return reachableSeqScope(initialContext)(selections, arities, context, path);
|
|
4162
|
+
});
|
|
4156
4163
|
const parseSync = (context) => {
|
|
4157
4164
|
let currentContext = context;
|
|
4158
4165
|
const allConsumed = [];
|
|
@@ -6426,11 +6433,13 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
6426
6433
|
}
|
|
6427
6434
|
const discriminatorConsumed = discriminatorResult.success ? discriminatorResult.consumed.length : discriminatorResult.consumed;
|
|
6428
6435
|
if (syncDefaultBranch !== void 0) {
|
|
6429
|
-
const
|
|
6436
|
+
const defaultContext = forkOptionScope(context);
|
|
6437
|
+
optionScope.select(defaultContext, syncDefaultBranch);
|
|
6438
|
+
const defaultResult = syncDefaultBranch.parse(withChildContext$1(defaultContext, "_branch", state.branchState ?? syncDefaultBranch.initialState, syncDefaultBranch, syncDefaultBranch.usage));
|
|
6430
6439
|
if (defaultResult.success && (defaultResult.consumed.length > 0 || discriminatorConsumed === 0 && context.buffer.length === 0)) {
|
|
6431
6440
|
const mergedExec = mergeChildExec(context.exec, defaultResult.next.exec);
|
|
6432
6441
|
const commitDefault = defaultResult.consumed.length > 0 || context.buffer.length === 0;
|
|
6433
|
-
if (commitDefault)
|
|
6442
|
+
if (commitDefault) adoptOptionScope(context, defaultResult.next);
|
|
6434
6443
|
return {
|
|
6435
6444
|
success: true,
|
|
6436
6445
|
...defaultResult.provisional ? { provisional: true } : {},
|
|
@@ -6682,11 +6691,13 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
6682
6691
|
}
|
|
6683
6692
|
const discriminatorConsumed = discriminatorResult.success ? discriminatorResult.consumed.length : discriminatorResult.consumed;
|
|
6684
6693
|
if (defaultBranch !== void 0) {
|
|
6685
|
-
const
|
|
6694
|
+
const defaultContext = forkOptionScope(context);
|
|
6695
|
+
optionScope.select(defaultContext, defaultBranch);
|
|
6696
|
+
const defaultResult = await defaultBranch.parse(withChildContext$1(defaultContext, "_branch", state.branchState ?? defaultBranch.initialState, defaultBranch, defaultBranch.usage));
|
|
6686
6697
|
if (defaultResult.success && (defaultResult.consumed.length > 0 || discriminatorConsumed === 0 && context.buffer.length === 0)) {
|
|
6687
6698
|
const mergedExec = mergeChildExec(context.exec, defaultResult.next.exec);
|
|
6688
6699
|
const commitDefault = defaultResult.consumed.length > 0 || context.buffer.length === 0;
|
|
6689
|
-
if (commitDefault)
|
|
6700
|
+
if (commitDefault) adoptOptionScope(context, defaultResult.next);
|
|
6690
6701
|
return {
|
|
6691
6702
|
success: true,
|
|
6692
6703
|
...defaultResult.provisional ? { provisional: true } : {},
|
|
@@ -7348,7 +7359,11 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
7348
7359
|
const branchContext = forkOptionScope(suggestContext);
|
|
7349
7360
|
optionScope.select(branchContext, resolvedBranch);
|
|
7350
7361
|
yield* resolvedBranch.suggest(withChildContext$1(branchContext, "_branch", state.branchState ?? resolvedBranch.initialState, resolvedBranch), prefix);
|
|
7351
|
-
} else if (syncDefaultBranch !== void 0)
|
|
7362
|
+
} else if (syncDefaultBranch !== void 0) {
|
|
7363
|
+
const defaultContext = forkOptionScope(suggestContext);
|
|
7364
|
+
optionScope.select(defaultContext, syncDefaultBranch);
|
|
7365
|
+
yield* syncDefaultBranch.suggest(withChildContext$1(defaultContext, "_branch", state.branchState ?? syncDefaultBranch.initialState, syncDefaultBranch), prefix);
|
|
7366
|
+
}
|
|
7352
7367
|
} else {
|
|
7353
7368
|
const branchParser = state.selectedBranch.kind === "default" ? syncDefaultBranch : syncBranches[state.selectedBranch.key];
|
|
7354
7369
|
const runtime = createDependencyRuntimeContext(context.dependencyRegistry?.clone());
|
|
@@ -7408,7 +7423,11 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
7408
7423
|
}
|
|
7409
7424
|
}
|
|
7410
7425
|
if (!discResolved) {
|
|
7411
|
-
if (defaultBranch !== void 0)
|
|
7426
|
+
if (defaultBranch !== void 0) {
|
|
7427
|
+
const defaultContext = forkOptionScope(suggestContext);
|
|
7428
|
+
optionScope.select(defaultContext, defaultBranch);
|
|
7429
|
+
yield* defaultBranch.suggest(withChildContext$1(defaultContext, "_branch", state.branchState ?? defaultBranch.initialState, defaultBranch), prefix);
|
|
7430
|
+
}
|
|
7412
7431
|
}
|
|
7413
7432
|
} else {
|
|
7414
7433
|
const branchParser = state.selectedBranch.kind === "default" ? defaultBranch : branches[state.selectedBranch.key];
|
package/dist/primitives.cjs
CHANGED
|
@@ -1524,7 +1524,7 @@ function command(name, parser, options = {}) {
|
|
|
1524
1524
|
const isAsync = parser.mode === "async";
|
|
1525
1525
|
const syncInnerParser = parser;
|
|
1526
1526
|
const asyncInnerParser = parser;
|
|
1527
|
-
const commandScope = require_short_option.selectableOptionScope(() => new Set(
|
|
1527
|
+
const commandScope = require_short_option.selectableOptionScope(() => /* @__PURE__ */ new Set());
|
|
1528
1528
|
const enteredScope = require_short_option.combinedOptionScope([parser], [name]);
|
|
1529
1529
|
const result = {
|
|
1530
1530
|
[Symbol.for("@optique/core/commandParser")]: true,
|
package/dist/primitives.js
CHANGED
|
@@ -1524,7 +1524,7 @@ function command(name, parser, options = {}) {
|
|
|
1524
1524
|
const isAsync = parser.mode === "async";
|
|
1525
1525
|
const syncInnerParser = parser;
|
|
1526
1526
|
const asyncInnerParser = parser;
|
|
1527
|
-
const commandScope = selectableOptionScope(() => new Set(
|
|
1527
|
+
const commandScope = selectableOptionScope(() => /* @__PURE__ */ new Set());
|
|
1528
1528
|
const enteredScope = combinedOptionScope([parser], [name]);
|
|
1529
1529
|
const result = {
|
|
1530
1530
|
[Symbol.for("@optique/core/commandParser")]: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.4.0-dev.
|
|
3
|
+
"version": "1.4.0-dev.2627",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
},
|
|
238
238
|
"sideEffects": false,
|
|
239
239
|
"devDependencies": {
|
|
240
|
-
"@optique/env": "1.4.0-dev.
|
|
240
|
+
"@optique/env": "1.4.0-dev.2627+4dd892c0",
|
|
241
241
|
"@types/node": "^24.0.0",
|
|
242
242
|
"fast-check": "^4.7.0",
|
|
243
243
|
"tsdown": "^0.13.0",
|