fix(mod_compiler): add diagnostic snapshots for output directories around clear and compile steps
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsbuild',
|
||||
version: '4.1.19',
|
||||
version: '4.1.20',
|
||||
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
|
||||
}
|
||||
|
||||
@@ -338,13 +338,30 @@ export class TsCompiler {
|
||||
// Get destination directory as absolute path
|
||||
const destDir = smartpath.transform.toAbsolute(destPath, this.cwd) as string;
|
||||
|
||||
// Diagnostic helper
|
||||
const diagSnap = (label: string) => {
|
||||
if (!isQuiet && !isJson) {
|
||||
for (const prevDir of successfulOutputDirs) {
|
||||
try {
|
||||
const entries = fs.readdirSync(prevDir);
|
||||
const dirs = entries.filter(e => { try { return fs.statSync(prevDir + '/' + e).isDirectory(); } catch { return false; } });
|
||||
console.log(` 📋 [${label}] ${prevDir.replace(this.cwd + '/', '')}: ${entries.length} entries, ${dirs.length} dirs`);
|
||||
} catch {
|
||||
console.log(` 📋 [${label}] ${prevDir.replace(this.cwd + '/', '')}: MISSING!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Clear the destination directory before compilation if it exists
|
||||
diagSnap('pre-clear');
|
||||
if (await FsHelpers.directoryExists(destDir)) {
|
||||
if (!isQuiet && !isJson) {
|
||||
console.log(`🧹 Clearing output directory: ${destPath}`);
|
||||
}
|
||||
await FsHelpers.removeDirectory(destDir);
|
||||
}
|
||||
diagSnap('post-clear');
|
||||
|
||||
// Update compiler options with the output directory
|
||||
const options: CompilerOptions = {
|
||||
@@ -365,6 +382,7 @@ export class TsCompiler {
|
||||
const result = await this.compileFiles(absoluteFiles, options, taskInfo);
|
||||
emittedFiles.push(...result.emittedFiles);
|
||||
errorSummaries.push(result.errorSummary);
|
||||
diagSnap('post-compile');
|
||||
|
||||
// Perform unpack if compilation succeeded
|
||||
if (result.errorSummary.totalErrors === 0) {
|
||||
|
||||
Reference in New Issue
Block a user