fix(compiler): log emitted files written outside expected destination directory for diagnostics

This commit is contained in:
2026-03-05 14:51:14 +00:00
parent 1033996cb5
commit fba2cba8e8
3 changed files with 22 additions and 1 deletions

View File

@@ -384,6 +384,20 @@ export class TsCompiler {
errorSummaries.push(result.errorSummary);
diagSnap('post-compile');
// Diagnostic: log emitted files that went to unexpected directories
if (!isQuiet && !isJson && result.emittedFiles.length > 0) {
const unexpectedFiles = result.emittedFiles.filter(f => !f.startsWith(destDir + '/') && !f.startsWith(destDir + '\\'));
if (unexpectedFiles.length > 0) {
console.log(` ⚠️ [diag] ${unexpectedFiles.length} files emitted OUTSIDE ${destPath}:`);
for (const f of unexpectedFiles.slice(0, 20)) {
console.log(` ${f.replace(this.cwd + '/', '')}`);
}
if (unexpectedFiles.length > 20) {
console.log(` ... and ${unexpectedFiles.length - 20} more`);
}
}
}
// Perform unpack if compilation succeeded
if (result.errorSummary.totalErrors === 0) {
await performUnpack(pattern, destDir, this.cwd);