v good
Some checks failed
Deploy to Pages / build (pull_request) Failing after 1m56s

This commit is contained in:
Andras Schmelczer 2026-05-16 13:46:19 +01:00
parent 2347ecd201
commit 10a81ba474
45 changed files with 1978 additions and 494 deletions

View file

@ -33,16 +33,23 @@ const resolveModule = (fromFile, specifier) => {
base.endsWith('.ts') ? base : null,
].filter(Boolean);
return candidates.find((candidate) => existsSync(candidate) && fileSet.has(candidate)) ?? null;
return (
candidates.find((candidate) => existsSync(candidate) && fileSet.has(candidate)) ??
null
);
};
const exportKey = (file, name) => `${path.resolve(file)}:${name}`;
const isExported = (node) =>
ts.canHaveModifiers(node) &&
(ts.getModifiers(node) ?? []).some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
(ts.getModifiers(node) ?? []).some(
(modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword
);
const isDefaultExported = (node) =>
ts.canHaveModifiers(node) &&
(ts.getModifiers(node) ?? []).some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword);
(ts.getModifiers(node) ?? []).some(
(modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword
);
const exportedDeclarations = new Map();
const usedExports = new Set();
@ -167,10 +174,15 @@ const parsedFiles = files.map((file) => ({
}));
parsedFiles.forEach(({ file, sourceFile }) => collectImportUsage(file, sourceFile));
parsedFiles.forEach(({ file, sourceFile }) => collectExportedDeclarations(file, sourceFile));
parsedFiles.forEach(({ file, sourceFile }) =>
collectExportedDeclarations(file, sourceFile)
);
const unusedExports = Array.from(exportedDeclarations.entries())
.filter(([key, declaration]) => !usedExports.has(key) && !wildcardUsedFiles.has(declaration.file))
.filter(
([key, declaration]) =>
!usedExports.has(key) && !wildcardUsedFiles.has(declaration.file)
)
.map(([, declaration]) => declaration)
.sort((left, right) =>
`${left.file}:${left.name}`.localeCompare(`${right.file}:${right.name}`)