@utilix-tech/sdk 0.62.0 → 0.63.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 +4 -0
- package/README.md +11 -3
- package/dist/{chunk-JW4NG2GN.js → chunk-JPFHEZ4P.js} +92 -1
- package/dist/{chunk-43WFN3CW.js → chunk-YTH76KAF.js} +101 -1
- package/dist/{code-rxidGgvB.d.cts → code-CKI2Z_NM.d.cts} +49 -2
- package/dist/{code-rxidGgvB.d.ts → code-CKI2Z_NM.d.ts} +49 -2
- package/dist/index.cjs +191 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/tools/code.cjs +91 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/units.cjs +100 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-izyUpUAb.d.cts → units-CLJ16Zzv.d.cts} +56 -2
- package/dist/{units-izyUpUAb.d.ts → units-CLJ16Zzv.d.ts} +56 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.63.0
|
|
6
|
+
- Add `planDebtPayoff` (debt-payoff-planner): simulate paying off a list of debts under both the snowball (smallest balance first) and avalanche (highest rate first) strategies given a fixed extra monthly payment, and compare months to payoff and total interest.
|
|
7
|
+
- Add `auditDependencyRanges` (package-json-dependency-auditor): classify each dependency's version specifier range type and flag wildcard ranges, the "latest" tag, git/URL/file/link dependencies, and packages listed with conflicting or redundant ranges across sections.
|
|
8
|
+
|
|
5
9
|
## 0.62.0
|
|
6
10
|
- Add `buildPriorityHeader`, `parsePriorityHeader` (priority-header): build an HTTP Priority request/response-header value from an urgency (0-7) and/or an incremental flag per RFC 9218, or parse an existing one into the same shape.
|
|
7
11
|
- Add `lookupCloseCode`, `listCloseCodes` (websocket-close-codes): look up what a WebSocket close code means per RFC 6455 and the IANA reserved ranges, or list every well-known code.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**672 developer utility functions for Node.js: runs locally, no API key required.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
@@ -493,6 +493,10 @@ calculateFreelancerRate({ targetAnnualIncome: 80000, billableHoursPerWeek: 25, w
|
|
|
493
493
|
// How much sooner a loan pays off, and how much interest is saved, with a fixed extra monthly payment
|
|
494
494
|
calculateExtraPaymentPayoff(200000, 6, 360, 200);
|
|
495
495
|
// { monthlyPayment: 1199.1, newPayoffMonths: 252, monthsSaved: 108, interestSaved: 79800.86, ... }
|
|
496
|
+
|
|
497
|
+
// Debt snowball vs avalanche payoff simulation with a fixed extra monthly payment
|
|
498
|
+
planDebtPayoff([{ label: "Credit card", balance: 4000, ratePercent: 22, minPayment: 100 }, { label: "Car loan", balance: 12000, ratePercent: 6, minPayment: 250 }], 200);
|
|
499
|
+
// { snowball: { monthsToPayoff, totalInterestPaid, order, schedule }, avalanche: { ... }, comparison: { fasterStrategy, cheaperStrategy, ... } }
|
|
496
500
|
```
|
|
497
501
|
|
|
498
502
|
---
|
|
@@ -761,6 +765,10 @@ validateTsconfig(JSON.stringify({ compilerOptions: { target: "ES2020", strict: t
|
|
|
761
765
|
// Validate a package.json "exports" field for dual-package (ESM/CJS) misconfigurations
|
|
762
766
|
validatePackageExports(JSON.stringify({ exports: { import: "./index.mjs", require: "./index.cjs", default: "./index.cjs" } }));
|
|
763
767
|
// { parsed: true, exportsShape: "conditions", subpaths: ["."], issues: [], valid: true }
|
|
768
|
+
|
|
769
|
+
// Classify each package.json dependency's version range and flag wildcards, "latest", git/URL/file deps, and conflicting duplicates
|
|
770
|
+
auditDependencyRanges(JSON.stringify({ dependencies: { lodash: "^4.17.21", "left-pad": "*" } }));
|
|
771
|
+
// { totalDependencies: 2, dependencies: [{ name: "lodash", rangeType: "caret", issues: [] }, { name: "left-pad", rangeType: "wildcard", issues: [...] }], duplicates: [], issues: [...] }
|
|
764
772
|
```
|
|
765
773
|
|
|
766
774
|
---
|
|
@@ -917,10 +925,10 @@ inspectGifFrames(new Uint8Array(gifBytes));
|
|
|
917
925
|
| `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert, NDJSON record deduplicator, SRT/WebVTT subtitles, Markdown front matter parser, YAML anchor/alias resolver, CSV column type inferencer |
|
|
918
926
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, entropy estimator, fake data, CSP nonce generator |
|
|
919
927
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
920
|
-
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, EMI calculator, compound/simple interest calculators, VAT/sales tax calculator, tip/bill split calculator, break-even point calculator, Rule of 72 calculator, savings goal calculator, ROI calculator, cash denomination/till calculator, payback period calculator, CD maturity calculator, debt-to-income ratio calculator, freelancer hourly rate calculator |
|
|
928
|
+
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, EMI calculator, compound/simple interest calculators, VAT/sales tax calculator, tip/bill split calculator, break-even point calculator, Rule of 72 calculator, savings goal calculator, ROI calculator, cash denomination/till calculator, payback period calculator, CD maturity calculator, debt-to-income ratio calculator, freelancer hourly rate calculator, debt snowball/avalanche payoff planner |
|
|
921
929
|
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing, IPv6 address compress/expand, Permissions-Policy header builder, Client Hints header builder/parser, Content-Disposition header builder/parser, X-Content-Type-Options header builder/risk assessor, sitemap.xml validator, sitemap index splitter, Prefer header builder/parser (RFC 7240), Retry-After header builder/parser (RFC 9110), Priority header builder/parser (RFC 9218), WebSocket close code reference/lookup |
|
|
922
930
|
| `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
|
|
923
|
-
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup, GitHub URL parsing, regex ReDoS detector, Conventional Commits linter, package.json exports field validator |
|
|
931
|
+
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup, GitHub URL parsing, regex ReDoS detector, Conventional Commits linter, package.json exports field validator, package.json dependency range auditor |
|
|
924
932
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
925
933
|
| `@utilix-tech/sdk/css` | CSS gradient, box-shadow, border-radius, keyframe animation generators |
|
|
926
934
|
| `@utilix-tech/sdk/misc` | SVG optimize/sanitize, file size format, Unicode inspector |
|
|
@@ -10,6 +10,7 @@ __export(code_exports, {
|
|
|
10
10
|
MIME_TABLE: () => MIME_TABLE,
|
|
11
11
|
OPERATIONS: () => OPERATIONS,
|
|
12
12
|
SQL_DEFAULT_OPTIONS: () => SQL_DEFAULT_OPTIONS,
|
|
13
|
+
auditDependencyRanges: () => auditDependencyRanges,
|
|
13
14
|
buildDockerPull: () => buildDockerPull,
|
|
14
15
|
buildDockerRun: () => buildDockerRun,
|
|
15
16
|
buildGitCommand: () => buildGitCommand,
|
|
@@ -3394,5 +3395,95 @@ function validatePackageExports(packageJsonText) {
|
|
|
3394
3395
|
const valid = !issues.some((i) => i.severity === "error");
|
|
3395
3396
|
return { parsed: true, exportsShape, subpaths, issues, valid };
|
|
3396
3397
|
}
|
|
3398
|
+
var DEPENDENCY_SECTIONS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
3399
|
+
var EXACT_SEMVER_RE = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;
|
|
3400
|
+
function classifyDependencyRange(version) {
|
|
3401
|
+
const v = version.trim();
|
|
3402
|
+
if (v === "" || v === "*" || v.toLowerCase() === "x") return "wildcard";
|
|
3403
|
+
if (v.startsWith("workspace:")) return "workspace";
|
|
3404
|
+
if (v.startsWith("file:")) return "file";
|
|
3405
|
+
if (v.startsWith("link:")) return "link";
|
|
3406
|
+
if (v.startsWith("http://") || v.startsWith("https://")) return "url";
|
|
3407
|
+
if (v.startsWith("git+") || v.startsWith("git://") || v.startsWith("github:") || v.endsWith(".git") || /^[\w-]+\/[\w.-]+$/.test(v)) return "git";
|
|
3408
|
+
if (v.startsWith("^")) return "caret";
|
|
3409
|
+
if (v.startsWith("~")) return "tilde";
|
|
3410
|
+
if (v.includes("||") || v.includes(" ") || v.startsWith(">") || v.startsWith("<") || v.startsWith("=")) return "range";
|
|
3411
|
+
if (EXACT_SEMVER_RE.test(v)) return "exact";
|
|
3412
|
+
if (/^[A-Za-z][\w.-]*$/.test(v)) return "tag";
|
|
3413
|
+
return "unknown";
|
|
3414
|
+
}
|
|
3415
|
+
function auditDependencyRanges(packageJsonText) {
|
|
3416
|
+
if (!packageJsonText || !packageJsonText.trim()) return { error: "Input is empty" };
|
|
3417
|
+
let parsed;
|
|
3418
|
+
try {
|
|
3419
|
+
parsed = JSON.parse(packageJsonText);
|
|
3420
|
+
} catch (e) {
|
|
3421
|
+
return { error: `Invalid JSON: ${e.message}` };
|
|
3422
|
+
}
|
|
3423
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
3424
|
+
return { error: "Root of package.json must be an object" };
|
|
3425
|
+
}
|
|
3426
|
+
const obj = parsed;
|
|
3427
|
+
const presentSections = DEPENDENCY_SECTIONS.filter((s) => obj[s] && typeof obj[s] === "object");
|
|
3428
|
+
if (presentSections.length === 0) {
|
|
3429
|
+
return { error: "package.json has no dependencies, devDependencies, peerDependencies, or optionalDependencies field" };
|
|
3430
|
+
}
|
|
3431
|
+
const dependencies = [];
|
|
3432
|
+
const issues = [];
|
|
3433
|
+
const byName = /* @__PURE__ */ new Map();
|
|
3434
|
+
for (const section of presentSections) {
|
|
3435
|
+
const map = obj[section];
|
|
3436
|
+
for (const [name, versionRaw] of Object.entries(map)) {
|
|
3437
|
+
const version = typeof versionRaw === "string" ? versionRaw : String(versionRaw);
|
|
3438
|
+
const rangeType = classifyDependencyRange(version);
|
|
3439
|
+
const entryIssues = [];
|
|
3440
|
+
if (rangeType === "wildcard") {
|
|
3441
|
+
entryIssues.push("no real version constraint; any version, including breaking ones, could be installed");
|
|
3442
|
+
}
|
|
3443
|
+
if (rangeType === "tag" && version.trim().toLowerCase() === "latest") {
|
|
3444
|
+
entryIssues.push('"latest" is not reproducible; a fresh install can pull in a different, potentially breaking version at any time');
|
|
3445
|
+
}
|
|
3446
|
+
if (rangeType === "git" || rangeType === "url") {
|
|
3447
|
+
entryIssues.push(`not resolved from the npm registry (${rangeType}); can't be checked against registry advisories the same way`);
|
|
3448
|
+
}
|
|
3449
|
+
if (rangeType === "file" || rangeType === "link") {
|
|
3450
|
+
entryIssues.push(`local ${rangeType === "file" ? "path" : "symlink"} dependency; not portable to a machine or CI runner without the same local path`);
|
|
3451
|
+
}
|
|
3452
|
+
const entry = { name, version, section, rangeType, issues: entryIssues };
|
|
3453
|
+
dependencies.push(entry);
|
|
3454
|
+
for (const issue of entryIssues) {
|
|
3455
|
+
issues.push({ severity: "warning", name, message: issue });
|
|
3456
|
+
}
|
|
3457
|
+
const existing = byName.get(name);
|
|
3458
|
+
if (existing) existing.push(entry);
|
|
3459
|
+
else byName.set(name, [entry]);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
const duplicates = [];
|
|
3463
|
+
for (const [name, entries] of byName) {
|
|
3464
|
+
if (entries.length < 2) continue;
|
|
3465
|
+
const versions = new Set(entries.map((e) => e.version));
|
|
3466
|
+
const sameVersion = versions.size === 1;
|
|
3467
|
+
duplicates.push({ name, sections: entries.map((e) => e.section), sameVersion });
|
|
3468
|
+
if (!sameVersion) {
|
|
3469
|
+
issues.push({ severity: "error", name, message: `listed with different version ranges in ${entries.map((e) => `${e.section} ("${e.version}")`).join(" and ")}` });
|
|
3470
|
+
} else {
|
|
3471
|
+
issues.push({ severity: "warning", name, message: `listed in more than one section (${entries.map((e) => e.section).join(", ")}) with the same range; redundant` });
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
const rangeTypeCounts = {};
|
|
3475
|
+
for (const dep of dependencies) {
|
|
3476
|
+
rangeTypeCounts[dep.rangeType] = (rangeTypeCounts[dep.rangeType] ?? 0) + 1;
|
|
3477
|
+
}
|
|
3478
|
+
return {
|
|
3479
|
+
parsed: true,
|
|
3480
|
+
sections: presentSections,
|
|
3481
|
+
totalDependencies: dependencies.length,
|
|
3482
|
+
dependencies,
|
|
3483
|
+
duplicates,
|
|
3484
|
+
rangeTypeCounts,
|
|
3485
|
+
issues
|
|
3486
|
+
};
|
|
3487
|
+
}
|
|
3397
3488
|
|
|
3398
|
-
export { ALL_FLAGS, CHEATSHEET, DEFAULT_COMMIT_TYPES, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, code_exports, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, detectRedos, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lintConventionalCommit, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseGithubUrl, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testGitignorePatterns, testPattern, testRegex, validateEditorConfig, validateEnvKey, validatePackageExports, validateTsconfig };
|
|
3489
|
+
export { ALL_FLAGS, CHEATSHEET, DEFAULT_COMMIT_TYPES, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, auditDependencyRanges, buildDockerPull, buildDockerRun, buildGitCommand, code_exports, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, detectRedos, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lintConventionalCommit, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseGithubUrl, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testGitignorePatterns, testPattern, testRegex, validateEditorConfig, validateEnvKey, validatePackageExports, validateTsconfig };
|
|
@@ -87,6 +87,7 @@ __export(units_exports, {
|
|
|
87
87
|
permissionsToChmod: () => permissionsToChmod,
|
|
88
88
|
permissionsToOctal: () => permissionsToOctal,
|
|
89
89
|
permissionsToSymbolic: () => permissionsToSymbolic,
|
|
90
|
+
planDebtPayoff: () => planDebtPayoff,
|
|
90
91
|
ptToPx: () => ptToPx,
|
|
91
92
|
pxToAll: () => pxToAll,
|
|
92
93
|
pxToViewport: () => pxToViewport,
|
|
@@ -2381,5 +2382,104 @@ function calculateFreelancerRate(input) {
|
|
|
2381
2382
|
monthlyRevenueTarget: round22(requiredAnnualRevenue / 12)
|
|
2382
2383
|
};
|
|
2383
2384
|
}
|
|
2385
|
+
var DEBT_PAYOFF_MAX_MONTHS = 1200;
|
|
2386
|
+
function _simulateDebtPayoff(debts, order, extraMonthlyPayment) {
|
|
2387
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
2388
|
+
const balances = debts.map((d) => d.balance);
|
|
2389
|
+
const totalMinPayment = debts.reduce((sum, d) => sum + d.minPayment, 0);
|
|
2390
|
+
const totalBudget = totalMinPayment + extraMonthlyPayment;
|
|
2391
|
+
let totalInterestPaid = 0;
|
|
2392
|
+
let totalPaid = 0;
|
|
2393
|
+
const schedule = [];
|
|
2394
|
+
let month = 0;
|
|
2395
|
+
while (balances.some((b) => b > 5e-3) && month < DEBT_PAYOFF_MAX_MONTHS) {
|
|
2396
|
+
month++;
|
|
2397
|
+
for (let i = 0; i < balances.length; i++) {
|
|
2398
|
+
if (balances[i] <= 0) continue;
|
|
2399
|
+
const interest = balances[i] * debts[i].ratePercent / 100 / 12;
|
|
2400
|
+
balances[i] += interest;
|
|
2401
|
+
totalInterestPaid += interest;
|
|
2402
|
+
}
|
|
2403
|
+
let remainingBudget = totalBudget;
|
|
2404
|
+
for (let i = 0; i < balances.length; i++) {
|
|
2405
|
+
if (balances[i] <= 0) continue;
|
|
2406
|
+
const pay = Math.min(balances[i], debts[i].minPayment);
|
|
2407
|
+
balances[i] -= pay;
|
|
2408
|
+
remainingBudget -= pay;
|
|
2409
|
+
totalPaid += pay;
|
|
2410
|
+
}
|
|
2411
|
+
for (const i of order) {
|
|
2412
|
+
if (remainingBudget <= 0) break;
|
|
2413
|
+
if (balances[i] <= 0) continue;
|
|
2414
|
+
const pay = Math.min(balances[i], remainingBudget);
|
|
2415
|
+
balances[i] -= pay;
|
|
2416
|
+
remainingBudget -= pay;
|
|
2417
|
+
totalPaid += pay;
|
|
2418
|
+
}
|
|
2419
|
+
for (const i of order) {
|
|
2420
|
+
if (balances[i] <= 5e-3 && !schedule.some((s) => s.label === debts[i].label)) {
|
|
2421
|
+
schedule.push({ label: debts[i].label, monthPaidOff: month });
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
if (balances.some((b) => b > 5e-3)) return null;
|
|
2426
|
+
return {
|
|
2427
|
+
order: order.map((i) => debts[i].label),
|
|
2428
|
+
monthsToPayoff: month,
|
|
2429
|
+
totalInterestPaid: round22(totalInterestPaid),
|
|
2430
|
+
totalPaid: round22(totalPaid),
|
|
2431
|
+
schedule
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
function planDebtPayoff(debts, extraMonthlyPayment = 0) {
|
|
2435
|
+
if (!Array.isArray(debts) || debts.length === 0) {
|
|
2436
|
+
return { error: "debts must be a non-empty array" };
|
|
2437
|
+
}
|
|
2438
|
+
if (!Number.isFinite(extraMonthlyPayment) || extraMonthlyPayment < 0) {
|
|
2439
|
+
return { error: "extraMonthlyPayment must be a finite, non-negative number" };
|
|
2440
|
+
}
|
|
2441
|
+
const normalized = [];
|
|
2442
|
+
for (let i = 0; i < debts.length; i++) {
|
|
2443
|
+
const d = debts[i];
|
|
2444
|
+
if (typeof d.balance !== "number" || !Number.isFinite(d.balance) || d.balance <= 0) {
|
|
2445
|
+
return { error: `debt ${i + 1}: balance must be a finite number greater than zero` };
|
|
2446
|
+
}
|
|
2447
|
+
if (typeof d.ratePercent !== "number" || !Number.isFinite(d.ratePercent) || d.ratePercent < 0) {
|
|
2448
|
+
return { error: `debt ${i + 1}: ratePercent must be a finite, non-negative number` };
|
|
2449
|
+
}
|
|
2450
|
+
if (typeof d.minPayment !== "number" || !Number.isFinite(d.minPayment) || d.minPayment <= 0) {
|
|
2451
|
+
return { error: `debt ${i + 1}: minPayment must be a finite number greater than zero` };
|
|
2452
|
+
}
|
|
2453
|
+
normalized.push({
|
|
2454
|
+
label: d.label?.trim() || `Debt ${i + 1}`,
|
|
2455
|
+
balance: d.balance,
|
|
2456
|
+
ratePercent: d.ratePercent,
|
|
2457
|
+
minPayment: d.minPayment
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
const snowballOrder = normalized.map((_, i) => i).sort((a, b) => normalized[a].balance - normalized[b].balance);
|
|
2461
|
+
const avalancheOrder = normalized.map((_, i) => i).sort((a, b) => normalized[b].ratePercent - normalized[a].ratePercent);
|
|
2462
|
+
const snowball = _simulateDebtPayoff(normalized, snowballOrder, extraMonthlyPayment);
|
|
2463
|
+
const avalanche = _simulateDebtPayoff(normalized, avalancheOrder, extraMonthlyPayment);
|
|
2464
|
+
if (!snowball || !avalanche) {
|
|
2465
|
+
return { error: `debts cannot be paid off within ${DEBT_PAYOFF_MAX_MONTHS} months at this payment level; increase a minimum payment or the extra monthly payment` };
|
|
2466
|
+
}
|
|
2467
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
2468
|
+
const monthsDifference = Math.abs(snowball.monthsToPayoff - avalanche.monthsToPayoff);
|
|
2469
|
+
const interestDifference = round22(Math.abs(snowball.totalInterestPaid - avalanche.totalInterestPaid));
|
|
2470
|
+
return {
|
|
2471
|
+
debts: normalized,
|
|
2472
|
+
totalMonthlyBudget: round22(normalized.reduce((sum, d) => sum + d.minPayment, 0) + extraMonthlyPayment),
|
|
2473
|
+
extraMonthlyPayment,
|
|
2474
|
+
snowball,
|
|
2475
|
+
avalanche,
|
|
2476
|
+
comparison: {
|
|
2477
|
+
fasterStrategy: snowball.monthsToPayoff === avalanche.monthsToPayoff ? "tie" : snowball.monthsToPayoff < avalanche.monthsToPayoff ? "snowball" : "avalanche",
|
|
2478
|
+
monthsDifference,
|
|
2479
|
+
cheaperStrategy: snowball.totalInterestPaid === avalanche.totalInterestPaid ? "tie" : snowball.totalInterestPaid < avalanche.totalInterestPaid ? "snowball" : "avalanche",
|
|
2480
|
+
interestDifference
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2384
2484
|
|
|
2385
|
-
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, GPA_GRADE_POINTS, USD_DENOMINATIONS, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBlendedLoanRate, calculateBreakEven, calculateCashBreakdown, calculateCashRounding, calculateCdMaturity, calculateChange, calculateCompoundInterest, calculateCreditUtilization, calculateDebtToIncomeRatio, calculateDepreciationSchedule, calculateDiscount, calculateEmi, calculateExtraPaymentPayoff, calculateFreelancerRate, calculateGpa, calculateLoan, calculateMarginMarkup, calculateMovingAverages, calculatePaybackPeriod, calculatePercentageChange, calculateRoi, calculateRuleOf72, calculateSavingsGoal, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, calculateVideoBitrate, compareSemver, compareUnitPrices, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
|
|
2485
|
+
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, GPA_GRADE_POINTS, USD_DENOMINATIONS, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBlendedLoanRate, calculateBreakEven, calculateCashBreakdown, calculateCashRounding, calculateCdMaturity, calculateChange, calculateCompoundInterest, calculateCreditUtilization, calculateDebtToIncomeRatio, calculateDepreciationSchedule, calculateDiscount, calculateEmi, calculateExtraPaymentPayoff, calculateFreelancerRate, calculateGpa, calculateLoan, calculateMarginMarkup, calculateMovingAverages, calculatePaybackPeriod, calculatePercentageChange, calculateRoi, calculateRuleOf72, calculateSavingsGoal, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, calculateVideoBitrate, compareSemver, compareUnitPrices, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, planDebtPayoff, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* - editorconfig-validator (validateEditorConfig)
|
|
26
26
|
* - tsconfig-validator (validateTsconfig)
|
|
27
27
|
* - package-json-exports-validator (validatePackageExports)
|
|
28
|
+
* - package-json-dependency-auditor (auditDependencyRanges)
|
|
28
29
|
*/
|
|
29
30
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
30
31
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -471,6 +472,45 @@ interface ExportsValidationResult {
|
|
|
471
472
|
declare function validatePackageExports(packageJsonText: string): ExportsValidationResult | {
|
|
472
473
|
error: string;
|
|
473
474
|
};
|
|
475
|
+
type DependencyRangeType = 'exact' | 'caret' | 'tilde' | 'range' | 'wildcard' | 'tag' | 'git' | 'url' | 'file' | 'link' | 'workspace' | 'unknown';
|
|
476
|
+
type DependencySection = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
|
|
477
|
+
interface DependencyAuditEntry {
|
|
478
|
+
name: string;
|
|
479
|
+
version: string;
|
|
480
|
+
section: DependencySection;
|
|
481
|
+
rangeType: DependencyRangeType;
|
|
482
|
+
issues: string[];
|
|
483
|
+
}
|
|
484
|
+
interface DependencyAuditIssue {
|
|
485
|
+
severity: 'error' | 'warning';
|
|
486
|
+
name: string;
|
|
487
|
+
message: string;
|
|
488
|
+
}
|
|
489
|
+
interface DependencyAuditDuplicate {
|
|
490
|
+
name: string;
|
|
491
|
+
sections: DependencySection[];
|
|
492
|
+
sameVersion: boolean;
|
|
493
|
+
}
|
|
494
|
+
interface DependencyAuditResult {
|
|
495
|
+
parsed: true;
|
|
496
|
+
sections: DependencySection[];
|
|
497
|
+
totalDependencies: number;
|
|
498
|
+
dependencies: DependencyAuditEntry[];
|
|
499
|
+
duplicates: DependencyAuditDuplicate[];
|
|
500
|
+
rangeTypeCounts: Partial<Record<DependencyRangeType, number>>;
|
|
501
|
+
issues: DependencyAuditIssue[];
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Parse a package.json's dependencies, devDependencies, peerDependencies,
|
|
505
|
+
* and optionalDependencies fields, classify each version specifier's range
|
|
506
|
+
* type, and flag common risks: wildcard/"*" ranges with no real constraint,
|
|
507
|
+
* the non-reproducible "latest" tag, git/URL/file/link dependencies that
|
|
508
|
+
* bypass the registry, and the same package listed in more than one section
|
|
509
|
+
* (a conflict if the ranges differ, redundant if they match).
|
|
510
|
+
*/
|
|
511
|
+
declare function auditDependencyRanges(packageJsonText: string): DependencyAuditResult | {
|
|
512
|
+
error: string;
|
|
513
|
+
};
|
|
474
514
|
|
|
475
515
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
476
516
|
type code_ApiEndpoint = ApiEndpoint;
|
|
@@ -485,6 +525,12 @@ type code_ConventionalCommitResult = ConventionalCommitResult;
|
|
|
485
525
|
type code_ConventionalCommitSeverity = ConventionalCommitSeverity;
|
|
486
526
|
type code_CssResult = CssResult;
|
|
487
527
|
declare const code_DEFAULT_COMMIT_TYPES: typeof DEFAULT_COMMIT_TYPES;
|
|
528
|
+
type code_DependencyAuditDuplicate = DependencyAuditDuplicate;
|
|
529
|
+
type code_DependencyAuditEntry = DependencyAuditEntry;
|
|
530
|
+
type code_DependencyAuditIssue = DependencyAuditIssue;
|
|
531
|
+
type code_DependencyAuditResult = DependencyAuditResult;
|
|
532
|
+
type code_DependencyRangeType = DependencyRangeType;
|
|
533
|
+
type code_DependencySection = DependencySection;
|
|
488
534
|
type code_DockerImageRef = DockerImageRef;
|
|
489
535
|
type code_EditorConfigIssue = EditorConfigIssue;
|
|
490
536
|
type code_EditorConfigProperty = EditorConfigProperty;
|
|
@@ -529,6 +575,7 @@ type code_SqlFormatOptions = SqlFormatOptions;
|
|
|
529
575
|
type code_TestPatternResult = TestPatternResult;
|
|
530
576
|
type code_TsconfigIssue = TsconfigIssue;
|
|
531
577
|
type code_TsconfigValidationResult = TsconfigValidationResult;
|
|
578
|
+
declare const code_auditDependencyRanges: typeof auditDependencyRanges;
|
|
532
579
|
declare const code_buildDockerPull: typeof buildDockerPull;
|
|
533
580
|
declare const code_buildDockerRun: typeof buildDockerRun;
|
|
534
581
|
declare const code_buildGitCommand: typeof buildGitCommand;
|
|
@@ -579,7 +626,7 @@ declare const code_validateEnvKey: typeof validateEnvKey;
|
|
|
579
626
|
declare const code_validatePackageExports: typeof validatePackageExports;
|
|
580
627
|
declare const code_validateTsconfig: typeof validateTsconfig;
|
|
581
628
|
declare namespace code {
|
|
582
|
-
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DockerImageRef as DockerImageRef, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
|
|
629
|
+
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DependencyAuditDuplicate as DependencyAuditDuplicate, type code_DependencyAuditEntry as DependencyAuditEntry, type code_DependencyAuditIssue as DependencyAuditIssue, type code_DependencyAuditResult as DependencyAuditResult, type code_DependencyRangeType as DependencyRangeType, type code_DependencySection as DependencySection, type code_DockerImageRef as DockerImageRef, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_auditDependencyRanges as auditDependencyRanges, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
|
|
583
630
|
}
|
|
584
631
|
|
|
585
|
-
export { type
|
|
632
|
+
export { type RegexMatch as $, ALL_FLAGS as A, type GitCommandResult as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EditorConfigIssue as E, type GitOperation as F, type GitCommandConfig as G, type GithubUrlInfo as H, type GithubUrlType as I, type GitignoreTestResult as J, type GqlFormatResult as K, type HtmlFormatResult as L, type HtmlMinifyOptions as M, type HtmlMinifyResult as N, type JsMinifyOptions as O, type JsMinifyResult as P, MIME_TABLE as Q, type MatchResult as R, type MimeEntry as S, type MimeLookupResult as T, OPERATIONS as U, type ParsedSpec as V, type RedosFinding as W, type RedosResult as X, type RedosSeverity as Y, type RegexError as Z, type RegexFlag as _, type ApiEndpoint as a, type RegexResult as a0, type RegexSuccess as a1, SQL_DEFAULT_OPTIONS as a2, type Segment as a3, type SpecVersion as a4, type SqlDialect as a5, type SqlFormatOptions as a6, type TestPatternResult as a7, type TsconfigIssue as a8, type TsconfigValidationResult as a9, minifyHtml as aA, minifyJs as aB, minifySql as aC, normalizeRef as aD, parseDockerImage as aE, parseEnv as aF, parseGitCommand as aG, parseGithubUrl as aH, parseSpec as aI, removeConsoleCalls as aJ, removeEmptyAttributes as aK, removeHtmlComments as aL, removeJsComments as aM, removeRedundantAttributes as aN, searchCheatsheet as aO, searchEndpoints as aP, splitStatements as aQ, testGitignorePatterns as aR, testPattern as aS, testRegex as aT, validateEditorConfig as aU, validateEnvKey as aV, validatePackageExports as aW, validateTsconfig as aX, auditDependencyRanges as aa, buildDockerPull as ab, buildDockerRun as ac, buildGitCommand as ad, collapseHtmlWhitespace as ae, collapseJsWhitespace as af, countProperties as ag, countRules as ah, detectDialect as ai, detectOperationType as aj, detectRedos as ak, envToExport as al, envToJson as am, formatCss as an, formatGql as ao, formatHtml as ap, formatSql as aq, getEndpointsByTag as ar, getHtmlStats as as, getJsStats as at, getMethodColor as au, isValidTag as av, lintConventionalCommit as aw, lookupMime as ax, minifyCss as ay, minifyGql as az, type ApiInfo as b, code as c, type CheatsheetEntry as d, type ConventionalCommitFinding as e, type ConventionalCommitFooter as f, type ConventionalCommitOptions as g, type ConventionalCommitParsed as h, type ConventionalCommitResult as i, type ConventionalCommitSeverity as j, type CssResult as k, type DependencyAuditDuplicate as l, type DependencyAuditEntry as m, type DependencyAuditIssue as n, type DependencyAuditResult as o, type DependencyRangeType as p, type DependencySection as q, type DockerImageRef as r, type EditorConfigProperty as s, type EditorConfigSection as t, type EditorConfigValidationResult as u, type EnvEntry as v, type EnvParseResult as w, type ExportsIssue as x, type ExportsShape as y, type ExportsValidationResult as z };
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* - editorconfig-validator (validateEditorConfig)
|
|
26
26
|
* - tsconfig-validator (validateTsconfig)
|
|
27
27
|
* - package-json-exports-validator (validatePackageExports)
|
|
28
|
+
* - package-json-dependency-auditor (auditDependencyRanges)
|
|
28
29
|
*/
|
|
29
30
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
30
31
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -471,6 +472,45 @@ interface ExportsValidationResult {
|
|
|
471
472
|
declare function validatePackageExports(packageJsonText: string): ExportsValidationResult | {
|
|
472
473
|
error: string;
|
|
473
474
|
};
|
|
475
|
+
type DependencyRangeType = 'exact' | 'caret' | 'tilde' | 'range' | 'wildcard' | 'tag' | 'git' | 'url' | 'file' | 'link' | 'workspace' | 'unknown';
|
|
476
|
+
type DependencySection = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
|
|
477
|
+
interface DependencyAuditEntry {
|
|
478
|
+
name: string;
|
|
479
|
+
version: string;
|
|
480
|
+
section: DependencySection;
|
|
481
|
+
rangeType: DependencyRangeType;
|
|
482
|
+
issues: string[];
|
|
483
|
+
}
|
|
484
|
+
interface DependencyAuditIssue {
|
|
485
|
+
severity: 'error' | 'warning';
|
|
486
|
+
name: string;
|
|
487
|
+
message: string;
|
|
488
|
+
}
|
|
489
|
+
interface DependencyAuditDuplicate {
|
|
490
|
+
name: string;
|
|
491
|
+
sections: DependencySection[];
|
|
492
|
+
sameVersion: boolean;
|
|
493
|
+
}
|
|
494
|
+
interface DependencyAuditResult {
|
|
495
|
+
parsed: true;
|
|
496
|
+
sections: DependencySection[];
|
|
497
|
+
totalDependencies: number;
|
|
498
|
+
dependencies: DependencyAuditEntry[];
|
|
499
|
+
duplicates: DependencyAuditDuplicate[];
|
|
500
|
+
rangeTypeCounts: Partial<Record<DependencyRangeType, number>>;
|
|
501
|
+
issues: DependencyAuditIssue[];
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Parse a package.json's dependencies, devDependencies, peerDependencies,
|
|
505
|
+
* and optionalDependencies fields, classify each version specifier's range
|
|
506
|
+
* type, and flag common risks: wildcard/"*" ranges with no real constraint,
|
|
507
|
+
* the non-reproducible "latest" tag, git/URL/file/link dependencies that
|
|
508
|
+
* bypass the registry, and the same package listed in more than one section
|
|
509
|
+
* (a conflict if the ranges differ, redundant if they match).
|
|
510
|
+
*/
|
|
511
|
+
declare function auditDependencyRanges(packageJsonText: string): DependencyAuditResult | {
|
|
512
|
+
error: string;
|
|
513
|
+
};
|
|
474
514
|
|
|
475
515
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
476
516
|
type code_ApiEndpoint = ApiEndpoint;
|
|
@@ -485,6 +525,12 @@ type code_ConventionalCommitResult = ConventionalCommitResult;
|
|
|
485
525
|
type code_ConventionalCommitSeverity = ConventionalCommitSeverity;
|
|
486
526
|
type code_CssResult = CssResult;
|
|
487
527
|
declare const code_DEFAULT_COMMIT_TYPES: typeof DEFAULT_COMMIT_TYPES;
|
|
528
|
+
type code_DependencyAuditDuplicate = DependencyAuditDuplicate;
|
|
529
|
+
type code_DependencyAuditEntry = DependencyAuditEntry;
|
|
530
|
+
type code_DependencyAuditIssue = DependencyAuditIssue;
|
|
531
|
+
type code_DependencyAuditResult = DependencyAuditResult;
|
|
532
|
+
type code_DependencyRangeType = DependencyRangeType;
|
|
533
|
+
type code_DependencySection = DependencySection;
|
|
488
534
|
type code_DockerImageRef = DockerImageRef;
|
|
489
535
|
type code_EditorConfigIssue = EditorConfigIssue;
|
|
490
536
|
type code_EditorConfigProperty = EditorConfigProperty;
|
|
@@ -529,6 +575,7 @@ type code_SqlFormatOptions = SqlFormatOptions;
|
|
|
529
575
|
type code_TestPatternResult = TestPatternResult;
|
|
530
576
|
type code_TsconfigIssue = TsconfigIssue;
|
|
531
577
|
type code_TsconfigValidationResult = TsconfigValidationResult;
|
|
578
|
+
declare const code_auditDependencyRanges: typeof auditDependencyRanges;
|
|
532
579
|
declare const code_buildDockerPull: typeof buildDockerPull;
|
|
533
580
|
declare const code_buildDockerRun: typeof buildDockerRun;
|
|
534
581
|
declare const code_buildGitCommand: typeof buildGitCommand;
|
|
@@ -579,7 +626,7 @@ declare const code_validateEnvKey: typeof validateEnvKey;
|
|
|
579
626
|
declare const code_validatePackageExports: typeof validatePackageExports;
|
|
580
627
|
declare const code_validateTsconfig: typeof validateTsconfig;
|
|
581
628
|
declare namespace code {
|
|
582
|
-
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DockerImageRef as DockerImageRef, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
|
|
629
|
+
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DependencyAuditDuplicate as DependencyAuditDuplicate, type code_DependencyAuditEntry as DependencyAuditEntry, type code_DependencyAuditIssue as DependencyAuditIssue, type code_DependencyAuditResult as DependencyAuditResult, type code_DependencyRangeType as DependencyRangeType, type code_DependencySection as DependencySection, type code_DockerImageRef as DockerImageRef, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_auditDependencyRanges as auditDependencyRanges, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
|
|
583
630
|
}
|
|
584
631
|
|
|
585
|
-
export { type
|
|
632
|
+
export { type RegexMatch as $, ALL_FLAGS as A, type GitCommandResult as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EditorConfigIssue as E, type GitOperation as F, type GitCommandConfig as G, type GithubUrlInfo as H, type GithubUrlType as I, type GitignoreTestResult as J, type GqlFormatResult as K, type HtmlFormatResult as L, type HtmlMinifyOptions as M, type HtmlMinifyResult as N, type JsMinifyOptions as O, type JsMinifyResult as P, MIME_TABLE as Q, type MatchResult as R, type MimeEntry as S, type MimeLookupResult as T, OPERATIONS as U, type ParsedSpec as V, type RedosFinding as W, type RedosResult as X, type RedosSeverity as Y, type RegexError as Z, type RegexFlag as _, type ApiEndpoint as a, type RegexResult as a0, type RegexSuccess as a1, SQL_DEFAULT_OPTIONS as a2, type Segment as a3, type SpecVersion as a4, type SqlDialect as a5, type SqlFormatOptions as a6, type TestPatternResult as a7, type TsconfigIssue as a8, type TsconfigValidationResult as a9, minifyHtml as aA, minifyJs as aB, minifySql as aC, normalizeRef as aD, parseDockerImage as aE, parseEnv as aF, parseGitCommand as aG, parseGithubUrl as aH, parseSpec as aI, removeConsoleCalls as aJ, removeEmptyAttributes as aK, removeHtmlComments as aL, removeJsComments as aM, removeRedundantAttributes as aN, searchCheatsheet as aO, searchEndpoints as aP, splitStatements as aQ, testGitignorePatterns as aR, testPattern as aS, testRegex as aT, validateEditorConfig as aU, validateEnvKey as aV, validatePackageExports as aW, validateTsconfig as aX, auditDependencyRanges as aa, buildDockerPull as ab, buildDockerRun as ac, buildGitCommand as ad, collapseHtmlWhitespace as ae, collapseJsWhitespace as af, countProperties as ag, countRules as ah, detectDialect as ai, detectOperationType as aj, detectRedos as ak, envToExport as al, envToJson as am, formatCss as an, formatGql as ao, formatHtml as ap, formatSql as aq, getEndpointsByTag as ar, getHtmlStats as as, getJsStats as at, getMethodColor as au, isValidTag as av, lintConventionalCommit as aw, lookupMime as ax, minifyCss as ay, minifyGql as az, type ApiInfo as b, code as c, type CheatsheetEntry as d, type ConventionalCommitFinding as e, type ConventionalCommitFooter as f, type ConventionalCommitOptions as g, type ConventionalCommitParsed as h, type ConventionalCommitResult as i, type ConventionalCommitSeverity as j, type CssResult as k, type DependencyAuditDuplicate as l, type DependencyAuditEntry as m, type DependencyAuditIssue as n, type DependencyAuditResult as o, type DependencyRangeType as p, type DependencySection as q, type DockerImageRef as r, type EditorConfigProperty as s, type EditorConfigSection as t, type EditorConfigValidationResult as u, type EnvEntry as v, type EnvParseResult as w, type ExportsIssue as x, type ExportsShape as y, type ExportsValidationResult as z };
|