@utilix-tech/sdk 0.61.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 +8 -0
- package/README.md +28 -4
- package/dist/{chunk-2WT347WO.js → chunk-43L7H3L2.js} +96 -1
- 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.ts → code-CKI2Z_NM.d.cts} +49 -2
- package/dist/{code-rxidGgvB.d.cts → code-CKI2Z_NM.d.ts} +49 -2
- package/dist/index.cjs +286 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{network-CXt69chQ.d.ts → network-DewFJy4E.d.cts} +62 -2
- package/dist/{network-CXt69chQ.d.cts → network-DewFJy4E.d.ts} +62 -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/network.cjs +95 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.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,14 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.62.0
|
|
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.
|
|
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.
|
|
12
|
+
|
|
5
13
|
## 0.61.0
|
|
6
14
|
- Add `calculateExtraPaymentPayoff` (extra-payment-mortgage-calculator): compute how much faster a fixed-rate loan pays off, and how much interest is saved, when a fixed extra amount is added to every monthly payment.
|
|
7
15
|
|
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
|
---
|
|
@@ -643,6 +647,22 @@ buildRetryAfterHeader({ seconds: 120 });
|
|
|
643
647
|
// Parse an existing Retry-After header value into the same shape
|
|
644
648
|
parseRetryAfterHeader("Retry-After: 120");
|
|
645
649
|
// { header: "Retry-After: 120", headerValue: "120", type: "seconds", seconds: 120 }
|
|
650
|
+
|
|
651
|
+
// Build a Priority request/response header from urgency (0-7) and/or incremental, per RFC 9218
|
|
652
|
+
buildPriorityHeader({ urgency: 1, incremental: true });
|
|
653
|
+
// { header: "Priority: u=1, i", headerValue: "u=1, i", urgency: 1, incremental: true }
|
|
654
|
+
|
|
655
|
+
// Parse an existing Priority header value into the same shape, with spec defaults applied
|
|
656
|
+
parsePriorityHeader("u=2");
|
|
657
|
+
// { header: "Priority: u=2, i=?0", headerValue: "u=2, i=?0", urgency: 2, incremental: false }
|
|
658
|
+
|
|
659
|
+
// Look up what a WebSocket close code means, per RFC 6455 and the IANA reserved ranges
|
|
660
|
+
lookupCloseCode(1006);
|
|
661
|
+
// { code: 1006, name: "Abnormal Closure", description: "...", range: "standard", sentOnWire: false }
|
|
662
|
+
|
|
663
|
+
// List every well-known WebSocket close code (1000-1015)
|
|
664
|
+
listCloseCodes();
|
|
665
|
+
// [{ code: 1000, name: "Normal Closure", ... }, ...]
|
|
646
666
|
```
|
|
647
667
|
|
|
648
668
|
---
|
|
@@ -745,6 +765,10 @@ validateTsconfig(JSON.stringify({ compilerOptions: { target: "ES2020", strict: t
|
|
|
745
765
|
// Validate a package.json "exports" field for dual-package (ESM/CJS) misconfigurations
|
|
746
766
|
validatePackageExports(JSON.stringify({ exports: { import: "./index.mjs", require: "./index.cjs", default: "./index.cjs" } }));
|
|
747
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: [...] }
|
|
748
772
|
```
|
|
749
773
|
|
|
750
774
|
---
|
|
@@ -901,10 +925,10 @@ inspectGifFrames(new Uint8Array(gifBytes));
|
|
|
901
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 |
|
|
902
926
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, entropy estimator, fake data, CSP nonce generator |
|
|
903
927
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
904
|
-
| `@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 |
|
|
905
|
-
| `@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) |
|
|
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 |
|
|
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 |
|
|
906
930
|
| `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
|
|
907
|
-
| `@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 |
|
|
908
932
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
909
933
|
| `@utilix-tech/sdk/css` | CSS gradient, box-shadow, border-radius, keyframe animation generators |
|
|
910
934
|
| `@utilix-tech/sdk/misc` | SVG optimize/sanitize, file size format, Unicode inspector |
|
|
@@ -23,6 +23,7 @@ __export(network_exports, {
|
|
|
23
23
|
buildMapUrl: () => buildMapUrl,
|
|
24
24
|
buildPermissionsPolicy: () => buildPermissionsPolicy,
|
|
25
25
|
buildPreferHeader: () => buildPreferHeader,
|
|
26
|
+
buildPriorityHeader: () => buildPriorityHeader,
|
|
26
27
|
buildRangeHeader: () => buildRangeHeader,
|
|
27
28
|
buildReferrerPolicy: () => buildReferrerPolicy,
|
|
28
29
|
buildRetryAfterHeader: () => buildRetryAfterHeader,
|
|
@@ -43,6 +44,8 @@ __export(network_exports, {
|
|
|
43
44
|
isValidIp: () => isValidIp,
|
|
44
45
|
isValidIpv4: () => isValidIpv4,
|
|
45
46
|
isValidIpv6: () => isValidIpv6,
|
|
47
|
+
listCloseCodes: () => listCloseCodes,
|
|
48
|
+
lookupCloseCode: () => lookupCloseCode,
|
|
46
49
|
parseAcceptLanguage: () => parseAcceptLanguage,
|
|
47
50
|
parseClientHintHeaders: () => parseClientHintHeaders,
|
|
48
51
|
parseContentDisposition: () => parseContentDisposition,
|
|
@@ -53,6 +56,7 @@ __export(network_exports, {
|
|
|
53
56
|
parseIpv6Address: () => parseIpv6Address,
|
|
54
57
|
parsePermissionsPolicy: () => parsePermissionsPolicy,
|
|
55
58
|
parsePreferHeader: () => parsePreferHeader,
|
|
59
|
+
parsePriorityHeader: () => parsePriorityHeader,
|
|
56
60
|
parseRetryAfterHeader: () => parseRetryAfterHeader,
|
|
57
61
|
parseUserAgent: () => parseUserAgent,
|
|
58
62
|
parseVaryHeader: () => parseVaryHeader,
|
|
@@ -3019,5 +3023,96 @@ function parseRetryAfterHeader(raw) {
|
|
|
3019
3023
|
const httpDate = parsed.toUTCString();
|
|
3020
3024
|
return { header: `Retry-After: ${httpDate}`, headerValue: httpDate, type: "http-date", httpDate, iso: parsed.toISOString() };
|
|
3021
3025
|
}
|
|
3026
|
+
function isValidUrgency(n) {
|
|
3027
|
+
return typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 7;
|
|
3028
|
+
}
|
|
3029
|
+
function buildPriorityHeader(input) {
|
|
3030
|
+
const { urgency, incremental } = input ?? {};
|
|
3031
|
+
if (urgency === void 0 && incremental === void 0) {
|
|
3032
|
+
return { error: "Provide at least one of urgency or incremental" };
|
|
3033
|
+
}
|
|
3034
|
+
if (urgency !== void 0 && !isValidUrgency(urgency)) {
|
|
3035
|
+
return { error: "urgency must be an integer between 0 and 7" };
|
|
3036
|
+
}
|
|
3037
|
+
const parts = [];
|
|
3038
|
+
if (urgency !== void 0) parts.push(`u=${urgency}`);
|
|
3039
|
+
if (incremental === true) parts.push("i");
|
|
3040
|
+
else if (incremental === false) parts.push("i=?0");
|
|
3041
|
+
const headerValue = parts.join(", ");
|
|
3042
|
+
return {
|
|
3043
|
+
header: `Priority: ${headerValue}`,
|
|
3044
|
+
headerValue,
|
|
3045
|
+
urgency: urgency ?? 3,
|
|
3046
|
+
incremental: incremental ?? false
|
|
3047
|
+
};
|
|
3048
|
+
}
|
|
3049
|
+
function parsePriorityHeader(raw) {
|
|
3050
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
3051
|
+
const withoutLabel = raw.trim().replace(/^priority:\s*/i, "");
|
|
3052
|
+
const parts = withoutLabel.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
3053
|
+
if (parts.length === 0) return { error: "Input is empty" };
|
|
3054
|
+
let urgency = 3;
|
|
3055
|
+
let incremental = false;
|
|
3056
|
+
for (const part of parts) {
|
|
3057
|
+
const eq = part.indexOf("=");
|
|
3058
|
+
const key = (eq === -1 ? part : part.slice(0, eq)).trim();
|
|
3059
|
+
const rawValue = eq === -1 ? void 0 : part.slice(eq + 1).trim();
|
|
3060
|
+
if (key === "u") {
|
|
3061
|
+
if (rawValue === void 0 || !/^\d+$/.test(rawValue)) return { error: `Invalid urgency value in "${part}"` };
|
|
3062
|
+
const n = Number(rawValue);
|
|
3063
|
+
if (n < 0 || n > 7) return { error: `urgency must be between 0 and 7, got ${n}` };
|
|
3064
|
+
urgency = n;
|
|
3065
|
+
} else if (key === "i") {
|
|
3066
|
+
if (rawValue === void 0 || rawValue === "?1") incremental = true;
|
|
3067
|
+
else if (rawValue === "?0") incremental = false;
|
|
3068
|
+
else return { error: `Invalid incremental value in "${part}"` };
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
const headerValue = incremental ? `u=${urgency}, i` : `u=${urgency}, i=?0`;
|
|
3072
|
+
return { header: `Priority: ${headerValue}`, headerValue, urgency, incremental };
|
|
3073
|
+
}
|
|
3074
|
+
var WELL_KNOWN_CLOSE_CODES = {
|
|
3075
|
+
1e3: { name: "Normal Closure", description: "The connection successfully completed the purpose for which it was created.", sentOnWire: true },
|
|
3076
|
+
1001: { name: "Going Away", description: "An endpoint is going away, such as a server shutting down or a browser navigating away from the page.", sentOnWire: true },
|
|
3077
|
+
1002: { name: "Protocol Error", description: "An endpoint is terminating the connection due to a protocol error.", sentOnWire: true },
|
|
3078
|
+
1003: { name: "Unsupported Data", description: "An endpoint received a data type it cannot accept, such as a binary-only endpoint receiving a text message.", sentOnWire: true },
|
|
3079
|
+
1004: { name: "Reserved", description: "Reserved. A meaning might be defined in the future.", sentOnWire: true },
|
|
3080
|
+
1005: { name: "No Status Received", description: "A reserved value used internally by libraries to indicate no status code was actually present in the close frame. Must not be sent on the wire.", sentOnWire: false },
|
|
3081
|
+
1006: { name: "Abnormal Closure", description: "A reserved value used internally by libraries to indicate the connection closed without a close frame, e.g. the TCP connection dropped. Must not be sent on the wire.", sentOnWire: false },
|
|
3082
|
+
1007: { name: "Invalid frame payload data", description: "An endpoint is terminating the connection because it received data inconsistent with the message type, such as non-UTF-8 data in a text message.", sentOnWire: true },
|
|
3083
|
+
1008: { name: "Policy Violation", description: "A generic status code used when no other code fits and the endpoint does not want to reveal further details, or a message violated its policy.", sentOnWire: true },
|
|
3084
|
+
1009: { name: "Message Too Big", description: "An endpoint is terminating the connection because it received a message too large to process.", sentOnWire: true },
|
|
3085
|
+
1010: { name: "Mandatory Extension", description: "A client is terminating the connection because the server did not negotiate one or more extensions the client required.", sentOnWire: true },
|
|
3086
|
+
1011: { name: "Internal Error", description: "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.", sentOnWire: true },
|
|
3087
|
+
1012: { name: "Service Restart", description: "The server is terminating the connection because it is restarting.", sentOnWire: true },
|
|
3088
|
+
1013: { name: "Try Again Later", description: "The server is terminating the connection due to a temporary condition, such as being overloaded, and the client should reconnect later.", sentOnWire: true },
|
|
3089
|
+
1014: { name: "Bad Gateway", description: "The server, acting as a gateway or proxy, received an invalid response from an upstream server it connected to while processing the request.", sentOnWire: true },
|
|
3090
|
+
1015: { name: "TLS Handshake", description: "A reserved value used internally by libraries to indicate the TLS handshake failed. Must not be sent on the wire.", sentOnWire: false }
|
|
3091
|
+
};
|
|
3092
|
+
function listCloseCodes() {
|
|
3093
|
+
return Object.entries(WELL_KNOWN_CLOSE_CODES).map(([code, info]) => ({ code: Number(code), name: info.name, description: info.description, range: "standard", sentOnWire: info.sentOnWire })).sort((a, b) => a.code - b.code);
|
|
3094
|
+
}
|
|
3095
|
+
function lookupCloseCode(code) {
|
|
3096
|
+
if (typeof code !== "number" || !Number.isInteger(code) || code < 0 || code > 65535) {
|
|
3097
|
+
return { error: "code must be an integer between 0 and 65535" };
|
|
3098
|
+
}
|
|
3099
|
+
const known = WELL_KNOWN_CLOSE_CODES[code];
|
|
3100
|
+
if (known) {
|
|
3101
|
+
return { code, name: known.name, description: known.description, range: "standard", sentOnWire: known.sentOnWire };
|
|
3102
|
+
}
|
|
3103
|
+
if (code < 1e3) {
|
|
3104
|
+
return { error: `${code} is not a valid WebSocket close code; codes below 1000 are not permitted on the wire` };
|
|
3105
|
+
}
|
|
3106
|
+
if (code <= 2999) {
|
|
3107
|
+
return { code, name: "Unassigned", description: "Reserved for future use by the WebSocket protocol specification. No meaning is defined yet.", range: "reserved-future", sentOnWire: true };
|
|
3108
|
+
}
|
|
3109
|
+
if (code <= 3999) {
|
|
3110
|
+
return { code, name: "Library/Framework Use", description: "Reserved for use by libraries, frameworks, and applications. Codes in this range are meant to be registered directly with IANA in the WebSocket Close Code Number Registry, so their meaning depends on which library or application defined them.", range: "library-framework", sentOnWire: true };
|
|
3111
|
+
}
|
|
3112
|
+
if (code <= 4999) {
|
|
3113
|
+
return { code, name: "Private Use", description: "Reserved for private use between a specific client and server implementation. These codes cannot be registered with IANA, so their meaning is defined entirely by the application using them.", range: "private-use", sentOnWire: true };
|
|
3114
|
+
}
|
|
3115
|
+
return { error: `${code} is outside the defined close code ranges (0-4999); codes 5000 and above have no assigned meaning` };
|
|
3116
|
+
}
|
|
3022
3117
|
|
|
3023
|
-
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, X_CONTENT_TYPE_OPTIONS_HEADER, analyzeEmailHeaders, assessContentTypeRisk, buildAcceptLanguage, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildPreferHeader, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parsePreferHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
|
3118
|
+
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, X_CONTENT_TYPE_OPTIONS_HEADER, analyzeEmailHeaders, assessContentTypeRisk, buildAcceptLanguage, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildPreferHeader, buildPriorityHeader, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, listCloseCodes, lookupCloseCode, network_exports, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parsePreferHeader, parsePriorityHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
|
@@ -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 };
|