@utilix-tech/sdk 0.53.0 → 0.55.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +35 -9
  3. package/dist/{chunk-3KIUADK4.js → chunk-56VFNHVO.js} +55 -1
  4. package/dist/{chunk-Y7YY733Z.js → chunk-DEBIH7QS.js} +58 -1
  5. package/dist/{chunk-K4ZERKBD.js → chunk-JW4NG2GN.js} +119 -1
  6. package/dist/{chunk-NKN656TQ.js → chunk-LI63MAZU.js} +39 -1
  7. package/dist/{code-B_gDkRAx.d.cts → code-rxidGgvB.d.cts} +28 -2
  8. package/dist/{code-B_gDkRAx.d.ts → code-rxidGgvB.d.ts} +28 -2
  9. package/dist/{data-CupeugaR.d.cts → data-Cvyg8ZXo.d.cts} +35 -2
  10. package/dist/{data-CupeugaR.d.ts → data-Cvyg8ZXo.d.ts} +35 -2
  11. package/dist/index.cjs +267 -0
  12. package/dist/index.d.cts +4 -4
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.js +4 -4
  15. package/dist/{network-DelcJeJa.d.cts → network-C6IcHeMB.d.cts} +51 -2
  16. package/dist/{network-DelcJeJa.d.ts → network-C6IcHeMB.d.ts} +51 -2
  17. package/dist/tools/code.cjs +118 -0
  18. package/dist/tools/code.d.cts +1 -1
  19. package/dist/tools/code.d.ts +1 -1
  20. package/dist/tools/code.js +1 -1
  21. package/dist/tools/data.cjs +54 -0
  22. package/dist/tools/data.d.cts +1 -1
  23. package/dist/tools/data.d.ts +1 -1
  24. package/dist/tools/data.js +1 -1
  25. package/dist/tools/network.cjs +57 -0
  26. package/dist/tools/network.d.cts +1 -1
  27. package/dist/tools/network.d.ts +1 -1
  28. package/dist/tools/network.js +1 -1
  29. package/dist/tools/units.cjs +38 -0
  30. package/dist/tools/units.d.cts +1 -1
  31. package/dist/tools/units.d.ts +1 -1
  32. package/dist/tools/units.js +1 -1
  33. package/dist/{units-p-1Ikx7l.d.cts → units-BM1l5LG9.d.cts} +37 -2
  34. package/dist/{units-p-1Ikx7l.d.ts → units-BM1l5LG9.d.ts} +37 -2
  35. 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.55.0
6
+ - Add `calculateDebtToIncomeRatio` (debt-to-income-ratio-calculator): compute the debt-to-income ratio (total monthly debt payments / gross monthly income) from one or more monthly debts, plus a qualitative tier matching common mortgage-lending guidance.
7
+ - Add `inferCsvColumnTypes` (csv-column-type-inferencer): parse CSV/TSV data and infer each column's data type (integer, float, boolean, ISO 8601 date, or string), flagging nullable columns and empty-cell counts.
8
+
9
+ ## 0.54.0
10
+ - Add `validatePackageExports` (package-json-exports-validator): parse a package.json's exports field and flag common dual-package (ESM/CJS) misconfigurations, a types condition not listed first, a missing default fallback, mismatched require/import extensions, mixed subpath/condition keys, and pattern mismatches.
11
+ - Add `buildXContentTypeOptionsHeader`, `parseXContentTypeOptionsHeader`, `assessContentTypeRisk` (x-content-type-options-builder): build the fixed X-Content-Type-Options: nosniff header, validate a pasted value, and assess MIME-sniffing risk for a given Content-Type.
12
+
5
13
  ## 0.53.0
6
14
  - Add `calculateCreditUtilization` (credit-utilization-calculator): compute per-account and overall credit utilization (balance / limit) from one or more credit accounts, plus a qualitative tier matching common credit-scoring guidance.
7
15
  - Add `analyzeCaptionSpeed` (caption-reading-speed-checker): parse an SRT or WebVTT file and report the words-per-minute reading speed of every cue, flagging ones that exceed common broadcast accessibility guidelines.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @utilix-tech/sdk
2
2
 
3
- **646 developer utility functions for Node.js: runs locally, no API key required.**
3
+ **648 developer utility functions for Node.js: runs locally, no API key required.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@utilix-tech/sdk?style=flat-square&color=cb3837)](https://www.npmjs.com/package/@utilix-tech/sdk)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@utilix-tech/sdk?style=flat-square)](https://www.npmjs.com/package/@utilix-tech/sdk)
@@ -205,7 +205,8 @@ import { parseCsv, csvToJson, validateYaml, resolveYamlAnchors, tomlToJson, json
205
205
  formatXml, xmlToJson, jsonToXml, parseIni,
206
206
  validateNdjson, formatNdjson, ndjsonToJsonArray, diffEnvExample,
207
207
  parseSubtitles, convertSubtitles, shiftSubtitles, analyzeCaptionSpeed, parseFrontMatter,
208
- generateMarkdownToc, csvToSqlInsert, findCsvDuplicateRows, calculateMarkdownTaskListProgress } from "@utilix-tech/sdk/data";
208
+ generateMarkdownToc, csvToSqlInsert, findCsvDuplicateRows, calculateMarkdownTaskListProgress,
209
+ inferCsvColumnTypes } from "@utilix-tech/sdk/data";
209
210
 
210
211
  // CSV
211
212
  const rows = parseCsv("name,age\nalice,30\nbob,25");
@@ -265,6 +266,10 @@ findCsvDuplicateRows("name,email\nAlice,a@x.com\nBob,b@x.com\nAlice,a@x.com");
265
266
  // Markdown task list progress: completion percentage overall and per heading section
266
267
  calculateMarkdownTaskListProgress("# Phase 1\n- [x] a\n- [x] b\n## Phase 2\n- [ ] c\n");
267
268
  // { totalItems: 3, completedItems: 2, percentComplete: 66.67, sections: [{ section: "Phase 1", ... }, { section: "Phase 2", ... }] }
269
+
270
+ // Infer each CSV column's data type: integer, float, boolean, ISO 8601 date, or string
271
+ inferCsvColumnTypes("id,price,active\n1,9.99,true\n2,5,false");
272
+ // { columns: [{ name: "id", inferredType: "integer", ... }, { name: "price", inferredType: "float", ... }, ...], rowCount: 2 }
268
273
  ```
269
274
 
270
275
  ---
@@ -326,7 +331,7 @@ formatIso8601Duration(90061); // { iso: "P1DT1H1M1S", ... }
326
331
  ### `/units`: Conversions
327
332
 
328
333
  ```ts
329
- import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy, calculateMarginMarkup, calculateDiscount, applySuccessiveDiscounts, calculateBreakEven, calculateVideoBitrate, calculateRuleOf72, calculateEmi, calculateRoi, compareUnitPrices, calculatePaybackPeriod, calculateCdMaturity, calculateDepreciationSchedule, calculateCashRounding, calculateMovingAverages, calculateGpa, calculateCreditUtilization } from "@utilix-tech/sdk/units";
334
+ import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy, calculateMarginMarkup, calculateDiscount, applySuccessiveDiscounts, calculateBreakEven, calculateVideoBitrate, calculateRuleOf72, calculateEmi, calculateRoi, compareUnitPrices, calculatePaybackPeriod, calculateCdMaturity, calculateDepreciationSchedule, calculateCashRounding, calculateMovingAverages, calculateGpa, calculateCreditUtilization, calculateDebtToIncomeRatio } from "@utilix-tech/sdk/units";
330
335
 
331
336
  // File sizes
332
337
  convertBytes(1073741824, "GB"); // 1
@@ -464,6 +469,10 @@ calculateGpa([{ name: "Calculus", grade: "A", credits: 4 }, { name: "History", g
464
469
  // Per-account and overall credit utilization, plus a qualitative tier
465
470
  calculateCreditUtilization([{ label: "Visa", balance: 500, limit: 5000 }, { label: "Amex", balance: 1200, limit: 3000 }]);
466
471
  // { overallUtilizationPercent: 21.25, overallTier: "good", totalBalance: 1700, totalLimit: 8000, accounts: [...] }
472
+
473
+ // Debt-to-income (DTI) ratio, plus a qualitative tier matching common mortgage-lending guidance
474
+ calculateDebtToIncomeRatio([{ label: "Rent", amount: 1500 }, { label: "Car loan", amount: 400 }], 5000);
475
+ // { dtiPercent: 38, tier: "moderate", totalMonthlyDebt: 1900, grossMonthlyIncome: 5000, debts: [...] }
467
476
  ```
468
477
 
469
478
  ---
@@ -477,7 +486,8 @@ import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
477
486
  parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address, buildLinkHeader, checkSetCookieHeader, analyzeEmailHeaders,
478
487
  buildRangeHeader, parseContentRangeHeader, buildVaryHeader, parseVaryHeader, validateManifest,
479
488
  buildPermissionsPolicy, parsePermissionsPolicy, buildClientHints, parseClientHintHeaders,
480
- buildContentDisposition, parseContentDisposition } from "@utilix-tech/sdk/network";
489
+ buildContentDisposition, parseContentDisposition,
490
+ buildXContentTypeOptionsHeader, parseXContentTypeOptionsHeader, assessContentTypeRisk } from "@utilix-tech/sdk/network";
481
491
 
482
492
  getStatusCode(404);
483
493
  // { code: 404, text: "Not Found", description: "...", category: "Client Error" }
@@ -582,6 +592,18 @@ buildContentDisposition({ type: "attachment", filename: "résumé.pdf" });
582
592
  // Parse an existing Content-Disposition header, decoding filename* in preference to filename
583
593
  parseContentDisposition('attachment; filename="report.pdf"');
584
594
  // { type: "attachment", filename: "report.pdf", filenameIsExtended: false, params: { filename: "report.pdf" } }
595
+
596
+ // Build the fixed X-Content-Type-Options header, with a plain-English explanation of the MIME-sniffing attack it prevents
597
+ buildXContentTypeOptionsHeader();
598
+ // { header: "X-Content-Type-Options: nosniff", value: "nosniff", explanation: "..." }
599
+
600
+ // Validate a pasted X-Content-Type-Options header value
601
+ parseXContentTypeOptionsHeader("nosniff");
602
+ // { raw: "nosniff", valid: true, message: "Valid. The browser will not MIME-sniff this response." }
603
+
604
+ // Assess how risky it is to serve a given Content-Type without X-Content-Type-Options: nosniff
605
+ assessContentTypeRisk("text/plain");
606
+ // { contentType: "text/plain", risk: "high", reason: "..." }
585
607
  ```
586
608
 
587
609
  ---
@@ -632,7 +654,7 @@ generateCspHeader({ "default-src": ["'self'"], "script-src": ["'self'", "cdn.exa
632
654
  import { formatSql, minifySql, testRegex, formatHtml, formatGql,
633
655
  detectDialect, splitStatements, lookupMime, parseGithubUrl,
634
656
  detectRedos, testGitignorePatterns, validateEditorConfig,
635
- validateTsconfig } from "@utilix-tech/sdk/code";
657
+ validateTsconfig, validatePackageExports } from "@utilix-tech/sdk/code";
636
658
 
637
659
  // SQL
638
660
  formatSql("SELECT id,name FROM users WHERE active=1 ORDER BY name");
@@ -680,6 +702,10 @@ validateEditorConfig("root = true\n\n[*]\nindent_style = space\nindent_size = 2\
680
702
  // Validate a tsconfig.json file (JSONC comments and trailing commas are stripped first)
681
703
  validateTsconfig(JSON.stringify({ compilerOptions: { target: "ES2020", strict: true } }));
682
704
  // { parsed: true, topLevelKeys: ["compilerOptions"], compilerOptionKeys: ["target", "strict"], issues: [], valid: true }
705
+
706
+ // Validate a package.json "exports" field for dual-package (ESM/CJS) misconfigurations
707
+ validatePackageExports(JSON.stringify({ exports: { import: "./index.mjs", require: "./index.cjs", default: "./index.cjs" } }));
708
+ // { parsed: true, exportsShape: "conditions", subpaths: ["."], issues: [], valid: true }
683
709
  ```
684
710
 
685
711
  ---
@@ -833,13 +859,13 @@ inspectGifFrames(new Uint8Array(gifBytes));
833
859
  | `@utilix-tech/sdk/encoding` | Base64, URL, HTML entities, Base32/Base58/Base62 encode/decode |
834
860
  | `@utilix-tech/sdk/hashing` | MD5, SHA-1/256/512, bcrypt, HMAC, .htpasswd, SRI hashes, content-hash ETag generation |
835
861
  | `@utilix-tech/sdk/text` | Case convert, slugify, word count, lorem ipsum, line ops, HTML→Markdown, Levenshtein/Damerau string distance, readability scoring, sentence length distribution, emoji lookup |
836
- | `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert, SRT/WebVTT subtitles, Markdown front matter parser, YAML anchor/alias resolver |
862
+ | `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert, SRT/WebVTT subtitles, Markdown front matter parser, YAML anchor/alias resolver, CSV column type inferencer |
837
863
  | `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, entropy estimator, fake data |
838
864
  | `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
839
- | `@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 |
840
- | `@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, sitemap.xml validator, sitemap index splitter |
865
+ | `@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 |
866
+ | `@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 |
841
867
  | `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
842
- | `@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 |
868
+ | `@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 |
843
869
  | `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
844
870
  | `@utilix-tech/sdk/css` | CSS gradient, box-shadow, border-radius, keyframe animation generators |
845
871
  | `@utilix-tech/sdk/misc` | SVG optimize/sanitize, file size format, Unicode inspector |
@@ -26,6 +26,7 @@ __export(data_exports, {
26
26
  getTomlStats: () => getTomlStats,
27
27
  getXmlStats: () => getXmlStats,
28
28
  getYamlStats: () => getYamlStats,
29
+ inferCsvColumnTypes: () => inferCsvColumnTypes,
29
30
  iniToJson: () => iniToJson,
30
31
  jsonArrayToNdjson: () => jsonArrayToNdjson,
31
32
  jsonToIni: () => jsonToIni,
@@ -1610,6 +1611,59 @@ function findCsvDuplicateRows(input, options) {
1610
1611
  uniqueRowCount: parsed.rows.length - duplicateRowCount + duplicateGroups.length
1611
1612
  };
1612
1613
  }
1614
+ var _ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/;
1615
+ function _classifyCsvValue(raw) {
1616
+ const v = raw.trim();
1617
+ if (v === "") return "empty";
1618
+ if (/^(true|false)$/i.test(v)) return "boolean";
1619
+ if (/^-?\d+$/.test(v)) return "integer";
1620
+ if (/^-?\d+\.\d+$/.test(v)) return "float";
1621
+ if (_ISO_DATE_RE.test(v)) return "date";
1622
+ return "string";
1623
+ }
1624
+ function inferCsvColumnTypes(input, options) {
1625
+ const parsed = parseCsv(input, {
1626
+ delimiter: options?.delimiter ?? ",",
1627
+ hasHeader: options?.hasHeader !== false
1628
+ });
1629
+ if ("error" in parsed) return parsed;
1630
+ const columns = parsed.headers.map((name, colIdx) => {
1631
+ const seen = /* @__PURE__ */ new Set();
1632
+ let sawString = false;
1633
+ let nullCount = 0;
1634
+ const sampleValues = [];
1635
+ for (const row of parsed.rows) {
1636
+ const raw = row[colIdx] ?? "";
1637
+ const kind = _classifyCsvValue(raw);
1638
+ if (kind === "empty") {
1639
+ nullCount++;
1640
+ continue;
1641
+ }
1642
+ if (sampleValues.length < 3) sampleValues.push(raw);
1643
+ if (kind === "string") sawString = true;
1644
+ else seen.add(kind);
1645
+ }
1646
+ let inferredType;
1647
+ if (sawString || seen.size === 0) {
1648
+ inferredType = "string";
1649
+ } else if (seen.size === 1) {
1650
+ inferredType = [...seen][0];
1651
+ } else if (seen.has("integer") && seen.has("float") && seen.size === 2) {
1652
+ inferredType = "float";
1653
+ } else {
1654
+ inferredType = "string";
1655
+ }
1656
+ return {
1657
+ name,
1658
+ inferredType,
1659
+ nullable: nullCount > 0,
1660
+ nullCount,
1661
+ totalCount: parsed.rows.length,
1662
+ sampleValues
1663
+ };
1664
+ });
1665
+ return { columns, rowCount: parsed.rows.length };
1666
+ }
1613
1667
  var _YAML_ANCHOR_RE = /(?:^|\s)&([A-Za-z0-9_.-]+)/g;
1614
1668
  var _YAML_ALIAS_RE = /(?:^|\s)\*([A-Za-z0-9_.-]+)/g;
1615
1669
  function _stripYamlLineComment(line) {
@@ -1721,4 +1775,4 @@ function calculateMarkdownTaskListProgress(markdown) {
1721
1775
  return { totalItems, completedItems, percentComplete, sections, items };
1722
1776
  }
1723
1777
 
1724
- export { analyzeCaptionSpeed, calculateMarkdownTaskListProgress, convertSubtitles, csvToJson, csvToSqlInsert, data_exports, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson };
1778
+ export { analyzeCaptionSpeed, calculateMarkdownTaskListProgress, convertSubtitles, csvToJson, csvToSqlInsert, data_exports, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, inferCsvColumnTypes, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson };
@@ -10,7 +10,9 @@ __export(network_exports, {
10
10
  PERMISSIONS_POLICY_FEATURES: () => PERMISSIONS_POLICY_FEATURES,
11
11
  REFERRER_POLICY_VALUES: () => REFERRER_POLICY_VALUES,
12
12
  STATUS_CODES: () => STATUS_CODES,
13
+ X_CONTENT_TYPE_OPTIONS_HEADER: () => X_CONTENT_TYPE_OPTIONS_HEADER,
13
14
  analyzeEmailHeaders: () => analyzeEmailHeaders,
15
+ assessContentTypeRisk: () => assessContentTypeRisk,
14
16
  buildCacheControl: () => buildCacheControl,
15
17
  buildClientHints: () => buildClientHints,
16
18
  buildContentDisposition: () => buildContentDisposition,
@@ -22,6 +24,7 @@ __export(network_exports, {
22
24
  buildRangeHeader: () => buildRangeHeader,
23
25
  buildReferrerPolicy: () => buildReferrerPolicy,
24
26
  buildVaryHeader: () => buildVaryHeader,
27
+ buildXContentTypeOptionsHeader: () => buildXContentTypeOptionsHeader,
25
28
  checkSetCookieHeader: () => checkSetCookieHeader,
26
29
  countryCodeToFlag: () => countryCodeToFlag,
27
30
  formatCoordinates: () => formatCoordinates,
@@ -47,6 +50,7 @@ __export(network_exports, {
47
50
  parsePermissionsPolicy: () => parsePermissionsPolicy,
48
51
  parseUserAgent: () => parseUserAgent,
49
52
  parseVaryHeader: () => parseVaryHeader,
53
+ parseXContentTypeOptionsHeader: () => parseXContentTypeOptionsHeader,
50
54
  searchHeaders: () => searchHeaders,
51
55
  searchStatusCodes: () => searchStatusCodes,
52
56
  splitSitemap: () => splitSitemap,
@@ -2775,5 +2779,58 @@ function parseContentDisposition(header) {
2775
2779
  }
2776
2780
  return { type, filename, filenameIsExtended, params };
2777
2781
  }
2782
+ var X_CONTENT_TYPE_OPTIONS_HEADER = "X-Content-Type-Options: nosniff";
2783
+ function buildXContentTypeOptionsHeader() {
2784
+ return {
2785
+ header: X_CONTENT_TYPE_OPTIONS_HEADER,
2786
+ value: "nosniff",
2787
+ explanation: `Tells the browser to strictly honor the declared Content-Type header instead of "sniffing" a response's bytes to guess its real type. Without it, a browser that decides an oddly-typed response looks like HTML or JavaScript may render or execute it, letting a file that was only ever meant to be downloaded or displayed as plain text be used to run a cross-site scripting attack.`
2788
+ };
2789
+ }
2790
+ function parseXContentTypeOptionsHeader(rawHeader) {
2791
+ if (typeof rawHeader !== "string" || rawHeader.trim() === "") return { error: "Provide a header line or value to check" };
2792
+ const withoutLabel = rawHeader.trim().replace(/^x-content-type-options\s*:\s*/i, "");
2793
+ const value = withoutLabel.trim();
2794
+ if (value.toLowerCase() === "nosniff") {
2795
+ return { raw: value, valid: true, message: "Valid. The browser will not MIME-sniff this response." };
2796
+ }
2797
+ if (value === "") {
2798
+ return { error: 'No value found after "X-Content-Type-Options:"' };
2799
+ }
2800
+ return { raw: value, valid: false, message: `"${value}" is not a recognized value. The only value browsers act on is "nosniff" (case-insensitive); anything else is silently ignored, same as omitting the header.` };
2801
+ }
2802
+ var X_CONTENT_TYPE_EXACT_RISK_TABLE = {
2803
+ "text/plain": { risk: "high", reason: "Browsers historically sniff text/plain responses and may render them as HTML if the body looks like markup, letting user-controlled text (comments, error pages, logs) execute as script." },
2804
+ "application/octet-stream": { risk: "high", reason: "A generic fallback type with no format hint, so browsers are the most likely to sniff its real content and may render it as HTML." },
2805
+ "": { risk: "high", reason: "A missing Content-Type header gives the browser nothing to trust, so it falls back to sniffing the response body entirely." }
2806
+ };
2807
+ var X_CONTENT_TYPE_PREFIX_RISK_TABLE = [
2808
+ { prefix: "text/html", risk: "medium", reason: "Already interpreted as HTML, so sniffing mostly matters if the type is wrong on purpose; nosniff still protects against a mismatched charset or embedded polyglot content." },
2809
+ { prefix: "image/", risk: "low", reason: 'Browsers rarely upgrade an image response to HTML, but a crafted "GIFAR"-style polyglot file can still be sniffed as HTML in older engines.' },
2810
+ { prefix: "audio/", risk: "low", reason: "Media types are rarely reinterpreted as HTML by modern sniffing algorithms." },
2811
+ { prefix: "video/", risk: "low", reason: "Media types are rarely reinterpreted as HTML by modern sniffing algorithms." },
2812
+ { prefix: "font/", risk: "low", reason: "Font types are rarely reinterpreted as HTML by modern sniffing algorithms." },
2813
+ { prefix: "application/pdf", risk: "low", reason: "PDF has a strong magic-number signature, so sniffing rarely reclassifies it, though nosniff is still worth setting for user-uploaded PDFs." },
2814
+ { prefix: "application/json", risk: "medium", reason: "Structurally distinct from HTML, but user-controlled JSONP-style responses served with a wrong or missing type have been used in real sniffing attacks." },
2815
+ { prefix: "application/javascript", risk: "medium", reason: "Already executable; nosniff mainly protects against it being served where a script tag was not expected, such as inside an <img> or <object> tag." },
2816
+ { prefix: "application/xml", risk: "medium", reason: "XML can be reinterpreted in ways that overlap with HTML/XHTML parsing in some legacy sniffing paths." }
2817
+ ];
2818
+ function assessContentTypeRisk(contentType) {
2819
+ if (typeof contentType !== "string") return { error: "contentType must be a string" };
2820
+ const normalized = contentType.trim().toLowerCase().split(";")[0].trim();
2821
+ if (normalized in X_CONTENT_TYPE_EXACT_RISK_TABLE) {
2822
+ const entry = X_CONTENT_TYPE_EXACT_RISK_TABLE[normalized];
2823
+ return { contentType: contentType.trim() || "(empty)", risk: entry.risk, reason: entry.reason };
2824
+ }
2825
+ const prefixMatch = X_CONTENT_TYPE_PREFIX_RISK_TABLE.find((e) => normalized.startsWith(e.prefix));
2826
+ if (prefixMatch) {
2827
+ return { contentType: contentType.trim(), risk: prefixMatch.risk, reason: prefixMatch.reason };
2828
+ }
2829
+ return {
2830
+ contentType: contentType.trim(),
2831
+ risk: "medium",
2832
+ reason: "Not a well-known type in this tool's lookup table. Treat any response type as sniffable unless you've confirmed the serving browser trusts it, and set nosniff regardless of type as a baseline defense."
2833
+ };
2834
+ }
2778
2835
 
2779
- export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
2836
+ 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, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
@@ -57,6 +57,7 @@ __export(code_exports, {
57
57
  testRegex: () => testRegex,
58
58
  validateEditorConfig: () => validateEditorConfig,
59
59
  validateEnvKey: () => validateEnvKey,
60
+ validatePackageExports: () => validatePackageExports,
60
61
  validateTsconfig: () => validateTsconfig
61
62
  });
62
63
  var ALL_FLAGS = ["g", "i", "m", "s", "u"];
@@ -3276,5 +3277,122 @@ function validateTsconfig(text) {
3276
3277
  const valid = !issues.some((i) => i.severity === "error");
3277
3278
  return { parsed: true, topLevelKeys, compilerOptionKeys, issues, valid };
3278
3279
  }
3280
+ function collectExportsStringLeaves(value, out = []) {
3281
+ if (typeof value === "string") out.push(value);
3282
+ else if (Array.isArray(value)) value.forEach((v) => collectExportsStringLeaves(v, out));
3283
+ else if (value && typeof value === "object") Object.values(value).forEach((v) => collectExportsStringLeaves(v, out));
3284
+ return out;
3285
+ }
3286
+ function checkExportsPatternMatch(key, value, path, issues) {
3287
+ const keyHasStar = key.includes("*");
3288
+ const leaves = collectExportsStringLeaves(value);
3289
+ if (keyHasStar) {
3290
+ const bad = leaves.filter((l) => !l.includes("*"));
3291
+ if (bad.length > 0) {
3292
+ issues.push({ severity: "error", path, message: `pattern key "${key}" contains "*" but target ${bad.map((l) => `"${l}"`).join(", ")} has no "*" to receive the matched text` });
3293
+ }
3294
+ } else {
3295
+ const bad = leaves.filter((l) => l.includes("*"));
3296
+ if (bad.length > 0) {
3297
+ issues.push({ severity: "error", path, message: `target ${bad.map((l) => `"${l}"`).join(", ")} contains "*" but key "${key}" has no "*" pattern to match against` });
3298
+ }
3299
+ }
3300
+ }
3301
+ function validateExportsValue(value, path, issues) {
3302
+ if (value === null) return;
3303
+ if (typeof value === "string") {
3304
+ if (!value.startsWith("./")) {
3305
+ issues.push({ severity: "error", path, message: `target "${value}" must start with "./"` });
3306
+ }
3307
+ return;
3308
+ }
3309
+ if (Array.isArray(value)) {
3310
+ if (value.length === 0) {
3311
+ issues.push({ severity: "warning", path, message: "empty fallback array will never resolve" });
3312
+ }
3313
+ value.forEach((v, i) => validateExportsValue(v, `${path}[${i}]`, issues));
3314
+ return;
3315
+ }
3316
+ if (typeof value === "object") {
3317
+ const obj = value;
3318
+ const keys = Object.keys(obj);
3319
+ if (keys.length === 0) {
3320
+ issues.push({ severity: "warning", path, message: "empty object will never resolve" });
3321
+ return;
3322
+ }
3323
+ const hasDotKeys = keys.some((k) => k.startsWith("."));
3324
+ const hasNonDotKeys = keys.some((k) => !k.startsWith("."));
3325
+ if (hasDotKeys && hasNonDotKeys) {
3326
+ issues.push({ severity: "error", path, message: 'cannot mix subpath keys (starting with ".") with condition keys in the same object' });
3327
+ return;
3328
+ }
3329
+ if (hasDotKeys) {
3330
+ for (const key of keys) {
3331
+ const subpath = `${path}["${key}"]`;
3332
+ if (key !== "." && !key.startsWith("./")) {
3333
+ issues.push({ severity: "error", path: subpath, message: `subpath key "${key}" must be "." or start with "./"` });
3334
+ }
3335
+ checkExportsPatternMatch(key, obj[key], subpath, issues);
3336
+ validateExportsValue(obj[key], subpath, issues);
3337
+ }
3338
+ return;
3339
+ }
3340
+ if (keys.includes("types") && keys[0] !== "types") {
3341
+ issues.push({ severity: "warning", path, message: '"types" condition should be listed first so TypeScript resolves it before any other condition matches' });
3342
+ }
3343
+ if (keys.includes("default") && keys[keys.length - 1] !== "default") {
3344
+ issues.push({ severity: "warning", path, message: '"default" condition should be listed last; conditions are matched in order and anything after "default" is unreachable' });
3345
+ }
3346
+ if ((keys.includes("import") || keys.includes("require")) && !keys.includes("default")) {
3347
+ issues.push({ severity: "warning", path, message: 'no "default" fallback condition; resolution fails for any importer using a condition not listed here' });
3348
+ }
3349
+ const requireVal = obj.require;
3350
+ if (typeof requireVal === "string" && requireVal.endsWith(".mjs")) {
3351
+ issues.push({ severity: "error", path: `${path}.require`, message: `"require" condition points to a .mjs file ("${requireVal}"), but .mjs is always treated as ESM and cannot be required` });
3352
+ }
3353
+ const importVal = obj.import;
3354
+ if (typeof importVal === "string" && importVal.endsWith(".cjs")) {
3355
+ issues.push({ severity: "error", path: `${path}.import`, message: `"import" condition points to a .cjs file ("${importVal}"), but .cjs is always treated as CommonJS and cannot be imported as ESM` });
3356
+ }
3357
+ for (const key of keys) {
3358
+ validateExportsValue(obj[key], `${path}.${key}`, issues);
3359
+ }
3360
+ return;
3361
+ }
3362
+ issues.push({ severity: "error", path, message: `unexpected value type at "${path}"` });
3363
+ }
3364
+ function validatePackageExports(packageJsonText) {
3365
+ if (!packageJsonText || !packageJsonText.trim()) return { error: "Input is empty" };
3366
+ let parsed;
3367
+ try {
3368
+ parsed = JSON.parse(packageJsonText);
3369
+ } catch (e) {
3370
+ return { error: `Invalid JSON: ${e.message}` };
3371
+ }
3372
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
3373
+ return { error: "Root of package.json must be an object" };
3374
+ }
3375
+ const obj = parsed;
3376
+ if (!("exports" in obj)) return { error: 'package.json has no "exports" field' };
3377
+ const exportsValue = obj.exports;
3378
+ const issues = [];
3379
+ let exportsShape;
3380
+ if (exportsValue === null) {
3381
+ exportsShape = "null";
3382
+ } else if (typeof exportsValue === "string") {
3383
+ exportsShape = "string";
3384
+ } else if (Array.isArray(exportsValue)) {
3385
+ exportsShape = "array";
3386
+ } else if (typeof exportsValue === "object") {
3387
+ const keys = Object.keys(exportsValue);
3388
+ exportsShape = keys.some((k) => k.startsWith(".")) ? "subpaths" : "conditions";
3389
+ } else {
3390
+ return { error: '"exports" must be a string, array, object, or null' };
3391
+ }
3392
+ validateExportsValue(exportsValue, "exports", issues);
3393
+ const subpaths = exportsShape === "subpaths" ? Object.keys(exportsValue) : ["."];
3394
+ const valid = !issues.some((i) => i.severity === "error");
3395
+ return { parsed: true, exportsShape, subpaths, issues, valid };
3396
+ }
3279
3397
 
3280
- 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, validateTsconfig };
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 };
@@ -28,6 +28,7 @@ __export(units_exports, {
28
28
  calculateChange: () => calculateChange,
29
29
  calculateCompoundInterest: () => calculateCompoundInterest,
30
30
  calculateCreditUtilization: () => calculateCreditUtilization,
31
+ calculateDebtToIncomeRatio: () => calculateDebtToIncomeRatio,
31
32
  calculateDepreciationSchedule: () => calculateDepreciationSchedule,
32
33
  calculateDiscount: () => calculateDiscount,
33
34
  calculateEmi: () => calculateEmi,
@@ -2233,5 +2234,42 @@ function calculateCreditUtilization(accounts) {
2233
2234
  overallTier: _classifyUtilization(overallUtilizationPercent)
2234
2235
  };
2235
2236
  }
2237
+ function _classifyDti(percent) {
2238
+ if (percent < 36) return "healthy";
2239
+ if (percent < 43) return "moderate";
2240
+ if (percent < 50) return "high";
2241
+ return "severe";
2242
+ }
2243
+ function calculateDebtToIncomeRatio(debts, grossMonthlyIncome) {
2244
+ if (!Array.isArray(debts) || debts.length === 0) {
2245
+ return { error: "debts must be a non-empty array" };
2246
+ }
2247
+ if (typeof grossMonthlyIncome !== "number" || !Number.isFinite(grossMonthlyIncome) || grossMonthlyIncome <= 0) {
2248
+ return { error: "grossMonthlyIncome must be a finite number greater than zero" };
2249
+ }
2250
+ const round22 = (n) => Math.round(n * 100) / 100;
2251
+ let totalMonthlyDebt = 0;
2252
+ const results = [];
2253
+ for (let i = 0; i < debts.length; i++) {
2254
+ const debt = debts[i];
2255
+ if (typeof debt.amount !== "number" || !Number.isFinite(debt.amount) || debt.amount < 0) {
2256
+ return { error: `debt ${i + 1}: amount must be a finite, non-negative number` };
2257
+ }
2258
+ totalMonthlyDebt += debt.amount;
2259
+ results.push({
2260
+ label: debt.label?.trim() || `Debt ${i + 1}`,
2261
+ amount: debt.amount,
2262
+ percentOfIncome: round22(debt.amount / grossMonthlyIncome * 100)
2263
+ });
2264
+ }
2265
+ const dtiPercent = round22(totalMonthlyDebt / grossMonthlyIncome * 100);
2266
+ return {
2267
+ debts: results,
2268
+ totalMonthlyDebt: round22(totalMonthlyDebt),
2269
+ grossMonthlyIncome,
2270
+ dtiPercent,
2271
+ tier: _classifyDti(dtiPercent)
2272
+ };
2273
+ }
2236
2274
 
2237
- 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, calculateBreakEven, calculateCashBreakdown, calculateCashRounding, calculateCdMaturity, calculateChange, calculateCompoundInterest, calculateCreditUtilization, calculateDepreciationSchedule, calculateDiscount, calculateEmi, 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 };
2275
+ 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, calculateBreakEven, calculateCashBreakdown, calculateCashRounding, calculateCdMaturity, calculateChange, calculateCompoundInterest, calculateCreditUtilization, calculateDebtToIncomeRatio, calculateDepreciationSchedule, calculateDiscount, calculateEmi, 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 };
@@ -24,6 +24,7 @@
24
24
  * - gitignore-tester (testGitignorePatterns)
25
25
  * - editorconfig-validator (validateEditorConfig)
26
26
  * - tsconfig-validator (validateTsconfig)
27
+ * - package-json-exports-validator (validatePackageExports)
27
28
  */
28
29
  type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
29
30
  declare const ALL_FLAGS: RegexFlag[];
@@ -449,6 +450,27 @@ interface TsconfigValidationResult {
449
450
  declare function validateTsconfig(text: string): TsconfigValidationResult | {
450
451
  error: string;
451
452
  };
453
+ interface ExportsIssue {
454
+ severity: 'error' | 'warning';
455
+ path: string;
456
+ message: string;
457
+ }
458
+ type ExportsShape = 'string' | 'array' | 'conditions' | 'subpaths' | 'null';
459
+ interface ExportsValidationResult {
460
+ parsed: true;
461
+ exportsShape: ExportsShape;
462
+ subpaths: string[];
463
+ issues: ExportsIssue[];
464
+ valid: boolean;
465
+ }
466
+ /**
467
+ * Validate a package.json's "exports" field: flag common dual-package
468
+ * (ESM/CJS) misconfigurations. Accepts the full package.json text (only the
469
+ * "exports" field is read).
470
+ */
471
+ declare function validatePackageExports(packageJsonText: string): ExportsValidationResult | {
472
+ error: string;
473
+ };
452
474
 
453
475
  declare const code_ALL_FLAGS: typeof ALL_FLAGS;
454
476
  type code_ApiEndpoint = ApiEndpoint;
@@ -470,6 +492,9 @@ type code_EditorConfigSection = EditorConfigSection;
470
492
  type code_EditorConfigValidationResult = EditorConfigValidationResult;
471
493
  type code_EnvEntry = EnvEntry;
472
494
  type code_EnvParseResult = EnvParseResult;
495
+ type code_ExportsIssue = ExportsIssue;
496
+ type code_ExportsShape = ExportsShape;
497
+ type code_ExportsValidationResult = ExportsValidationResult;
473
498
  type code_GitCommandConfig = GitCommandConfig;
474
499
  type code_GitCommandResult = GitCommandResult;
475
500
  type code_GitOperation = GitOperation;
@@ -551,9 +576,10 @@ declare const code_testPattern: typeof testPattern;
551
576
  declare const code_testRegex: typeof testRegex;
552
577
  declare const code_validateEditorConfig: typeof validateEditorConfig;
553
578
  declare const code_validateEnvKey: typeof validateEnvKey;
579
+ declare const code_validatePackageExports: typeof validatePackageExports;
554
580
  declare const code_validateTsconfig: typeof validateTsconfig;
555
581
  declare namespace code {
556
- 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_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_validateTsconfig as validateTsconfig };
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 };
557
583
  }
558
584
 
559
- export { type TsconfigIssue as $, ALL_FLAGS as A, type MatchResult as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EditorConfigIssue as E, type MimeEntry as F, type GitCommandConfig as G, type HtmlFormatResult as H, type MimeLookupResult as I, type JsMinifyOptions as J, type RedosResult as K, type RedosSeverity as L, MIME_TABLE as M, type RegexError as N, OPERATIONS as O, type ParsedSpec as P, type RegexFlag as Q, type RedosFinding as R, type RegexMatch as S, type RegexResult as T, type RegexSuccess as U, SQL_DEFAULT_OPTIONS as V, type Segment as W, type SpecVersion as X, type SqlDialect as Y, type SqlFormatOptions as Z, type TestPatternResult as _, type ApiEndpoint as a, type TsconfigValidationResult as a0, buildDockerPull as a1, buildDockerRun as a2, buildGitCommand as a3, collapseHtmlWhitespace as a4, collapseJsWhitespace as a5, countProperties as a6, countRules as a7, detectDialect as a8, detectOperationType as a9, removeEmptyAttributes as aA, removeHtmlComments as aB, removeJsComments as aC, removeRedundantAttributes as aD, searchCheatsheet as aE, searchEndpoints as aF, splitStatements as aG, testGitignorePatterns as aH, testPattern as aI, testRegex as aJ, validateEditorConfig as aK, validateEnvKey as aL, validateTsconfig as aM, detectRedos as aa, envToExport as ab, envToJson as ac, formatCss as ad, formatGql as ae, formatHtml as af, formatSql as ag, getEndpointsByTag as ah, getHtmlStats as ai, getJsStats as aj, getMethodColor as ak, isValidTag as al, lintConventionalCommit as am, lookupMime as an, minifyCss as ao, minifyGql as ap, minifyHtml as aq, minifyJs as ar, minifySql as as, normalizeRef as at, parseDockerImage as au, parseEnv as av, parseGitCommand as aw, parseGithubUrl as ax, parseSpec as ay, removeConsoleCalls 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 DockerImageRef as l, type EditorConfigProperty as m, type EditorConfigSection as n, type EditorConfigValidationResult as o, type EnvEntry as p, type EnvParseResult as q, type GitCommandResult as r, type GitOperation as s, type GithubUrlInfo as t, type GithubUrlType as u, type GitignoreTestResult as v, type GqlFormatResult as w, type HtmlMinifyOptions as x, type HtmlMinifyResult as y, type JsMinifyResult as z };
585
+ export { type SqlDialect as $, ALL_FLAGS as A, type HtmlMinifyOptions as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EditorConfigIssue as E, type HtmlMinifyResult as F, type GitCommandConfig as G, type HtmlFormatResult as H, type JsMinifyResult as I, type JsMinifyOptions as J, type MatchResult as K, type MimeEntry as L, MIME_TABLE as M, type MimeLookupResult as N, OPERATIONS as O, type ParsedSpec as P, type RedosResult as Q, type RedosFinding as R, type RedosSeverity as S, type RegexError as T, type RegexFlag as U, type RegexMatch as V, type RegexResult as W, type RegexSuccess as X, SQL_DEFAULT_OPTIONS as Y, type Segment as Z, type SpecVersion as _, type ApiEndpoint as a, type SqlFormatOptions as a0, type TestPatternResult as a1, type TsconfigIssue as a2, type TsconfigValidationResult as a3, buildDockerPull as a4, buildDockerRun as a5, buildGitCommand as a6, collapseHtmlWhitespace as a7, collapseJsWhitespace as a8, countProperties as a9, parseGithubUrl as aA, parseSpec as aB, removeConsoleCalls as aC, removeEmptyAttributes as aD, removeHtmlComments as aE, removeJsComments as aF, removeRedundantAttributes as aG, searchCheatsheet as aH, searchEndpoints as aI, splitStatements as aJ, testGitignorePatterns as aK, testPattern as aL, testRegex as aM, validateEditorConfig as aN, validateEnvKey as aO, validatePackageExports as aP, validateTsconfig as aQ, countRules as aa, detectDialect as ab, detectOperationType as ac, detectRedos as ad, envToExport as ae, envToJson as af, formatCss as ag, formatGql as ah, formatHtml as ai, formatSql as aj, getEndpointsByTag as ak, getHtmlStats as al, getJsStats as am, getMethodColor as an, isValidTag as ao, lintConventionalCommit as ap, lookupMime as aq, minifyCss as ar, minifyGql as as, minifyHtml as at, minifyJs as au, minifySql as av, normalizeRef as aw, parseDockerImage as ax, parseEnv as ay, parseGitCommand 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 DockerImageRef as l, type EditorConfigProperty as m, type EditorConfigSection as n, type EditorConfigValidationResult as o, type EnvEntry as p, type EnvParseResult as q, type ExportsIssue as r, type ExportsShape as s, type ExportsValidationResult as t, type GitCommandResult as u, type GitOperation as v, type GithubUrlInfo as w, type GithubUrlType as x, type GitignoreTestResult as y, type GqlFormatResult as z };