@optique/core 0.9.7 → 0.9.8
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 +37 -13
- package/dist/constructs.js +37 -13
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -1300,6 +1300,9 @@ function merge(...args) {
|
|
|
1300
1300
|
}();
|
|
1301
1301
|
},
|
|
1302
1302
|
getDocFragments(state, _defaultValue) {
|
|
1303
|
+
let brief;
|
|
1304
|
+
let description;
|
|
1305
|
+
let footer;
|
|
1303
1306
|
const fragments = parsers.flatMap((p, i) => {
|
|
1304
1307
|
let parserState;
|
|
1305
1308
|
if (p.initialState === void 0) {
|
|
@@ -1313,7 +1316,11 @@ function merge(...args) {
|
|
|
1313
1316
|
kind: "available",
|
|
1314
1317
|
state: state.state
|
|
1315
1318
|
};
|
|
1316
|
-
|
|
1319
|
+
const docFragments = p.getDocFragments(parserState, void 0);
|
|
1320
|
+
brief ??= docFragments.brief;
|
|
1321
|
+
description ??= docFragments.description;
|
|
1322
|
+
footer ??= docFragments.footer;
|
|
1323
|
+
return docFragments.fragments;
|
|
1317
1324
|
});
|
|
1318
1325
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
1319
1326
|
const sections = [];
|
|
@@ -1328,18 +1335,28 @@ function merge(...args) {
|
|
|
1328
1335
|
entries
|
|
1329
1336
|
};
|
|
1330
1337
|
sections.push(labeledSection);
|
|
1331
|
-
return {
|
|
1338
|
+
return {
|
|
1339
|
+
brief,
|
|
1340
|
+
description,
|
|
1341
|
+
footer,
|
|
1342
|
+
fragments: sections.map((s) => ({
|
|
1343
|
+
...s,
|
|
1344
|
+
type: "section"
|
|
1345
|
+
}))
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
return {
|
|
1349
|
+
brief,
|
|
1350
|
+
description,
|
|
1351
|
+
footer,
|
|
1352
|
+
fragments: [...sections.map((s) => ({
|
|
1332
1353
|
...s,
|
|
1333
1354
|
type: "section"
|
|
1334
|
-
}))
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
})), {
|
|
1340
|
-
type: "section",
|
|
1341
|
-
entries
|
|
1342
|
-
}] };
|
|
1355
|
+
})), {
|
|
1356
|
+
type: "section",
|
|
1357
|
+
entries
|
|
1358
|
+
}]
|
|
1359
|
+
};
|
|
1343
1360
|
}
|
|
1344
1361
|
};
|
|
1345
1362
|
}
|
|
@@ -1636,10 +1653,17 @@ function group(label, parser) {
|
|
|
1636
1653
|
for (const fragment of fragments) if (fragment.type === "entry") allEntries.push(fragment);
|
|
1637
1654
|
else if (fragment.type === "section") if (fragment.title) titledSections.push(fragment);
|
|
1638
1655
|
else allEntries.push(...fragment.entries);
|
|
1639
|
-
const
|
|
1656
|
+
const initialFragments = parser.getDocFragments({
|
|
1657
|
+
kind: "available",
|
|
1658
|
+
state: parser.initialState
|
|
1659
|
+
}, void 0);
|
|
1660
|
+
const initialHasCommands = initialFragments.fragments.some((f) => f.type === "entry" && f.term.type === "command" || f.type === "section" && f.entries.some((e) => e.term.type === "command"));
|
|
1661
|
+
const currentHasCommands = allEntries.some((e) => e.term.type === "command");
|
|
1662
|
+
const applyLabel = !initialHasCommands || currentHasCommands;
|
|
1663
|
+
const labeledSection = applyLabel ? {
|
|
1640
1664
|
title: label,
|
|
1641
1665
|
entries: allEntries
|
|
1642
|
-
};
|
|
1666
|
+
} : { entries: allEntries };
|
|
1643
1667
|
return {
|
|
1644
1668
|
description,
|
|
1645
1669
|
fragments: [...titledSections.map((s) => ({
|
package/dist/constructs.js
CHANGED
|
@@ -1300,6 +1300,9 @@ function merge(...args) {
|
|
|
1300
1300
|
}();
|
|
1301
1301
|
},
|
|
1302
1302
|
getDocFragments(state, _defaultValue) {
|
|
1303
|
+
let brief;
|
|
1304
|
+
let description;
|
|
1305
|
+
let footer;
|
|
1303
1306
|
const fragments = parsers.flatMap((p, i) => {
|
|
1304
1307
|
let parserState;
|
|
1305
1308
|
if (p.initialState === void 0) {
|
|
@@ -1313,7 +1316,11 @@ function merge(...args) {
|
|
|
1313
1316
|
kind: "available",
|
|
1314
1317
|
state: state.state
|
|
1315
1318
|
};
|
|
1316
|
-
|
|
1319
|
+
const docFragments = p.getDocFragments(parserState, void 0);
|
|
1320
|
+
brief ??= docFragments.brief;
|
|
1321
|
+
description ??= docFragments.description;
|
|
1322
|
+
footer ??= docFragments.footer;
|
|
1323
|
+
return docFragments.fragments;
|
|
1317
1324
|
});
|
|
1318
1325
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
1319
1326
|
const sections = [];
|
|
@@ -1328,18 +1335,28 @@ function merge(...args) {
|
|
|
1328
1335
|
entries
|
|
1329
1336
|
};
|
|
1330
1337
|
sections.push(labeledSection);
|
|
1331
|
-
return {
|
|
1338
|
+
return {
|
|
1339
|
+
brief,
|
|
1340
|
+
description,
|
|
1341
|
+
footer,
|
|
1342
|
+
fragments: sections.map((s) => ({
|
|
1343
|
+
...s,
|
|
1344
|
+
type: "section"
|
|
1345
|
+
}))
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
return {
|
|
1349
|
+
brief,
|
|
1350
|
+
description,
|
|
1351
|
+
footer,
|
|
1352
|
+
fragments: [...sections.map((s) => ({
|
|
1332
1353
|
...s,
|
|
1333
1354
|
type: "section"
|
|
1334
|
-
}))
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
})), {
|
|
1340
|
-
type: "section",
|
|
1341
|
-
entries
|
|
1342
|
-
}] };
|
|
1355
|
+
})), {
|
|
1356
|
+
type: "section",
|
|
1357
|
+
entries
|
|
1358
|
+
}]
|
|
1359
|
+
};
|
|
1343
1360
|
}
|
|
1344
1361
|
};
|
|
1345
1362
|
}
|
|
@@ -1636,10 +1653,17 @@ function group(label, parser) {
|
|
|
1636
1653
|
for (const fragment of fragments) if (fragment.type === "entry") allEntries.push(fragment);
|
|
1637
1654
|
else if (fragment.type === "section") if (fragment.title) titledSections.push(fragment);
|
|
1638
1655
|
else allEntries.push(...fragment.entries);
|
|
1639
|
-
const
|
|
1656
|
+
const initialFragments = parser.getDocFragments({
|
|
1657
|
+
kind: "available",
|
|
1658
|
+
state: parser.initialState
|
|
1659
|
+
}, void 0);
|
|
1660
|
+
const initialHasCommands = initialFragments.fragments.some((f) => f.type === "entry" && f.term.type === "command" || f.type === "section" && f.entries.some((e) => e.term.type === "command"));
|
|
1661
|
+
const currentHasCommands = allEntries.some((e) => e.term.type === "command");
|
|
1662
|
+
const applyLabel = !initialHasCommands || currentHasCommands;
|
|
1663
|
+
const labeledSection = applyLabel ? {
|
|
1640
1664
|
title: label,
|
|
1641
1665
|
entries: allEntries
|
|
1642
|
-
};
|
|
1666
|
+
} : { entries: allEntries };
|
|
1643
1667
|
return {
|
|
1644
1668
|
description,
|
|
1645
1669
|
fragments: [...titledSections.map((s) => ({
|