@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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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.15.0
|
|
6
|
+
- Added MIME Type Lookup (`lookupMime`) and Tip / Bill Split Calculator (`calculateTipSplit`).
|
|
7
|
+
|
|
8
|
+
## 0.14.0
|
|
9
|
+
- Added Compound Interest Calculator (`calculateCompoundInterest`) and ISBN Validator / Converter (`validateIsbn`).
|
|
10
|
+
|
|
5
11
|
## 0.13.0
|
|
6
12
|
- Added VAT / Sales Tax Calculator (`calculateTax`).
|
|
7
13
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**543 developer utility functions for Node.js: runs locally, no API key required.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
@@ -242,7 +242,7 @@ getNextRuns("*/5 * * * *", 5); // next 5 run timestamps
|
|
|
242
242
|
### `/units`: Conversions
|
|
243
243
|
|
|
244
244
|
```ts
|
|
245
|
-
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax } from "@utilix-tech/sdk/units";
|
|
245
|
+
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit } from "@utilix-tech/sdk/units";
|
|
246
246
|
|
|
247
247
|
// File sizes
|
|
248
248
|
convertBytes(1073741824, "GB"); // 1
|
|
@@ -280,6 +280,18 @@ validateBarcode("4006381333931");
|
|
|
280
280
|
// VAT / sales tax: add or remove tax in either direction
|
|
281
281
|
calculateTax(100, 20, "add");
|
|
282
282
|
// { netAmount: 100, taxAmount: 20, grossAmount: 120, ratePercent: 20, direction: "add" }
|
|
283
|
+
|
|
284
|
+
// Compound interest: future value with an optional recurring contribution
|
|
285
|
+
calculateCompoundInterest(1000, 5, 10, 1);
|
|
286
|
+
// { futureValue: 1628.89, totalInterest: 628.89, years: 10, compoundsPerYear: 1, schedule: [...] }
|
|
287
|
+
|
|
288
|
+
// ISBN-10 / ISBN-13 checksum validation + format conversion
|
|
289
|
+
validateIsbn("0-306-40615-2");
|
|
290
|
+
// { valid: true, format: "ISBN-10", converted: "9780306406157", ... }
|
|
291
|
+
|
|
292
|
+
// Tip / bill split: tip amount, total, and an even per-person split
|
|
293
|
+
calculateTipSplit(84.5, 18, 2);
|
|
294
|
+
// { tipAmount: 15.21, totalAmount: 99.71, perPersonTotal: 49.86, ... }
|
|
283
295
|
```
|
|
284
296
|
|
|
285
297
|
---
|
|
@@ -358,7 +370,7 @@ generateCspHeader({ "default-src": ["'self'"], "script-src": ["'self'", "cdn.exa
|
|
|
358
370
|
|
|
359
371
|
```ts
|
|
360
372
|
import { formatSql, minifySql, testRegex, formatHtml, formatGql,
|
|
361
|
-
detectDialect, splitStatements } from "@utilix-tech/sdk/code";
|
|
373
|
+
detectDialect, splitStatements, lookupMime } from "@utilix-tech/sdk/code";
|
|
362
374
|
|
|
363
375
|
// SQL
|
|
364
376
|
formatSql("SELECT id,name FROM users WHERE active=1 ORDER BY name");
|
|
@@ -382,6 +394,10 @@ minifyHtml("<div> <p> hello </p> </div>");
|
|
|
382
394
|
|
|
383
395
|
// GraphQL
|
|
384
396
|
formatGql("query { user(id: 1) { name email } }");
|
|
397
|
+
|
|
398
|
+
// MIME type lookup, either direction
|
|
399
|
+
lookupMime("json"); // { kind: "extension", matches: [{ extension: "json", mimeType: "application/json" }] }
|
|
400
|
+
lookupMime("image/jpeg"); // { kind: "mime", matches: [{ extension: "jpg", ... }, { extension: "jpeg", ... }] }
|
|
385
401
|
```
|
|
386
402
|
|
|
387
403
|
---
|
|
@@ -510,10 +526,10 @@ readIcoInfo(new Uint8Array(icoBytes));
|
|
|
510
526
|
| `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert |
|
|
511
527
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, fake data |
|
|
512
528
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
513
|
-
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode validation, loan calculator, VAT/sales tax calculator |
|
|
529
|
+
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, compound interest calculator, VAT/sales tax calculator, tip/bill split calculator |
|
|
514
530
|
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing |
|
|
515
531
|
| `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
|
|
516
|
-
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format |
|
|
532
|
+
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup |
|
|
517
533
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
518
534
|
| `@utilix-tech/sdk/css` | CSS gradient, box-shadow, border-radius, keyframe animation generators |
|
|
519
535
|
| `@utilix-tech/sdk/misc` | SVG optimize/sanitize, file size format, Unicode inspector |
|
|
@@ -12,13 +12,16 @@ __export(units_exports, {
|
|
|
12
12
|
COMMON_RATIOS: () => COMMON_RATIOS,
|
|
13
13
|
COMMON_SIZES: () => COMMON_SIZES,
|
|
14
14
|
COMMON_TAX_RATES: () => COMMON_TAX_RATES,
|
|
15
|
+
COMMON_TIP_PERCENTAGES: () => COMMON_TIP_PERCENTAGES,
|
|
15
16
|
COMMON_VIEWPORTS: () => COMMON_VIEWPORTS,
|
|
16
17
|
autoFormat: () => autoFormat,
|
|
17
18
|
bumpVersion: () => bumpVersion,
|
|
18
19
|
calcAspectRatio: () => calcAspectRatio,
|
|
19
20
|
calcSubnet: () => calcSubnet,
|
|
21
|
+
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
20
22
|
calculateLoan: () => calculateLoan,
|
|
21
23
|
calculateTax: () => calculateTax,
|
|
24
|
+
calculateTipSplit: () => calculateTipSplit,
|
|
22
25
|
compareSemver: () => compareSemver,
|
|
23
26
|
convert: () => convert,
|
|
24
27
|
convertBytes: () => convertBytes,
|
|
@@ -66,6 +69,7 @@ __export(units_exports, {
|
|
|
66
69
|
validateBarcode: () => validateBarcode,
|
|
67
70
|
validateCardNumber: () => validateCardNumber,
|
|
68
71
|
validateIban: () => validateIban,
|
|
72
|
+
validateIsbn: () => validateIsbn,
|
|
69
73
|
viewportToPx: () => viewportToPx
|
|
70
74
|
});
|
|
71
75
|
function pxToAll(px, baseFontSize = 16, viewportWidth = 1440, viewportHeight = 900) {
|
|
@@ -1167,5 +1171,114 @@ function calculateTax(amount, ratePercent, direction) {
|
|
|
1167
1171
|
const taxAmount = round22(grossAmount - netAmount);
|
|
1168
1172
|
return { netAmount, taxAmount, grossAmount, ratePercent, direction };
|
|
1169
1173
|
}
|
|
1174
|
+
function calculateCompoundInterest(principal, annualRatePercent, years, compoundsPerYear, contributionPerPeriod = 0) {
|
|
1175
|
+
if (!Number.isFinite(principal) || principal < 0) return { error: "Principal must be zero or a positive number" };
|
|
1176
|
+
if (!Number.isFinite(annualRatePercent) || annualRatePercent < 0) {
|
|
1177
|
+
return { error: "Annual interest rate must be zero or a positive number" };
|
|
1178
|
+
}
|
|
1179
|
+
if (!Number.isInteger(years) || years <= 0) return { error: "Years must be a positive whole number" };
|
|
1180
|
+
if (!Number.isInteger(compoundsPerYear) || compoundsPerYear <= 0) {
|
|
1181
|
+
return { error: "Compounding frequency must be a positive whole number of periods per year" };
|
|
1182
|
+
}
|
|
1183
|
+
if (!Number.isFinite(contributionPerPeriod) || contributionPerPeriod < 0) {
|
|
1184
|
+
return { error: "Contribution per period must be zero or a positive number" };
|
|
1185
|
+
}
|
|
1186
|
+
if (principal === 0 && contributionPerPeriod === 0) return { error: "Enter a principal or a recurring contribution" };
|
|
1187
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
1188
|
+
const ratePerPeriod = annualRatePercent / 100 / compoundsPerYear;
|
|
1189
|
+
function futureValueAtPeriod(periods) {
|
|
1190
|
+
const growth = ratePerPeriod === 0 ? 1 : Math.pow(1 + ratePerPeriod, periods);
|
|
1191
|
+
const fvPrincipal = principal * growth;
|
|
1192
|
+
const fvContributions = contributionPerPeriod === 0 ? 0 : ratePerPeriod === 0 ? contributionPerPeriod * periods : contributionPerPeriod * ((growth - 1) / ratePerPeriod);
|
|
1193
|
+
return fvPrincipal + fvContributions;
|
|
1194
|
+
}
|
|
1195
|
+
const schedule = [];
|
|
1196
|
+
for (let year = 1; year <= years; year++) {
|
|
1197
|
+
const periods = year * compoundsPerYear;
|
|
1198
|
+
const balance = round22(futureValueAtPeriod(periods));
|
|
1199
|
+
const contributions = round22(contributionPerPeriod * periods);
|
|
1200
|
+
schedule.push({ year, balance, contributions, interest: round22(balance - principal - contributions) });
|
|
1201
|
+
}
|
|
1202
|
+
const totalPeriods = years * compoundsPerYear;
|
|
1203
|
+
const futureValue = round22(futureValueAtPeriod(totalPeriods));
|
|
1204
|
+
const totalContributions = round22(contributionPerPeriod * totalPeriods);
|
|
1205
|
+
const totalInterest = round22(futureValue - principal - totalContributions);
|
|
1206
|
+
return {
|
|
1207
|
+
futureValue,
|
|
1208
|
+
totalPrincipal: round22(principal),
|
|
1209
|
+
totalContributions,
|
|
1210
|
+
totalInterest,
|
|
1211
|
+
years,
|
|
1212
|
+
compoundsPerYear,
|
|
1213
|
+
schedule
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
function computeIsbn10CheckDigit(dataDigits) {
|
|
1217
|
+
let sum = 0;
|
|
1218
|
+
for (let i = 0; i < 9; i++) sum += dataDigits[i] * (10 - i);
|
|
1219
|
+
const check = (11 - sum % 11) % 11;
|
|
1220
|
+
return check === 10 ? "X" : String(check);
|
|
1221
|
+
}
|
|
1222
|
+
function computeIsbn13CheckDigit(dataDigits) {
|
|
1223
|
+
let sum = 0;
|
|
1224
|
+
const n = dataDigits.length;
|
|
1225
|
+
for (let i = 0; i < n; i++) {
|
|
1226
|
+
const distanceFromEnd = n - 1 - i;
|
|
1227
|
+
const weight = distanceFromEnd % 2 === 0 ? 3 : 1;
|
|
1228
|
+
sum += dataDigits[i] * weight;
|
|
1229
|
+
}
|
|
1230
|
+
return String((10 - sum % 10) % 10);
|
|
1231
|
+
}
|
|
1232
|
+
function validateIsbn(input) {
|
|
1233
|
+
if (!input || !input.trim()) return { error: "Input is empty" };
|
|
1234
|
+
const cleaned = input.replace(/[\s-]/g, "").toUpperCase();
|
|
1235
|
+
if (cleaned.length === 10) {
|
|
1236
|
+
if (!/^\d{9}[\dX]$/.test(cleaned)) {
|
|
1237
|
+
return { error: 'ISBN-10 must be 9 digits followed by a digit or "X" check digit' };
|
|
1238
|
+
}
|
|
1239
|
+
const dataDigits = cleaned.slice(0, 9).split("").map(Number);
|
|
1240
|
+
const checkDigit = cleaned[9];
|
|
1241
|
+
const expectedCheckDigit = computeIsbn10CheckDigit(dataDigits);
|
|
1242
|
+
const valid = checkDigit === expectedCheckDigit;
|
|
1243
|
+
const isbn13Digits = [9, 7, 8, ...dataDigits];
|
|
1244
|
+
const isbn13Check = computeIsbn13CheckDigit(isbn13Digits);
|
|
1245
|
+
const converted = valid ? isbn13Digits.join("") + isbn13Check : null;
|
|
1246
|
+
return { valid, format: "ISBN-10", digits: cleaned, checkDigit, expectedCheckDigit, converted };
|
|
1247
|
+
}
|
|
1248
|
+
if (cleaned.length === 13) {
|
|
1249
|
+
if (!/^\d{13}$/.test(cleaned)) return { error: "ISBN-13 must contain only digits" };
|
|
1250
|
+
const dataDigits = cleaned.slice(0, 12).split("").map(Number);
|
|
1251
|
+
const checkDigit = cleaned[12];
|
|
1252
|
+
const expectedCheckDigit = computeIsbn13CheckDigit(dataDigits);
|
|
1253
|
+
const valid = checkDigit === expectedCheckDigit;
|
|
1254
|
+
let converted = null;
|
|
1255
|
+
if (valid && cleaned.startsWith("978")) {
|
|
1256
|
+
const isbn10Digits = dataDigits.slice(3);
|
|
1257
|
+
converted = isbn10Digits.join("") + computeIsbn10CheckDigit(isbn10Digits);
|
|
1258
|
+
}
|
|
1259
|
+
return { valid, format: "ISBN-13", digits: cleaned, checkDigit, expectedCheckDigit, converted };
|
|
1260
|
+
}
|
|
1261
|
+
return { error: `Unsupported length (${cleaned.length} characters); expected 10 (ISBN-10) or 13 (ISBN-13)` };
|
|
1262
|
+
}
|
|
1263
|
+
var COMMON_TIP_PERCENTAGES = [10, 15, 18, 20, 25];
|
|
1264
|
+
function calculateTipSplit(billAmount, tipPercent, numPeople = 1) {
|
|
1265
|
+
if (!Number.isFinite(billAmount) || billAmount < 0) return { error: "Bill amount must be zero or a positive number" };
|
|
1266
|
+
if (!Number.isFinite(tipPercent) || tipPercent < 0) return { error: "Tip percent must be zero or a positive number" };
|
|
1267
|
+
if (!Number.isInteger(numPeople) || numPeople < 1) return { error: "Number of people must be a positive whole number" };
|
|
1268
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
1269
|
+
const billRounded = round22(billAmount);
|
|
1270
|
+
const tipAmount = round22(billAmount * (tipPercent / 100));
|
|
1271
|
+
const totalAmount = round22(billRounded + tipAmount);
|
|
1272
|
+
return {
|
|
1273
|
+
billAmount: billRounded,
|
|
1274
|
+
tipPercent,
|
|
1275
|
+
tipAmount,
|
|
1276
|
+
totalAmount,
|
|
1277
|
+
numPeople,
|
|
1278
|
+
perPersonBill: round22(billRounded / numPeople),
|
|
1279
|
+
perPersonTip: round22(tipAmount / numPeople),
|
|
1280
|
+
perPersonTotal: round22(totalAmount / numPeople)
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1170
1283
|
|
|
1171
|
-
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateLoan, calculateTax, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateBarcode, validateCardNumber, validateIban, viewportToPx };
|
|
1284
|
+
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, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateCompoundInterest, calculateLoan, calculateTax, calculateTipSplit, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, 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 };
|
|
@@ -6,6 +6,7 @@ var code_exports = {};
|
|
|
6
6
|
__export(code_exports, {
|
|
7
7
|
ALL_FLAGS: () => ALL_FLAGS,
|
|
8
8
|
CHEATSHEET: () => CHEATSHEET,
|
|
9
|
+
MIME_TABLE: () => MIME_TABLE,
|
|
9
10
|
OPERATIONS: () => OPERATIONS,
|
|
10
11
|
SQL_DEFAULT_OPTIONS: () => SQL_DEFAULT_OPTIONS,
|
|
11
12
|
buildDockerPull: () => buildDockerPull,
|
|
@@ -28,6 +29,7 @@ __export(code_exports, {
|
|
|
28
29
|
getJsStats: () => getJsStats,
|
|
29
30
|
getMethodColor: () => getMethodColor,
|
|
30
31
|
isValidTag: () => isValidTag,
|
|
32
|
+
lookupMime: () => lookupMime,
|
|
31
33
|
minifyCss: () => minifyCss,
|
|
32
34
|
minifyGql: () => minifyGql,
|
|
33
35
|
minifyHtml: () => minifyHtml,
|
|
@@ -2278,5 +2280,137 @@ function countProperties(css) {
|
|
|
2278
2280
|
});
|
|
2279
2281
|
return count;
|
|
2280
2282
|
}
|
|
2283
|
+
var MIME_TABLE = [
|
|
2284
|
+
// Text / web
|
|
2285
|
+
{ extension: "txt", mimeType: "text/plain" },
|
|
2286
|
+
{ extension: "html", mimeType: "text/html" },
|
|
2287
|
+
{ extension: "htm", mimeType: "text/html" },
|
|
2288
|
+
{ extension: "css", mimeType: "text/css" },
|
|
2289
|
+
{ extension: "js", mimeType: "text/javascript" },
|
|
2290
|
+
{ extension: "mjs", mimeType: "text/javascript" },
|
|
2291
|
+
{ extension: "json", mimeType: "application/json" },
|
|
2292
|
+
{ extension: "jsonld", mimeType: "application/ld+json" },
|
|
2293
|
+
{ extension: "xml", mimeType: "application/xml" },
|
|
2294
|
+
{ extension: "csv", mimeType: "text/csv" },
|
|
2295
|
+
{ extension: "tsv", mimeType: "text/tab-separated-values" },
|
|
2296
|
+
{ extension: "md", mimeType: "text/markdown" },
|
|
2297
|
+
{ extension: "rtf", mimeType: "application/rtf" },
|
|
2298
|
+
{ extension: "yaml", mimeType: "application/x-yaml" },
|
|
2299
|
+
{ extension: "yml", mimeType: "application/x-yaml" },
|
|
2300
|
+
{ extension: "toml", mimeType: "application/toml" },
|
|
2301
|
+
{ extension: "ini", mimeType: "text/plain" },
|
|
2302
|
+
{ extension: "ics", mimeType: "text/calendar" },
|
|
2303
|
+
{ extension: "vcf", mimeType: "text/vcard" },
|
|
2304
|
+
{ extension: "atom", mimeType: "application/atom+xml" },
|
|
2305
|
+
{ extension: "rss", mimeType: "application/rss+xml" },
|
|
2306
|
+
// Images
|
|
2307
|
+
{ extension: "png", mimeType: "image/png" },
|
|
2308
|
+
{ extension: "jpg", mimeType: "image/jpeg" },
|
|
2309
|
+
{ extension: "jpeg", mimeType: "image/jpeg" },
|
|
2310
|
+
{ extension: "gif", mimeType: "image/gif" },
|
|
2311
|
+
{ extension: "bmp", mimeType: "image/bmp" },
|
|
2312
|
+
{ extension: "webp", mimeType: "image/webp" },
|
|
2313
|
+
{ extension: "svg", mimeType: "image/svg+xml" },
|
|
2314
|
+
{ extension: "ico", mimeType: "image/x-icon" },
|
|
2315
|
+
{ extension: "tif", mimeType: "image/tiff" },
|
|
2316
|
+
{ extension: "tiff", mimeType: "image/tiff" },
|
|
2317
|
+
{ extension: "avif", mimeType: "image/avif" },
|
|
2318
|
+
{ extension: "heic", mimeType: "image/heic" },
|
|
2319
|
+
{ extension: "psd", mimeType: "image/vnd.adobe.photoshop" },
|
|
2320
|
+
// Fonts
|
|
2321
|
+
{ extension: "ttf", mimeType: "font/ttf" },
|
|
2322
|
+
{ extension: "otf", mimeType: "font/otf" },
|
|
2323
|
+
{ extension: "woff", mimeType: "font/woff" },
|
|
2324
|
+
{ extension: "woff2", mimeType: "font/woff2" },
|
|
2325
|
+
{ extension: "eot", mimeType: "application/vnd.ms-fontobject" },
|
|
2326
|
+
// Documents
|
|
2327
|
+
{ extension: "pdf", mimeType: "application/pdf" },
|
|
2328
|
+
{ extension: "doc", mimeType: "application/msword" },
|
|
2329
|
+
{ extension: "docx", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
|
|
2330
|
+
{ extension: "xls", mimeType: "application/vnd.ms-excel" },
|
|
2331
|
+
{ extension: "xlsx", mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
|
|
2332
|
+
{ extension: "ppt", mimeType: "application/vnd.ms-powerpoint" },
|
|
2333
|
+
{ extension: "pptx", mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
|
|
2334
|
+
{ extension: "odt", mimeType: "application/vnd.oasis.opendocument.text" },
|
|
2335
|
+
{ extension: "ods", mimeType: "application/vnd.oasis.opendocument.spreadsheet" },
|
|
2336
|
+
{ extension: "odp", mimeType: "application/vnd.oasis.opendocument.presentation" },
|
|
2337
|
+
{ extension: "epub", mimeType: "application/epub+zip" },
|
|
2338
|
+
// Archives
|
|
2339
|
+
{ extension: "zip", mimeType: "application/zip" },
|
|
2340
|
+
{ extension: "rar", mimeType: "application/vnd.rar" },
|
|
2341
|
+
{ extension: "7z", mimeType: "application/x-7z-compressed" },
|
|
2342
|
+
{ extension: "tar", mimeType: "application/x-tar" },
|
|
2343
|
+
{ extension: "gz", mimeType: "application/gzip" },
|
|
2344
|
+
{ extension: "bz2", mimeType: "application/x-bzip2" },
|
|
2345
|
+
{ extension: "jar", mimeType: "application/java-archive" },
|
|
2346
|
+
// Audio
|
|
2347
|
+
{ extension: "mp3", mimeType: "audio/mpeg" },
|
|
2348
|
+
{ extension: "wav", mimeType: "audio/wav" },
|
|
2349
|
+
{ extension: "ogg", mimeType: "audio/ogg" },
|
|
2350
|
+
{ extension: "oga", mimeType: "audio/ogg" },
|
|
2351
|
+
{ extension: "flac", mimeType: "audio/flac" },
|
|
2352
|
+
{ extension: "aac", mimeType: "audio/aac" },
|
|
2353
|
+
{ extension: "m4a", mimeType: "audio/mp4" },
|
|
2354
|
+
{ extension: "mid", mimeType: "audio/midi" },
|
|
2355
|
+
{ extension: "midi", mimeType: "audio/midi" },
|
|
2356
|
+
{ extension: "weba", mimeType: "audio/webm" },
|
|
2357
|
+
// Video
|
|
2358
|
+
{ extension: "mp4", mimeType: "video/mp4" },
|
|
2359
|
+
{ extension: "m4v", mimeType: "video/mp4" },
|
|
2360
|
+
{ extension: "webm", mimeType: "video/webm" },
|
|
2361
|
+
{ extension: "mov", mimeType: "video/quicktime" },
|
|
2362
|
+
{ extension: "avi", mimeType: "video/x-msvideo" },
|
|
2363
|
+
{ extension: "mkv", mimeType: "video/x-matroska" },
|
|
2364
|
+
{ extension: "wmv", mimeType: "video/x-ms-wmv" },
|
|
2365
|
+
{ extension: "flv", mimeType: "video/x-flv" },
|
|
2366
|
+
{ extension: "mpeg", mimeType: "video/mpeg" },
|
|
2367
|
+
{ extension: "mpg", mimeType: "video/mpeg" },
|
|
2368
|
+
{ extension: "3gp", mimeType: "video/3gpp" },
|
|
2369
|
+
{ extension: "ts", mimeType: "video/mp2t" },
|
|
2370
|
+
// Application / binary
|
|
2371
|
+
{ extension: "bin", mimeType: "application/octet-stream" },
|
|
2372
|
+
{ extension: "exe", mimeType: "application/vnd.microsoft.portable-executable" },
|
|
2373
|
+
{ extension: "dmg", mimeType: "application/x-apple-diskimage" },
|
|
2374
|
+
{ extension: "apk", mimeType: "application/vnd.android.package-archive" },
|
|
2375
|
+
{ extension: "iso", mimeType: "application/x-iso9660-image" },
|
|
2376
|
+
{ extension: "deb", mimeType: "application/vnd.debian.binary-package" },
|
|
2377
|
+
{ extension: "rpm", mimeType: "application/x-rpm" },
|
|
2378
|
+
{ extension: "msi", mimeType: "application/x-msi" },
|
|
2379
|
+
{ extension: "dll", mimeType: "application/x-msdownload" },
|
|
2380
|
+
{ extension: "so", mimeType: "application/octet-stream" },
|
|
2381
|
+
{ extension: "wasm", mimeType: "application/wasm" },
|
|
2382
|
+
{ extension: "swf", mimeType: "application/x-shockwave-flash" },
|
|
2383
|
+
{ extension: "crx", mimeType: "application/x-chrome-extension" },
|
|
2384
|
+
{ extension: "torrent", mimeType: "application/x-bittorrent" },
|
|
2385
|
+
// Code / config
|
|
2386
|
+
{ extension: "sh", mimeType: "application/x-sh" },
|
|
2387
|
+
{ extension: "bat", mimeType: "application/x-bat" },
|
|
2388
|
+
{ extension: "py", mimeType: "text/x-python" },
|
|
2389
|
+
{ extension: "java", mimeType: "text/x-java-source" },
|
|
2390
|
+
{ extension: "c", mimeType: "text/x-c" },
|
|
2391
|
+
{ extension: "h", mimeType: "text/x-c" },
|
|
2392
|
+
{ extension: "cpp", mimeType: "text/x-c++src" },
|
|
2393
|
+
{ extension: "rb", mimeType: "text/x-ruby" },
|
|
2394
|
+
{ extension: "php", mimeType: "application/x-httpd-php" },
|
|
2395
|
+
{ extension: "go", mimeType: "text/x-go" },
|
|
2396
|
+
{ extension: "rs", mimeType: "text/x-rust" },
|
|
2397
|
+
{ extension: "swift", mimeType: "text/x-swift" },
|
|
2398
|
+
{ extension: "sql", mimeType: "application/sql" },
|
|
2399
|
+
{ extension: "log", mimeType: "text/plain" }
|
|
2400
|
+
];
|
|
2401
|
+
function lookupMime(query) {
|
|
2402
|
+
if (!query || !query.trim()) return { error: "Input is empty" };
|
|
2403
|
+
const trimmed = query.trim();
|
|
2404
|
+
if (trimmed.includes("/")) {
|
|
2405
|
+
const mime = trimmed.toLowerCase();
|
|
2406
|
+
const matches2 = MIME_TABLE.filter((e) => e.mimeType.toLowerCase() === mime);
|
|
2407
|
+
if (matches2.length === 0) return { error: `No known file extension for MIME type "${trimmed}"` };
|
|
2408
|
+
return { query: trimmed, kind: "mime", matches: matches2 };
|
|
2409
|
+
}
|
|
2410
|
+
const ext = trimmed.replace(/^\./, "").toLowerCase();
|
|
2411
|
+
const matches = MIME_TABLE.filter((e) => e.extension === ext);
|
|
2412
|
+
if (matches.length === 0) return { error: `No known MIME type for extension ".${ext}"` };
|
|
2413
|
+
return { query: trimmed, kind: "extension", matches };
|
|
2414
|
+
}
|
|
2281
2415
|
|
|
2282
|
-
export { ALL_FLAGS, CHEATSHEET, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, code_exports, 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 };
|
|
2416
|
+
export { ALL_FLAGS, CHEATSHEET, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, code_exports, 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 };
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - openapi-viewer (parseSpec, getEndpointsByTag, searchEndpoints, getMethodColor)
|
|
18
18
|
* - env-parser (parseEnv, envToJson, envToExport, validateEnvKey)
|
|
19
19
|
* - css-minifier (minifyCss, formatCss, countRules, countProperties)
|
|
20
|
+
* - mime-lookup (lookupMime, MIME_TABLE)
|
|
20
21
|
*/
|
|
21
22
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
22
23
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -262,6 +263,28 @@ declare function minifyCss(input: string): CssResult;
|
|
|
262
263
|
declare function formatCss(input: string, indentSize?: number): CssResult;
|
|
263
264
|
declare function countRules(css: string): number;
|
|
264
265
|
declare function countProperties(css: string): number;
|
|
266
|
+
interface MimeEntry {
|
|
267
|
+
extension: string;
|
|
268
|
+
mimeType: string;
|
|
269
|
+
}
|
|
270
|
+
interface MimeLookupResult {
|
|
271
|
+
query: string;
|
|
272
|
+
kind: 'extension' | 'mime';
|
|
273
|
+
matches: MimeEntry[];
|
|
274
|
+
}
|
|
275
|
+
/** Static table of common file extensions and their well-known MIME type.
|
|
276
|
+
* Several extensions intentionally map to the same MIME type (aliases,
|
|
277
|
+
* e.g. "jpg"/"jpeg"), and a few MIME types have more than one extension. */
|
|
278
|
+
declare const MIME_TABLE: MimeEntry[];
|
|
279
|
+
/**
|
|
280
|
+
* Look up MIME table entries either by file extension (a bare word like
|
|
281
|
+
* "json" or ".json") or by MIME type (any query containing a "/", like
|
|
282
|
+
* "image/png"). Returns every matching entry, since a MIME type can have
|
|
283
|
+
* more than one registered extension and vice versa.
|
|
284
|
+
*/
|
|
285
|
+
declare function lookupMime(query: string): MimeLookupResult | {
|
|
286
|
+
error: string;
|
|
287
|
+
};
|
|
265
288
|
|
|
266
289
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
267
290
|
type code_ApiEndpoint = ApiEndpoint;
|
|
@@ -281,7 +304,10 @@ type code_HtmlMinifyOptions = HtmlMinifyOptions;
|
|
|
281
304
|
type code_HtmlMinifyResult = HtmlMinifyResult;
|
|
282
305
|
type code_JsMinifyOptions = JsMinifyOptions;
|
|
283
306
|
type code_JsMinifyResult = JsMinifyResult;
|
|
307
|
+
declare const code_MIME_TABLE: typeof MIME_TABLE;
|
|
284
308
|
type code_MatchResult = MatchResult;
|
|
309
|
+
type code_MimeEntry = MimeEntry;
|
|
310
|
+
type code_MimeLookupResult = MimeLookupResult;
|
|
285
311
|
declare const code_OPERATIONS: typeof OPERATIONS;
|
|
286
312
|
type code_ParsedSpec = ParsedSpec;
|
|
287
313
|
type code_RegexError = RegexError;
|
|
@@ -315,6 +341,7 @@ declare const code_getHtmlStats: typeof getHtmlStats;
|
|
|
315
341
|
declare const code_getJsStats: typeof getJsStats;
|
|
316
342
|
declare const code_getMethodColor: typeof getMethodColor;
|
|
317
343
|
declare const code_isValidTag: typeof isValidTag;
|
|
344
|
+
declare const code_lookupMime: typeof lookupMime;
|
|
318
345
|
declare const code_minifyCss: typeof minifyCss;
|
|
319
346
|
declare const code_minifyGql: typeof minifyGql;
|
|
320
347
|
declare const code_minifyHtml: typeof minifyHtml;
|
|
@@ -337,7 +364,7 @@ declare const code_testPattern: typeof testPattern;
|
|
|
337
364
|
declare const code_testRegex: typeof testRegex;
|
|
338
365
|
declare const code_validateEnvKey: typeof validateEnvKey;
|
|
339
366
|
declare namespace code {
|
|
340
|
-
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_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, 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_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, type code_MatchResult as MatchResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, 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, 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_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_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_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_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
367
|
+
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_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, 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_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_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, 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_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_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_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_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
341
368
|
}
|
|
342
369
|
|
|
343
|
-
export {
|
|
370
|
+
export { getJsStats as $, ALL_FLAGS as A, collapseHtmlWhitespace as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, collapseJsWhitespace as F, type GitCommandConfig as G, type HtmlFormatResult as H, countProperties as I, type JsMinifyOptions as J, countRules as K, detectDialect as L, MIME_TABLE as M, detectOperationType as N, OPERATIONS as O, type ParsedSpec as P, envToExport as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, envToJson as U, formatCss as V, formatGql as W, formatHtml as X, formatSql as Y, getEndpointsByTag as Z, getHtmlStats as _, type ApiEndpoint as a, getMethodColor as a0, isValidTag as a1, lookupMime as a2, minifyCss as a3, minifyGql as a4, minifyHtml as a5, minifyJs as a6, minifySql as a7, normalizeRef as a8, parseDockerImage as a9, parseEnv as aa, parseGitCommand as ab, parseSpec as ac, removeConsoleCalls as ad, removeEmptyAttributes as ae, removeHtmlComments as af, removeJsComments as ag, removeRedundantAttributes as ah, searchCheatsheet as ai, searchEndpoints as aj, splitStatements as ak, testPattern as al, testRegex as am, validateEnvKey as an, type ApiInfo as b, code as c, type CheatsheetEntry as d, type CssResult as e, type EnvParseResult as f, type GitCommandResult as g, type GitOperation as h, type GqlFormatResult as i, type HtmlMinifyOptions as j, type HtmlMinifyResult as k, type JsMinifyResult as l, type MatchResult as m, type MimeEntry as n, type MimeLookupResult as o, type RegexFlag as p, type RegexMatch as q, type RegexResult as r, type RegexSuccess as s, type Segment as t, type SpecVersion as u, type SqlDialect as v, type SqlFormatOptions as w, buildDockerPull as x, buildDockerRun as y, buildGitCommand as z };
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - openapi-viewer (parseSpec, getEndpointsByTag, searchEndpoints, getMethodColor)
|
|
18
18
|
* - env-parser (parseEnv, envToJson, envToExport, validateEnvKey)
|
|
19
19
|
* - css-minifier (minifyCss, formatCss, countRules, countProperties)
|
|
20
|
+
* - mime-lookup (lookupMime, MIME_TABLE)
|
|
20
21
|
*/
|
|
21
22
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
22
23
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -262,6 +263,28 @@ declare function minifyCss(input: string): CssResult;
|
|
|
262
263
|
declare function formatCss(input: string, indentSize?: number): CssResult;
|
|
263
264
|
declare function countRules(css: string): number;
|
|
264
265
|
declare function countProperties(css: string): number;
|
|
266
|
+
interface MimeEntry {
|
|
267
|
+
extension: string;
|
|
268
|
+
mimeType: string;
|
|
269
|
+
}
|
|
270
|
+
interface MimeLookupResult {
|
|
271
|
+
query: string;
|
|
272
|
+
kind: 'extension' | 'mime';
|
|
273
|
+
matches: MimeEntry[];
|
|
274
|
+
}
|
|
275
|
+
/** Static table of common file extensions and their well-known MIME type.
|
|
276
|
+
* Several extensions intentionally map to the same MIME type (aliases,
|
|
277
|
+
* e.g. "jpg"/"jpeg"), and a few MIME types have more than one extension. */
|
|
278
|
+
declare const MIME_TABLE: MimeEntry[];
|
|
279
|
+
/**
|
|
280
|
+
* Look up MIME table entries either by file extension (a bare word like
|
|
281
|
+
* "json" or ".json") or by MIME type (any query containing a "/", like
|
|
282
|
+
* "image/png"). Returns every matching entry, since a MIME type can have
|
|
283
|
+
* more than one registered extension and vice versa.
|
|
284
|
+
*/
|
|
285
|
+
declare function lookupMime(query: string): MimeLookupResult | {
|
|
286
|
+
error: string;
|
|
287
|
+
};
|
|
265
288
|
|
|
266
289
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
267
290
|
type code_ApiEndpoint = ApiEndpoint;
|
|
@@ -281,7 +304,10 @@ type code_HtmlMinifyOptions = HtmlMinifyOptions;
|
|
|
281
304
|
type code_HtmlMinifyResult = HtmlMinifyResult;
|
|
282
305
|
type code_JsMinifyOptions = JsMinifyOptions;
|
|
283
306
|
type code_JsMinifyResult = JsMinifyResult;
|
|
307
|
+
declare const code_MIME_TABLE: typeof MIME_TABLE;
|
|
284
308
|
type code_MatchResult = MatchResult;
|
|
309
|
+
type code_MimeEntry = MimeEntry;
|
|
310
|
+
type code_MimeLookupResult = MimeLookupResult;
|
|
285
311
|
declare const code_OPERATIONS: typeof OPERATIONS;
|
|
286
312
|
type code_ParsedSpec = ParsedSpec;
|
|
287
313
|
type code_RegexError = RegexError;
|
|
@@ -315,6 +341,7 @@ declare const code_getHtmlStats: typeof getHtmlStats;
|
|
|
315
341
|
declare const code_getJsStats: typeof getJsStats;
|
|
316
342
|
declare const code_getMethodColor: typeof getMethodColor;
|
|
317
343
|
declare const code_isValidTag: typeof isValidTag;
|
|
344
|
+
declare const code_lookupMime: typeof lookupMime;
|
|
318
345
|
declare const code_minifyCss: typeof minifyCss;
|
|
319
346
|
declare const code_minifyGql: typeof minifyGql;
|
|
320
347
|
declare const code_minifyHtml: typeof minifyHtml;
|
|
@@ -337,7 +364,7 @@ declare const code_testPattern: typeof testPattern;
|
|
|
337
364
|
declare const code_testRegex: typeof testRegex;
|
|
338
365
|
declare const code_validateEnvKey: typeof validateEnvKey;
|
|
339
366
|
declare namespace code {
|
|
340
|
-
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_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, 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_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, type code_MatchResult as MatchResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, 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, 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_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_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_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_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
367
|
+
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_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, 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_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_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, 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_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_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_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_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
341
368
|
}
|
|
342
369
|
|
|
343
|
-
export {
|
|
370
|
+
export { getJsStats as $, ALL_FLAGS as A, collapseHtmlWhitespace as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, collapseJsWhitespace as F, type GitCommandConfig as G, type HtmlFormatResult as H, countProperties as I, type JsMinifyOptions as J, countRules as K, detectDialect as L, MIME_TABLE as M, detectOperationType as N, OPERATIONS as O, type ParsedSpec as P, envToExport as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, envToJson as U, formatCss as V, formatGql as W, formatHtml as X, formatSql as Y, getEndpointsByTag as Z, getHtmlStats as _, type ApiEndpoint as a, getMethodColor as a0, isValidTag as a1, lookupMime as a2, minifyCss as a3, minifyGql as a4, minifyHtml as a5, minifyJs as a6, minifySql as a7, normalizeRef as a8, parseDockerImage as a9, parseEnv as aa, parseGitCommand as ab, parseSpec as ac, removeConsoleCalls as ad, removeEmptyAttributes as ae, removeHtmlComments as af, removeJsComments as ag, removeRedundantAttributes as ah, searchCheatsheet as ai, searchEndpoints as aj, splitStatements as ak, testPattern as al, testRegex as am, validateEnvKey as an, type ApiInfo as b, code as c, type CheatsheetEntry as d, type CssResult as e, type EnvParseResult as f, type GitCommandResult as g, type GitOperation as h, type GqlFormatResult as i, type HtmlMinifyOptions as j, type HtmlMinifyResult as k, type JsMinifyResult as l, type MatchResult as m, type MimeEntry as n, type MimeLookupResult as o, type RegexFlag as p, type RegexMatch as q, type RegexResult as r, type RegexSuccess as s, type Segment as t, type SpecVersion as u, type SqlDialect as v, type SqlFormatOptions as w, buildDockerPull as x, buildDockerRun as y, buildGitCommand as z };
|