fix(compiler): log emitted files written outside expected destination directory for diagnostics
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-03-05 - 4.1.21 - fix(compiler)
|
||||
log emitted files written outside expected destination directory for diagnostics
|
||||
|
||||
- Adds diagnostic logging for emitted files that are not under the configured destDir, listing up to 20 example paths and reporting the remaining count.
|
||||
- Logging is conditional: only when not in quiet mode and not emitting JSON.
|
||||
- Diagnostic runs after compilation (post-compile) and before unpacking of outputs; paths are trimmed using the process cwd for readability.
|
||||
|
||||
## 2026-03-05 - 4.1.20 - fix(mod_compiler)
|
||||
add diagnostic snapshots for output directories around clear and compile steps
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsbuild',
|
||||
version: '4.1.20',
|
||||
version: '4.1.21',
|
||||
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
|
||||
}
|
||||
|
||||
@@ -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