fix(compiler): log emitted files written outside expected destination directory for diagnostics
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user