@utilix-tech/sdk 0.13.0 → 0.15.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 +6 -0
- package/README.md +21 -5
- package/dist/{chunk-BI3SOWM7.js → chunk-RJPYVCKQ.js} +114 -1
- package/dist/{chunk-V5S6OJ4A.js → chunk-Y5X34JAC.js} +135 -1
- package/dist/{code-BUqyaofO.d.cts → code-C4skwg3l.d.cts} +29 -2
- package/dist/{code-BUqyaofO.d.ts → code-C4skwg3l.d.ts} +29 -2
- package/dist/index.cjs +247 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/tools/code.cjs +134 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/units.cjs +113 -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-CKS5W_ih.d.ts → units-CADUCiYZ.d.cts} +80 -2
- package/dist/{units-CKS5W_ih.d.cts → units-CADUCiYZ.d.ts} +80 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6617,13 +6617,16 @@ __export(units_exports, {
|
|
|
6617
6617
|
COMMON_RATIOS: () => COMMON_RATIOS,
|
|
6618
6618
|
COMMON_SIZES: () => COMMON_SIZES,
|
|
6619
6619
|
COMMON_TAX_RATES: () => COMMON_TAX_RATES,
|
|
6620
|
+
COMMON_TIP_PERCENTAGES: () => COMMON_TIP_PERCENTAGES,
|
|
6620
6621
|
COMMON_VIEWPORTS: () => COMMON_VIEWPORTS,
|
|
6621
6622
|
autoFormat: () => autoFormat,
|
|
6622
6623
|
bumpVersion: () => bumpVersion,
|
|
6623
6624
|
calcAspectRatio: () => calcAspectRatio,
|
|
6624
6625
|
calcSubnet: () => calcSubnet,
|
|
6626
|
+
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
6625
6627
|
calculateLoan: () => calculateLoan,
|
|
6626
6628
|
calculateTax: () => calculateTax,
|
|
6629
|
+
calculateTipSplit: () => calculateTipSplit,
|
|
6627
6630
|
compareSemver: () => compareSemver,
|
|
6628
6631
|
convert: () => convert,
|
|
6629
6632
|
convertBytes: () => convertBytes,
|
|
@@ -6671,6 +6674,7 @@ __export(units_exports, {
|
|
|
6671
6674
|
validateBarcode: () => validateBarcode,
|
|
6672
6675
|
validateCardNumber: () => validateCardNumber,
|
|
6673
6676
|
validateIban: () => validateIban,
|
|
6677
|
+
validateIsbn: () => validateIsbn,
|
|
6674
6678
|
viewportToPx: () => viewportToPx
|
|
6675
6679
|
});
|
|
6676
6680
|
function pxToAll(px, baseFontSize = 16, viewportWidth = 1440, viewportHeight = 900) {
|
|
@@ -7772,6 +7776,115 @@ function calculateTax(amount, ratePercent, direction) {
|
|
|
7772
7776
|
const taxAmount = round23(grossAmount - netAmount);
|
|
7773
7777
|
return { netAmount, taxAmount, grossAmount, ratePercent, direction };
|
|
7774
7778
|
}
|
|
7779
|
+
function calculateCompoundInterest(principal, annualRatePercent, years, compoundsPerYear, contributionPerPeriod = 0) {
|
|
7780
|
+
if (!Number.isFinite(principal) || principal < 0) return { error: "Principal must be zero or a positive number" };
|
|
7781
|
+
if (!Number.isFinite(annualRatePercent) || annualRatePercent < 0) {
|
|
7782
|
+
return { error: "Annual interest rate must be zero or a positive number" };
|
|
7783
|
+
}
|
|
7784
|
+
if (!Number.isInteger(years) || years <= 0) return { error: "Years must be a positive whole number" };
|
|
7785
|
+
if (!Number.isInteger(compoundsPerYear) || compoundsPerYear <= 0) {
|
|
7786
|
+
return { error: "Compounding frequency must be a positive whole number of periods per year" };
|
|
7787
|
+
}
|
|
7788
|
+
if (!Number.isFinite(contributionPerPeriod) || contributionPerPeriod < 0) {
|
|
7789
|
+
return { error: "Contribution per period must be zero or a positive number" };
|
|
7790
|
+
}
|
|
7791
|
+
if (principal === 0 && contributionPerPeriod === 0) return { error: "Enter a principal or a recurring contribution" };
|
|
7792
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
7793
|
+
const ratePerPeriod = annualRatePercent / 100 / compoundsPerYear;
|
|
7794
|
+
function futureValueAtPeriod(periods) {
|
|
7795
|
+
const growth = ratePerPeriod === 0 ? 1 : Math.pow(1 + ratePerPeriod, periods);
|
|
7796
|
+
const fvPrincipal = principal * growth;
|
|
7797
|
+
const fvContributions = contributionPerPeriod === 0 ? 0 : ratePerPeriod === 0 ? contributionPerPeriod * periods : contributionPerPeriod * ((growth - 1) / ratePerPeriod);
|
|
7798
|
+
return fvPrincipal + fvContributions;
|
|
7799
|
+
}
|
|
7800
|
+
const schedule = [];
|
|
7801
|
+
for (let year = 1; year <= years; year++) {
|
|
7802
|
+
const periods = year * compoundsPerYear;
|
|
7803
|
+
const balance = round23(futureValueAtPeriod(periods));
|
|
7804
|
+
const contributions = round23(contributionPerPeriod * periods);
|
|
7805
|
+
schedule.push({ year, balance, contributions, interest: round23(balance - principal - contributions) });
|
|
7806
|
+
}
|
|
7807
|
+
const totalPeriods = years * compoundsPerYear;
|
|
7808
|
+
const futureValue = round23(futureValueAtPeriod(totalPeriods));
|
|
7809
|
+
const totalContributions = round23(contributionPerPeriod * totalPeriods);
|
|
7810
|
+
const totalInterest = round23(futureValue - principal - totalContributions);
|
|
7811
|
+
return {
|
|
7812
|
+
futureValue,
|
|
7813
|
+
totalPrincipal: round23(principal),
|
|
7814
|
+
totalContributions,
|
|
7815
|
+
totalInterest,
|
|
7816
|
+
years,
|
|
7817
|
+
compoundsPerYear,
|
|
7818
|
+
schedule
|
|
7819
|
+
};
|
|
7820
|
+
}
|
|
7821
|
+
function computeIsbn10CheckDigit(dataDigits) {
|
|
7822
|
+
let sum = 0;
|
|
7823
|
+
for (let i = 0; i < 9; i++) sum += dataDigits[i] * (10 - i);
|
|
7824
|
+
const check = (11 - sum % 11) % 11;
|
|
7825
|
+
return check === 10 ? "X" : String(check);
|
|
7826
|
+
}
|
|
7827
|
+
function computeIsbn13CheckDigit(dataDigits) {
|
|
7828
|
+
let sum = 0;
|
|
7829
|
+
const n = dataDigits.length;
|
|
7830
|
+
for (let i = 0; i < n; i++) {
|
|
7831
|
+
const distanceFromEnd = n - 1 - i;
|
|
7832
|
+
const weight = distanceFromEnd % 2 === 0 ? 3 : 1;
|
|
7833
|
+
sum += dataDigits[i] * weight;
|
|
7834
|
+
}
|
|
7835
|
+
return String((10 - sum % 10) % 10);
|
|
7836
|
+
}
|
|
7837
|
+
function validateIsbn(input) {
|
|
7838
|
+
if (!input || !input.trim()) return { error: "Input is empty" };
|
|
7839
|
+
const cleaned = input.replace(/[\s-]/g, "").toUpperCase();
|
|
7840
|
+
if (cleaned.length === 10) {
|
|
7841
|
+
if (!/^\d{9}[\dX]$/.test(cleaned)) {
|
|
7842
|
+
return { error: 'ISBN-10 must be 9 digits followed by a digit or "X" check digit' };
|
|
7843
|
+
}
|
|
7844
|
+
const dataDigits = cleaned.slice(0, 9).split("").map(Number);
|
|
7845
|
+
const checkDigit = cleaned[9];
|
|
7846
|
+
const expectedCheckDigit = computeIsbn10CheckDigit(dataDigits);
|
|
7847
|
+
const valid = checkDigit === expectedCheckDigit;
|
|
7848
|
+
const isbn13Digits = [9, 7, 8, ...dataDigits];
|
|
7849
|
+
const isbn13Check = computeIsbn13CheckDigit(isbn13Digits);
|
|
7850
|
+
const converted = valid ? isbn13Digits.join("") + isbn13Check : null;
|
|
7851
|
+
return { valid, format: "ISBN-10", digits: cleaned, checkDigit, expectedCheckDigit, converted };
|
|
7852
|
+
}
|
|
7853
|
+
if (cleaned.length === 13) {
|
|
7854
|
+
if (!/^\d{13}$/.test(cleaned)) return { error: "ISBN-13 must contain only digits" };
|
|
7855
|
+
const dataDigits = cleaned.slice(0, 12).split("").map(Number);
|
|
7856
|
+
const checkDigit = cleaned[12];
|
|
7857
|
+
const expectedCheckDigit = computeIsbn13CheckDigit(dataDigits);
|
|
7858
|
+
const valid = checkDigit === expectedCheckDigit;
|
|
7859
|
+
let converted = null;
|
|
7860
|
+
if (valid && cleaned.startsWith("978")) {
|
|
7861
|
+
const isbn10Digits = dataDigits.slice(3);
|
|
7862
|
+
converted = isbn10Digits.join("") + computeIsbn10CheckDigit(isbn10Digits);
|
|
7863
|
+
}
|
|
7864
|
+
return { valid, format: "ISBN-13", digits: cleaned, checkDigit, expectedCheckDigit, converted };
|
|
7865
|
+
}
|
|
7866
|
+
return { error: `Unsupported length (${cleaned.length} characters); expected 10 (ISBN-10) or 13 (ISBN-13)` };
|
|
7867
|
+
}
|
|
7868
|
+
var COMMON_TIP_PERCENTAGES = [10, 15, 18, 20, 25];
|
|
7869
|
+
function calculateTipSplit(billAmount, tipPercent, numPeople = 1) {
|
|
7870
|
+
if (!Number.isFinite(billAmount) || billAmount < 0) return { error: "Bill amount must be zero or a positive number" };
|
|
7871
|
+
if (!Number.isFinite(tipPercent) || tipPercent < 0) return { error: "Tip percent must be zero or a positive number" };
|
|
7872
|
+
if (!Number.isInteger(numPeople) || numPeople < 1) return { error: "Number of people must be a positive whole number" };
|
|
7873
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
7874
|
+
const billRounded = round23(billAmount);
|
|
7875
|
+
const tipAmount = round23(billAmount * (tipPercent / 100));
|
|
7876
|
+
const totalAmount = round23(billRounded + tipAmount);
|
|
7877
|
+
return {
|
|
7878
|
+
billAmount: billRounded,
|
|
7879
|
+
tipPercent,
|
|
7880
|
+
tipAmount,
|
|
7881
|
+
totalAmount,
|
|
7882
|
+
numPeople,
|
|
7883
|
+
perPersonBill: round23(billRounded / numPeople),
|
|
7884
|
+
perPersonTip: round23(tipAmount / numPeople),
|
|
7885
|
+
perPersonTotal: round23(totalAmount / numPeople)
|
|
7886
|
+
};
|
|
7887
|
+
}
|
|
7775
7888
|
|
|
7776
7889
|
// src/tools/network.ts
|
|
7777
7890
|
var network_exports = {};
|
|
@@ -10659,6 +10772,7 @@ var code_exports = {};
|
|
|
10659
10772
|
__export(code_exports, {
|
|
10660
10773
|
ALL_FLAGS: () => ALL_FLAGS,
|
|
10661
10774
|
CHEATSHEET: () => CHEATSHEET,
|
|
10775
|
+
MIME_TABLE: () => MIME_TABLE,
|
|
10662
10776
|
OPERATIONS: () => OPERATIONS,
|
|
10663
10777
|
SQL_DEFAULT_OPTIONS: () => SQL_DEFAULT_OPTIONS,
|
|
10664
10778
|
buildDockerPull: () => buildDockerPull,
|
|
@@ -10681,6 +10795,7 @@ __export(code_exports, {
|
|
|
10681
10795
|
getJsStats: () => getJsStats,
|
|
10682
10796
|
getMethodColor: () => getMethodColor,
|
|
10683
10797
|
isValidTag: () => isValidTag,
|
|
10798
|
+
lookupMime: () => lookupMime,
|
|
10684
10799
|
minifyCss: () => minifyCss,
|
|
10685
10800
|
minifyGql: () => minifyGql,
|
|
10686
10801
|
minifyHtml: () => minifyHtml,
|
|
@@ -12931,6 +13046,138 @@ function countProperties(css) {
|
|
|
12931
13046
|
});
|
|
12932
13047
|
return count;
|
|
12933
13048
|
}
|
|
13049
|
+
var MIME_TABLE = [
|
|
13050
|
+
// Text / web
|
|
13051
|
+
{ extension: "txt", mimeType: "text/plain" },
|
|
13052
|
+
{ extension: "html", mimeType: "text/html" },
|
|
13053
|
+
{ extension: "htm", mimeType: "text/html" },
|
|
13054
|
+
{ extension: "css", mimeType: "text/css" },
|
|
13055
|
+
{ extension: "js", mimeType: "text/javascript" },
|
|
13056
|
+
{ extension: "mjs", mimeType: "text/javascript" },
|
|
13057
|
+
{ extension: "json", mimeType: "application/json" },
|
|
13058
|
+
{ extension: "jsonld", mimeType: "application/ld+json" },
|
|
13059
|
+
{ extension: "xml", mimeType: "application/xml" },
|
|
13060
|
+
{ extension: "csv", mimeType: "text/csv" },
|
|
13061
|
+
{ extension: "tsv", mimeType: "text/tab-separated-values" },
|
|
13062
|
+
{ extension: "md", mimeType: "text/markdown" },
|
|
13063
|
+
{ extension: "rtf", mimeType: "application/rtf" },
|
|
13064
|
+
{ extension: "yaml", mimeType: "application/x-yaml" },
|
|
13065
|
+
{ extension: "yml", mimeType: "application/x-yaml" },
|
|
13066
|
+
{ extension: "toml", mimeType: "application/toml" },
|
|
13067
|
+
{ extension: "ini", mimeType: "text/plain" },
|
|
13068
|
+
{ extension: "ics", mimeType: "text/calendar" },
|
|
13069
|
+
{ extension: "vcf", mimeType: "text/vcard" },
|
|
13070
|
+
{ extension: "atom", mimeType: "application/atom+xml" },
|
|
13071
|
+
{ extension: "rss", mimeType: "application/rss+xml" },
|
|
13072
|
+
// Images
|
|
13073
|
+
{ extension: "png", mimeType: "image/png" },
|
|
13074
|
+
{ extension: "jpg", mimeType: "image/jpeg" },
|
|
13075
|
+
{ extension: "jpeg", mimeType: "image/jpeg" },
|
|
13076
|
+
{ extension: "gif", mimeType: "image/gif" },
|
|
13077
|
+
{ extension: "bmp", mimeType: "image/bmp" },
|
|
13078
|
+
{ extension: "webp", mimeType: "image/webp" },
|
|
13079
|
+
{ extension: "svg", mimeType: "image/svg+xml" },
|
|
13080
|
+
{ extension: "ico", mimeType: "image/x-icon" },
|
|
13081
|
+
{ extension: "tif", mimeType: "image/tiff" },
|
|
13082
|
+
{ extension: "tiff", mimeType: "image/tiff" },
|
|
13083
|
+
{ extension: "avif", mimeType: "image/avif" },
|
|
13084
|
+
{ extension: "heic", mimeType: "image/heic" },
|
|
13085
|
+
{ extension: "psd", mimeType: "image/vnd.adobe.photoshop" },
|
|
13086
|
+
// Fonts
|
|
13087
|
+
{ extension: "ttf", mimeType: "font/ttf" },
|
|
13088
|
+
{ extension: "otf", mimeType: "font/otf" },
|
|
13089
|
+
{ extension: "woff", mimeType: "font/woff" },
|
|
13090
|
+
{ extension: "woff2", mimeType: "font/woff2" },
|
|
13091
|
+
{ extension: "eot", mimeType: "application/vnd.ms-fontobject" },
|
|
13092
|
+
// Documents
|
|
13093
|
+
{ extension: "pdf", mimeType: "application/pdf" },
|
|
13094
|
+
{ extension: "doc", mimeType: "application/msword" },
|
|
13095
|
+
{ extension: "docx", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
|
|
13096
|
+
{ extension: "xls", mimeType: "application/vnd.ms-excel" },
|
|
13097
|
+
{ extension: "xlsx", mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
|
|
13098
|
+
{ extension: "ppt", mimeType: "application/vnd.ms-powerpoint" },
|
|
13099
|
+
{ extension: "pptx", mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
|
|
13100
|
+
{ extension: "odt", mimeType: "application/vnd.oasis.opendocument.text" },
|
|
13101
|
+
{ extension: "ods", mimeType: "application/vnd.oasis.opendocument.spreadsheet" },
|
|
13102
|
+
{ extension: "odp", mimeType: "application/vnd.oasis.opendocument.presentation" },
|
|
13103
|
+
{ extension: "epub", mimeType: "application/epub+zip" },
|
|
13104
|
+
// Archives
|
|
13105
|
+
{ extension: "zip", mimeType: "application/zip" },
|
|
13106
|
+
{ extension: "rar", mimeType: "application/vnd.rar" },
|
|
13107
|
+
{ extension: "7z", mimeType: "application/x-7z-compressed" },
|
|
13108
|
+
{ extension: "tar", mimeType: "application/x-tar" },
|
|
13109
|
+
{ extension: "gz", mimeType: "application/gzip" },
|
|
13110
|
+
{ extension: "bz2", mimeType: "application/x-bzip2" },
|
|
13111
|
+
{ extension: "jar", mimeType: "application/java-archive" },
|
|
13112
|
+
// Audio
|
|
13113
|
+
{ extension: "mp3", mimeType: "audio/mpeg" },
|
|
13114
|
+
{ extension: "wav", mimeType: "audio/wav" },
|
|
13115
|
+
{ extension: "ogg", mimeType: "audio/ogg" },
|
|
13116
|
+
{ extension: "oga", mimeType: "audio/ogg" },
|
|
13117
|
+
{ extension: "flac", mimeType: "audio/flac" },
|
|
13118
|
+
{ extension: "aac", mimeType: "audio/aac" },
|
|
13119
|
+
{ extension: "m4a", mimeType: "audio/mp4" },
|
|
13120
|
+
{ extension: "mid", mimeType: "audio/midi" },
|
|
13121
|
+
{ extension: "midi", mimeType: "audio/midi" },
|
|
13122
|
+
{ extension: "weba", mimeType: "audio/webm" },
|
|
13123
|
+
// Video
|
|
13124
|
+
{ extension: "mp4", mimeType: "video/mp4" },
|
|
13125
|
+
{ extension: "m4v", mimeType: "video/mp4" },
|
|
13126
|
+
{ extension: "webm", mimeType: "video/webm" },
|
|
13127
|
+
{ extension: "mov", mimeType: "video/quicktime" },
|
|
13128
|
+
{ extension: "avi", mimeType: "video/x-msvideo" },
|
|
13129
|
+
{ extension: "mkv", mimeType: "video/x-matroska" },
|
|
13130
|
+
{ extension: "wmv", mimeType: "video/x-ms-wmv" },
|
|
13131
|
+
{ extension: "flv", mimeType: "video/x-flv" },
|
|
13132
|
+
{ extension: "mpeg", mimeType: "video/mpeg" },
|
|
13133
|
+
{ extension: "mpg", mimeType: "video/mpeg" },
|
|
13134
|
+
{ extension: "3gp", mimeType: "video/3gpp" },
|
|
13135
|
+
{ extension: "ts", mimeType: "video/mp2t" },
|
|
13136
|
+
// Application / binary
|
|
13137
|
+
{ extension: "bin", mimeType: "application/octet-stream" },
|
|
13138
|
+
{ extension: "exe", mimeType: "application/vnd.microsoft.portable-executable" },
|
|
13139
|
+
{ extension: "dmg", mimeType: "application/x-apple-diskimage" },
|
|
13140
|
+
{ extension: "apk", mimeType: "application/vnd.android.package-archive" },
|
|
13141
|
+
{ extension: "iso", mimeType: "application/x-iso9660-image" },
|
|
13142
|
+
{ extension: "deb", mimeType: "application/vnd.debian.binary-package" },
|
|
13143
|
+
{ extension: "rpm", mimeType: "application/x-rpm" },
|
|
13144
|
+
{ extension: "msi", mimeType: "application/x-msi" },
|
|
13145
|
+
{ extension: "dll", mimeType: "application/x-msdownload" },
|
|
13146
|
+
{ extension: "so", mimeType: "application/octet-stream" },
|
|
13147
|
+
{ extension: "wasm", mimeType: "application/wasm" },
|
|
13148
|
+
{ extension: "swf", mimeType: "application/x-shockwave-flash" },
|
|
13149
|
+
{ extension: "crx", mimeType: "application/x-chrome-extension" },
|
|
13150
|
+
{ extension: "torrent", mimeType: "application/x-bittorrent" },
|
|
13151
|
+
// Code / config
|
|
13152
|
+
{ extension: "sh", mimeType: "application/x-sh" },
|
|
13153
|
+
{ extension: "bat", mimeType: "application/x-bat" },
|
|
13154
|
+
{ extension: "py", mimeType: "text/x-python" },
|
|
13155
|
+
{ extension: "java", mimeType: "text/x-java-source" },
|
|
13156
|
+
{ extension: "c", mimeType: "text/x-c" },
|
|
13157
|
+
{ extension: "h", mimeType: "text/x-c" },
|
|
13158
|
+
{ extension: "cpp", mimeType: "text/x-c++src" },
|
|
13159
|
+
{ extension: "rb", mimeType: "text/x-ruby" },
|
|
13160
|
+
{ extension: "php", mimeType: "application/x-httpd-php" },
|
|
13161
|
+
{ extension: "go", mimeType: "text/x-go" },
|
|
13162
|
+
{ extension: "rs", mimeType: "text/x-rust" },
|
|
13163
|
+
{ extension: "swift", mimeType: "text/x-swift" },
|
|
13164
|
+
{ extension: "sql", mimeType: "application/sql" },
|
|
13165
|
+
{ extension: "log", mimeType: "text/plain" }
|
|
13166
|
+
];
|
|
13167
|
+
function lookupMime(query) {
|
|
13168
|
+
if (!query || !query.trim()) return { error: "Input is empty" };
|
|
13169
|
+
const trimmed = query.trim();
|
|
13170
|
+
if (trimmed.includes("/")) {
|
|
13171
|
+
const mime = trimmed.toLowerCase();
|
|
13172
|
+
const matches2 = MIME_TABLE.filter((e) => e.mimeType.toLowerCase() === mime);
|
|
13173
|
+
if (matches2.length === 0) return { error: `No known file extension for MIME type "${trimmed}"` };
|
|
13174
|
+
return { query: trimmed, kind: "mime", matches: matches2 };
|
|
13175
|
+
}
|
|
13176
|
+
const ext = trimmed.replace(/^\./, "").toLowerCase();
|
|
13177
|
+
const matches = MIME_TABLE.filter((e) => e.extension === ext);
|
|
13178
|
+
if (matches.length === 0) return { error: `No known MIME type for extension ".${ext}"` };
|
|
13179
|
+
return { query: trimmed, kind: "extension", matches };
|
|
13180
|
+
}
|
|
12934
13181
|
|
|
12935
13182
|
// src/tools/color.ts
|
|
12936
13183
|
var color_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -5,10 +5,10 @@ export { t as text } from './text-Bbx-tZ43.cjs';
|
|
|
5
5
|
export { d as data } from './data-D8XTI7Du.cjs';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.cjs';
|
|
7
7
|
export { t as time } from './time-DbT8fjaF.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-CADUCiYZ.cjs';
|
|
9
9
|
export { n as network } from './network-DaNoZ5ER.cjs';
|
|
10
10
|
export { a as api } from './api-Xl7OzIgq.cjs';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-C4skwg3l.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.cjs';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ export { t as text } from './text-Bbx-tZ43.js';
|
|
|
5
5
|
export { d as data } from './data-D8XTI7Du.js';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.js';
|
|
7
7
|
export { t as time } from './time-DbT8fjaF.js';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-CADUCiYZ.js';
|
|
9
9
|
export { n as network } from './network-DaNoZ5ER.js';
|
|
10
10
|
export { a as api } from './api-Xl7OzIgq.js';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-C4skwg3l.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.js';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-XMKJYVKB.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-RJPYVCKQ.js';
|
|
3
3
|
export { network_exports as network } from './chunk-OB56VNKJ.js';
|
|
4
4
|
export { api_exports as api } from './chunk-Q3B3YWOA.js';
|
|
5
|
-
export { code_exports as code } from './chunk-
|
|
5
|
+
export { code_exports as code } from './chunk-Y5X34JAC.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
7
7
|
export { css_exports as css } from './chunk-6YPV2AB5.js';
|
|
8
8
|
export { misc_exports as misc } from './chunk-GX7H6TAX.js';
|
package/dist/tools/code.cjs
CHANGED
|
@@ -2231,9 +2231,142 @@ function countProperties(css) {
|
|
|
2231
2231
|
});
|
|
2232
2232
|
return count;
|
|
2233
2233
|
}
|
|
2234
|
+
var MIME_TABLE = [
|
|
2235
|
+
// Text / web
|
|
2236
|
+
{ extension: "txt", mimeType: "text/plain" },
|
|
2237
|
+
{ extension: "html", mimeType: "text/html" },
|
|
2238
|
+
{ extension: "htm", mimeType: "text/html" },
|
|
2239
|
+
{ extension: "css", mimeType: "text/css" },
|
|
2240
|
+
{ extension: "js", mimeType: "text/javascript" },
|
|
2241
|
+
{ extension: "mjs", mimeType: "text/javascript" },
|
|
2242
|
+
{ extension: "json", mimeType: "application/json" },
|
|
2243
|
+
{ extension: "jsonld", mimeType: "application/ld+json" },
|
|
2244
|
+
{ extension: "xml", mimeType: "application/xml" },
|
|
2245
|
+
{ extension: "csv", mimeType: "text/csv" },
|
|
2246
|
+
{ extension: "tsv", mimeType: "text/tab-separated-values" },
|
|
2247
|
+
{ extension: "md", mimeType: "text/markdown" },
|
|
2248
|
+
{ extension: "rtf", mimeType: "application/rtf" },
|
|
2249
|
+
{ extension: "yaml", mimeType: "application/x-yaml" },
|
|
2250
|
+
{ extension: "yml", mimeType: "application/x-yaml" },
|
|
2251
|
+
{ extension: "toml", mimeType: "application/toml" },
|
|
2252
|
+
{ extension: "ini", mimeType: "text/plain" },
|
|
2253
|
+
{ extension: "ics", mimeType: "text/calendar" },
|
|
2254
|
+
{ extension: "vcf", mimeType: "text/vcard" },
|
|
2255
|
+
{ extension: "atom", mimeType: "application/atom+xml" },
|
|
2256
|
+
{ extension: "rss", mimeType: "application/rss+xml" },
|
|
2257
|
+
// Images
|
|
2258
|
+
{ extension: "png", mimeType: "image/png" },
|
|
2259
|
+
{ extension: "jpg", mimeType: "image/jpeg" },
|
|
2260
|
+
{ extension: "jpeg", mimeType: "image/jpeg" },
|
|
2261
|
+
{ extension: "gif", mimeType: "image/gif" },
|
|
2262
|
+
{ extension: "bmp", mimeType: "image/bmp" },
|
|
2263
|
+
{ extension: "webp", mimeType: "image/webp" },
|
|
2264
|
+
{ extension: "svg", mimeType: "image/svg+xml" },
|
|
2265
|
+
{ extension: "ico", mimeType: "image/x-icon" },
|
|
2266
|
+
{ extension: "tif", mimeType: "image/tiff" },
|
|
2267
|
+
{ extension: "tiff", mimeType: "image/tiff" },
|
|
2268
|
+
{ extension: "avif", mimeType: "image/avif" },
|
|
2269
|
+
{ extension: "heic", mimeType: "image/heic" },
|
|
2270
|
+
{ extension: "psd", mimeType: "image/vnd.adobe.photoshop" },
|
|
2271
|
+
// Fonts
|
|
2272
|
+
{ extension: "ttf", mimeType: "font/ttf" },
|
|
2273
|
+
{ extension: "otf", mimeType: "font/otf" },
|
|
2274
|
+
{ extension: "woff", mimeType: "font/woff" },
|
|
2275
|
+
{ extension: "woff2", mimeType: "font/woff2" },
|
|
2276
|
+
{ extension: "eot", mimeType: "application/vnd.ms-fontobject" },
|
|
2277
|
+
// Documents
|
|
2278
|
+
{ extension: "pdf", mimeType: "application/pdf" },
|
|
2279
|
+
{ extension: "doc", mimeType: "application/msword" },
|
|
2280
|
+
{ extension: "docx", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
|
|
2281
|
+
{ extension: "xls", mimeType: "application/vnd.ms-excel" },
|
|
2282
|
+
{ extension: "xlsx", mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
|
|
2283
|
+
{ extension: "ppt", mimeType: "application/vnd.ms-powerpoint" },
|
|
2284
|
+
{ extension: "pptx", mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
|
|
2285
|
+
{ extension: "odt", mimeType: "application/vnd.oasis.opendocument.text" },
|
|
2286
|
+
{ extension: "ods", mimeType: "application/vnd.oasis.opendocument.spreadsheet" },
|
|
2287
|
+
{ extension: "odp", mimeType: "application/vnd.oasis.opendocument.presentation" },
|
|
2288
|
+
{ extension: "epub", mimeType: "application/epub+zip" },
|
|
2289
|
+
// Archives
|
|
2290
|
+
{ extension: "zip", mimeType: "application/zip" },
|
|
2291
|
+
{ extension: "rar", mimeType: "application/vnd.rar" },
|
|
2292
|
+
{ extension: "7z", mimeType: "application/x-7z-compressed" },
|
|
2293
|
+
{ extension: "tar", mimeType: "application/x-tar" },
|
|
2294
|
+
{ extension: "gz", mimeType: "application/gzip" },
|
|
2295
|
+
{ extension: "bz2", mimeType: "application/x-bzip2" },
|
|
2296
|
+
{ extension: "jar", mimeType: "application/java-archive" },
|
|
2297
|
+
// Audio
|
|
2298
|
+
{ extension: "mp3", mimeType: "audio/mpeg" },
|
|
2299
|
+
{ extension: "wav", mimeType: "audio/wav" },
|
|
2300
|
+
{ extension: "ogg", mimeType: "audio/ogg" },
|
|
2301
|
+
{ extension: "oga", mimeType: "audio/ogg" },
|
|
2302
|
+
{ extension: "flac", mimeType: "audio/flac" },
|
|
2303
|
+
{ extension: "aac", mimeType: "audio/aac" },
|
|
2304
|
+
{ extension: "m4a", mimeType: "audio/mp4" },
|
|
2305
|
+
{ extension: "mid", mimeType: "audio/midi" },
|
|
2306
|
+
{ extension: "midi", mimeType: "audio/midi" },
|
|
2307
|
+
{ extension: "weba", mimeType: "audio/webm" },
|
|
2308
|
+
// Video
|
|
2309
|
+
{ extension: "mp4", mimeType: "video/mp4" },
|
|
2310
|
+
{ extension: "m4v", mimeType: "video/mp4" },
|
|
2311
|
+
{ extension: "webm", mimeType: "video/webm" },
|
|
2312
|
+
{ extension: "mov", mimeType: "video/quicktime" },
|
|
2313
|
+
{ extension: "avi", mimeType: "video/x-msvideo" },
|
|
2314
|
+
{ extension: "mkv", mimeType: "video/x-matroska" },
|
|
2315
|
+
{ extension: "wmv", mimeType: "video/x-ms-wmv" },
|
|
2316
|
+
{ extension: "flv", mimeType: "video/x-flv" },
|
|
2317
|
+
{ extension: "mpeg", mimeType: "video/mpeg" },
|
|
2318
|
+
{ extension: "mpg", mimeType: "video/mpeg" },
|
|
2319
|
+
{ extension: "3gp", mimeType: "video/3gpp" },
|
|
2320
|
+
{ extension: "ts", mimeType: "video/mp2t" },
|
|
2321
|
+
// Application / binary
|
|
2322
|
+
{ extension: "bin", mimeType: "application/octet-stream" },
|
|
2323
|
+
{ extension: "exe", mimeType: "application/vnd.microsoft.portable-executable" },
|
|
2324
|
+
{ extension: "dmg", mimeType: "application/x-apple-diskimage" },
|
|
2325
|
+
{ extension: "apk", mimeType: "application/vnd.android.package-archive" },
|
|
2326
|
+
{ extension: "iso", mimeType: "application/x-iso9660-image" },
|
|
2327
|
+
{ extension: "deb", mimeType: "application/vnd.debian.binary-package" },
|
|
2328
|
+
{ extension: "rpm", mimeType: "application/x-rpm" },
|
|
2329
|
+
{ extension: "msi", mimeType: "application/x-msi" },
|
|
2330
|
+
{ extension: "dll", mimeType: "application/x-msdownload" },
|
|
2331
|
+
{ extension: "so", mimeType: "application/octet-stream" },
|
|
2332
|
+
{ extension: "wasm", mimeType: "application/wasm" },
|
|
2333
|
+
{ extension: "swf", mimeType: "application/x-shockwave-flash" },
|
|
2334
|
+
{ extension: "crx", mimeType: "application/x-chrome-extension" },
|
|
2335
|
+
{ extension: "torrent", mimeType: "application/x-bittorrent" },
|
|
2336
|
+
// Code / config
|
|
2337
|
+
{ extension: "sh", mimeType: "application/x-sh" },
|
|
2338
|
+
{ extension: "bat", mimeType: "application/x-bat" },
|
|
2339
|
+
{ extension: "py", mimeType: "text/x-python" },
|
|
2340
|
+
{ extension: "java", mimeType: "text/x-java-source" },
|
|
2341
|
+
{ extension: "c", mimeType: "text/x-c" },
|
|
2342
|
+
{ extension: "h", mimeType: "text/x-c" },
|
|
2343
|
+
{ extension: "cpp", mimeType: "text/x-c++src" },
|
|
2344
|
+
{ extension: "rb", mimeType: "text/x-ruby" },
|
|
2345
|
+
{ extension: "php", mimeType: "application/x-httpd-php" },
|
|
2346
|
+
{ extension: "go", mimeType: "text/x-go" },
|
|
2347
|
+
{ extension: "rs", mimeType: "text/x-rust" },
|
|
2348
|
+
{ extension: "swift", mimeType: "text/x-swift" },
|
|
2349
|
+
{ extension: "sql", mimeType: "application/sql" },
|
|
2350
|
+
{ extension: "log", mimeType: "text/plain" }
|
|
2351
|
+
];
|
|
2352
|
+
function lookupMime(query) {
|
|
2353
|
+
if (!query || !query.trim()) return { error: "Input is empty" };
|
|
2354
|
+
const trimmed = query.trim();
|
|
2355
|
+
if (trimmed.includes("/")) {
|
|
2356
|
+
const mime = trimmed.toLowerCase();
|
|
2357
|
+
const matches2 = MIME_TABLE.filter((e) => e.mimeType.toLowerCase() === mime);
|
|
2358
|
+
if (matches2.length === 0) return { error: `No known file extension for MIME type "${trimmed}"` };
|
|
2359
|
+
return { query: trimmed, kind: "mime", matches: matches2 };
|
|
2360
|
+
}
|
|
2361
|
+
const ext = trimmed.replace(/^\./, "").toLowerCase();
|
|
2362
|
+
const matches = MIME_TABLE.filter((e) => e.extension === ext);
|
|
2363
|
+
if (matches.length === 0) return { error: `No known MIME type for extension ".${ext}"` };
|
|
2364
|
+
return { query: trimmed, kind: "extension", matches };
|
|
2365
|
+
}
|
|
2234
2366
|
|
|
2235
2367
|
exports.ALL_FLAGS = ALL_FLAGS;
|
|
2236
2368
|
exports.CHEATSHEET = CHEATSHEET;
|
|
2369
|
+
exports.MIME_TABLE = MIME_TABLE;
|
|
2237
2370
|
exports.OPERATIONS = OPERATIONS;
|
|
2238
2371
|
exports.SQL_DEFAULT_OPTIONS = SQL_DEFAULT_OPTIONS;
|
|
2239
2372
|
exports.buildDockerPull = buildDockerPull;
|
|
@@ -2256,6 +2389,7 @@ exports.getHtmlStats = getHtmlStats;
|
|
|
2256
2389
|
exports.getJsStats = getJsStats;
|
|
2257
2390
|
exports.getMethodColor = getMethodColor;
|
|
2258
2391
|
exports.isValidTag = isValidTag;
|
|
2392
|
+
exports.lookupMime = lookupMime;
|
|
2259
2393
|
exports.minifyCss = minifyCss;
|
|
2260
2394
|
exports.minifyGql = minifyGql;
|
|
2261
2395
|
exports.minifyHtml = minifyHtml;
|
package/dist/tools/code.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as CssResult, D as DockerImageRef, E as EnvEntry, f as EnvParseResult, G as GitCommandConfig, g as GitCommandResult, h as GitOperation, i as GqlFormatResult, H as HtmlFormatResult, j as HtmlMinifyOptions, k as HtmlMinifyResult, J as JsMinifyOptions, l as JsMinifyResult, M as MatchResult, O as OPERATIONS, P as ParsedSpec, R as RegexError,
|
|
1
|
+
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as CssResult, D as DockerImageRef, E as EnvEntry, f as EnvParseResult, G as GitCommandConfig, g as GitCommandResult, h as GitOperation, i as GqlFormatResult, H as HtmlFormatResult, j as HtmlMinifyOptions, k as HtmlMinifyResult, J as JsMinifyOptions, l as JsMinifyResult, M as MIME_TABLE, m as MatchResult, n as MimeEntry, o as MimeLookupResult, O as OPERATIONS, P as ParsedSpec, R as RegexError, p as RegexFlag, q as RegexMatch, r as RegexResult, s as RegexSuccess, S as SQL_DEFAULT_OPTIONS, t as Segment, u as SpecVersion, v as SqlDialect, w as SqlFormatOptions, T as TestPatternResult, x as buildDockerPull, y as buildDockerRun, z as buildGitCommand, B as collapseHtmlWhitespace, F as collapseJsWhitespace, I as countProperties, K as countRules, L as detectDialect, N as detectOperationType, Q as envToExport, U as envToJson, V as formatCss, W as formatGql, X as formatHtml, Y as formatSql, Z as getEndpointsByTag, _ as getHtmlStats, $ as getJsStats, a0 as getMethodColor, a1 as isValidTag, a2 as lookupMime, a3 as minifyCss, a4 as minifyGql, a5 as minifyHtml, a6 as minifyJs, a7 as minifySql, a8 as normalizeRef, a9 as parseDockerImage, aa as parseEnv, ab as parseGitCommand, ac as parseSpec, ad as removeConsoleCalls, ae as removeEmptyAttributes, af as removeHtmlComments, ag as removeJsComments, ah as removeRedundantAttributes, ai as searchCheatsheet, aj as searchEndpoints, ak as splitStatements, al as testPattern, am as testRegex, an as validateEnvKey } from '../code-C4skwg3l.cjs';
|
package/dist/tools/code.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as CssResult, D as DockerImageRef, E as EnvEntry, f as EnvParseResult, G as GitCommandConfig, g as GitCommandResult, h as GitOperation, i as GqlFormatResult, H as HtmlFormatResult, j as HtmlMinifyOptions, k as HtmlMinifyResult, J as JsMinifyOptions, l as JsMinifyResult, M as MatchResult, O as OPERATIONS, P as ParsedSpec, R as RegexError,
|
|
1
|
+
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as CssResult, D as DockerImageRef, E as EnvEntry, f as EnvParseResult, G as GitCommandConfig, g as GitCommandResult, h as GitOperation, i as GqlFormatResult, H as HtmlFormatResult, j as HtmlMinifyOptions, k as HtmlMinifyResult, J as JsMinifyOptions, l as JsMinifyResult, M as MIME_TABLE, m as MatchResult, n as MimeEntry, o as MimeLookupResult, O as OPERATIONS, P as ParsedSpec, R as RegexError, p as RegexFlag, q as RegexMatch, r as RegexResult, s as RegexSuccess, S as SQL_DEFAULT_OPTIONS, t as Segment, u as SpecVersion, v as SqlDialect, w as SqlFormatOptions, T as TestPatternResult, x as buildDockerPull, y as buildDockerRun, z as buildGitCommand, B as collapseHtmlWhitespace, F as collapseJsWhitespace, I as countProperties, K as countRules, L as detectDialect, N as detectOperationType, Q as envToExport, U as envToJson, V as formatCss, W as formatGql, X as formatHtml, Y as formatSql, Z as getEndpointsByTag, _ as getHtmlStats, $ as getJsStats, a0 as getMethodColor, a1 as isValidTag, a2 as lookupMime, a3 as minifyCss, a4 as minifyGql, a5 as minifyHtml, a6 as minifyJs, a7 as minifySql, a8 as normalizeRef, a9 as parseDockerImage, aa as parseEnv, ab as parseGitCommand, ac as parseSpec, ad as removeConsoleCalls, ae as removeEmptyAttributes, af as removeHtmlComments, ag as removeJsComments, ah as removeRedundantAttributes, ai as searchCheatsheet, aj as searchEndpoints, ak as splitStatements, al as testPattern, am as testRegex, an as validateEnvKey } from '../code-C4skwg3l.js';
|
package/dist/tools/code.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ALL_FLAGS, CHEATSHEET, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testPattern, testRegex, validateEnvKey } from '../chunk-
|
|
1
|
+
export { ALL_FLAGS, CHEATSHEET, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testPattern, testRegex, validateEnvKey } from '../chunk-Y5X34JAC.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|