@utilix-tech/sdk 0.86.0 → 0.88.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 +7 -0
- package/README.md +4 -4
- package/dist/{chunk-XOUS3M5Z.js → chunk-CUQDHXUX.js} +80 -1
- package/dist/{chunk-7XHM7HHU.js → chunk-KYBI62YY.js} +119 -1
- package/dist/{chunk-YM6UC4SM.js → chunk-LKFMBUJZ.js} +52 -1
- package/dist/{code-B9LwFkB1.d.ts → code-DvJYYTea.d.cts} +35 -2
- package/dist/{code-B9LwFkB1.d.cts → code-DvJYYTea.d.ts} +35 -2
- package/dist/{data-DIyBrJ6l.d.cts → data-Cz1Q0sg0.d.cts} +32 -2
- package/dist/{data-DIyBrJ6l.d.ts → data-Cz1Q0sg0.d.ts} +32 -2
- package/dist/index.cjs +248 -0
- 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 +118 -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 +79 -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 +51 -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-gLm_pq6U.d.cts → units-B6aXeGr6.d.cts} +46 -2
- package/dist/{units-gLm_pq6U.d.ts → units-B6aXeGr6.d.ts} +46 -2
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* - csv-duplicate-row-finder: findCsvDuplicateRows
|
|
22
22
|
* - yaml-anchor-resolver: resolveYamlAnchors
|
|
23
23
|
* - markdown-table-aligner: alignMarkdownTables
|
|
24
|
+
* - markdown-heading-hierarchy-validator: validateMarkdownHeadingHierarchy
|
|
24
25
|
*/
|
|
25
26
|
interface ValidationResult {
|
|
26
27
|
valid: boolean;
|
|
@@ -384,6 +385,30 @@ interface MarkdownTocResult {
|
|
|
384
385
|
declare function generateMarkdownToc(markdown: string, options?: MarkdownTocOptions): MarkdownTocResult | {
|
|
385
386
|
error: string;
|
|
386
387
|
};
|
|
388
|
+
type HeadingIssueType = 'empty-heading' | 'multiple-h1' | 'skipped-level' | 'duplicate-heading' | 'starts-below-h1';
|
|
389
|
+
interface HeadingEntry {
|
|
390
|
+
line: number;
|
|
391
|
+
level: number;
|
|
392
|
+
text: string;
|
|
393
|
+
}
|
|
394
|
+
interface HeadingIssue {
|
|
395
|
+
line: number;
|
|
396
|
+
type: HeadingIssueType;
|
|
397
|
+
message: string;
|
|
398
|
+
}
|
|
399
|
+
interface HeadingHierarchyResult {
|
|
400
|
+
headings: HeadingEntry[];
|
|
401
|
+
issues: HeadingIssue[];
|
|
402
|
+
h1Count: number;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Scans a Markdown document's ATX headings and validates the overall
|
|
406
|
+
* heading hierarchy: a level that skips one or more levels going deeper,
|
|
407
|
+
* more than one H1, an empty heading, a duplicate heading at the same
|
|
408
|
+
* level, or a document that doesn't start at H1. Setext-style headings are
|
|
409
|
+
* not recognized, and headings inside fenced code blocks are ignored.
|
|
410
|
+
*/
|
|
411
|
+
declare function validateMarkdownHeadingHierarchy(markdown: string): HeadingHierarchyResult;
|
|
387
412
|
interface CsvToSqlOptions {
|
|
388
413
|
tableName?: string;
|
|
389
414
|
dialect?: 'ansi' | 'mysql';
|
|
@@ -563,6 +588,10 @@ type data_EnvEntry = EnvEntry;
|
|
|
563
588
|
type data_EnvParseResult = EnvParseResult;
|
|
564
589
|
type data_FrontMatterError = FrontMatterError;
|
|
565
590
|
type data_FrontMatterResult = FrontMatterResult;
|
|
591
|
+
type data_HeadingEntry = HeadingEntry;
|
|
592
|
+
type data_HeadingHierarchyResult = HeadingHierarchyResult;
|
|
593
|
+
type data_HeadingIssue = HeadingIssue;
|
|
594
|
+
type data_HeadingIssueType = HeadingIssueType;
|
|
566
595
|
type data_IniSection = IniSection;
|
|
567
596
|
type data_MarkdownTableAlignResult = MarkdownTableAlignResult;
|
|
568
597
|
type data_MarkdownTableColumnAlignment = MarkdownTableColumnAlignment;
|
|
@@ -637,13 +666,14 @@ declare const data_toCsvString: typeof toCsvString;
|
|
|
637
666
|
declare const data_tomlToJson: typeof tomlToJson;
|
|
638
667
|
declare const data_validateEnvKey: typeof validateEnvKey;
|
|
639
668
|
declare const data_validateIni: typeof validateIni;
|
|
669
|
+
declare const data_validateMarkdownHeadingHierarchy: typeof validateMarkdownHeadingHierarchy;
|
|
640
670
|
declare const data_validateNdjson: typeof validateNdjson;
|
|
641
671
|
declare const data_validateToml: typeof validateToml;
|
|
642
672
|
declare const data_validateXml: typeof validateXml;
|
|
643
673
|
declare const data_validateYaml: typeof validateYaml;
|
|
644
674
|
declare const data_xmlToJson: typeof xmlToJson;
|
|
645
675
|
declare namespace data {
|
|
646
|
-
export { type data_CaptionSpeedCue as CaptionSpeedCue, type data_CaptionSpeedResult as CaptionSpeedResult, type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvColumnType as CsvColumnType, type data_CsvColumnTypeInfo as CsvColumnTypeInfo, type data_CsvColumnTypeOptions as CsvColumnTypeOptions, type data_CsvColumnTypeResult as CsvColumnTypeResult, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTableAlignResult as MarkdownTableAlignResult, type data_MarkdownTableColumnAlignment as MarkdownTableColumnAlignment, type data_MarkdownTableInfo as MarkdownTableInfo, type data_MarkdownTaskListItem as MarkdownTaskListItem, type data_MarkdownTaskListProgressResult as MarkdownTaskListProgressResult, type data_MarkdownTaskListSectionSummary as MarkdownTaskListSectionSummary, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonDedupeResult as NdjsonDedupeResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, type data_YamlAnchorInfo as YamlAnchorInfo, type data_YamlAnchorResolveError as YamlAnchorResolveError, type data_YamlAnchorResolveResult as YamlAnchorResolveResult, data_alignMarkdownTables as alignMarkdownTables, data_analyzeCaptionSpeed as analyzeCaptionSpeed, data_calculateMarkdownTaskListProgress as calculateMarkdownTaskListProgress, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_dedupeNdjson as dedupeNdjson, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_inferCsvColumnTypes as inferCsvColumnTypes, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToCsv as ndjsonToCsv, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_resolveYamlAnchors as resolveYamlAnchors, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
676
|
+
export { type data_CaptionSpeedCue as CaptionSpeedCue, type data_CaptionSpeedResult as CaptionSpeedResult, type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvColumnType as CsvColumnType, type data_CsvColumnTypeInfo as CsvColumnTypeInfo, type data_CsvColumnTypeOptions as CsvColumnTypeOptions, type data_CsvColumnTypeResult as CsvColumnTypeResult, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_HeadingEntry as HeadingEntry, type data_HeadingHierarchyResult as HeadingHierarchyResult, type data_HeadingIssue as HeadingIssue, type data_HeadingIssueType as HeadingIssueType, type data_IniSection as IniSection, type data_MarkdownTableAlignResult as MarkdownTableAlignResult, type data_MarkdownTableColumnAlignment as MarkdownTableColumnAlignment, type data_MarkdownTableInfo as MarkdownTableInfo, type data_MarkdownTaskListItem as MarkdownTaskListItem, type data_MarkdownTaskListProgressResult as MarkdownTaskListProgressResult, type data_MarkdownTaskListSectionSummary as MarkdownTaskListSectionSummary, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonDedupeResult as NdjsonDedupeResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, type data_YamlAnchorInfo as YamlAnchorInfo, type data_YamlAnchorResolveError as YamlAnchorResolveError, type data_YamlAnchorResolveResult as YamlAnchorResolveResult, data_alignMarkdownTables as alignMarkdownTables, data_analyzeCaptionSpeed as analyzeCaptionSpeed, data_calculateMarkdownTaskListProgress as calculateMarkdownTaskListProgress, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_dedupeNdjson as dedupeNdjson, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_inferCsvColumnTypes as inferCsvColumnTypes, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToCsv as ndjsonToCsv, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_resolveYamlAnchors as resolveYamlAnchors, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateMarkdownHeadingHierarchy as validateMarkdownHeadingHierarchy, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
647
677
|
}
|
|
648
678
|
|
|
649
|
-
export {
|
|
679
|
+
export { csvToJson as $, type MarkdownTocOptions as A, type MarkdownTocResult as B, type CaptionSpeedCue as C, type NdjsonLineResult as D, type EnvDiffError as E, type FrontMatterError as F, type NdjsonValidateResult as G, type HeadingEntry as H, type IniSection as I, type ParsedIni as J, type ParsedSubtitles as K, type SubtitleFormat as L, type MarkdownTableAlignResult as M, type NdjsonDedupeResult as N, type XmlToJsonOptions as O, type ParseOptions as P, type YamlAnchorResolveError as Q, type YamlAnchorResolveResult as R, type SubtitleCue as S, type TomlFormatResult as T, alignMarkdownTables as U, type ValidationResult as V, analyzeCaptionSpeed as W, type XmlFormatResult as X, type YamlAnchorInfo as Y, calculateMarkdownTaskListProgress as Z, convertSubtitles as _, type CaptionSpeedResult as a, csvToSqlInsert as a0, dedupeNdjson as a1, detectDelimiter as a2, detectSubtitleFormat as a3, diffEnvExample as a4, envToExport as a5, envToJson as a6, findCsvDuplicateRows as a7, formatNdjson as a8, formatSubtitleTimestamp as a9, resolveYamlAnchors as aA, serializeSubtitles as aB, shiftSubtitles as aC, stringifyIni as aD, toCsvString as aE, tomlToJson as aF, validateEnvKey as aG, validateIni as aH, validateMarkdownHeadingHierarchy as aI, validateNdjson as aJ, validateToml as aK, validateXml as aL, validateYaml as aM, xmlToJson as aN, formatToml as aa, formatXml as ab, generateMarkdownToc as ac, getSection as ad, getSectionNames as ae, getTomlStats as af, getXmlStats as ag, getYamlStats as ah, inferCsvColumnTypes as ai, iniToJson as aj, jsonArrayToNdjson as ak, jsonToIni as al, jsonToToml as am, jsonToXml as an, minifyNdjson as ao, minifyToml as ap, minifyXml as aq, ndjsonToCsv as ar, ndjsonToJsonArray as as, parseCsv as at, parseEnv as au, parseFrontMatter as av, parseIni as aw, parseSubtitleTimestamp as ax, parseSubtitles as ay, parseXmlToObject as az, type ConvertedSubtitles as b, type CsvColumnType as c, data as d, type CsvColumnTypeInfo as e, type CsvColumnTypeOptions as f, type CsvColumnTypeResult as g, type CsvDuplicateGroup as h, type CsvDuplicateOptions as i, type CsvDuplicateResult as j, type CsvParseResult as k, type CsvToSqlOptions as l, type CsvToSqlResult as m, type EnvDiffResult as n, type EnvEntry as o, type EnvParseResult as p, type FrontMatterResult as q, type HeadingHierarchyResult as r, type HeadingIssue as s, type HeadingIssueType as t, type MarkdownTableColumnAlignment as u, type MarkdownTableInfo as v, type MarkdownTaskListItem as w, type MarkdownTaskListProgressResult as x, type MarkdownTaskListSectionSummary as y, type MarkdownTocEntry as z };
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* - csv-duplicate-row-finder: findCsvDuplicateRows
|
|
22
22
|
* - yaml-anchor-resolver: resolveYamlAnchors
|
|
23
23
|
* - markdown-table-aligner: alignMarkdownTables
|
|
24
|
+
* - markdown-heading-hierarchy-validator: validateMarkdownHeadingHierarchy
|
|
24
25
|
*/
|
|
25
26
|
interface ValidationResult {
|
|
26
27
|
valid: boolean;
|
|
@@ -384,6 +385,30 @@ interface MarkdownTocResult {
|
|
|
384
385
|
declare function generateMarkdownToc(markdown: string, options?: MarkdownTocOptions): MarkdownTocResult | {
|
|
385
386
|
error: string;
|
|
386
387
|
};
|
|
388
|
+
type HeadingIssueType = 'empty-heading' | 'multiple-h1' | 'skipped-level' | 'duplicate-heading' | 'starts-below-h1';
|
|
389
|
+
interface HeadingEntry {
|
|
390
|
+
line: number;
|
|
391
|
+
level: number;
|
|
392
|
+
text: string;
|
|
393
|
+
}
|
|
394
|
+
interface HeadingIssue {
|
|
395
|
+
line: number;
|
|
396
|
+
type: HeadingIssueType;
|
|
397
|
+
message: string;
|
|
398
|
+
}
|
|
399
|
+
interface HeadingHierarchyResult {
|
|
400
|
+
headings: HeadingEntry[];
|
|
401
|
+
issues: HeadingIssue[];
|
|
402
|
+
h1Count: number;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Scans a Markdown document's ATX headings and validates the overall
|
|
406
|
+
* heading hierarchy: a level that skips one or more levels going deeper,
|
|
407
|
+
* more than one H1, an empty heading, a duplicate heading at the same
|
|
408
|
+
* level, or a document that doesn't start at H1. Setext-style headings are
|
|
409
|
+
* not recognized, and headings inside fenced code blocks are ignored.
|
|
410
|
+
*/
|
|
411
|
+
declare function validateMarkdownHeadingHierarchy(markdown: string): HeadingHierarchyResult;
|
|
387
412
|
interface CsvToSqlOptions {
|
|
388
413
|
tableName?: string;
|
|
389
414
|
dialect?: 'ansi' | 'mysql';
|
|
@@ -563,6 +588,10 @@ type data_EnvEntry = EnvEntry;
|
|
|
563
588
|
type data_EnvParseResult = EnvParseResult;
|
|
564
589
|
type data_FrontMatterError = FrontMatterError;
|
|
565
590
|
type data_FrontMatterResult = FrontMatterResult;
|
|
591
|
+
type data_HeadingEntry = HeadingEntry;
|
|
592
|
+
type data_HeadingHierarchyResult = HeadingHierarchyResult;
|
|
593
|
+
type data_HeadingIssue = HeadingIssue;
|
|
594
|
+
type data_HeadingIssueType = HeadingIssueType;
|
|
566
595
|
type data_IniSection = IniSection;
|
|
567
596
|
type data_MarkdownTableAlignResult = MarkdownTableAlignResult;
|
|
568
597
|
type data_MarkdownTableColumnAlignment = MarkdownTableColumnAlignment;
|
|
@@ -637,13 +666,14 @@ declare const data_toCsvString: typeof toCsvString;
|
|
|
637
666
|
declare const data_tomlToJson: typeof tomlToJson;
|
|
638
667
|
declare const data_validateEnvKey: typeof validateEnvKey;
|
|
639
668
|
declare const data_validateIni: typeof validateIni;
|
|
669
|
+
declare const data_validateMarkdownHeadingHierarchy: typeof validateMarkdownHeadingHierarchy;
|
|
640
670
|
declare const data_validateNdjson: typeof validateNdjson;
|
|
641
671
|
declare const data_validateToml: typeof validateToml;
|
|
642
672
|
declare const data_validateXml: typeof validateXml;
|
|
643
673
|
declare const data_validateYaml: typeof validateYaml;
|
|
644
674
|
declare const data_xmlToJson: typeof xmlToJson;
|
|
645
675
|
declare namespace data {
|
|
646
|
-
export { type data_CaptionSpeedCue as CaptionSpeedCue, type data_CaptionSpeedResult as CaptionSpeedResult, type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvColumnType as CsvColumnType, type data_CsvColumnTypeInfo as CsvColumnTypeInfo, type data_CsvColumnTypeOptions as CsvColumnTypeOptions, type data_CsvColumnTypeResult as CsvColumnTypeResult, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTableAlignResult as MarkdownTableAlignResult, type data_MarkdownTableColumnAlignment as MarkdownTableColumnAlignment, type data_MarkdownTableInfo as MarkdownTableInfo, type data_MarkdownTaskListItem as MarkdownTaskListItem, type data_MarkdownTaskListProgressResult as MarkdownTaskListProgressResult, type data_MarkdownTaskListSectionSummary as MarkdownTaskListSectionSummary, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonDedupeResult as NdjsonDedupeResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, type data_YamlAnchorInfo as YamlAnchorInfo, type data_YamlAnchorResolveError as YamlAnchorResolveError, type data_YamlAnchorResolveResult as YamlAnchorResolveResult, data_alignMarkdownTables as alignMarkdownTables, data_analyzeCaptionSpeed as analyzeCaptionSpeed, data_calculateMarkdownTaskListProgress as calculateMarkdownTaskListProgress, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_dedupeNdjson as dedupeNdjson, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_inferCsvColumnTypes as inferCsvColumnTypes, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToCsv as ndjsonToCsv, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_resolveYamlAnchors as resolveYamlAnchors, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
676
|
+
export { type data_CaptionSpeedCue as CaptionSpeedCue, type data_CaptionSpeedResult as CaptionSpeedResult, type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvColumnType as CsvColumnType, type data_CsvColumnTypeInfo as CsvColumnTypeInfo, type data_CsvColumnTypeOptions as CsvColumnTypeOptions, type data_CsvColumnTypeResult as CsvColumnTypeResult, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_HeadingEntry as HeadingEntry, type data_HeadingHierarchyResult as HeadingHierarchyResult, type data_HeadingIssue as HeadingIssue, type data_HeadingIssueType as HeadingIssueType, type data_IniSection as IniSection, type data_MarkdownTableAlignResult as MarkdownTableAlignResult, type data_MarkdownTableColumnAlignment as MarkdownTableColumnAlignment, type data_MarkdownTableInfo as MarkdownTableInfo, type data_MarkdownTaskListItem as MarkdownTaskListItem, type data_MarkdownTaskListProgressResult as MarkdownTaskListProgressResult, type data_MarkdownTaskListSectionSummary as MarkdownTaskListSectionSummary, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonDedupeResult as NdjsonDedupeResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, type data_YamlAnchorInfo as YamlAnchorInfo, type data_YamlAnchorResolveError as YamlAnchorResolveError, type data_YamlAnchorResolveResult as YamlAnchorResolveResult, data_alignMarkdownTables as alignMarkdownTables, data_analyzeCaptionSpeed as analyzeCaptionSpeed, data_calculateMarkdownTaskListProgress as calculateMarkdownTaskListProgress, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_dedupeNdjson as dedupeNdjson, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_inferCsvColumnTypes as inferCsvColumnTypes, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToCsv as ndjsonToCsv, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_resolveYamlAnchors as resolveYamlAnchors, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateMarkdownHeadingHierarchy as validateMarkdownHeadingHierarchy, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
647
677
|
}
|
|
648
678
|
|
|
649
|
-
export {
|
|
679
|
+
export { csvToJson as $, type MarkdownTocOptions as A, type MarkdownTocResult as B, type CaptionSpeedCue as C, type NdjsonLineResult as D, type EnvDiffError as E, type FrontMatterError as F, type NdjsonValidateResult as G, type HeadingEntry as H, type IniSection as I, type ParsedIni as J, type ParsedSubtitles as K, type SubtitleFormat as L, type MarkdownTableAlignResult as M, type NdjsonDedupeResult as N, type XmlToJsonOptions as O, type ParseOptions as P, type YamlAnchorResolveError as Q, type YamlAnchorResolveResult as R, type SubtitleCue as S, type TomlFormatResult as T, alignMarkdownTables as U, type ValidationResult as V, analyzeCaptionSpeed as W, type XmlFormatResult as X, type YamlAnchorInfo as Y, calculateMarkdownTaskListProgress as Z, convertSubtitles as _, type CaptionSpeedResult as a, csvToSqlInsert as a0, dedupeNdjson as a1, detectDelimiter as a2, detectSubtitleFormat as a3, diffEnvExample as a4, envToExport as a5, envToJson as a6, findCsvDuplicateRows as a7, formatNdjson as a8, formatSubtitleTimestamp as a9, resolveYamlAnchors as aA, serializeSubtitles as aB, shiftSubtitles as aC, stringifyIni as aD, toCsvString as aE, tomlToJson as aF, validateEnvKey as aG, validateIni as aH, validateMarkdownHeadingHierarchy as aI, validateNdjson as aJ, validateToml as aK, validateXml as aL, validateYaml as aM, xmlToJson as aN, formatToml as aa, formatXml as ab, generateMarkdownToc as ac, getSection as ad, getSectionNames as ae, getTomlStats as af, getXmlStats as ag, getYamlStats as ah, inferCsvColumnTypes as ai, iniToJson as aj, jsonArrayToNdjson as ak, jsonToIni as al, jsonToToml as am, jsonToXml as an, minifyNdjson as ao, minifyToml as ap, minifyXml as aq, ndjsonToCsv as ar, ndjsonToJsonArray as as, parseCsv as at, parseEnv as au, parseFrontMatter as av, parseIni as aw, parseSubtitleTimestamp as ax, parseSubtitles as ay, parseXmlToObject as az, type ConvertedSubtitles as b, type CsvColumnType as c, data as d, type CsvColumnTypeInfo as e, type CsvColumnTypeOptions as f, type CsvColumnTypeResult as g, type CsvDuplicateGroup as h, type CsvDuplicateOptions as i, type CsvDuplicateResult as j, type CsvParseResult as k, type CsvToSqlOptions as l, type CsvToSqlResult as m, type EnvDiffResult as n, type EnvEntry as o, type EnvParseResult as p, type FrontMatterResult as q, type HeadingHierarchyResult as r, type HeadingIssue as s, type HeadingIssueType as t, type MarkdownTableColumnAlignment as u, type MarkdownTableInfo as v, type MarkdownTaskListItem as w, type MarkdownTaskListProgressResult as x, type MarkdownTaskListSectionSummary as y, type MarkdownTocEntry as z };
|
package/dist/index.cjs
CHANGED
|
@@ -5621,6 +5621,7 @@ __export(data_exports, {
|
|
|
5621
5621
|
tomlToJson: () => tomlToJson,
|
|
5622
5622
|
validateEnvKey: () => validateEnvKey,
|
|
5623
5623
|
validateIni: () => validateIni,
|
|
5624
|
+
validateMarkdownHeadingHierarchy: () => validateMarkdownHeadingHierarchy,
|
|
5624
5625
|
validateNdjson: () => validateNdjson,
|
|
5625
5626
|
validateToml: () => validateToml,
|
|
5626
5627
|
validateXml: () => validateXml,
|
|
@@ -7147,6 +7148,84 @@ function generateMarkdownToc(markdown, options = {}) {
|
|
|
7147
7148
|
});
|
|
7148
7149
|
return { toc: tocLines.join("\n"), entries };
|
|
7149
7150
|
}
|
|
7151
|
+
var HEADING_HIERARCHY_RE = /^(#{1,6})(?!#)(?:[ \t]+(.*?))?[ \t]*#*[ \t]*$/;
|
|
7152
|
+
function validateMarkdownHeadingHierarchy(markdown) {
|
|
7153
|
+
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
|
|
7154
|
+
const headings = [];
|
|
7155
|
+
let inFence = false;
|
|
7156
|
+
let fenceMarker = "";
|
|
7157
|
+
for (let i = 0; i < lines.length; i++) {
|
|
7158
|
+
const line = lines[i];
|
|
7159
|
+
const fenceMatch = line.match(/^\s*(```+|~~~+)/);
|
|
7160
|
+
if (fenceMatch) {
|
|
7161
|
+
if (!inFence) {
|
|
7162
|
+
inFence = true;
|
|
7163
|
+
fenceMarker = fenceMatch[1][0];
|
|
7164
|
+
} else if (fenceMatch[1][0] === fenceMarker) {
|
|
7165
|
+
inFence = false;
|
|
7166
|
+
}
|
|
7167
|
+
continue;
|
|
7168
|
+
}
|
|
7169
|
+
if (inFence) continue;
|
|
7170
|
+
const match = line.match(HEADING_HIERARCHY_RE);
|
|
7171
|
+
if (!match) continue;
|
|
7172
|
+
const level = match[1].length;
|
|
7173
|
+
const text = stripInlineMarkdown(match[2] ?? "");
|
|
7174
|
+
headings.push({ line: i + 1, level, text });
|
|
7175
|
+
}
|
|
7176
|
+
const issues = [];
|
|
7177
|
+
const seen = /* @__PURE__ */ new Map();
|
|
7178
|
+
let h1Count = 0;
|
|
7179
|
+
let firstH1Line = null;
|
|
7180
|
+
let prevLevel = null;
|
|
7181
|
+
headings.forEach((h, idx) => {
|
|
7182
|
+
if (h.text === "") {
|
|
7183
|
+
issues.push({ line: h.line, type: "empty-heading", message: `Heading at line ${h.line} has no text` });
|
|
7184
|
+
}
|
|
7185
|
+
if (idx === 0 && h.level !== 1) {
|
|
7186
|
+
issues.push({
|
|
7187
|
+
line: h.line,
|
|
7188
|
+
type: "starts-below-h1",
|
|
7189
|
+
message: `Document starts with an H${h.level} heading instead of H1`
|
|
7190
|
+
});
|
|
7191
|
+
}
|
|
7192
|
+
if (h.level === 1) {
|
|
7193
|
+
h1Count++;
|
|
7194
|
+
if (h1Count === 1) {
|
|
7195
|
+
firstH1Line = h.line;
|
|
7196
|
+
} else {
|
|
7197
|
+
issues.push({
|
|
7198
|
+
line: h.line,
|
|
7199
|
+
type: "multiple-h1",
|
|
7200
|
+
message: `Multiple H1 headings found: another H1 at line ${h.line} (first was at line ${firstH1Line})`
|
|
7201
|
+
});
|
|
7202
|
+
}
|
|
7203
|
+
}
|
|
7204
|
+
if (prevLevel !== null && h.level > prevLevel + 1) {
|
|
7205
|
+
const skipped = h.level - prevLevel > 2 ? `H${prevLevel + 1}-H${h.level - 1}` : `H${prevLevel + 1}`;
|
|
7206
|
+
issues.push({
|
|
7207
|
+
line: h.line,
|
|
7208
|
+
type: "skipped-level",
|
|
7209
|
+
message: `Heading level jumps from H${prevLevel} to H${h.level} at line ${h.line}, skipping ${skipped}`
|
|
7210
|
+
});
|
|
7211
|
+
}
|
|
7212
|
+
prevLevel = h.level;
|
|
7213
|
+
if (h.text !== "") {
|
|
7214
|
+
const key = `${h.level}:${h.text.toLowerCase()}`;
|
|
7215
|
+
const earlierLine = seen.get(key);
|
|
7216
|
+
if (earlierLine !== void 0) {
|
|
7217
|
+
issues.push({
|
|
7218
|
+
line: h.line,
|
|
7219
|
+
type: "duplicate-heading",
|
|
7220
|
+
message: `Heading "${h.text}" at line ${h.line} duplicates an H${h.level} heading at line ${earlierLine}`
|
|
7221
|
+
});
|
|
7222
|
+
} else {
|
|
7223
|
+
seen.set(key, h.line);
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7226
|
+
});
|
|
7227
|
+
return { headings, issues, h1Count };
|
|
7228
|
+
}
|
|
7150
7229
|
function quoteSqlIdentifier(name, dialect) {
|
|
7151
7230
|
if (dialect === "mysql") return "`" + name.replace(/`/g, "``") + "`";
|
|
7152
7231
|
return '"' + name.replace(/"/g, '""') + '"';
|
|
@@ -9012,6 +9091,7 @@ __export(units_exports, {
|
|
|
9012
9091
|
bumpVersion: () => bumpVersion,
|
|
9013
9092
|
calcAspectRatio: () => calcAspectRatio,
|
|
9014
9093
|
calcSubnet: () => calcSubnet,
|
|
9094
|
+
calculateAnnuityPayout: () => calculateAnnuityPayout,
|
|
9015
9095
|
calculateBlendedLoanRate: () => calculateBlendedLoanRate,
|
|
9016
9096
|
calculateBreakEven: () => calculateBreakEven,
|
|
9017
9097
|
calculateCashBreakdown: () => calculateCashBreakdown,
|
|
@@ -10862,6 +10942,56 @@ function calculateSavingsGoal(input) {
|
|
|
10862
10942
|
finalBalance: round4(goalAmount)
|
|
10863
10943
|
};
|
|
10864
10944
|
}
|
|
10945
|
+
function calculateAnnuityPayout(input) {
|
|
10946
|
+
const { mode, structure, years, paymentsPerYear, annualRatePercent, principal, periodicPayout } = input;
|
|
10947
|
+
if (mode !== "payout-from-principal" && mode !== "principal-from-payout") {
|
|
10948
|
+
return { error: "mode must be 'payout-from-principal' or 'principal-from-payout'" };
|
|
10949
|
+
}
|
|
10950
|
+
if (structure !== "ordinary" && structure !== "due") {
|
|
10951
|
+
return { error: "structure must be 'ordinary' or 'due'" };
|
|
10952
|
+
}
|
|
10953
|
+
if (!Number.isInteger(years) || years <= 0) return { error: "years must be a positive whole number" };
|
|
10954
|
+
if (!Number.isInteger(paymentsPerYear) || paymentsPerYear <= 0) {
|
|
10955
|
+
return { error: "paymentsPerYear must be a positive whole number" };
|
|
10956
|
+
}
|
|
10957
|
+
if (!Number.isFinite(annualRatePercent) || annualRatePercent < 0) {
|
|
10958
|
+
return { error: "annualRatePercent must be a finite, non-negative number" };
|
|
10959
|
+
}
|
|
10960
|
+
const periods = years * paymentsPerYear;
|
|
10961
|
+
const r = annualRatePercent / 100 / paymentsPerYear;
|
|
10962
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
10963
|
+
let factor = r === 0 ? periods : (1 - Math.pow(1 + r, -periods)) / r;
|
|
10964
|
+
if (structure === "due") factor *= 1 + r;
|
|
10965
|
+
let resolvedPrincipal;
|
|
10966
|
+
let resolvedPayout;
|
|
10967
|
+
if (mode === "payout-from-principal") {
|
|
10968
|
+
if (typeof principal !== "number" || !Number.isFinite(principal) || principal <= 0) {
|
|
10969
|
+
return { error: 'principal must be a finite number greater than zero for mode "payout-from-principal"' };
|
|
10970
|
+
}
|
|
10971
|
+
resolvedPrincipal = principal;
|
|
10972
|
+
resolvedPayout = principal / factor;
|
|
10973
|
+
} else {
|
|
10974
|
+
if (typeof periodicPayout !== "number" || !Number.isFinite(periodicPayout) || periodicPayout <= 0) {
|
|
10975
|
+
return { error: 'periodicPayout must be a finite number greater than zero for mode "principal-from-payout"' };
|
|
10976
|
+
}
|
|
10977
|
+
resolvedPayout = periodicPayout;
|
|
10978
|
+
resolvedPrincipal = periodicPayout * factor;
|
|
10979
|
+
}
|
|
10980
|
+
const totalPaid = resolvedPayout * periods;
|
|
10981
|
+
const totalInterest = totalPaid - resolvedPrincipal;
|
|
10982
|
+
return {
|
|
10983
|
+
mode,
|
|
10984
|
+
structure,
|
|
10985
|
+
years,
|
|
10986
|
+
paymentsPerYear,
|
|
10987
|
+
periods,
|
|
10988
|
+
annualRatePercent,
|
|
10989
|
+
principal: round23(resolvedPrincipal),
|
|
10990
|
+
periodicPayout: round23(resolvedPayout),
|
|
10991
|
+
totalPaid: round23(totalPaid),
|
|
10992
|
+
totalInterest: round23(totalInterest)
|
|
10993
|
+
};
|
|
10994
|
+
}
|
|
10865
10995
|
function calculateRoi(input) {
|
|
10866
10996
|
const { initialValue, finalValue, years } = input;
|
|
10867
10997
|
if (!Number.isFinite(initialValue) || initialValue <= 0) {
|
|
@@ -17074,6 +17204,7 @@ __export(code_exports, {
|
|
|
17074
17204
|
validateEditorConfig: () => validateEditorConfig,
|
|
17075
17205
|
validateEnvKey: () => validateEnvKey2,
|
|
17076
17206
|
validateFenceLanguageTags: () => validateFenceLanguageTags,
|
|
17207
|
+
validateMermaidSyntax: () => validateMermaidSyntax,
|
|
17077
17208
|
validatePackageExports: () => validatePackageExports,
|
|
17078
17209
|
validateTsconfig: () => validateTsconfig
|
|
17079
17210
|
});
|
|
@@ -18980,6 +19111,123 @@ function lintDockerfile(content) {
|
|
|
18980
19111
|
}
|
|
18981
19112
|
return { findings, stages };
|
|
18982
19113
|
}
|
|
19114
|
+
var MERMAID_DIAGRAM_TYPES = {
|
|
19115
|
+
flowchart: "flowchart",
|
|
19116
|
+
graph: "flowchart",
|
|
19117
|
+
sequencediagram: "sequenceDiagram",
|
|
19118
|
+
classdiagram: "classDiagram",
|
|
19119
|
+
statediagram: "stateDiagram",
|
|
19120
|
+
"statediagram-v2": "stateDiagram",
|
|
19121
|
+
erdiagram: "erDiagram",
|
|
19122
|
+
pie: "pie"
|
|
19123
|
+
};
|
|
19124
|
+
var _MERMAID_ARROW_RE = /(-\.->|==>|--x|--o|-\.-|-->|---|===)/i;
|
|
19125
|
+
function _checkMermaidFlowchart(lines, fromLine, issues) {
|
|
19126
|
+
const subgraphStack = [];
|
|
19127
|
+
for (let i = fromLine; i < lines.length; i++) {
|
|
19128
|
+
const lineNo = i + 1;
|
|
19129
|
+
const trimmed = lines[i].split("%%")[0].trim();
|
|
19130
|
+
if (trimmed === "") continue;
|
|
19131
|
+
const firstToken = trimmed.split(/\s+/)[0];
|
|
19132
|
+
if (firstToken === "subgraph") {
|
|
19133
|
+
subgraphStack.push(lineNo);
|
|
19134
|
+
continue;
|
|
19135
|
+
}
|
|
19136
|
+
if (trimmed === "end") {
|
|
19137
|
+
if (subgraphStack.length === 0) {
|
|
19138
|
+
issues.push({ rule: "unexpected-end", line: lineNo, message: "'end' with no matching 'subgraph' to close" });
|
|
19139
|
+
} else {
|
|
19140
|
+
subgraphStack.pop();
|
|
19141
|
+
}
|
|
19142
|
+
continue;
|
|
19143
|
+
}
|
|
19144
|
+
const opens = (trimmed.match(/[[({]/g) || []).length;
|
|
19145
|
+
const closes = (trimmed.match(/[\])}]/g) || []).length;
|
|
19146
|
+
if (opens !== closes) {
|
|
19147
|
+
issues.push({
|
|
19148
|
+
rule: "unbalanced-brackets",
|
|
19149
|
+
line: lineNo,
|
|
19150
|
+
message: `Unbalanced brackets in node/edge definition: ${opens} opening vs ${closes} closing`
|
|
19151
|
+
});
|
|
19152
|
+
}
|
|
19153
|
+
const segments = trimmed.split(_MERMAID_ARROW_RE);
|
|
19154
|
+
if (segments.length > 1) {
|
|
19155
|
+
let missingNode = false;
|
|
19156
|
+
for (let s = 0; s < segments.length; s += 2) {
|
|
19157
|
+
if (segments[s].trim() === "") missingNode = true;
|
|
19158
|
+
}
|
|
19159
|
+
if (missingNode) {
|
|
19160
|
+
issues.push({ rule: "malformed-edge", line: lineNo, message: "Edge arrow is missing a node on one side" });
|
|
19161
|
+
}
|
|
19162
|
+
}
|
|
19163
|
+
}
|
|
19164
|
+
for (const openLine of subgraphStack) {
|
|
19165
|
+
issues.push({
|
|
19166
|
+
rule: "unterminated-subgraph",
|
|
19167
|
+
line: openLine,
|
|
19168
|
+
message: "'subgraph' opened here is never closed with a matching 'end'"
|
|
19169
|
+
});
|
|
19170
|
+
}
|
|
19171
|
+
}
|
|
19172
|
+
var _MERMAID_SEQ_DECL_RE = /^(participant|actor)\s+(\S+)/i;
|
|
19173
|
+
var _MERMAID_SEQ_MSG_RE = /^([A-Za-z0-9_]+)\s*(-{1,2}>{1,2}|-{1,2}x|-{1,2}\))\s*([A-Za-z0-9_]+)\s*:/i;
|
|
19174
|
+
function _checkMermaidSequenceDiagram(lines, fromLine, issues) {
|
|
19175
|
+
const declaredAtLine = {};
|
|
19176
|
+
for (let i = fromLine; i < lines.length; i++) {
|
|
19177
|
+
const trimmed = lines[i].split("%%")[0].trim();
|
|
19178
|
+
if (trimmed === "") continue;
|
|
19179
|
+
const m = trimmed.match(_MERMAID_SEQ_DECL_RE);
|
|
19180
|
+
if (m && declaredAtLine[m[2]] === void 0) declaredAtLine[m[2]] = i + 1;
|
|
19181
|
+
}
|
|
19182
|
+
for (let i = fromLine; i < lines.length; i++) {
|
|
19183
|
+
const lineNo = i + 1;
|
|
19184
|
+
const trimmed = lines[i].split("%%")[0].trim();
|
|
19185
|
+
if (trimmed === "") continue;
|
|
19186
|
+
const m = trimmed.match(_MERMAID_SEQ_MSG_RE);
|
|
19187
|
+
if (!m) continue;
|
|
19188
|
+
for (const id of [m[1], m[3]]) {
|
|
19189
|
+
const declaredLine = declaredAtLine[id];
|
|
19190
|
+
if (declaredLine !== void 0 && declaredLine > lineNo) {
|
|
19191
|
+
issues.push({
|
|
19192
|
+
rule: "participant-before-declared",
|
|
19193
|
+
line: lineNo,
|
|
19194
|
+
message: `Participant '${id}' is referenced here but not explicitly declared (with 'participant' or 'actor') until line ${declaredLine}`
|
|
19195
|
+
});
|
|
19196
|
+
}
|
|
19197
|
+
}
|
|
19198
|
+
}
|
|
19199
|
+
}
|
|
19200
|
+
function validateMermaidSyntax(input) {
|
|
19201
|
+
if (!input || !input.trim()) return { error: "Diagram text is required" };
|
|
19202
|
+
const lines = input.replace(/\r\n/g, "\n").split("\n");
|
|
19203
|
+
const issues = [];
|
|
19204
|
+
let headerLine = -1;
|
|
19205
|
+
let headerText = "";
|
|
19206
|
+
for (let i = 0; i < lines.length; i++) {
|
|
19207
|
+
const trimmed = lines[i].trim();
|
|
19208
|
+
if (trimmed === "" || trimmed.startsWith("%%")) continue;
|
|
19209
|
+
headerLine = i + 1;
|
|
19210
|
+
headerText = trimmed;
|
|
19211
|
+
break;
|
|
19212
|
+
}
|
|
19213
|
+
if (headerLine === -1) return { error: "Diagram text is required" };
|
|
19214
|
+
const firstWord = headerText.split(/\s+/)[0];
|
|
19215
|
+
const diagramType = MERMAID_DIAGRAM_TYPES[firstWord.toLowerCase()] ?? null;
|
|
19216
|
+
if (!diagramType) {
|
|
19217
|
+
issues.push({
|
|
19218
|
+
rule: "unrecognized-diagram-type",
|
|
19219
|
+
line: headerLine,
|
|
19220
|
+
message: `"${firstWord}" is not a recognized Mermaid diagram type (expected one of: flowchart/graph, sequenceDiagram, classDiagram, stateDiagram, erDiagram, pie)`
|
|
19221
|
+
});
|
|
19222
|
+
return { diagramType: null, valid: false, issues };
|
|
19223
|
+
}
|
|
19224
|
+
if (diagramType === "flowchart") {
|
|
19225
|
+
_checkMermaidFlowchart(lines, headerLine, issues);
|
|
19226
|
+
} else if (diagramType === "sequenceDiagram") {
|
|
19227
|
+
_checkMermaidSequenceDiagram(lines, headerLine, issues);
|
|
19228
|
+
}
|
|
19229
|
+
return { diagramType, valid: issues.length === 0, issues };
|
|
19230
|
+
}
|
|
18983
19231
|
function removeJsComments(code) {
|
|
18984
19232
|
let result = "";
|
|
18985
19233
|
let i = 0;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,13 +2,13 @@ export { j as json } from './json-Ca6gZCNB.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-xY5MJwr0.cjs';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-Cz1Q0sg0.cjs';
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.cjs';
|
|
7
7
|
export { t as time } from './time-VMAy_SrV.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-B6aXeGr6.cjs';
|
|
9
9
|
export { n as network } from './network-ylRtLPEs.cjs';
|
|
10
10
|
export { a as api } from './api-CQnIUrVB.cjs';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-DvJYYTea.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-Ca6gZCNB.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-xY5MJwr0.js';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-Cz1Q0sg0.js';
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.js';
|
|
7
7
|
export { t as time } from './time-VMAy_SrV.js';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-B6aXeGr6.js';
|
|
9
9
|
export { n as network } from './network-ylRtLPEs.js';
|
|
10
10
|
export { a as api } from './api-CQnIUrVB.js';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-DvJYYTea.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-ZWFZRDQ4.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-LKFMBUJZ.js';
|
|
3
3
|
export { network_exports as network } from './chunk-SW3J5CAI.js';
|
|
4
4
|
export { api_exports as api } from './chunk-U2HREMZU.js';
|
|
5
|
-
export { code_exports as code } from './chunk-
|
|
5
|
+
export { code_exports as code } from './chunk-KYBI62YY.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-WUOZHCIC.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-FB6CCFR5.js';
|
|
14
|
-
export { data_exports as data } from './chunk-
|
|
14
|
+
export { data_exports as data } from './chunk-CUQDHXUX.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-422ICOZX.js';
|
|
16
16
|
export { time_exports as time } from './chunk-6EJVNQSY.js';
|
|
17
17
|
import './chunk-MLKGABMK.js';
|