superjs-core 0.4.4 → 0.6.0
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/CHANGELOG.md +26 -0
- package/CONTRIBUTING.md +1 -1
- package/PUBLISH.md +2 -2
- package/README.md +9 -5
- package/ROADMAP.md +1 -1
- package/SUMMARY.md +6 -2
- package/dist/async/index.d.ts +106 -1
- package/dist/async/index.js +128 -1
- package/dist/async/index.js.map +1 -1
- package/dist/collection/index.d.ts +135 -1
- package/dist/collection/index.js +145 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/color/index.d.ts +79 -1
- package/dist/color/index.js +101 -0
- package/dist/color/index.js.map +1 -1
- package/dist/date/index.d.ts +316 -1
- package/dist/date/index.js +339 -1
- package/dist/date/index.js.map +1 -1
- package/dist/dep-exray/cli.js +95 -43
- package/dist/dep-exray/cli.js.map +1 -1
- package/dist/dep-exray/index.js +48 -34
- package/dist/dep-exray/index.js.map +1 -1
- package/dist/dep-exray/reporter/index.js +48 -34
- package/dist/dep-exray/reporter/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +50 -36
- package/dist/index.js.map +1 -1
- package/dist/isNoRekening-CHSpgD4P.d.ts +167 -0
- package/dist/math/index.d.ts +188 -1
- package/dist/math/index.js +199 -1
- package/dist/math/index.js.map +1 -1
- package/dist/string/index.d.ts +71 -1
- package/dist/string/index.js +94 -0
- package/dist/string/index.js.map +1 -1
- package/dist/validation/index.d.ts +22 -150
- package/dist/validation/index.js +27 -0
- package/dist/validation/index.js.map +1 -1
- package/package.json +2 -6
package/dist/index.js
CHANGED
|
@@ -1018,7 +1018,7 @@ function truncate(str, maxLength, suffix = "...") {
|
|
|
1018
1018
|
return str.slice(0, Math.max(0, maxLength - suffix.length)) + suffix;
|
|
1019
1019
|
}
|
|
1020
1020
|
function template(str, data) {
|
|
1021
|
-
return str.replace(/\{\{(\w+)\}\}/g, (
|
|
1021
|
+
return str.replace(/\{\{(\w+)\}\}/g, (_2, key) => {
|
|
1022
1022
|
const value = data[key];
|
|
1023
1023
|
return value !== void 0 ? String(value) : `{{${key}}}`;
|
|
1024
1024
|
});
|
|
@@ -1118,7 +1118,7 @@ function sleep(ms) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
async function timeout(promise, ms, errorMessage) {
|
|
1120
1120
|
let timer;
|
|
1121
|
-
const timeoutPromise = new Promise((
|
|
1121
|
+
const timeoutPromise = new Promise((_2, reject) => {
|
|
1122
1122
|
timer = setTimeout(() => reject(new Error(errorMessage ?? `Promise timed out after ${ms}ms`)), ms);
|
|
1123
1123
|
});
|
|
1124
1124
|
try {
|
|
@@ -1668,27 +1668,40 @@ async function scanProject(config) {
|
|
|
1668
1668
|
}
|
|
1669
1669
|
|
|
1670
1670
|
// src/dep-exray/reporter/index.ts
|
|
1671
|
-
|
|
1671
|
+
var _ = {
|
|
1672
|
+
reset: "\x1B[0m",
|
|
1673
|
+
bold: "\x1B[1m",
|
|
1674
|
+
dim: "\x1B[2m",
|
|
1675
|
+
red: "\x1B[31m",
|
|
1676
|
+
green: "\x1B[32m",
|
|
1677
|
+
yellow: "\x1B[33m",
|
|
1678
|
+
blue: "\x1B[34m",
|
|
1679
|
+
cyan: "\x1B[36m",
|
|
1680
|
+
white: "\x1B[37m"
|
|
1681
|
+
};
|
|
1682
|
+
function style(text, codes) {
|
|
1683
|
+
return codes.join("") + text + _.reset;
|
|
1684
|
+
}
|
|
1672
1685
|
function severityColor(severity) {
|
|
1673
1686
|
switch (severity) {
|
|
1674
1687
|
case "critical":
|
|
1675
|
-
return
|
|
1688
|
+
return style(severity.toUpperCase(), [_.bold, _.red]);
|
|
1676
1689
|
case "high":
|
|
1677
|
-
return
|
|
1690
|
+
return style(severity.toUpperCase(), [_.red]);
|
|
1678
1691
|
case "medium":
|
|
1679
|
-
return
|
|
1692
|
+
return style(severity.toUpperCase(), [_.yellow]);
|
|
1680
1693
|
case "low":
|
|
1681
|
-
return
|
|
1694
|
+
return style(severity.toUpperCase(), [_.dim]);
|
|
1682
1695
|
}
|
|
1683
1696
|
}
|
|
1684
1697
|
function confidenceIcon(confidence) {
|
|
1685
1698
|
switch (confidence) {
|
|
1686
1699
|
case "high":
|
|
1687
|
-
return
|
|
1700
|
+
return style("\u25CF", [_.green]);
|
|
1688
1701
|
case "medium":
|
|
1689
|
-
return
|
|
1702
|
+
return style("\u25CF", [_.yellow]);
|
|
1690
1703
|
case "low":
|
|
1691
|
-
return
|
|
1704
|
+
return style("\u25CF", [_.red]);
|
|
1692
1705
|
}
|
|
1693
1706
|
}
|
|
1694
1707
|
function generateReport(result, jsonOutput) {
|
|
@@ -1696,46 +1709,47 @@ function generateReport(result, jsonOutput) {
|
|
|
1696
1709
|
return JSON.stringify(result, null, 2);
|
|
1697
1710
|
}
|
|
1698
1711
|
const lines = [];
|
|
1699
|
-
|
|
1700
|
-
lines.push(
|
|
1701
|
-
lines.push(
|
|
1702
|
-
lines.push(
|
|
1703
|
-
lines.push(
|
|
1704
|
-
lines.push(
|
|
1705
|
-
lines.push(
|
|
1712
|
+
const t = (text, codes = [_.cyan]) => style(text, [_.bold, ...codes]);
|
|
1713
|
+
lines.push(t(`\u250C${"\u2500".repeat(58)}\u2510`));
|
|
1714
|
+
lines.push(t(`\u2502${" ".repeat(18)}dep-exray Report${" ".repeat(21)}\u2502`));
|
|
1715
|
+
lines.push(t(`\u251C${"\u2500".repeat(58)}\u2524`));
|
|
1716
|
+
lines.push(t(`\u2502 ${style("\u{1F4E6} PROJECT:", [_.white])} ${style(result.projectName, [_.bold])}${" ".repeat(Math.max(1, 47 - result.projectName.length))}\u2502`));
|
|
1717
|
+
lines.push(t(`\u2502 ${style("\u{1F4CA} DEPENDENCIES:", [_.white])} ${style(String(result.directDeps), [_.bold])} direct + ${style(String(result.transitiveDeps), [_.bold])} transitive${" ".repeat(Math.max(1, 27 - String(result.transitiveDeps).length))}\u2502`));
|
|
1718
|
+
lines.push(t(`\u2502 ${style("\u{1F4BE} TOTAL SIZE:", [_.white])} ${style(result.totalEstimatedSize, [_.bold])}${" ".repeat(Math.max(1, 42 - result.totalEstimatedSize.length))}\u2502`));
|
|
1719
|
+
lines.push(t(`\u251C${"\u2500".repeat(58)}\u2524`));
|
|
1706
1720
|
if (result.highImpactReplacements.length > 0) {
|
|
1707
|
-
lines.push(
|
|
1721
|
+
lines.push(t(`\u2502 ${style("\u{1F7E2}", [_.green])} ${style("HIGH IMPACT REPLACEMENTS", [_.bold, _.green])}${" ".repeat(23)}\u2502`));
|
|
1708
1722
|
for (const item of result.highImpactReplacements) {
|
|
1709
|
-
const autoPr = item.autoPrReady ?
|
|
1723
|
+
const autoPr = item.autoPrReady ? style("\u2713 Auto-PR ready", [_.green]) : style("Manual review needed", [_.dim]);
|
|
1710
1724
|
const confIcon = confidenceIcon(item.confidence);
|
|
1711
|
-
lines.push(
|
|
1712
|
-
lines.push(
|
|
1713
|
-
lines.push(
|
|
1714
|
-
lines.push(
|
|
1725
|
+
lines.push(t(`\u251C${"\u2500".repeat(58)}\u2524`));
|
|
1726
|
+
lines.push(t(`\u2502 ${style("\u2717", [_.red])} ${style(item.packageName, [_.bold])} (${item.estimatedSizeReduction})${" ".repeat(Math.max(1, 38 - item.estimatedSizeReduction.length))}\u2502`));
|
|
1727
|
+
lines.push(t(`\u2502 ${style("\u2192", [_.dim])} ${style(item.replacement, [_.cyan])}${" ".repeat(Math.max(1, 51 - item.replacement.length))}\u2502`));
|
|
1728
|
+
lines.push(t(`\u2502 ${style("\u2514\u2500", [_.dim])} ${autoPr} ${confIcon} ${item.confidence}${" ".repeat(Math.max(1, 35))}\u2502`));
|
|
1715
1729
|
}
|
|
1716
1730
|
}
|
|
1717
1731
|
if (result.mediumImpactReplacements.length > 0) {
|
|
1718
|
-
lines.push(
|
|
1719
|
-
lines.push(
|
|
1732
|
+
lines.push(t(`\u251C${"\u2500".repeat(58)}\u2524`));
|
|
1733
|
+
lines.push(t(`\u2502 ${style("\u{1F7E1}", [_.yellow])} ${style("MEDIUM IMPACT REPLACEMENTS", [_.bold, _.yellow])}${" ".repeat(20)}\u2502`));
|
|
1720
1734
|
for (const item of result.mediumImpactReplacements) {
|
|
1721
|
-
const autoPr = item.autoPrReady ?
|
|
1735
|
+
const autoPr = item.autoPrReady ? style("\u2713 Auto-PR ready", [_.green]) : style("Manual review needed", [_.dim]);
|
|
1722
1736
|
const confIcon = confidenceIcon(item.confidence);
|
|
1723
|
-
lines.push(
|
|
1724
|
-
lines.push(
|
|
1725
|
-
lines.push(
|
|
1726
|
-
lines.push(
|
|
1737
|
+
lines.push(t(`\u251C${"\u2500".repeat(58)}\u2524`));
|
|
1738
|
+
lines.push(t(`\u2502 ${style("\u2717", [_.red])} ${style(item.packageName, [_.bold])} (${item.estimatedSizeReduction})${" ".repeat(Math.max(1, 38 - item.estimatedSizeReduction.length))}\u2502`));
|
|
1739
|
+
lines.push(t(`\u2502 ${style("\u2192", [_.dim])} ${style(item.replacement, [_.cyan])}${" ".repeat(Math.max(1, 51 - item.replacement.length))}\u2502`));
|
|
1740
|
+
lines.push(t(`\u2502 ${style("\u2514\u2500", [_.dim])} ${autoPr} ${confIcon} ${item.confidence}${" ".repeat(Math.max(1, 35))}\u2502`));
|
|
1727
1741
|
}
|
|
1728
1742
|
}
|
|
1729
1743
|
if (result.securityIssues.length > 0) {
|
|
1730
|
-
lines.push(
|
|
1731
|
-
lines.push(
|
|
1744
|
+
lines.push(t(`\u251C${"\u2500".repeat(58)}\u2524`));
|
|
1745
|
+
lines.push(t(`\u2502 ${style("\u{1F534}", [_.red])} ${style("SECURITY ISSUES", [_.bold, _.red])}${" ".repeat(33)}\u2502`));
|
|
1732
1746
|
for (const issue of result.securityIssues) {
|
|
1733
|
-
lines.push(
|
|
1734
|
-
lines.push(
|
|
1735
|
-
lines.push(
|
|
1747
|
+
lines.push(t(`\u251C${"\u2500".repeat(58)}\u2524`));
|
|
1748
|
+
lines.push(t(`\u2502 ${severityColor(issue.severity)} ${style(issue.cveId, [_.bold])} in ${issue.packageName}${" ".repeat(Math.max(1, 40 - issue.packageName.length))}\u2502`));
|
|
1749
|
+
lines.push(t(`\u2502 ${style("\u2192", [_.dim])} ${issue.fix}${" ".repeat(Math.max(1, 52 - issue.fix.length))}\u2502`));
|
|
1736
1750
|
}
|
|
1737
1751
|
}
|
|
1738
|
-
lines.push(
|
|
1752
|
+
lines.push(t(`\u2514${"\u2500".repeat(58)}\u2518`));
|
|
1739
1753
|
return lines.join("\n");
|
|
1740
1754
|
}
|
|
1741
1755
|
|