@shell-shock/preset-script 0.2.0 → 0.2.1
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/README.md +2 -2
- package/dist/components/args-parser-logic.d.cts +7 -7
- package/dist/components/args-parser-logic.d.cts.map +1 -1
- package/dist/components/command-entry.d.cts +4 -4
- package/dist/components/command-router.cjs +3 -5
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.mjs +3 -5
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +69 -49
- package/dist/components/console-builtin.cjs.map +1 -1
- package/dist/components/console-builtin.d.cts.map +1 -1
- package/dist/components/console-builtin.d.mts.map +1 -1
- package/dist/components/console-builtin.mjs +69 -49
- package/dist/components/console-builtin.mjs.map +1 -1
- package/dist/components/help.cjs +33 -21
- package/dist/components/help.cjs.map +1 -1
- package/dist/components/help.d.cts +19 -11
- package/dist/components/help.d.cts.map +1 -1
- package/dist/components/help.d.mts +19 -11
- package/dist/components/help.d.mts.map +1 -1
- package/dist/components/help.mjs +34 -22
- package/dist/components/help.mjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/utils-builtin.d.cts +7 -7
- package/dist/components/utils-builtin.d.mts +7 -7
- package/dist/components/virtual-command-entry.d.cts +3 -3
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/index.cjs +91 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +92 -72
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-builtin.d.cts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AA8EA;AA47BgB,iBA57BA,iBAAA,CAAA,CA47B4B,EA57BX,QA47BW;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B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAsF1B,uBAAA,CAAA,GAAuB;;;;KA0F3B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;;;;iBAse7D,cAAA,CAAA,GAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-builtin.d.mts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AA8EA;AA47BgB,iBA57BA,iBAAA,CAAA,CA47B4B,EA57BX,QA47BW;AAuJ5C;;;AAA8C,iBAvJ9B,4BAAA,CAAA,CAuJ8B,EAvJF,QAuJE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EAGA,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAAQ,OAAA,EAHR,mBAGQ;EAMH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EAoGO,WAAA,EAAA,MAAgB;EA4EhB,MAAA,CAAA,EAvLL,QAuLK;AAmChB,CAAA;AAsFA;AA0FA;AAQA;
|
|
1
|
+
{"version":3,"file":"console-builtin.d.mts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AA8EA;AA47BgB,iBA57BA,iBAAA,CAAA,CA47B4B,EA57BX,QA47BW;AAuJ5C;;;AAA8C,iBAvJ9B,4BAAA,CAAA,CAuJ8B,EAvJF,QAuJE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EAGA,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAAQ,OAAA,EAHR,mBAGQ;EAMH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EAoGO,WAAA,EAAA,MAAgB;EA4EhB,MAAA,CAAA,EAvLL,QAuLK;AAmChB,CAAA;AAsFA;AA0FA;AAQA;AAsegB,iBAl3BA,0BAAA,CAk3Bc,KAAA,EAj3BrB,+BAi3BqB,CAAA,EAj3BU,QAi3BV;;;;iBA7wBd,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAsF1B,uBAAA,CAAA,GAAuB;;;;KA0F3B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;;;;iBAse7D,cAAA,CAAA,GAAc"}
|
|
@@ -983,7 +983,7 @@ function WriteLineFunctionDeclaration() {
|
|
|
983
983
|
} else {
|
|
984
984
|
const index = [" ", "/", "\\\\", ".", ",", "-", ":", "|", "@", "+"].reduce((ret, split) => {
|
|
985
985
|
let current = ret;
|
|
986
|
-
while (stripAnsi(line).indexOf(split, current + 1) !== -1 && stripAnsi(line).indexOf(split, current + 1) <= maxLength) {
|
|
986
|
+
while (stripAnsi(line).indexOf(split, current + 1) !== -1 && stripAnsi(line).indexOf(split, current + 1) <= maxLength && (!/.*\\([^)]*$/.test(stripAnsi(line).slice(0, line.indexOf(split, current + 1))) || !/^[^(]*\\).*/.test(stripAnsi(line).slice(line.indexOf(split, current + 1) + 1)) || stripAnsi(line).slice(line.indexOf(split, current + 1) + 1).replace(/^.*\\)/, "").indexOf(split) !== -1)) {
|
|
987
987
|
current = line.indexOf(split, current + 1);
|
|
988
988
|
}
|
|
989
989
|
|
|
@@ -1361,11 +1361,11 @@ function DividerFunctionDeclaration() {
|
|
|
1361
1361
|
optional: false
|
|
1362
1362
|
}],
|
|
1363
1363
|
get children() {
|
|
1364
|
-
return code`const padding = options.padding ?? ${theme.padding.app * 4};
|
|
1364
|
+
return code`const padding = options.padding ?? ${Math.max(theme.padding.app, 1) * 4};
|
|
1365
1365
|
const width = options.width ?? (process.stdout.columns - (Math.max(padding, 0) * 2));
|
|
1366
1366
|
const border = options.border === "tertiary" ? colors.border.app.divider.tertiary("${theme.borderStyles.app.divider.tertiary.top}") : options.border === "secondary" ? colors.border.app.divider.secondary("${theme.borderStyles.app.divider.secondary.top}") : colors.border.app.divider.primary("${theme.borderStyles.app.divider.primary.top}");
|
|
1367
1367
|
|
|
1368
|
-
writeLine(" ".repeat(padding) + border.repeat(Math.max(width / ${theme.borderStyles.app.divider.primary.top.length ?? 1}, 0)));
|
|
1368
|
+
writeLine(" ".repeat(Math.max(padding - ${theme.padding.app}, 0)) + border.repeat(Math.max(width / ${theme.borderStyles.app.divider.primary.top.length ?? 1}, 0)));
|
|
1369
1369
|
`;
|
|
1370
1370
|
}
|
|
1371
1371
|
})
|
|
@@ -1824,14 +1824,17 @@ let colWidths = [] as number[];
|
|
|
1824
1824
|
let rowDims = [] as Dimensions[];
|
|
1825
1825
|
|
|
1826
1826
|
const calculateRowDimensions = () => {
|
|
1827
|
+
colWidths = [];
|
|
1827
1828
|
return cells.reduce((dims, row) => {
|
|
1828
|
-
dims.push(row.reduce((dim, cell) => {
|
|
1829
|
-
|
|
1830
|
-
dim.width = cell.width;
|
|
1831
|
-
}
|
|
1829
|
+
dims.push(row.reduce((dim, cell, index) => {
|
|
1830
|
+
dim.width += cell.width;
|
|
1832
1831
|
if (cell.height > dim.height) {
|
|
1833
1832
|
dim.height = cell.height;
|
|
1834
1833
|
}
|
|
1834
|
+
if (!colWidths[index] || cell.width > colWidths[index]!) {
|
|
1835
|
+
colWidths[index] = cell.width;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1835
1838
|
return dim;
|
|
1836
1839
|
}, { width: 0, height: 0 } as Dimensions));
|
|
1837
1840
|
|
|
@@ -1839,14 +1842,13 @@ const calculateRowDimensions = () => {
|
|
|
1839
1842
|
}, [] as Dimensions[]);
|
|
1840
1843
|
}
|
|
1841
1844
|
|
|
1842
|
-
rowDims = calculateRowDimensions();
|
|
1843
|
-
|
|
1844
|
-
/*
|
|
1845
1845
|
let recalculate!: boolean;
|
|
1846
1846
|
do {
|
|
1847
1847
|
recalculate = false;
|
|
1848
|
-
rowDims
|
|
1849
|
-
|
|
1848
|
+
rowDims = calculateRowDimensions();
|
|
1849
|
+
|
|
1850
|
+
rowDims.forEach((row, rowIndex) => {
|
|
1851
|
+
if (!recalculate && row.width > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
|
|
1850
1852
|
const cell = cells[rowIndex]!.reduce((largestCell, cell) => {
|
|
1851
1853
|
if (cell.width > largestCell.width) {
|
|
1852
1854
|
return cell;
|
|
@@ -1856,7 +1858,7 @@ do {
|
|
|
1856
1858
|
|
|
1857
1859
|
const lines = splitText(
|
|
1858
1860
|
cell.value,
|
|
1859
|
-
Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}
|
|
1861
|
+
Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (row.width - (cell.width - cell.padding * 2)), 0)
|
|
1860
1862
|
);
|
|
1861
1863
|
|
|
1862
1864
|
cell.value = lines.join("\\n");
|
|
@@ -1867,50 +1869,68 @@ do {
|
|
|
1867
1869
|
}
|
|
1868
1870
|
});
|
|
1869
1871
|
|
|
1870
|
-
if (recalculate) {
|
|
1871
|
-
|
|
1872
|
+
if (!recalculate && colWidths.reduce((a, b) => a + b, 0) > Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2}, 0)) {
|
|
1873
|
+
let colIndex = 0;
|
|
1874
|
+
const cell = cells.reduce((ret, row) => {
|
|
1875
|
+
return row.reduce((largest, current, i) => {
|
|
1876
|
+
if (largest.width < current.width) {
|
|
1877
|
+
colIndex = i;
|
|
1878
|
+
return current;
|
|
1879
|
+
}
|
|
1880
|
+
return largest;
|
|
1881
|
+
}, ret);
|
|
1882
|
+
}, cells[0]![0]!);
|
|
1883
|
+
|
|
1884
|
+
const lines = splitText(
|
|
1885
|
+
cell.value,
|
|
1886
|
+
Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2), 0)
|
|
1887
|
+
);
|
|
1888
|
+
|
|
1889
|
+
cell.value = lines.join("\\n");
|
|
1890
|
+
cell.height = lines.length;
|
|
1891
|
+
cell.width = Math.max(...lines.map(line => stripAnsi(line).length)) + cell.padding * 2;
|
|
1892
|
+
|
|
1893
|
+
recalculate = true;
|
|
1872
1894
|
}
|
|
1873
1895
|
} while (recalculate);
|
|
1874
|
-
*/
|
|
1875
|
-
|
|
1876
|
-
rowDims.map((row, rowIndex) => {
|
|
1877
|
-
cells[rowIndex]!.forEach(cell => {
|
|
1878
|
-
cell.height = row.height;
|
|
1879
|
-
});
|
|
1880
|
-
});
|
|
1881
1896
|
|
|
1882
1897
|
// Render table
|
|
1883
|
-
cells.forEach(row => {
|
|
1884
|
-
|
|
1898
|
+
cells.forEach((row, rowIndex) => {
|
|
1899
|
+
const outputs = [] as string[][];
|
|
1885
1900
|
row.forEach((cell, colIndex) => {
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
const contentLength = stripAnsi(cellContent).length;
|
|
1890
|
-
const totalWidth = colWidths[colIndex] ?? contentLength + totalPadding;
|
|
1891
|
-
|
|
1892
|
-
switch (cell.align) {
|
|
1893
|
-
case "right":
|
|
1894
|
-
paddedContent = " ".repeat(totalWidth - contentLength - totalPadding) + cellContent + " ".repeat(totalPadding);
|
|
1895
|
-
break;
|
|
1896
|
-
case "center":
|
|
1897
|
-
const leftPadding = Math.floor((totalWidth - contentLength - totalPadding) / 2);
|
|
1898
|
-
const rightPadding = totalWidth - contentLength - totalPadding - leftPadding;
|
|
1899
|
-
paddedContent = " ".repeat(leftPadding) + cellContent + " ".repeat(rightPadding + totalPadding);
|
|
1900
|
-
break;
|
|
1901
|
-
case "left":
|
|
1902
|
-
default:
|
|
1903
|
-
paddedContent = " ".repeat(totalPadding) + cellContent + " ".repeat(totalWidth - contentLength - totalPadding);
|
|
1904
|
-
break;
|
|
1901
|
+
const lines = cell.value.split("\\n");
|
|
1902
|
+
while (lines.length < rowDims[rowIndex]!.height) {
|
|
1903
|
+
lines.push("");
|
|
1905
1904
|
}
|
|
1906
1905
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1906
|
+
outputs.push(lines.map(line => {
|
|
1907
|
+
let paddedContent = "";
|
|
1908
|
+
switch (cell.align) {
|
|
1909
|
+
case "right":
|
|
1910
|
+
paddedContent = " ".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0)) + line + " ".repeat(cell.padding);
|
|
1911
|
+
break;
|
|
1912
|
+
case "center":
|
|
1913
|
+
const leftPadding = Math.floor((colWidths[colIndex] - stripAnsi(line).length - cell.padding) / 2);
|
|
1914
|
+
const rightPadding = colWidths[colIndex] - stripAnsi(line).length - leftPadding;
|
|
1915
|
+
paddedContent = " ".repeat(leftPadding) + line + " ".repeat(rightPadding);
|
|
1916
|
+
break;
|
|
1917
|
+
case "left":
|
|
1918
|
+
default:
|
|
1919
|
+
paddedContent = " ".repeat(cell.padding) + line + " ".repeat(Math.max(colWidths[colIndex] - stripAnsi(line).length - cell.padding, 0));
|
|
1920
|
+
break;
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
if (colIndex === row.length - 1) {
|
|
1924
|
+
return cell.border.left + paddedContent + cell.border.right;
|
|
1925
|
+
} else {
|
|
1926
|
+
return cell.border.left + paddedContent;
|
|
1927
|
+
}
|
|
1928
|
+
}));
|
|
1911
1929
|
});
|
|
1912
1930
|
|
|
1913
|
-
|
|
1931
|
+
for (let index = 0; index < rowDims[rowIndex]!.height; index++) {
|
|
1932
|
+
writeLine(outputs.map(output => output[index] ?? "").join(""));
|
|
1933
|
+
}
|
|
1914
1934
|
});
|
|
1915
1935
|
`)
|
|
1916
1936
|
];
|
|
@@ -2007,7 +2027,7 @@ function ConsoleBuiltin() {
|
|
|
2007
2027
|
description: "verbose",
|
|
2008
2028
|
get prefix() {
|
|
2009
2029
|
return createComponent(IfStatement, {
|
|
2010
|
-
condition: code`!(isDevelopment || isDebug || env.LOG_LEVEL === "debug" || hasFlag(["verbose", "verbose=true", "verbose=always"
|
|
2030
|
+
condition: code`!(isDevelopment || isDebug || env.LOG_LEVEL === "debug" || hasFlag(["verbose", "verbose=true", "verbose=always"]))`,
|
|
2011
2031
|
children: code`return; `
|
|
2012
2032
|
});
|
|
2013
2033
|
}
|