@utilix-tech/sdk 0.51.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +21 -4
- package/dist/{chunk-BDQXYFTO.js → chunk-3KIUADK4.js} +49 -1
- package/dist/{chunk-JL7YTXRB.js → chunk-K4ZERKBD.js} +338 -2
- package/dist/{chunk-ZZJPD366.js → chunk-NKN656TQ.js} +44 -1
- package/dist/{code-KXoRsHtl.d.ts → code-B_gDkRAx.d.cts} +67 -2
- package/dist/{code-KXoRsHtl.d.cts → code-B_gDkRAx.d.ts} +67 -2
- package/dist/{data-BI_007dA.d.cts → data-CupeugaR.d.cts} +37 -2
- package/dist/{data-BI_007dA.d.ts → data-CupeugaR.d.ts} +37 -2
- package/dist/index.cjs +428 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/tools/code.cjs +336 -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/data.cjs +48 -0
- package/dist/tools/data.d.cts +1 -1
- package/dist/tools/data.d.ts +1 -1
- package/dist/tools/data.js +1 -1
- package/dist/tools/units.cjs +43 -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-y30YVhqI.d.ts → units-p-1Ikx7l.d.cts} +39 -2
- package/dist/{units-y30YVhqI.d.cts → units-p-1Ikx7l.d.ts} +39 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5151,6 +5151,7 @@ function getEmojiCategories() {
|
|
|
5151
5151
|
// src/tools/data.ts
|
|
5152
5152
|
var data_exports = {};
|
|
5153
5153
|
__export(data_exports, {
|
|
5154
|
+
analyzeCaptionSpeed: () => analyzeCaptionSpeed,
|
|
5154
5155
|
calculateMarkdownTaskListProgress: () => calculateMarkdownTaskListProgress,
|
|
5155
5156
|
convertSubtitles: () => convertSubtitles,
|
|
5156
5157
|
csvToJson: () => csvToJson2,
|
|
@@ -6486,6 +6487,53 @@ function shiftSubtitles(input, offsetSeconds, target) {
|
|
|
6486
6487
|
warnings
|
|
6487
6488
|
};
|
|
6488
6489
|
}
|
|
6490
|
+
function analyzeCaptionSpeed(input, wpmThreshold = 180, cpsThreshold = 20) {
|
|
6491
|
+
if (!Number.isFinite(wpmThreshold) || wpmThreshold <= 0) {
|
|
6492
|
+
return { error: "wpmThreshold must be a finite number greater than zero" };
|
|
6493
|
+
}
|
|
6494
|
+
if (!Number.isFinite(cpsThreshold) || cpsThreshold <= 0) {
|
|
6495
|
+
return { error: "cpsThreshold must be a finite number greater than zero" };
|
|
6496
|
+
}
|
|
6497
|
+
const parsed = parseSubtitles(input);
|
|
6498
|
+
if ("error" in parsed) return parsed;
|
|
6499
|
+
const round12 = (n) => Math.round(n * 10) / 10;
|
|
6500
|
+
const cues = [];
|
|
6501
|
+
for (const cue of parsed.cues) {
|
|
6502
|
+
const text = cue.text.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
6503
|
+
const durationSeconds = cue.end - cue.start;
|
|
6504
|
+
if (text.length === 0 || durationSeconds <= 0) continue;
|
|
6505
|
+
const wordCount = text.split(" ").filter(Boolean).length;
|
|
6506
|
+
const charCount = text.length;
|
|
6507
|
+
const wpm = wordCount / durationSeconds * 60;
|
|
6508
|
+
const charsPerSecond = charCount / durationSeconds;
|
|
6509
|
+
cues.push({
|
|
6510
|
+
index: cues.length + 1,
|
|
6511
|
+
start: round12(cue.start),
|
|
6512
|
+
end: round12(cue.end),
|
|
6513
|
+
text,
|
|
6514
|
+
durationSeconds: round12(durationSeconds),
|
|
6515
|
+
wordCount,
|
|
6516
|
+
charCount,
|
|
6517
|
+
wpm: round12(wpm),
|
|
6518
|
+
charsPerSecond: round12(charsPerSecond),
|
|
6519
|
+
exceedsWpm: wpm > wpmThreshold,
|
|
6520
|
+
exceedsCps: charsPerSecond > cpsThreshold
|
|
6521
|
+
});
|
|
6522
|
+
}
|
|
6523
|
+
if (cues.length === 0) {
|
|
6524
|
+
return { error: "No cues with both text and a positive duration were found" };
|
|
6525
|
+
}
|
|
6526
|
+
const wpmValues = cues.map((c) => c.wpm);
|
|
6527
|
+
return {
|
|
6528
|
+
cueCount: cues.length,
|
|
6529
|
+
cues,
|
|
6530
|
+
averageWpm: round12(wpmValues.reduce((a, b) => a + b, 0) / wpmValues.length),
|
|
6531
|
+
maxWpm: round12(Math.max(...wpmValues)),
|
|
6532
|
+
flaggedCount: cues.filter((c) => c.exceedsWpm || c.exceedsCps).length,
|
|
6533
|
+
wpmThreshold,
|
|
6534
|
+
cpsThreshold
|
|
6535
|
+
};
|
|
6536
|
+
}
|
|
6489
6537
|
function parseFrontMatterScalar(value) {
|
|
6490
6538
|
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
6491
6539
|
return value.slice(1, -1);
|
|
@@ -8242,6 +8290,7 @@ __export(units_exports, {
|
|
|
8242
8290
|
calculateCdMaturity: () => calculateCdMaturity,
|
|
8243
8291
|
calculateChange: () => calculateChange,
|
|
8244
8292
|
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
8293
|
+
calculateCreditUtilization: () => calculateCreditUtilization,
|
|
8245
8294
|
calculateDepreciationSchedule: () => calculateDepreciationSchedule,
|
|
8246
8295
|
calculateDiscount: () => calculateDiscount,
|
|
8247
8296
|
calculateEmi: () => calculateEmi,
|
|
@@ -10405,6 +10454,48 @@ function calculateGpa(courses) {
|
|
|
10405
10454
|
gpa: round23(totalQualityPoints / totalCredits)
|
|
10406
10455
|
};
|
|
10407
10456
|
}
|
|
10457
|
+
function _classifyUtilization(percent) {
|
|
10458
|
+
if (percent < 10) return "excellent";
|
|
10459
|
+
if (percent < 30) return "good";
|
|
10460
|
+
if (percent < 50) return "fair";
|
|
10461
|
+
return "poor";
|
|
10462
|
+
}
|
|
10463
|
+
function calculateCreditUtilization(accounts) {
|
|
10464
|
+
if (!Array.isArray(accounts) || accounts.length === 0) {
|
|
10465
|
+
return { error: "accounts must be a non-empty array" };
|
|
10466
|
+
}
|
|
10467
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
10468
|
+
let totalBalance = 0;
|
|
10469
|
+
let totalLimit = 0;
|
|
10470
|
+
const results = [];
|
|
10471
|
+
for (let i = 0; i < accounts.length; i++) {
|
|
10472
|
+
const account = accounts[i];
|
|
10473
|
+
if (typeof account.balance !== "number" || !Number.isFinite(account.balance) || account.balance < 0) {
|
|
10474
|
+
return { error: `account ${i + 1}: balance must be a finite, non-negative number` };
|
|
10475
|
+
}
|
|
10476
|
+
if (typeof account.limit !== "number" || !Number.isFinite(account.limit) || account.limit <= 0) {
|
|
10477
|
+
return { error: `account ${i + 1}: limit must be a finite number greater than zero` };
|
|
10478
|
+
}
|
|
10479
|
+
const utilizationPercent = round23(account.balance / account.limit * 100);
|
|
10480
|
+
totalBalance += account.balance;
|
|
10481
|
+
totalLimit += account.limit;
|
|
10482
|
+
results.push({
|
|
10483
|
+
label: account.label?.trim() || `Account ${i + 1}`,
|
|
10484
|
+
balance: account.balance,
|
|
10485
|
+
limit: account.limit,
|
|
10486
|
+
utilizationPercent,
|
|
10487
|
+
tier: _classifyUtilization(utilizationPercent)
|
|
10488
|
+
});
|
|
10489
|
+
}
|
|
10490
|
+
const overallUtilizationPercent = round23(totalBalance / totalLimit * 100);
|
|
10491
|
+
return {
|
|
10492
|
+
accounts: results,
|
|
10493
|
+
totalBalance: round23(totalBalance),
|
|
10494
|
+
totalLimit: round23(totalLimit),
|
|
10495
|
+
overallUtilizationPercent,
|
|
10496
|
+
overallTier: _classifyUtilization(overallUtilizationPercent)
|
|
10497
|
+
};
|
|
10498
|
+
}
|
|
10408
10499
|
|
|
10409
10500
|
// src/tools/network.ts
|
|
10410
10501
|
var network_exports = {};
|
|
@@ -14544,7 +14635,9 @@ __export(code_exports, {
|
|
|
14544
14635
|
testGitignorePatterns: () => testGitignorePatterns,
|
|
14545
14636
|
testPattern: () => testPattern,
|
|
14546
14637
|
testRegex: () => testRegex,
|
|
14547
|
-
|
|
14638
|
+
validateEditorConfig: () => validateEditorConfig,
|
|
14639
|
+
validateEnvKey: () => validateEnvKey2,
|
|
14640
|
+
validateTsconfig: () => validateTsconfig
|
|
14548
14641
|
});
|
|
14549
14642
|
var ALL_FLAGS = ["g", "i", "m", "s", "u"];
|
|
14550
14643
|
function testRegex(pattern, flags, input) {
|
|
@@ -17429,6 +17522,340 @@ function testGitignorePatterns(gitignoreContent, paths) {
|
|
|
17429
17522
|
return { path, ignored, matchedPattern, matchedLine };
|
|
17430
17523
|
});
|
|
17431
17524
|
}
|
|
17525
|
+
var EDITORCONFIG_ENUM_PROPERTIES = {
|
|
17526
|
+
indent_style: ["tab", "space"],
|
|
17527
|
+
end_of_line: ["lf", "cr", "crlf"],
|
|
17528
|
+
charset: ["latin1", "utf-8", "utf-8-bom", "utf-16be", "utf-16le"],
|
|
17529
|
+
trim_trailing_whitespace: ["true", "false"],
|
|
17530
|
+
insert_final_newline: ["true", "false"]
|
|
17531
|
+
};
|
|
17532
|
+
var EDITORCONFIG_KNOWN_PROPERTIES = /* @__PURE__ */ new Set([
|
|
17533
|
+
"indent_style",
|
|
17534
|
+
"indent_size",
|
|
17535
|
+
"tab_width",
|
|
17536
|
+
"end_of_line",
|
|
17537
|
+
"charset",
|
|
17538
|
+
"trim_trailing_whitespace",
|
|
17539
|
+
"insert_final_newline",
|
|
17540
|
+
"max_line_length",
|
|
17541
|
+
"root"
|
|
17542
|
+
]);
|
|
17543
|
+
var POSITIVE_INT_RE = /^[1-9][0-9]*$/;
|
|
17544
|
+
function validateEditorConfig(text) {
|
|
17545
|
+
if (!text || !text.trim()) return { error: "Input is empty" };
|
|
17546
|
+
const lines = text.split("\n");
|
|
17547
|
+
const issues = [];
|
|
17548
|
+
const sections = [];
|
|
17549
|
+
let root = false;
|
|
17550
|
+
let rootSeen = false;
|
|
17551
|
+
let currentSection = null;
|
|
17552
|
+
for (let i = 0; i < lines.length; i++) {
|
|
17553
|
+
const lineNum = i + 1;
|
|
17554
|
+
const trimmed = lines[i].trim();
|
|
17555
|
+
if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith(";")) continue;
|
|
17556
|
+
const sectionMatch = trimmed.match(/^\[(.*)\]$/);
|
|
17557
|
+
if (sectionMatch) {
|
|
17558
|
+
const glob = sectionMatch[1];
|
|
17559
|
+
if (!glob) {
|
|
17560
|
+
issues.push({ severity: "warning", line: lineNum, message: 'Section header is empty ("[]" matches no files)' });
|
|
17561
|
+
}
|
|
17562
|
+
if (sections.some((s) => s.glob === glob)) {
|
|
17563
|
+
issues.push({ severity: "warning", line: lineNum, message: `Duplicate section "[${glob}]" (an earlier section already uses this exact glob)` });
|
|
17564
|
+
}
|
|
17565
|
+
currentSection = { glob, line: lineNum, properties: [] };
|
|
17566
|
+
sections.push(currentSection);
|
|
17567
|
+
continue;
|
|
17568
|
+
}
|
|
17569
|
+
const eqIdx = trimmed.indexOf("=");
|
|
17570
|
+
if (eqIdx === -1) {
|
|
17571
|
+
issues.push({ severity: "error", line: lineNum, message: `Malformed line (missing '='): "${trimmed}"` });
|
|
17572
|
+
continue;
|
|
17573
|
+
}
|
|
17574
|
+
const rawKey = trimmed.slice(0, eqIdx).trim();
|
|
17575
|
+
const key = rawKey.toLowerCase();
|
|
17576
|
+
const rawValue = trimmed.slice(eqIdx + 1).trim();
|
|
17577
|
+
const normalizedValue = rawValue.toLowerCase();
|
|
17578
|
+
if (!rawKey) {
|
|
17579
|
+
issues.push({ severity: "error", line: lineNum, message: "Property is missing a name" });
|
|
17580
|
+
continue;
|
|
17581
|
+
}
|
|
17582
|
+
if (key === "root") {
|
|
17583
|
+
if (sections.length > 0) {
|
|
17584
|
+
issues.push({ severity: "error", line: lineNum, message: `"root" must appear before any section, in the file's preamble` });
|
|
17585
|
+
} else if (rootSeen) {
|
|
17586
|
+
issues.push({ severity: "warning", line: lineNum, message: 'Duplicate "root" declaration' });
|
|
17587
|
+
} else if (normalizedValue !== "true" && normalizedValue !== "false") {
|
|
17588
|
+
issues.push({ severity: "error", line: lineNum, message: `"root" must be "true" or "false", got "${rawValue}"` });
|
|
17589
|
+
} else {
|
|
17590
|
+
root = normalizedValue === "true";
|
|
17591
|
+
}
|
|
17592
|
+
rootSeen = true;
|
|
17593
|
+
continue;
|
|
17594
|
+
}
|
|
17595
|
+
if (!currentSection) {
|
|
17596
|
+
issues.push({ severity: "error", line: lineNum, message: `Property "${rawKey}" found before any section header` });
|
|
17597
|
+
continue;
|
|
17598
|
+
}
|
|
17599
|
+
if (currentSection.properties.some((p) => p.key === key)) {
|
|
17600
|
+
issues.push({ severity: "warning", line: lineNum, message: `Duplicate property "${key}" in section "[${currentSection.glob}]"` });
|
|
17601
|
+
}
|
|
17602
|
+
currentSection.properties.push({ key, value: rawValue, line: lineNum });
|
|
17603
|
+
if (!EDITORCONFIG_KNOWN_PROPERTIES.has(key)) {
|
|
17604
|
+
issues.push({ severity: "warning", line: lineNum, message: `Unknown property "${key}"` });
|
|
17605
|
+
continue;
|
|
17606
|
+
}
|
|
17607
|
+
if (key in EDITORCONFIG_ENUM_PROPERTIES) {
|
|
17608
|
+
if (!EDITORCONFIG_ENUM_PROPERTIES[key].includes(normalizedValue)) {
|
|
17609
|
+
issues.push({ severity: "error", line: lineNum, message: `"${key}" must be one of ${EDITORCONFIG_ENUM_PROPERTIES[key].join(", ")}, got "${rawValue}"` });
|
|
17610
|
+
}
|
|
17611
|
+
} else if (key === "indent_size") {
|
|
17612
|
+
if (normalizedValue !== "tab" && !POSITIVE_INT_RE.test(rawValue)) {
|
|
17613
|
+
issues.push({ severity: "error", line: lineNum, message: `"indent_size" must be a positive integer or "tab", got "${rawValue}"` });
|
|
17614
|
+
}
|
|
17615
|
+
} else if (key === "tab_width") {
|
|
17616
|
+
if (!POSITIVE_INT_RE.test(rawValue)) {
|
|
17617
|
+
issues.push({ severity: "error", line: lineNum, message: `"tab_width" must be a positive integer, got "${rawValue}"` });
|
|
17618
|
+
}
|
|
17619
|
+
} else if (key === "max_line_length") {
|
|
17620
|
+
if (normalizedValue !== "off" && !POSITIVE_INT_RE.test(rawValue)) {
|
|
17621
|
+
issues.push({ severity: "error", line: lineNum, message: `"max_line_length" must be a positive integer or "off", got "${rawValue}"` });
|
|
17622
|
+
}
|
|
17623
|
+
}
|
|
17624
|
+
}
|
|
17625
|
+
if (sections.length === 0 && !rootSeen) {
|
|
17626
|
+
issues.push({ severity: "warning", line: 1, message: "File has no section headers and no root declaration" });
|
|
17627
|
+
}
|
|
17628
|
+
const valid = !issues.some((i) => i.severity === "error");
|
|
17629
|
+
return { root, sections, issues, valid };
|
|
17630
|
+
}
|
|
17631
|
+
function stripJsonComments(input) {
|
|
17632
|
+
let out = "";
|
|
17633
|
+
let i = 0;
|
|
17634
|
+
const n = input.length;
|
|
17635
|
+
let inString = false;
|
|
17636
|
+
while (i < n) {
|
|
17637
|
+
const c = input[i];
|
|
17638
|
+
const next = input[i + 1];
|
|
17639
|
+
if (inString) {
|
|
17640
|
+
out += c;
|
|
17641
|
+
if (c === "\\") {
|
|
17642
|
+
out += next ?? "";
|
|
17643
|
+
i += 2;
|
|
17644
|
+
continue;
|
|
17645
|
+
}
|
|
17646
|
+
if (c === '"') inString = false;
|
|
17647
|
+
i++;
|
|
17648
|
+
continue;
|
|
17649
|
+
}
|
|
17650
|
+
if (c === '"') {
|
|
17651
|
+
inString = true;
|
|
17652
|
+
out += c;
|
|
17653
|
+
i++;
|
|
17654
|
+
continue;
|
|
17655
|
+
}
|
|
17656
|
+
if (c === "/" && next === "/") {
|
|
17657
|
+
while (i < n && input[i] !== "\n") i++;
|
|
17658
|
+
continue;
|
|
17659
|
+
}
|
|
17660
|
+
if (c === "/" && next === "*") {
|
|
17661
|
+
i += 2;
|
|
17662
|
+
while (i < n && !(input[i] === "*" && input[i + 1] === "/")) {
|
|
17663
|
+
out += input[i] === "\n" ? "\n" : "";
|
|
17664
|
+
i++;
|
|
17665
|
+
}
|
|
17666
|
+
i += 2;
|
|
17667
|
+
continue;
|
|
17668
|
+
}
|
|
17669
|
+
out += c;
|
|
17670
|
+
i++;
|
|
17671
|
+
}
|
|
17672
|
+
return out;
|
|
17673
|
+
}
|
|
17674
|
+
function stripTrailingCommas(input) {
|
|
17675
|
+
return input.replace(/,(\s*[}\]])/g, "$1");
|
|
17676
|
+
}
|
|
17677
|
+
var TSCONFIG_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
|
|
17678
|
+
"compilerOptions",
|
|
17679
|
+
"files",
|
|
17680
|
+
"include",
|
|
17681
|
+
"exclude",
|
|
17682
|
+
"extends",
|
|
17683
|
+
"references",
|
|
17684
|
+
"compileOnSave",
|
|
17685
|
+
"typeAcquisition",
|
|
17686
|
+
"watchOptions",
|
|
17687
|
+
"buildOptions",
|
|
17688
|
+
"$schema"
|
|
17689
|
+
]);
|
|
17690
|
+
var TSCONFIG_ENUM_OPTIONS = {
|
|
17691
|
+
target: ["es3", "es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "esnext"],
|
|
17692
|
+
module: ["none", "commonjs", "amd", "umd", "system", "es6", "es2015", "es2020", "es2022", "esnext", "node16", "nodenext", "node18", "preserve"],
|
|
17693
|
+
moduleResolution: ["classic", "node", "node10", "node16", "nodenext", "bundler"],
|
|
17694
|
+
moduleDetection: ["legacy", "auto", "force"],
|
|
17695
|
+
jsx: ["preserve", "react", "react-jsx", "react-jsxdev", "react-native"],
|
|
17696
|
+
newLine: ["crlf", "lf"],
|
|
17697
|
+
importsNotUsedAsValues: ["remove", "preserve", "error"]
|
|
17698
|
+
};
|
|
17699
|
+
var TSCONFIG_BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
17700
|
+
"allowJs",
|
|
17701
|
+
"checkJs",
|
|
17702
|
+
"strict",
|
|
17703
|
+
"noImplicitAny",
|
|
17704
|
+
"strictNullChecks",
|
|
17705
|
+
"strictFunctionTypes",
|
|
17706
|
+
"strictBindCallApply",
|
|
17707
|
+
"strictPropertyInitialization",
|
|
17708
|
+
"noImplicitThis",
|
|
17709
|
+
"useUnknownInCatchVariables",
|
|
17710
|
+
"alwaysStrict",
|
|
17711
|
+
"noUnusedLocals",
|
|
17712
|
+
"noUnusedParameters",
|
|
17713
|
+
"exactOptionalPropertyTypes",
|
|
17714
|
+
"noImplicitReturns",
|
|
17715
|
+
"noFallthroughCasesInSwitch",
|
|
17716
|
+
"noUncheckedIndexedAccess",
|
|
17717
|
+
"noImplicitOverride",
|
|
17718
|
+
"noPropertyAccessFromIndexSignature",
|
|
17719
|
+
"esModuleInterop",
|
|
17720
|
+
"allowSyntheticDefaultImports",
|
|
17721
|
+
"forceConsistentCasingInFileNames",
|
|
17722
|
+
"isolatedModules",
|
|
17723
|
+
"verbatimModuleSyntax",
|
|
17724
|
+
"declaration",
|
|
17725
|
+
"declarationMap",
|
|
17726
|
+
"emitDeclarationOnly",
|
|
17727
|
+
"sourceMap",
|
|
17728
|
+
"inlineSourceMap",
|
|
17729
|
+
"inlineSources",
|
|
17730
|
+
"noEmit",
|
|
17731
|
+
"noEmitOnError",
|
|
17732
|
+
"preserveConstEnums",
|
|
17733
|
+
"removeComments",
|
|
17734
|
+
"skipLibCheck",
|
|
17735
|
+
"composite",
|
|
17736
|
+
"incremental",
|
|
17737
|
+
"experimentalDecorators",
|
|
17738
|
+
"emitDecoratorMetadata",
|
|
17739
|
+
"resolveJsonModule",
|
|
17740
|
+
"allowUmdGlobalAccess",
|
|
17741
|
+
"downlevelIteration",
|
|
17742
|
+
"importHelpers",
|
|
17743
|
+
"preserveSymlinks",
|
|
17744
|
+
"allowUnreachableCode",
|
|
17745
|
+
"allowUnusedLabels",
|
|
17746
|
+
"disableSizeLimit",
|
|
17747
|
+
"noResolve",
|
|
17748
|
+
"skipDefaultLibCheck",
|
|
17749
|
+
"suppressImplicitAnyIndexErrors"
|
|
17750
|
+
]);
|
|
17751
|
+
var TSCONFIG_STRING_OPTIONS = /* @__PURE__ */ new Set([
|
|
17752
|
+
"outDir",
|
|
17753
|
+
"rootDir",
|
|
17754
|
+
"baseUrl",
|
|
17755
|
+
"outFile",
|
|
17756
|
+
"declarationDir",
|
|
17757
|
+
"tsBuildInfoFile",
|
|
17758
|
+
"jsxFactory",
|
|
17759
|
+
"jsxFragmentFactory",
|
|
17760
|
+
"jsxImportSource"
|
|
17761
|
+
]);
|
|
17762
|
+
var TSCONFIG_ARRAY_OPTIONS = /* @__PURE__ */ new Set(["lib", "types", "typeRoots", "rootDirs"]);
|
|
17763
|
+
function validateTsconfig(text) {
|
|
17764
|
+
if (!text || !text.trim()) return { error: "Input is empty" };
|
|
17765
|
+
const stripped = stripTrailingCommas(stripJsonComments(text));
|
|
17766
|
+
let parsed;
|
|
17767
|
+
try {
|
|
17768
|
+
parsed = JSON.parse(stripped);
|
|
17769
|
+
} catch (e) {
|
|
17770
|
+
return { error: `Invalid JSON: ${e.message}` };
|
|
17771
|
+
}
|
|
17772
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
17773
|
+
return { error: "Root of tsconfig.json must be an object" };
|
|
17774
|
+
}
|
|
17775
|
+
const obj = parsed;
|
|
17776
|
+
const issues = [];
|
|
17777
|
+
const topLevelKeys = Object.keys(obj);
|
|
17778
|
+
for (const key of topLevelKeys) {
|
|
17779
|
+
if (!TSCONFIG_TOP_LEVEL_KEYS.has(key)) {
|
|
17780
|
+
issues.push({ severity: "warning", path: key, message: `Unknown top-level key "${key}"` });
|
|
17781
|
+
}
|
|
17782
|
+
}
|
|
17783
|
+
for (const key of ["files", "include", "exclude"]) {
|
|
17784
|
+
if (key in obj) {
|
|
17785
|
+
const v = obj[key];
|
|
17786
|
+
if (!Array.isArray(v) || !v.every((x) => typeof x === "string")) {
|
|
17787
|
+
issues.push({ severity: "error", path: key, message: `"${key}" must be an array of strings` });
|
|
17788
|
+
}
|
|
17789
|
+
}
|
|
17790
|
+
}
|
|
17791
|
+
if ("extends" in obj) {
|
|
17792
|
+
const v = obj.extends;
|
|
17793
|
+
const validExtends = typeof v === "string" || Array.isArray(v) && v.every((x) => typeof x === "string");
|
|
17794
|
+
if (!validExtends) {
|
|
17795
|
+
issues.push({ severity: "error", path: "extends", message: '"extends" must be a string or an array of strings' });
|
|
17796
|
+
}
|
|
17797
|
+
}
|
|
17798
|
+
if ("references" in obj) {
|
|
17799
|
+
const v = obj.references;
|
|
17800
|
+
const validRefs = Array.isArray(v) && v.every((r) => typeof r === "object" && r !== null && typeof r.path === "string");
|
|
17801
|
+
if (!validRefs) {
|
|
17802
|
+
issues.push({ severity: "error", path: "references", message: '"references" must be an array of objects with a "path" string' });
|
|
17803
|
+
}
|
|
17804
|
+
}
|
|
17805
|
+
let compilerOptionKeys = [];
|
|
17806
|
+
if ("compilerOptions" in obj) {
|
|
17807
|
+
const co = obj.compilerOptions;
|
|
17808
|
+
if (typeof co !== "object" || co === null || Array.isArray(co)) {
|
|
17809
|
+
issues.push({ severity: "error", path: "compilerOptions", message: '"compilerOptions" must be an object' });
|
|
17810
|
+
} else {
|
|
17811
|
+
const coObj = co;
|
|
17812
|
+
compilerOptionKeys = Object.keys(coObj);
|
|
17813
|
+
for (const key of compilerOptionKeys) {
|
|
17814
|
+
const value = coObj[key];
|
|
17815
|
+
const path = `compilerOptions.${key}`;
|
|
17816
|
+
if (key === "paths") {
|
|
17817
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
17818
|
+
issues.push({ severity: "error", path, message: '"paths" must be an object mapping patterns to arrays of strings' });
|
|
17819
|
+
} else {
|
|
17820
|
+
for (const [k, v] of Object.entries(value)) {
|
|
17821
|
+
if (!Array.isArray(v) || !v.every((x) => typeof x === "string")) {
|
|
17822
|
+
issues.push({ severity: "error", path: `${path}.${k}`, message: `"paths.${k}" must be an array of strings` });
|
|
17823
|
+
}
|
|
17824
|
+
}
|
|
17825
|
+
}
|
|
17826
|
+
continue;
|
|
17827
|
+
}
|
|
17828
|
+
if (key in TSCONFIG_ENUM_OPTIONS) {
|
|
17829
|
+
if (typeof value !== "string" || !TSCONFIG_ENUM_OPTIONS[key].includes(value.toLowerCase())) {
|
|
17830
|
+
issues.push({ severity: "error", path, message: `"${key}" must be one of ${TSCONFIG_ENUM_OPTIONS[key].join(", ")}, got ${JSON.stringify(value)}` });
|
|
17831
|
+
}
|
|
17832
|
+
continue;
|
|
17833
|
+
}
|
|
17834
|
+
if (TSCONFIG_BOOLEAN_OPTIONS.has(key)) {
|
|
17835
|
+
if (typeof value !== "boolean") {
|
|
17836
|
+
issues.push({ severity: "error", path, message: `"${key}" must be a boolean, got ${JSON.stringify(value)}` });
|
|
17837
|
+
}
|
|
17838
|
+
continue;
|
|
17839
|
+
}
|
|
17840
|
+
if (TSCONFIG_STRING_OPTIONS.has(key)) {
|
|
17841
|
+
if (typeof value !== "string") {
|
|
17842
|
+
issues.push({ severity: "error", path, message: `"${key}" must be a string, got ${JSON.stringify(value)}` });
|
|
17843
|
+
}
|
|
17844
|
+
continue;
|
|
17845
|
+
}
|
|
17846
|
+
if (TSCONFIG_ARRAY_OPTIONS.has(key)) {
|
|
17847
|
+
if (!Array.isArray(value) || !value.every((x) => typeof x === "string")) {
|
|
17848
|
+
issues.push({ severity: "error", path, message: `"${key}" must be an array of strings, got ${JSON.stringify(value)}` });
|
|
17849
|
+
}
|
|
17850
|
+
continue;
|
|
17851
|
+
}
|
|
17852
|
+
issues.push({ severity: "warning", path, message: `Unknown compilerOption "${key}"` });
|
|
17853
|
+
}
|
|
17854
|
+
}
|
|
17855
|
+
}
|
|
17856
|
+
const valid = !issues.some((i) => i.severity === "error");
|
|
17857
|
+
return { parsed: true, topLevelKeys, compilerOptionKeys, issues, valid };
|
|
17858
|
+
}
|
|
17432
17859
|
|
|
17433
17860
|
// src/tools/color.ts
|
|
17434
17861
|
var color_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -2,13 +2,13 @@ export { j as json } from './json-Ta9JykSB.cjs';
|
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.cjs';
|
|
4
4
|
export { t as text } from './text-DWUcY8H1.cjs';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-CupeugaR.cjs';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-p-1Ikx7l.cjs';
|
|
9
9
|
export { n as network } from './network-DelcJeJa.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-B_gDkRAx.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
|
@@ -2,13 +2,13 @@ export { j as json } from './json-Ta9JykSB.js';
|
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.js';
|
|
4
4
|
export { t as text } from './text-DWUcY8H1.js';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-CupeugaR.js';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-p-1Ikx7l.js';
|
|
9
9
|
export { n as network } from './network-DelcJeJa.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-B_gDkRAx.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-226EH3ZI.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-NKN656TQ.js';
|
|
3
3
|
export { network_exports as network } from './chunk-Y7YY733Z.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
|
-
export { code_exports as code } from './chunk-
|
|
5
|
+
export { code_exports as code } from './chunk-K4ZERKBD.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';
|
|
@@ -11,7 +11,7 @@ export { json_exports as json } from './chunk-WVEKRKGU.js';
|
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
|
|
13
13
|
export { text_exports as text } from './chunk-P7TXG7CI.js';
|
|
14
|
-
export { data_exports as data } from './chunk-
|
|
14
|
+
export { data_exports as data } from './chunk-3KIUADK4.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-3TYWIX3B.js';
|
|
16
16
|
export { time_exports as time } from './chunk-IEPWZERQ.js';
|
|
17
17
|
import './chunk-MLKGABMK.js';
|