fix(mod_compiler): add diagnostic snapshots for output directories around clear and compile steps
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-03-05 - 4.1.20 - fix(mod_compiler)
|
||||||
|
add diagnostic snapshots for output directories around clear and compile steps
|
||||||
|
|
||||||
|
- Introduce diagSnap helper to log entry and directory counts for successful output directories when not in quiet or JSON mode
|
||||||
|
- Call diagSnap before clearing the destination directory, after clearing, and after compilation to aid debugging of missing or unexpected outputs
|
||||||
|
- Behavior for emitted files and unpacking is unchanged; this is observational/logging-only instrumentation
|
||||||
|
|
||||||
## 2026-03-05 - 4.1.19 - fix(mod_fs)
|
## 2026-03-05 - 4.1.19 - fix(mod_fs)
|
||||||
use synchronous rm to avoid XFS metadata corruption when removing directories
|
use synchronous rm to avoid XFS metadata corruption when removing directories
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tsbuild',
|
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.'
|
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
|
// Get destination directory as absolute path
|
||||||
const destDir = smartpath.transform.toAbsolute(destPath, this.cwd) as string;
|
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
|
// Clear the destination directory before compilation if it exists
|
||||||
|
diagSnap('pre-clear');
|
||||||
if (await FsHelpers.directoryExists(destDir)) {
|
if (await FsHelpers.directoryExists(destDir)) {
|
||||||
if (!isQuiet && !isJson) {
|
if (!isQuiet && !isJson) {
|
||||||
console.log(`🧹 Clearing output directory: ${destPath}`);
|
console.log(`🧹 Clearing output directory: ${destPath}`);
|
||||||
}
|
}
|
||||||
await FsHelpers.removeDirectory(destDir);
|
await FsHelpers.removeDirectory(destDir);
|
||||||
}
|
}
|
||||||
|
diagSnap('post-clear');
|
||||||
|
|
||||||
// Update compiler options with the output directory
|
// Update compiler options with the output directory
|
||||||
const options: CompilerOptions = {
|
const options: CompilerOptions = {
|
||||||
@@ -365,6 +382,7 @@ export class TsCompiler {
|
|||||||
const result = await this.compileFiles(absoluteFiles, options, taskInfo);
|
const result = await this.compileFiles(absoluteFiles, options, taskInfo);
|
||||||
emittedFiles.push(...result.emittedFiles);
|
emittedFiles.push(...result.emittedFiles);
|
||||||
errorSummaries.push(result.errorSummary);
|
errorSummaries.push(result.errorSummary);
|
||||||
|
diagSnap('post-compile');
|
||||||
|
|
||||||
// Perform unpack if compilation succeeded
|
// Perform unpack if compilation succeeded
|
||||||
if (result.errorSummary.totalErrors === 0) {
|
if (result.errorSummary.totalErrors === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user