@optique/core 1.0.11-dev.2640 → 1.0.11-dev.2654
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 +260 -40
- package/dist/constructs.js +260 -40
- package/dist/extension.cjs +17 -0
- package/dist/extension.d.cts +13 -1
- package/dist/extension.d.ts +13 -1
- package/dist/extension.js +17 -1
- package/dist/internal/passthrough.cjs +230 -0
- package/dist/internal/passthrough.js +213 -0
- package/dist/modifiers.cjs +22 -0
- package/dist/modifiers.js +22 -0
- package/dist/primitives.cjs +27 -1
- package/dist/primitives.js +27 -1
- package/package.json +1 -1
package/dist/primitives.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_annotations = require('./internal/annotations.cjs');
|
|
2
2
|
const require_message = require('./message.cjs');
|
|
3
|
+
const require_passthrough = require('./internal/passthrough.cjs');
|
|
3
4
|
const require_validate = require('./validate.cjs');
|
|
4
5
|
const require_usage = require('./usage.cjs');
|
|
5
6
|
const require_mode_dispatch = require('./internal/mode-dispatch.cjs');
|
|
@@ -137,6 +138,7 @@ function constant(value) {
|
|
|
137
138
|
return { fragments: [] };
|
|
138
139
|
}
|
|
139
140
|
};
|
|
141
|
+
require_passthrough.defineKnownCompletion(result, (state) => require_annotation_state.normalizeInjectedAnnotationState(state));
|
|
140
142
|
Object.defineProperty(result, "placeholder", {
|
|
141
143
|
value,
|
|
142
144
|
configurable: true,
|
|
@@ -1434,6 +1436,22 @@ function command(name, parser, options = {}) {
|
|
|
1434
1436
|
configurable: true,
|
|
1435
1437
|
enumerable: false
|
|
1436
1438
|
});
|
|
1439
|
+
require_passthrough.definePassThroughPriority(result, [parser], (state, token) => {
|
|
1440
|
+
const active = normalizeCommandState(state);
|
|
1441
|
+
if (active == null) return void 0;
|
|
1442
|
+
const childState = active[0] === "matched" ? parser.initialState : active[1];
|
|
1443
|
+
return require_passthrough.getPassThroughPriority(parser, getCommandParseChildState(state, childState, parser), token);
|
|
1444
|
+
});
|
|
1445
|
+
require_passthrough.defineOptionMatch(result, (state, token) => {
|
|
1446
|
+
const active = normalizeCommandState(state);
|
|
1447
|
+
if (active == null) return void 0;
|
|
1448
|
+
const childState = active[0] === "matched" ? parser.initialState : active[1];
|
|
1449
|
+
const match = require_passthrough.getOptionMatch(parser, getCommandParseChildState(state, childState, parser), token);
|
|
1450
|
+
return match == null ? void 0 : {
|
|
1451
|
+
...match,
|
|
1452
|
+
continuesCommand: true
|
|
1453
|
+
};
|
|
1454
|
+
});
|
|
1437
1455
|
return result;
|
|
1438
1456
|
}
|
|
1439
1457
|
/**
|
|
@@ -1486,7 +1504,7 @@ function passThrough(options = {}) {
|
|
|
1486
1504
|
const format = options.format ?? "equalsOnly";
|
|
1487
1505
|
const optionPattern = /^-[a-z0-9-]|^--[a-z0-9-]+/i;
|
|
1488
1506
|
const equalsOptionPattern = /^--[a-z0-9-]+=/i;
|
|
1489
|
-
|
|
1507
|
+
const result = {
|
|
1490
1508
|
$valueType: [],
|
|
1491
1509
|
$stateType: [],
|
|
1492
1510
|
mode: "sync",
|
|
@@ -1504,6 +1522,8 @@ function passThrough(options = {}) {
|
|
|
1504
1522
|
consumed: 0,
|
|
1505
1523
|
error: require_message.message`No input to pass through.`
|
|
1506
1524
|
};
|
|
1525
|
+
const failure = require_passthrough.getPassThroughFailure(context, this?.priority ?? -10);
|
|
1526
|
+
if (failure != null) return failure.failure;
|
|
1507
1527
|
const token = context.buffer[0];
|
|
1508
1528
|
if (format === "greedy") {
|
|
1509
1529
|
const captured = [...context.buffer];
|
|
@@ -1615,6 +1635,12 @@ function passThrough(options = {}) {
|
|
|
1615
1635
|
return `passThrough(${format})`;
|
|
1616
1636
|
}
|
|
1617
1637
|
};
|
|
1638
|
+
require_passthrough.definePassThroughPriority(result, [result], (_state, token) => {
|
|
1639
|
+
if (token == null || format === "greedy") return result.priority;
|
|
1640
|
+
const accepts = format === "equalsOnly" ? equalsOptionPattern.test(token) : format === "nextToken" && optionPattern.test(token);
|
|
1641
|
+
return accepts ? result.priority : void 0;
|
|
1642
|
+
});
|
|
1643
|
+
return result;
|
|
1618
1644
|
}
|
|
1619
1645
|
|
|
1620
1646
|
//#endregion
|
package/dist/primitives.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { annotateFreshArray, getAnnotations } from "./internal/annotations.js";
|
|
2
2
|
import { message, metavar, optionName, optionNames, text, valueSet } from "./message.js";
|
|
3
|
+
import { defineKnownCompletion, defineOptionMatch, definePassThroughPriority, getOptionMatch, getPassThroughFailure, getPassThroughPriority } from "./internal/passthrough.js";
|
|
3
4
|
import { validateCommandNames, validateOptionNames } from "./validate.js";
|
|
4
5
|
import { extractOptionNames, isDocHidden, isSuggestionHidden } from "./usage.js";
|
|
5
6
|
import { dispatchByMode, dispatchIterableByMode, wrapForMode } from "./internal/mode-dispatch.js";
|
|
@@ -137,6 +138,7 @@ function constant(value) {
|
|
|
137
138
|
return { fragments: [] };
|
|
138
139
|
}
|
|
139
140
|
};
|
|
141
|
+
defineKnownCompletion(result, (state) => normalizeInjectedAnnotationState(state));
|
|
140
142
|
Object.defineProperty(result, "placeholder", {
|
|
141
143
|
value,
|
|
142
144
|
configurable: true,
|
|
@@ -1434,6 +1436,22 @@ function command(name, parser, options = {}) {
|
|
|
1434
1436
|
configurable: true,
|
|
1435
1437
|
enumerable: false
|
|
1436
1438
|
});
|
|
1439
|
+
definePassThroughPriority(result, [parser], (state, token) => {
|
|
1440
|
+
const active = normalizeCommandState(state);
|
|
1441
|
+
if (active == null) return void 0;
|
|
1442
|
+
const childState = active[0] === "matched" ? parser.initialState : active[1];
|
|
1443
|
+
return getPassThroughPriority(parser, getCommandParseChildState(state, childState, parser), token);
|
|
1444
|
+
});
|
|
1445
|
+
defineOptionMatch(result, (state, token) => {
|
|
1446
|
+
const active = normalizeCommandState(state);
|
|
1447
|
+
if (active == null) return void 0;
|
|
1448
|
+
const childState = active[0] === "matched" ? parser.initialState : active[1];
|
|
1449
|
+
const match = getOptionMatch(parser, getCommandParseChildState(state, childState, parser), token);
|
|
1450
|
+
return match == null ? void 0 : {
|
|
1451
|
+
...match,
|
|
1452
|
+
continuesCommand: true
|
|
1453
|
+
};
|
|
1454
|
+
});
|
|
1437
1455
|
return result;
|
|
1438
1456
|
}
|
|
1439
1457
|
/**
|
|
@@ -1486,7 +1504,7 @@ function passThrough(options = {}) {
|
|
|
1486
1504
|
const format = options.format ?? "equalsOnly";
|
|
1487
1505
|
const optionPattern = /^-[a-z0-9-]|^--[a-z0-9-]+/i;
|
|
1488
1506
|
const equalsOptionPattern = /^--[a-z0-9-]+=/i;
|
|
1489
|
-
|
|
1507
|
+
const result = {
|
|
1490
1508
|
$valueType: [],
|
|
1491
1509
|
$stateType: [],
|
|
1492
1510
|
mode: "sync",
|
|
@@ -1504,6 +1522,8 @@ function passThrough(options = {}) {
|
|
|
1504
1522
|
consumed: 0,
|
|
1505
1523
|
error: message`No input to pass through.`
|
|
1506
1524
|
};
|
|
1525
|
+
const failure = getPassThroughFailure(context, this?.priority ?? -10);
|
|
1526
|
+
if (failure != null) return failure.failure;
|
|
1507
1527
|
const token = context.buffer[0];
|
|
1508
1528
|
if (format === "greedy") {
|
|
1509
1529
|
const captured = [...context.buffer];
|
|
@@ -1615,6 +1635,12 @@ function passThrough(options = {}) {
|
|
|
1615
1635
|
return `passThrough(${format})`;
|
|
1616
1636
|
}
|
|
1617
1637
|
};
|
|
1638
|
+
definePassThroughPriority(result, [result], (_state, token) => {
|
|
1639
|
+
if (token == null || format === "greedy") return result.priority;
|
|
1640
|
+
const accepts = format === "equalsOnly" ? equalsOptionPattern.test(token) : format === "nextToken" && optionPattern.test(token);
|
|
1641
|
+
return accepts ? result.priority : void 0;
|
|
1642
|
+
});
|
|
1643
|
+
return result;
|
|
1618
1644
|
}
|
|
1619
1645
|
|
|
1620
1646
|
//#endregion
|