@utilix-tech/sdk 0.92.0 → 0.94.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 +17 -2
- package/dist/{chunk-K3B4JTHN.js → chunk-K242OOF4.js} +111 -1
- package/dist/{chunk-KYBI62YY.js → chunk-KRPIOHJ4.js} +207 -1
- package/dist/{code-DvJYYTea.d.cts → code-CZHElFHu.d.cts} +69 -2
- package/dist/{code-DvJYYTea.d.ts → code-CZHElFHu.d.ts} +69 -2
- package/dist/index.cjs +316 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{network-9j5aKpoR.d.cts → network-B6fQrsCc.d.cts} +47 -2
- package/dist/{network-9j5aKpoR.d.ts → network-B6fQrsCc.d.ts} +47 -2
- package/dist/tools/code.cjs +206 -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/network.cjs +110 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/package.json +2 -2
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
* - sql-placeholder-counter (countSqlPlaceholders)
|
|
38
38
|
* - regex-character-class-builder (buildCharacterClass)
|
|
39
39
|
* - mermaid-syntax-validator (validateMermaidSyntax)
|
|
40
|
+
* - lockfile-duplicate-version-reporter (findDuplicateLockfileVersions, detectLockfileFormat)
|
|
41
|
+
* - git-diff-stat-summarizer (summarizeGitDiffStat)
|
|
40
42
|
*/
|
|
41
43
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
42
44
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -835,6 +837,62 @@ interface CharClassResult {
|
|
|
835
837
|
declare function buildCharacterClass(options: CharClassOptions): CharClassResult | {
|
|
836
838
|
error: string;
|
|
837
839
|
};
|
|
840
|
+
type LockfileFormat = 'npm' | 'yarn' | 'pnpm';
|
|
841
|
+
interface LockfileVersionInstance {
|
|
842
|
+
version: string;
|
|
843
|
+
count: number;
|
|
844
|
+
}
|
|
845
|
+
interface LockfilePackageEntry {
|
|
846
|
+
name: string;
|
|
847
|
+
versions: LockfileVersionInstance[];
|
|
848
|
+
isDuplicate: boolean;
|
|
849
|
+
}
|
|
850
|
+
interface LockfileDuplicateReport {
|
|
851
|
+
format: LockfileFormat;
|
|
852
|
+
totalPackages: number;
|
|
853
|
+
duplicatePackages: LockfilePackageEntry[];
|
|
854
|
+
packages: LockfilePackageEntry[];
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Detect whether lockfile text is npm's package-lock.json, a classic
|
|
858
|
+
* yarn.lock, or a pnpm-lock.yaml, from its content alone.
|
|
859
|
+
*/
|
|
860
|
+
declare function detectLockfileFormat(input: string): LockfileFormat | null;
|
|
861
|
+
/**
|
|
862
|
+
* Parse an npm (package-lock.json), yarn (yarn.lock), or pnpm (pnpm-lock.yaml)
|
|
863
|
+
* lockfile and report every package installed at more than one resolved
|
|
864
|
+
* version, with a count of how many install locations resolve to each
|
|
865
|
+
* version. Format is auto-detected from content unless given explicitly.
|
|
866
|
+
*/
|
|
867
|
+
declare function findDuplicateLockfileVersions(input: string, format?: LockfileFormat): LockfileDuplicateReport | {
|
|
868
|
+
error: string;
|
|
869
|
+
};
|
|
870
|
+
interface GitDiffStatFileEntry {
|
|
871
|
+
file: string;
|
|
872
|
+
oldFile?: string;
|
|
873
|
+
changes: number | null;
|
|
874
|
+
insertions: number | null;
|
|
875
|
+
deletions: number | null;
|
|
876
|
+
binary: boolean;
|
|
877
|
+
approximate: boolean;
|
|
878
|
+
}
|
|
879
|
+
interface GitDiffStatSummary {
|
|
880
|
+
files: GitDiffStatFileEntry[];
|
|
881
|
+
filesChanged: number;
|
|
882
|
+
totalInsertions: number;
|
|
883
|
+
totalDeletions: number;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Parse the per-file lines and trailing summary line of `git diff --stat`
|
|
887
|
+
* or `git log --stat` output into structured insertion/deletion counts.
|
|
888
|
+
* The number before each file's bar is always exact; the bar's +/- split
|
|
889
|
+
* is scaled down by git once a diff is wide enough, in which case the
|
|
890
|
+
* split below is a proportional estimate (flagged via `approximate`) rather
|
|
891
|
+
* than an exact count.
|
|
892
|
+
*/
|
|
893
|
+
declare function summarizeGitDiffStat(input: string): GitDiffStatSummary | {
|
|
894
|
+
error: string;
|
|
895
|
+
};
|
|
838
896
|
|
|
839
897
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
840
898
|
type code_ApiEndpoint = ApiEndpoint;
|
|
@@ -881,6 +939,8 @@ type code_FenceTagIssueType = FenceTagIssueType;
|
|
|
881
939
|
type code_FenceValidationResult = FenceValidationResult;
|
|
882
940
|
type code_GitCommandConfig = GitCommandConfig;
|
|
883
941
|
type code_GitCommandResult = GitCommandResult;
|
|
942
|
+
type code_GitDiffStatFileEntry = GitDiffStatFileEntry;
|
|
943
|
+
type code_GitDiffStatSummary = GitDiffStatSummary;
|
|
884
944
|
type code_GitOperation = GitOperation;
|
|
885
945
|
type code_GithubUrlInfo = GithubUrlInfo;
|
|
886
946
|
type code_GithubUrlType = GithubUrlType;
|
|
@@ -894,6 +954,10 @@ type code_JsMinifyResult = JsMinifyResult;
|
|
|
894
954
|
declare const code_KNOWN_LANGUAGE_TAGS: typeof KNOWN_LANGUAGE_TAGS;
|
|
895
955
|
type code_LinkReferenceDefinition = LinkReferenceDefinition;
|
|
896
956
|
type code_LinkReferenceUsage = LinkReferenceUsage;
|
|
957
|
+
type code_LockfileDuplicateReport = LockfileDuplicateReport;
|
|
958
|
+
type code_LockfileFormat = LockfileFormat;
|
|
959
|
+
type code_LockfilePackageEntry = LockfilePackageEntry;
|
|
960
|
+
type code_LockfileVersionInstance = LockfileVersionInstance;
|
|
897
961
|
declare const code_MIME_TABLE: typeof MIME_TABLE;
|
|
898
962
|
type code_MarkdownFootnoteDefinition = MarkdownFootnoteDefinition;
|
|
899
963
|
type code_MarkdownFootnoteReference = MarkdownFootnoteReference;
|
|
@@ -945,6 +1009,7 @@ declare const code_countProperties: typeof countProperties;
|
|
|
945
1009
|
declare const code_countRules: typeof countRules;
|
|
946
1010
|
declare const code_countSqlPlaceholders: typeof countSqlPlaceholders;
|
|
947
1011
|
declare const code_detectDialect: typeof detectDialect;
|
|
1012
|
+
declare const code_detectLockfileFormat: typeof detectLockfileFormat;
|
|
948
1013
|
declare const code_detectOperationType: typeof detectOperationType;
|
|
949
1014
|
declare const code_detectRedos: typeof detectRedos;
|
|
950
1015
|
declare const code_envToExport: typeof envToExport;
|
|
@@ -952,6 +1017,7 @@ declare const code_envToJson: typeof envToJson;
|
|
|
952
1017
|
declare const code_extractMarkdownFootnotes: typeof extractMarkdownFootnotes;
|
|
953
1018
|
declare const code_extractMarkdownLinkReferences: typeof extractMarkdownLinkReferences;
|
|
954
1019
|
declare const code_extractSvgSpriteSymbols: typeof extractSvgSpriteSymbols;
|
|
1020
|
+
declare const code_findDuplicateLockfileVersions: typeof findDuplicateLockfileVersions;
|
|
955
1021
|
declare const code_formatCss: typeof formatCss;
|
|
956
1022
|
declare const code_formatGql: typeof formatGql;
|
|
957
1023
|
declare const code_formatHtml: typeof formatHtml;
|
|
@@ -985,6 +1051,7 @@ declare const code_removeRedundantAttributes: typeof removeRedundantAttributes;
|
|
|
985
1051
|
declare const code_searchCheatsheet: typeof searchCheatsheet;
|
|
986
1052
|
declare const code_searchEndpoints: typeof searchEndpoints;
|
|
987
1053
|
declare const code_splitStatements: typeof splitStatements;
|
|
1054
|
+
declare const code_summarizeGitDiffStat: typeof summarizeGitDiffStat;
|
|
988
1055
|
declare const code_testGitignorePatterns: typeof testGitignorePatterns;
|
|
989
1056
|
declare const code_testPattern: typeof testPattern;
|
|
990
1057
|
declare const code_testRegex: typeof testRegex;
|
|
@@ -996,7 +1063,7 @@ declare const code_validateMermaidSyntax: typeof validateMermaidSyntax;
|
|
|
996
1063
|
declare const code_validatePackageExports: typeof validatePackageExports;
|
|
997
1064
|
declare const code_validateTsconfig: typeof validateTsconfig;
|
|
998
1065
|
declare namespace code {
|
|
999
|
-
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, type code_AriaIssue as AriaIssue, type code_AriaValidationResult as AriaValidationResult, code_CHEATSHEET as CHEATSHEET, type code_CharClassOptions as CharClassOptions, type code_CharClassResult as CharClassResult, type code_CheatsheetEntry as CheatsheetEntry, type code_CommitTrailer as CommitTrailer, type code_CommitTrailerResult as CommitTrailerResult, type code_ConnectionStringHost as ConnectionStringHost, type code_ConnectionStringResult as ConnectionStringResult, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DependencyAuditDuplicate as DependencyAuditDuplicate, type code_DependencyAuditEntry as DependencyAuditEntry, type code_DependencyAuditIssue as DependencyAuditIssue, type code_DependencyAuditResult as DependencyAuditResult, type code_DependencyRangeType as DependencyRangeType, type code_DependencySection as DependencySection, type code_DockerImageRef as DockerImageRef, type code_DockerfileLintFinding as DockerfileLintFinding, type code_DockerfileLintResult as DockerfileLintResult, type code_DockerfileStage as DockerfileStage, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_FenceTagIssue as FenceTagIssue, type code_FenceTagIssueType as FenceTagIssueType, type code_FenceValidationResult as FenceValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_KNOWN_LANGUAGE_TAGS as KNOWN_LANGUAGE_TAGS, type code_LinkReferenceDefinition as LinkReferenceDefinition, type code_LinkReferenceUsage as LinkReferenceUsage, code_MIME_TABLE as MIME_TABLE, type code_MarkdownFootnoteDefinition as MarkdownFootnoteDefinition, type code_MarkdownFootnoteReference as MarkdownFootnoteReference, type code_MarkdownFootnoteResult as MarkdownFootnoteResult, type code_MarkdownLinkReferenceResult as MarkdownLinkReferenceResult, type code_MatchResult as MatchResult, type code_MermaidSyntaxIssue as MermaidSyntaxIssue, type code_MermaidSyntaxResult as MermaidSyntaxResult, type code_MermaidSyntaxRule as MermaidSyntaxRule, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_PlaceholderStyle as PlaceholderStyle, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexBackreferenceInfo as RegexBackreferenceInfo, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexGroupAnalysis as RegexGroupAnalysis, type code_RegexGroupInfo as RegexGroupInfo, type code_RegexGroupIssue as RegexGroupIssue, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, type code_ResolvedLinkReference as ResolvedLinkReference, 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_SqlPlaceholder as SqlPlaceholder, type code_SqlPlaceholderResult as SqlPlaceholderResult, type code_SvgSpriteResult as SvgSpriteResult, type code_SvgSpriteSymbol as SvgSpriteSymbol, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_analyzeRegexGroups as analyzeRegexGroups, code_auditDependencyRanges as auditDependencyRanges, code_buildCharacterClass as buildCharacterClass, 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_countSqlPlaceholders as countSqlPlaceholders, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_extractMarkdownFootnotes as extractMarkdownFootnotes, code_extractMarkdownLinkReferences as extractMarkdownLinkReferences, code_extractSvgSpriteSymbols as extractSvgSpriteSymbols, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lintDockerfile as lintDockerfile, 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_parseCommitTrailers as parseCommitTrailers, code_parseConnectionString as parseConnectionString, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateAria as validateAria, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validateFenceLanguageTags as validateFenceLanguageTags, code_validateMermaidSyntax as validateMermaidSyntax, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
|
|
1066
|
+
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, type code_AriaIssue as AriaIssue, type code_AriaValidationResult as AriaValidationResult, code_CHEATSHEET as CHEATSHEET, type code_CharClassOptions as CharClassOptions, type code_CharClassResult as CharClassResult, type code_CheatsheetEntry as CheatsheetEntry, type code_CommitTrailer as CommitTrailer, type code_CommitTrailerResult as CommitTrailerResult, type code_ConnectionStringHost as ConnectionStringHost, type code_ConnectionStringResult as ConnectionStringResult, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DependencyAuditDuplicate as DependencyAuditDuplicate, type code_DependencyAuditEntry as DependencyAuditEntry, type code_DependencyAuditIssue as DependencyAuditIssue, type code_DependencyAuditResult as DependencyAuditResult, type code_DependencyRangeType as DependencyRangeType, type code_DependencySection as DependencySection, type code_DockerImageRef as DockerImageRef, type code_DockerfileLintFinding as DockerfileLintFinding, type code_DockerfileLintResult as DockerfileLintResult, type code_DockerfileStage as DockerfileStage, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_FenceTagIssue as FenceTagIssue, type code_FenceTagIssueType as FenceTagIssueType, type code_FenceValidationResult as FenceValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitDiffStatFileEntry as GitDiffStatFileEntry, type code_GitDiffStatSummary as GitDiffStatSummary, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_KNOWN_LANGUAGE_TAGS as KNOWN_LANGUAGE_TAGS, type code_LinkReferenceDefinition as LinkReferenceDefinition, type code_LinkReferenceUsage as LinkReferenceUsage, type code_LockfileDuplicateReport as LockfileDuplicateReport, type code_LockfileFormat as LockfileFormat, type code_LockfilePackageEntry as LockfilePackageEntry, type code_LockfileVersionInstance as LockfileVersionInstance, code_MIME_TABLE as MIME_TABLE, type code_MarkdownFootnoteDefinition as MarkdownFootnoteDefinition, type code_MarkdownFootnoteReference as MarkdownFootnoteReference, type code_MarkdownFootnoteResult as MarkdownFootnoteResult, type code_MarkdownLinkReferenceResult as MarkdownLinkReferenceResult, type code_MatchResult as MatchResult, type code_MermaidSyntaxIssue as MermaidSyntaxIssue, type code_MermaidSyntaxResult as MermaidSyntaxResult, type code_MermaidSyntaxRule as MermaidSyntaxRule, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_PlaceholderStyle as PlaceholderStyle, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexBackreferenceInfo as RegexBackreferenceInfo, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexGroupAnalysis as RegexGroupAnalysis, type code_RegexGroupInfo as RegexGroupInfo, type code_RegexGroupIssue as RegexGroupIssue, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, type code_ResolvedLinkReference as ResolvedLinkReference, 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_SqlPlaceholder as SqlPlaceholder, type code_SqlPlaceholderResult as SqlPlaceholderResult, type code_SvgSpriteResult as SvgSpriteResult, type code_SvgSpriteSymbol as SvgSpriteSymbol, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_analyzeRegexGroups as analyzeRegexGroups, code_auditDependencyRanges as auditDependencyRanges, code_buildCharacterClass as buildCharacterClass, 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_countSqlPlaceholders as countSqlPlaceholders, code_detectDialect as detectDialect, code_detectLockfileFormat as detectLockfileFormat, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_extractMarkdownFootnotes as extractMarkdownFootnotes, code_extractMarkdownLinkReferences as extractMarkdownLinkReferences, code_extractSvgSpriteSymbols as extractSvgSpriteSymbols, code_findDuplicateLockfileVersions as findDuplicateLockfileVersions, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lintDockerfile as lintDockerfile, 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_parseCommitTrailers as parseCommitTrailers, code_parseConnectionString as parseConnectionString, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_summarizeGitDiffStat as summarizeGitDiffStat, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateAria as validateAria, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validateFenceLanguageTags as validateFenceLanguageTags, code_validateMermaidSyntax as validateMermaidSyntax, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
|
|
1000
1067
|
}
|
|
1001
1068
|
|
|
1002
|
-
export { type
|
|
1069
|
+
export { type HtmlFormatResult as $, ALL_FLAGS as A, type DockerfileLintFinding as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type DockerfileLintResult as E, type DockerfileStage as F, type EditorConfigIssue as G, type EditorConfigProperty as H, type EditorConfigSection as I, type EditorConfigValidationResult as J, type EnvEntry as K, type EnvParseResult as L, type ExportsIssue as M, type ExportsShape as N, type ExportsValidationResult as O, type FenceTagIssue as P, type FenceTagIssueType as Q, type FenceValidationResult as R, type GitCommandConfig as S, type GitCommandResult as T, type GitDiffStatFileEntry as U, type GitDiffStatSummary as V, type GitOperation as W, type GithubUrlInfo as X, type GithubUrlType as Y, type GitignoreTestResult as Z, type GqlFormatResult as _, type ApiEndpoint as a, detectOperationType as a$, type HtmlMinifyOptions as a0, type HtmlMinifyResult as a1, type JsMinifyOptions as a2, type JsMinifyResult as a3, KNOWN_LANGUAGE_TAGS as a4, type LinkReferenceDefinition as a5, type LinkReferenceUsage as a6, type LockfileDuplicateReport as a7, type LockfileFormat as a8, type LockfilePackageEntry as a9, type RegexSuccess as aA, type ResolvedLinkReference as aB, SQL_DEFAULT_OPTIONS as aC, type Segment as aD, type SpecVersion as aE, type SqlDialect as aF, type SqlFormatOptions as aG, type SqlPlaceholder as aH, type SqlPlaceholderResult as aI, type SvgSpriteResult as aJ, type SvgSpriteSymbol as aK, type TestPatternResult as aL, type TsconfigIssue as aM, type TsconfigValidationResult as aN, analyzeRegexGroups as aO, auditDependencyRanges as aP, buildCharacterClass as aQ, buildDockerPull as aR, buildDockerRun as aS, buildGitCommand as aT, collapseHtmlWhitespace as aU, collapseJsWhitespace as aV, countProperties as aW, countRules as aX, countSqlPlaceholders as aY, detectDialect as aZ, detectLockfileFormat as a_, type LockfileVersionInstance as aa, MIME_TABLE as ab, type MarkdownFootnoteDefinition as ac, type MarkdownFootnoteReference as ad, type MarkdownFootnoteResult as ae, type MarkdownLinkReferenceResult as af, type MatchResult as ag, type MermaidSyntaxIssue as ah, type MermaidSyntaxResult as ai, type MermaidSyntaxRule as aj, type MimeEntry as ak, type MimeLookupResult as al, OPERATIONS as am, type ParsedSpec as an, type PlaceholderStyle as ao, type RedosFinding as ap, type RedosResult as aq, type RedosSeverity as ar, type RegexBackreferenceInfo as as, type RegexError as at, type RegexFlag as au, type RegexGroupAnalysis as av, type RegexGroupInfo as aw, type RegexGroupIssue as ax, type RegexMatch as ay, type RegexResult as az, type ApiInfo as b, detectRedos as b0, envToExport as b1, envToJson as b2, extractMarkdownFootnotes as b3, extractMarkdownLinkReferences as b4, extractSvgSpriteSymbols as b5, findDuplicateLockfileVersions as b6, formatCss as b7, formatGql as b8, formatHtml as b9, removeRedundantAttributes as bA, searchCheatsheet as bB, searchEndpoints as bC, splitStatements as bD, summarizeGitDiffStat as bE, testGitignorePatterns as bF, testPattern as bG, testRegex as bH, validateAria as bI, validateEditorConfig as bJ, validateEnvKey as bK, validateFenceLanguageTags as bL, validateMermaidSyntax as bM, validatePackageExports as bN, validateTsconfig as bO, formatSql as ba, getEndpointsByTag as bb, getHtmlStats as bc, getJsStats as bd, getMethodColor as be, isValidTag as bf, lintConventionalCommit as bg, lintDockerfile as bh, lookupMime as bi, minifyCss as bj, minifyGql as bk, minifyHtml as bl, minifyJs as bm, minifySql as bn, normalizeRef as bo, parseCommitTrailers as bp, parseConnectionString as bq, parseDockerImage as br, parseEnv as bs, parseGitCommand as bt, parseGithubUrl as bu, parseSpec as bv, removeConsoleCalls as bw, removeEmptyAttributes as bx, removeHtmlComments as by, removeJsComments as bz, code as c, type AriaIssue as d, type AriaValidationResult as e, type CharClassOptions as f, type CharClassResult as g, type CheatsheetEntry as h, type CommitTrailer as i, type CommitTrailerResult as j, type ConnectionStringHost as k, type ConnectionStringResult as l, type ConventionalCommitFinding as m, type ConventionalCommitFooter as n, type ConventionalCommitOptions as o, type ConventionalCommitParsed as p, type ConventionalCommitResult as q, type ConventionalCommitSeverity as r, type CssResult as s, type DependencyAuditDuplicate as t, type DependencyAuditEntry as u, type DependencyAuditIssue as v, type DependencyAuditResult as w, type DependencyRangeType as x, type DependencySection as y, type DockerImageRef as z };
|
package/dist/index.cjs
CHANGED
|
@@ -12483,6 +12483,7 @@ __export(network_exports, {
|
|
|
12483
12483
|
analyzeEmailHeaders: () => analyzeEmailHeaders,
|
|
12484
12484
|
assessContentTypeRisk: () => assessContentTypeRisk,
|
|
12485
12485
|
buildAcceptLanguage: () => buildAcceptLanguage,
|
|
12486
|
+
buildAltSvcHeader: () => buildAltSvcHeader,
|
|
12486
12487
|
buildCacheControl: () => buildCacheControl,
|
|
12487
12488
|
buildClearSiteData: () => buildClearSiteData,
|
|
12488
12489
|
buildClientHints: () => buildClientHints,
|
|
@@ -12525,6 +12526,7 @@ __export(network_exports, {
|
|
|
12525
12526
|
lookupCloseCode: () => lookupCloseCode,
|
|
12526
12527
|
lookupOpcode: () => lookupOpcode,
|
|
12527
12528
|
parseAcceptLanguage: () => parseAcceptLanguage,
|
|
12529
|
+
parseAltSvcHeader: () => parseAltSvcHeader,
|
|
12528
12530
|
parseClearSiteData: () => parseClearSiteData,
|
|
12529
12531
|
parseClientHintHeaders: () => parseClientHintHeaders,
|
|
12530
12532
|
parseContentDisposition: () => parseContentDisposition,
|
|
@@ -16180,6 +16182,114 @@ function parseClearSiteData(raw) {
|
|
|
16180
16182
|
}
|
|
16181
16183
|
return buildClearSiteData(directives);
|
|
16182
16184
|
}
|
|
16185
|
+
var ALT_SVC_DEFAULT_MAX_AGE = 86400;
|
|
16186
|
+
var ALT_SVC_DEPRECATED_H3_DRAFTS = /* @__PURE__ */ new Set(["h3-29", "h3-27", "h3-25", "h3-24", "h3-23", "h3-22"]);
|
|
16187
|
+
var ALT_SVC_PROTOCOL_NOTES = {
|
|
16188
|
+
"h3": "HTTP/3 over QUIC, the current protocol ID clients should be offered.",
|
|
16189
|
+
"h3-29": 'An outdated HTTP/3 draft version (draft-29); modern clients only match "h3".',
|
|
16190
|
+
"h3-27": 'An outdated HTTP/3 draft version (draft-27); modern clients only match "h3".',
|
|
16191
|
+
"h3-25": 'An outdated HTTP/3 draft version (draft-25); modern clients only match "h3".',
|
|
16192
|
+
"h2": "HTTP/2 over TLS.",
|
|
16193
|
+
"h2c": "HTTP/2 over cleartext TCP; rarely advertised via Alt-Svc since it needs an out-of-band upgrade rather than ALPN negotiation.",
|
|
16194
|
+
"http/1.1": "Plain HTTP/1.1; advertising it via Alt-Svc is unusual since it is already the universal fallback."
|
|
16195
|
+
};
|
|
16196
|
+
function buildAltSvcHeader(alternatives) {
|
|
16197
|
+
if (!Array.isArray(alternatives) || alternatives.length === 0) {
|
|
16198
|
+
return { error: "At least one alternative service is required" };
|
|
16199
|
+
}
|
|
16200
|
+
const warnings = [];
|
|
16201
|
+
const entries = [];
|
|
16202
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16203
|
+
for (const alt of alternatives) {
|
|
16204
|
+
const protocolId = typeof alt.protocolId === "string" ? alt.protocolId.trim() : "";
|
|
16205
|
+
if (!protocolId) return { error: 'Each alternative needs a protocol-id (e.g. "h3")' };
|
|
16206
|
+
if (!Number.isInteger(alt.port) || alt.port < 1 || alt.port > 65535) {
|
|
16207
|
+
return { error: `Each alternative needs a valid port (1-65535), got ${JSON.stringify(alt.port)}` };
|
|
16208
|
+
}
|
|
16209
|
+
const host = alt.host?.trim();
|
|
16210
|
+
const authority = `${host ?? ""}:${alt.port}`;
|
|
16211
|
+
const maxAge = alt.maxAge !== void 0 ? alt.maxAge : ALT_SVC_DEFAULT_MAX_AGE;
|
|
16212
|
+
if (!Number.isFinite(maxAge) || maxAge < 0) return { error: "maxAge must be a non-negative number of seconds" };
|
|
16213
|
+
const persist = alt.persist === true;
|
|
16214
|
+
const dedupeKey = `${protocolId.toLowerCase()}|${authority.toLowerCase()}`;
|
|
16215
|
+
if (seen.has(dedupeKey)) {
|
|
16216
|
+
warnings.push(`duplicate alternative "${protocolId}=${JSON.stringify(authority)}" was removed`);
|
|
16217
|
+
continue;
|
|
16218
|
+
}
|
|
16219
|
+
seen.add(dedupeKey);
|
|
16220
|
+
if (maxAge === 0) warnings.push(`"${protocolId}" has ma=0, so clients should treat it as already expired`);
|
|
16221
|
+
if (persist && maxAge === 0) warnings.push(`"${protocolId}" sets persist=1 with ma=0, which is contradictory: the entry expires immediately`);
|
|
16222
|
+
if (ALT_SVC_DEPRECATED_H3_DRAFTS.has(protocolId.toLowerCase())) {
|
|
16223
|
+
warnings.push(`"${protocolId}" is an outdated HTTP/3 draft protocol-id; modern clients only match "h3"`);
|
|
16224
|
+
}
|
|
16225
|
+
const note = ALT_SVC_PROTOCOL_NOTES[protocolId.toLowerCase()] ?? `Advertises "${protocolId}" as an alternative protocol clients may switch to for this authority.`;
|
|
16226
|
+
entries.push({ protocolId, authority, maxAge, persist, note });
|
|
16227
|
+
}
|
|
16228
|
+
if (entries.length === 0) return { error: "At least one alternative service is required" };
|
|
16229
|
+
const headerValue = entries.map((e) => {
|
|
16230
|
+
let s = `${e.protocolId}="${e.authority}"; ma=${e.maxAge}`;
|
|
16231
|
+
if (e.persist) s += "; persist=1";
|
|
16232
|
+
return s;
|
|
16233
|
+
}).join(", ");
|
|
16234
|
+
return { header: `Alt-Svc: ${headerValue}`, headerValue, entries, cleared: false, warnings };
|
|
16235
|
+
}
|
|
16236
|
+
function altSvcSplitTopLevel(s, sep) {
|
|
16237
|
+
const out = [];
|
|
16238
|
+
let inQuotes = false;
|
|
16239
|
+
let current = "";
|
|
16240
|
+
for (const ch of s) {
|
|
16241
|
+
if (ch === '"') inQuotes = !inQuotes;
|
|
16242
|
+
if (ch === sep && !inQuotes) {
|
|
16243
|
+
out.push(current);
|
|
16244
|
+
current = "";
|
|
16245
|
+
} else {
|
|
16246
|
+
current += ch;
|
|
16247
|
+
}
|
|
16248
|
+
}
|
|
16249
|
+
out.push(current);
|
|
16250
|
+
return out;
|
|
16251
|
+
}
|
|
16252
|
+
function parseAltSvcHeader(raw) {
|
|
16253
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
16254
|
+
const withoutLabel = raw.trim().replace(/^alt-svc:\s*/i, "");
|
|
16255
|
+
if (withoutLabel.toLowerCase() === "clear") {
|
|
16256
|
+
return { header: "Alt-Svc: clear", headerValue: "clear", entries: [], cleared: true, warnings: [] };
|
|
16257
|
+
}
|
|
16258
|
+
const parts = altSvcSplitTopLevel(withoutLabel, ",");
|
|
16259
|
+
const alternatives = [];
|
|
16260
|
+
for (const part of parts) {
|
|
16261
|
+
const trimmedPart = part.trim();
|
|
16262
|
+
if (!trimmedPart) continue;
|
|
16263
|
+
const eq = trimmedPart.indexOf("=");
|
|
16264
|
+
if (eq === -1) return { error: `Could not parse alternative: "${trimmedPart}"` };
|
|
16265
|
+
const protocolId = trimmedPart.slice(0, eq).trim();
|
|
16266
|
+
const rest = trimmedPart.slice(eq + 1).trim();
|
|
16267
|
+
const segments = altSvcSplitTopLevel(rest, ";").map((s) => s.trim());
|
|
16268
|
+
const authorityMatch = segments[0]?.match(/^"(.*)"$/);
|
|
16269
|
+
if (!authorityMatch) return { error: `Alternative "${protocolId}" is missing a quoted authority (e.g. ":443")` };
|
|
16270
|
+
const authority = authorityMatch[1];
|
|
16271
|
+
const colonIdx = authority.lastIndexOf(":");
|
|
16272
|
+
if (colonIdx === -1) return { error: `Alternative "${protocolId}" has an authority with no port: "${authority}"` };
|
|
16273
|
+
const host = authority.slice(0, colonIdx) || void 0;
|
|
16274
|
+
const portStr = authority.slice(colonIdx + 1);
|
|
16275
|
+
const port = Number(portStr);
|
|
16276
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) return { error: `Alternative "${protocolId}" has an invalid port: "${portStr}"` };
|
|
16277
|
+
let maxAge;
|
|
16278
|
+
let persist = false;
|
|
16279
|
+
for (const seg of segments.slice(1)) {
|
|
16280
|
+
const sepIdx = seg.indexOf("=");
|
|
16281
|
+
if (sepIdx === -1) continue;
|
|
16282
|
+
const key = seg.slice(0, sepIdx).trim().toLowerCase();
|
|
16283
|
+
const value = seg.slice(sepIdx + 1).trim();
|
|
16284
|
+
if (key === "ma") maxAge = Number(value);
|
|
16285
|
+
if (key === "persist") persist = value === "1";
|
|
16286
|
+
}
|
|
16287
|
+
if (maxAge !== void 0 && !Number.isFinite(maxAge)) return { error: `Alternative "${protocolId}" has a non-numeric ma value` };
|
|
16288
|
+
alternatives.push({ protocolId, host, port, maxAge, persist });
|
|
16289
|
+
}
|
|
16290
|
+
if (alternatives.length === 0) return { error: "No alternative services found" };
|
|
16291
|
+
return buildAltSvcHeader(alternatives);
|
|
16292
|
+
}
|
|
16183
16293
|
|
|
16184
16294
|
// src/tools/api.ts
|
|
16185
16295
|
var api_exports = {};
|
|
@@ -17617,6 +17727,7 @@ __export(code_exports, {
|
|
|
17617
17727
|
countRules: () => countRules,
|
|
17618
17728
|
countSqlPlaceholders: () => countSqlPlaceholders,
|
|
17619
17729
|
detectDialect: () => detectDialect,
|
|
17730
|
+
detectLockfileFormat: () => detectLockfileFormat,
|
|
17620
17731
|
detectOperationType: () => detectOperationType,
|
|
17621
17732
|
detectRedos: () => detectRedos,
|
|
17622
17733
|
envToExport: () => envToExport2,
|
|
@@ -17624,6 +17735,7 @@ __export(code_exports, {
|
|
|
17624
17735
|
extractMarkdownFootnotes: () => extractMarkdownFootnotes,
|
|
17625
17736
|
extractMarkdownLinkReferences: () => extractMarkdownLinkReferences,
|
|
17626
17737
|
extractSvgSpriteSymbols: () => extractSvgSpriteSymbols,
|
|
17738
|
+
findDuplicateLockfileVersions: () => findDuplicateLockfileVersions,
|
|
17627
17739
|
formatCss: () => formatCss,
|
|
17628
17740
|
formatGql: () => formatGql,
|
|
17629
17741
|
formatHtml: () => formatHtml,
|
|
@@ -17657,6 +17769,7 @@ __export(code_exports, {
|
|
|
17657
17769
|
searchCheatsheet: () => searchCheatsheet,
|
|
17658
17770
|
searchEndpoints: () => searchEndpoints,
|
|
17659
17771
|
splitStatements: () => splitStatements,
|
|
17772
|
+
summarizeGitDiffStat: () => summarizeGitDiffStat,
|
|
17660
17773
|
testGitignorePatterns: () => testGitignorePatterns,
|
|
17661
17774
|
testPattern: () => testPattern,
|
|
17662
17775
|
testRegex: () => testRegex,
|
|
@@ -22211,6 +22324,209 @@ function buildCharacterClass(options) {
|
|
|
22211
22324
|
const pattern = `[${negate ? "^" : ""}${parts.join("")}]`;
|
|
22212
22325
|
return { pattern, negate, includes };
|
|
22213
22326
|
}
|
|
22327
|
+
function detectLockfileFormat(input) {
|
|
22328
|
+
const trimmed = input.trim();
|
|
22329
|
+
if (trimmed.startsWith("{")) return "npm";
|
|
22330
|
+
if (/^lockfileVersion:/m.test(trimmed) || /^packages:\s*$/m.test(trimmed)) return "pnpm";
|
|
22331
|
+
if (/yarn lockfile v\d/i.test(trimmed)) return "yarn";
|
|
22332
|
+
if (/^\s*version\s+"[^"]+"/m.test(trimmed) && /@[^\s",]+["']?\s*:?\s*$/m.test(trimmed)) return "yarn";
|
|
22333
|
+
return null;
|
|
22334
|
+
}
|
|
22335
|
+
function parseNpmLockfile(input) {
|
|
22336
|
+
const data = JSON.parse(input);
|
|
22337
|
+
const entries = [];
|
|
22338
|
+
const packages = data.packages;
|
|
22339
|
+
if (packages && typeof packages === "object" && !Array.isArray(packages)) {
|
|
22340
|
+
for (const [path, metaRaw] of Object.entries(packages)) {
|
|
22341
|
+
if (path === "" || !metaRaw || typeof metaRaw !== "object") continue;
|
|
22342
|
+
const meta = metaRaw;
|
|
22343
|
+
if (typeof meta.version !== "string") continue;
|
|
22344
|
+
const idx = path.lastIndexOf("node_modules/");
|
|
22345
|
+
const name = idx === -1 ? path : path.slice(idx + "node_modules/".length);
|
|
22346
|
+
entries.push({ name, version: meta.version });
|
|
22347
|
+
}
|
|
22348
|
+
return entries;
|
|
22349
|
+
}
|
|
22350
|
+
const dependencies = data.dependencies;
|
|
22351
|
+
if (dependencies && typeof dependencies === "object" && !Array.isArray(dependencies)) {
|
|
22352
|
+
const walk = (deps) => {
|
|
22353
|
+
for (const [name, metaRaw] of Object.entries(deps)) {
|
|
22354
|
+
if (!metaRaw || typeof metaRaw !== "object") continue;
|
|
22355
|
+
const meta = metaRaw;
|
|
22356
|
+
if (typeof meta.version === "string") entries.push({ name, version: meta.version });
|
|
22357
|
+
if (meta.dependencies && typeof meta.dependencies === "object") {
|
|
22358
|
+
walk(meta.dependencies);
|
|
22359
|
+
}
|
|
22360
|
+
}
|
|
22361
|
+
};
|
|
22362
|
+
walk(dependencies);
|
|
22363
|
+
}
|
|
22364
|
+
return entries;
|
|
22365
|
+
}
|
|
22366
|
+
function splitYarnKey(key) {
|
|
22367
|
+
const trimmedKey = key.trim().replace(/^"|"$/g, "");
|
|
22368
|
+
const idx = trimmedKey.lastIndexOf("@");
|
|
22369
|
+
if (idx <= 0) return null;
|
|
22370
|
+
return { name: trimmedKey.slice(0, idx), range: trimmedKey.slice(idx + 1) };
|
|
22371
|
+
}
|
|
22372
|
+
function parseYarnLockfile(input) {
|
|
22373
|
+
const entries = [];
|
|
22374
|
+
const blocks = input.replace(/\r\n/g, "\n").split(/\n\n+/);
|
|
22375
|
+
for (const block of blocks) {
|
|
22376
|
+
const lines = block.split("\n");
|
|
22377
|
+
const headerLines = [];
|
|
22378
|
+
let i = 0;
|
|
22379
|
+
while (i < lines.length && lines[i].trim() !== "" && !lines[i].startsWith(" ") && !lines[i].startsWith("#")) {
|
|
22380
|
+
headerLines.push(lines[i]);
|
|
22381
|
+
i++;
|
|
22382
|
+
}
|
|
22383
|
+
if (headerLines.length === 0) continue;
|
|
22384
|
+
const header = headerLines.join(" ").replace(/:\s*$/, "");
|
|
22385
|
+
const keys = header.split(",").map((k) => k.trim()).filter(Boolean);
|
|
22386
|
+
const versionLine = lines.find((l) => /^\s+version\s+"/.test(l));
|
|
22387
|
+
if (!versionLine) continue;
|
|
22388
|
+
const versionMatch = versionLine.match(/version\s+"([^"]+)"/);
|
|
22389
|
+
if (!versionMatch) continue;
|
|
22390
|
+
const version2 = versionMatch[1];
|
|
22391
|
+
const names = /* @__PURE__ */ new Set();
|
|
22392
|
+
for (const key of keys) {
|
|
22393
|
+
const split = splitYarnKey(key);
|
|
22394
|
+
if (split) names.add(split.name);
|
|
22395
|
+
}
|
|
22396
|
+
for (const name of names) entries.push({ name, version: version2 });
|
|
22397
|
+
}
|
|
22398
|
+
return entries;
|
|
22399
|
+
}
|
|
22400
|
+
function parsePnpmPackageKey(rawKey) {
|
|
22401
|
+
let key = rawKey.trim();
|
|
22402
|
+
if (key.startsWith("/")) key = key.slice(1);
|
|
22403
|
+
const parenIdx = key.indexOf("(");
|
|
22404
|
+
if (parenIdx !== -1) key = key.slice(0, parenIdx);
|
|
22405
|
+
const idx = key.lastIndexOf("@");
|
|
22406
|
+
if (idx <= 0) return null;
|
|
22407
|
+
const name = key.slice(0, idx);
|
|
22408
|
+
const version2 = key.slice(idx + 1).trim();
|
|
22409
|
+
if (!version2) return null;
|
|
22410
|
+
return { name, version: version2 };
|
|
22411
|
+
}
|
|
22412
|
+
function parsePnpmLockfile(input) {
|
|
22413
|
+
const data = yaml2.load(input);
|
|
22414
|
+
const entries = [];
|
|
22415
|
+
const packages = data?.packages;
|
|
22416
|
+
if (!packages || typeof packages !== "object" || Array.isArray(packages)) return entries;
|
|
22417
|
+
for (const rawKey of Object.keys(packages)) {
|
|
22418
|
+
const parsed = parsePnpmPackageKey(rawKey);
|
|
22419
|
+
if (parsed) entries.push(parsed);
|
|
22420
|
+
}
|
|
22421
|
+
return entries;
|
|
22422
|
+
}
|
|
22423
|
+
function findDuplicateLockfileVersions(input, format) {
|
|
22424
|
+
if (!input || !input.trim()) return { error: "Input is empty" };
|
|
22425
|
+
const detected = format ?? detectLockfileFormat(input);
|
|
22426
|
+
if (!detected) {
|
|
22427
|
+
return { error: "Could not detect lockfile format; expected an npm package-lock.json, a yarn.lock, or a pnpm-lock.yaml" };
|
|
22428
|
+
}
|
|
22429
|
+
let rawEntries;
|
|
22430
|
+
try {
|
|
22431
|
+
if (detected === "npm") rawEntries = parseNpmLockfile(input);
|
|
22432
|
+
else if (detected === "yarn") rawEntries = parseYarnLockfile(input);
|
|
22433
|
+
else rawEntries = parsePnpmLockfile(input);
|
|
22434
|
+
} catch (e) {
|
|
22435
|
+
return { error: `Failed to parse ${detected} lockfile: ${e.message}` };
|
|
22436
|
+
}
|
|
22437
|
+
if (rawEntries.length === 0) {
|
|
22438
|
+
return { error: `No packages found in ${detected} lockfile. If this is a pnpm lockfile older than v6 (slash-separated versions instead of "name@version"), re-generate it with a current pnpm version first.` };
|
|
22439
|
+
}
|
|
22440
|
+
const byName = /* @__PURE__ */ new Map();
|
|
22441
|
+
for (const { name, version: version2 } of rawEntries) {
|
|
22442
|
+
let versions = byName.get(name);
|
|
22443
|
+
if (!versions) {
|
|
22444
|
+
versions = /* @__PURE__ */ new Map();
|
|
22445
|
+
byName.set(name, versions);
|
|
22446
|
+
}
|
|
22447
|
+
versions.set(version2, (versions.get(version2) ?? 0) + 1);
|
|
22448
|
+
}
|
|
22449
|
+
const packages = [];
|
|
22450
|
+
for (const [name, versions] of byName) {
|
|
22451
|
+
const versionList = [...versions.entries()].map(([version2, count]) => ({ version: version2, count })).sort((a, b) => b.count - a.count || a.version.localeCompare(b.version));
|
|
22452
|
+
packages.push({ name, versions: versionList, isDuplicate: versionList.length > 1 });
|
|
22453
|
+
}
|
|
22454
|
+
packages.sort((a, b) => a.name.localeCompare(b.name));
|
|
22455
|
+
const duplicatePackages = packages.filter((p) => p.isDuplicate);
|
|
22456
|
+
return {
|
|
22457
|
+
format: detected,
|
|
22458
|
+
totalPackages: packages.length,
|
|
22459
|
+
duplicatePackages,
|
|
22460
|
+
packages
|
|
22461
|
+
};
|
|
22462
|
+
}
|
|
22463
|
+
var GIT_DIFF_STAT_FILE_RE = /^\s*(.+?)\s*\|\s*(Bin|\d+)\s*(.*)$/;
|
|
22464
|
+
var GIT_DIFF_STAT_SUMMARY_RE = /^\s*(\d+)\s+files?\s+changed(?:,\s*(\d+)\s+insertions?\(\+\))?(?:,\s*(\d+)\s+deletions?\(-\))?/;
|
|
22465
|
+
function summarizeGitDiffStat(input) {
|
|
22466
|
+
if (!input || !input.trim()) return { error: "Input is empty" };
|
|
22467
|
+
const lines = input.replace(/\r\n/g, "\n").split("\n");
|
|
22468
|
+
const files = [];
|
|
22469
|
+
let summaryMatch = null;
|
|
22470
|
+
for (const line of lines) {
|
|
22471
|
+
if (!line.trim()) continue;
|
|
22472
|
+
const sm = line.match(GIT_DIFF_STAT_SUMMARY_RE);
|
|
22473
|
+
if (sm) {
|
|
22474
|
+
summaryMatch = sm;
|
|
22475
|
+
continue;
|
|
22476
|
+
}
|
|
22477
|
+
const m = line.match(GIT_DIFF_STAT_FILE_RE);
|
|
22478
|
+
if (!m) continue;
|
|
22479
|
+
const rawName = m[1];
|
|
22480
|
+
const countRaw = m[2];
|
|
22481
|
+
const bar = m[3];
|
|
22482
|
+
let file = rawName;
|
|
22483
|
+
let oldFile;
|
|
22484
|
+
const renameMatch = rawName.match(/^(.*?)\s*=>\s*(.*)$/);
|
|
22485
|
+
if (renameMatch) {
|
|
22486
|
+
oldFile = renameMatch[1].trim();
|
|
22487
|
+
file = renameMatch[2].trim();
|
|
22488
|
+
}
|
|
22489
|
+
if (countRaw === "Bin") {
|
|
22490
|
+
files.push({ file, oldFile, changes: null, insertions: null, deletions: null, binary: true, approximate: false });
|
|
22491
|
+
continue;
|
|
22492
|
+
}
|
|
22493
|
+
const changes = parseInt(countRaw, 10);
|
|
22494
|
+
const plusCount = (bar.match(/\+/g) ?? []).length;
|
|
22495
|
+
const minusCount = (bar.match(/-/g) ?? []).length;
|
|
22496
|
+
const barTotal = plusCount + minusCount;
|
|
22497
|
+
let insertions;
|
|
22498
|
+
let deletions;
|
|
22499
|
+
let approximate = false;
|
|
22500
|
+
if (barTotal === changes) {
|
|
22501
|
+
insertions = plusCount;
|
|
22502
|
+
deletions = minusCount;
|
|
22503
|
+
} else if (barTotal > 0) {
|
|
22504
|
+
approximate = true;
|
|
22505
|
+
insertions = Math.round(changes * plusCount / barTotal);
|
|
22506
|
+
deletions = changes - insertions;
|
|
22507
|
+
} else if (changes === 0) {
|
|
22508
|
+
insertions = 0;
|
|
22509
|
+
deletions = 0;
|
|
22510
|
+
} else {
|
|
22511
|
+
approximate = true;
|
|
22512
|
+
insertions = null;
|
|
22513
|
+
deletions = null;
|
|
22514
|
+
}
|
|
22515
|
+
files.push({ file, oldFile, changes, insertions, deletions, binary: false, approximate });
|
|
22516
|
+
}
|
|
22517
|
+
if (files.length === 0) {
|
|
22518
|
+
return { error: "No file stat lines found; expected output from `git diff --stat` or `git log --stat`" };
|
|
22519
|
+
}
|
|
22520
|
+
let filesChanged = files.length;
|
|
22521
|
+
let totalInsertions = files.reduce((sum, f) => sum + (f.insertions ?? 0), 0);
|
|
22522
|
+
let totalDeletions = files.reduce((sum, f) => sum + (f.deletions ?? 0), 0);
|
|
22523
|
+
if (summaryMatch) {
|
|
22524
|
+
filesChanged = parseInt(summaryMatch[1], 10);
|
|
22525
|
+
if (summaryMatch[2]) totalInsertions = parseInt(summaryMatch[2], 10);
|
|
22526
|
+
if (summaryMatch[3]) totalDeletions = parseInt(summaryMatch[3], 10);
|
|
22527
|
+
}
|
|
22528
|
+
return { files, filesChanged, totalInsertions, totalDeletions };
|
|
22529
|
+
}
|
|
22214
22530
|
|
|
22215
22531
|
// src/tools/color.ts
|
|
22216
22532
|
var color_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -6,9 +6,9 @@ export { d as data } from './data-3qMdFIF5.cjs';
|
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.cjs';
|
|
7
7
|
export { t as time } from './time-VMAy_SrV.cjs';
|
|
8
8
|
export { u as units } from './units-DnWrOTSV.cjs';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-B6fQrsCc.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-CZHElFHu.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
|
@@ -6,9 +6,9 @@ export { d as data } from './data-3qMdFIF5.js';
|
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.js';
|
|
7
7
|
export { t as time } from './time-VMAy_SrV.js';
|
|
8
8
|
export { u as units } from './units-DnWrOTSV.js';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-B6fQrsCc.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-CZHElFHu.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
2
|
export { units_exports as units } from './chunk-XAPHAUPI.js';
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
3
|
+
export { network_exports as network } from './chunk-K242OOF4.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-KRPIOHJ4.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';
|