fix(mod_compiler): add diagnostic logging to report dist_ts and output directory contents after each compilation task and after import-path rewriting

This commit is contained in:
2026-03-05 12:12:51 +00:00
parent 10b8d47a55
commit cf05229b86
3 changed files with 35 additions and 1 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## 2026-03-05 - 4.1.6 - fix(mod_compiler)
add diagnostic logging to report dist_ts and output directory contents after each compilation task and after import-path rewriting
- Adds DIAG-CROSSTASK logs to inspect dist_ts subdirectories after each task when not in quiet or JSON mode
- Adds DIAG-FINAL logs to report directory names and file counts for each successful output dir after import-path rewriting
- Diagnostics use dynamic fs import and are non-intrusive: gated by isQuiet/isJson and errors are ignored
## 2026-03-05 - 4.1.5 - fix(diagnostics) ## 2026-03-05 - 4.1.5 - fix(diagnostics)
add diagnostic logging around compilation and unpack to aid troubleshooting add diagnostic logging around compilation and unpack to aid troubleshooting

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tsbuild', name: '@git.zone/tsbuild',
version: '4.1.5', version: '4.1.6',
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.' description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
} }

View File

@@ -394,6 +394,19 @@ export class TsCompiler {
successfulOutputDirs.push(destDir); successfulOutputDirs.push(destDir);
} }
// DIAGNOSTIC: Check dist_ts after each task (not just current destDir)
if (!isQuiet && !isJson) {
try {
const fs = await import('fs');
const distTsPath = require('path').join(this.cwd, 'dist_ts');
if (fs.existsSync(distTsPath)) {
const dirEntries = fs.readdirSync(distTsPath, { withFileTypes: true });
const dirs = dirEntries.filter((e: any) => e.isDirectory()).map((e: any) => e.name).sort();
console.log(` 📋 [DIAG-CROSSTASK] dist_ts after task ${currentTask}: ${dirs.length} dirs [${dirs.join(', ')}]`);
}
} catch (e: any) { /* ignore */ }
}
} }
// Rewrite import paths in all output directories to handle cross-module references // Rewrite import paths in all output directories to handle cross-module references
@@ -410,6 +423,20 @@ export class TsCompiler {
} }
} }
// DIAGNOSTIC: Check dist_ts after path rewriting
if (!isQuiet && !isJson) {
for (const outputDir of successfulOutputDirs) {
try {
const fs = await import('fs');
const dirEntries = fs.readdirSync(outputDir, { 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;
const relDir = outputDir.replace(this.cwd, '').replace(/^\//, '');
console.log(` 📋 [DIAG-FINAL] ${relDir}: ${dirs.length} dirs [${dirs.join(', ')}], ${fileCount} files`);
} catch (e: any) { console.log(` 📋 [DIAG-FINAL] Error: ${e.message}`); }
}
}
// Merge all error summaries // Merge all error summaries
const finalErrorSummary = this.mergeErrorSummaries(errorSummaries); const finalErrorSummary = this.mergeErrorSummaries(errorSummaries);