fix(diagnostics): add diagnostic logging around compilation and unpack to aid troubleshooting
This commit is contained in:
@@ -349,6 +349,7 @@ export class TsCompiler {
|
||||
const options: CompilerOptions = {
|
||||
...customOptions,
|
||||
outDir: destDir,
|
||||
listEmittedFiles: true,
|
||||
};
|
||||
|
||||
currentTask++;
|
||||
@@ -364,9 +365,33 @@ export class TsCompiler {
|
||||
emittedFiles.push(...result.emittedFiles);
|
||||
errorSummaries.push(result.errorSummary);
|
||||
|
||||
// DIAGNOSTIC: Log directory contents after compilation
|
||||
if (!isQuiet && !isJson) {
|
||||
try {
|
||||
const fs = await import('fs');
|
||||
const dirEntries = fs.readdirSync(destDir, { withFileTypes: true });
|
||||
const dirs = dirEntries.filter((e: any) => e.isDirectory()).map((e: any) => e.name).sort();
|
||||
const fileCount = dirEntries.filter((e: any) => e.isFile()).length;
|
||||
console.log(` 📋 [DIAG] After emit: ${dirs.length} dirs [${dirs.join(', ')}], ${fileCount} top-level files`);
|
||||
console.log(` 📋 [DIAG] emittedFiles.length=${result.emittedFiles.length}, totalErrors=${result.errorSummary.totalErrors}`);
|
||||
} catch (e: any) { console.log(` 📋 [DIAG] Error reading destDir: ${e.message}`); }
|
||||
}
|
||||
|
||||
// Perform unpack if compilation succeeded
|
||||
if (result.errorSummary.totalErrors === 0) {
|
||||
await performUnpack(pattern, destDir, this.cwd);
|
||||
|
||||
// DIAGNOSTIC: Log directory contents after unpack
|
||||
if (!isQuiet && !isJson) {
|
||||
try {
|
||||
const fs = await import('fs');
|
||||
const dirEntries = fs.readdirSync(destDir, { withFileTypes: true });
|
||||
const dirs = dirEntries.filter((e: any) => e.isDirectory()).map((e: any) => e.name).sort();
|
||||
const fileCount = dirEntries.filter((e: any) => e.isFile()).length;
|
||||
console.log(` 📋 [DIAG] After unpack: ${dirs.length} dirs [${dirs.join(', ')}], ${fileCount} top-level files`);
|
||||
} catch (e: any) { console.log(` 📋 [DIAG] Error reading destDir after unpack: ${e.message}`); }
|
||||
}
|
||||
|
||||
successfulOutputDirs.push(destDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user