From 856099b5ed75e6dd6210b38106a5dcad7fa6f1e1 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Thu, 5 Mar 2026 12:29:11 +0000 Subject: [PATCH] fix(unpack): catch unpack errors and add verbose unpack logging --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts/mod_compiler/classes.tscompiler.ts | 6 +++++- ts/mod_unpack/classes.tsunpacker.ts | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 2fb0685..1f6e6ac 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2026-03-05 - 4.1.8 - fix(unpack) +catch unpack errors and add verbose unpack logging + +- Wrap performUnpack call in the compiler to catch and log exceptions so unpack failures don't crash the process +- Log the number of directories and files being unpacked when moving nested contents to aid debugging + ## 2026-03-05 - 4.1.7 - fix(fs/compiler/unpack) robustify directory removal and remove noisy diagnostic logging diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 7052239..57dc7fb 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tsbuild', - version: '4.1.7', + version: '4.1.8', description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.' } diff --git a/ts/mod_compiler/classes.tscompiler.ts b/ts/mod_compiler/classes.tscompiler.ts index 6baaefc..8fe5d5a 100644 --- a/ts/mod_compiler/classes.tscompiler.ts +++ b/ts/mod_compiler/classes.tscompiler.ts @@ -367,7 +367,11 @@ export class TsCompiler { // Perform unpack if compilation succeeded if (result.errorSummary.totalErrors === 0) { - await performUnpack(pattern, destDir, this.cwd); + try { + await performUnpack(pattern, destDir, this.cwd); + } catch (unpackErr: any) { + console.error(` ⚠️ Unpack error for ${destPath}: ${unpackErr.message}`); + } successfulOutputDirs.push(destDir); } diff --git a/ts/mod_unpack/classes.tsunpacker.ts b/ts/mod_unpack/classes.tsunpacker.ts index 17aa663..d331c5d 100644 --- a/ts/mod_unpack/classes.tsunpacker.ts +++ b/ts/mod_unpack/classes.tsunpacker.ts @@ -128,6 +128,9 @@ export class TsUnpacker { private async moveNestedContentsUp(): Promise { const nestedPath = this.getNestedPath(); const entries = await FsHelpers.listDirectory(nestedPath); + const dirCount = entries.filter(e => e.isDirectory).length; + const fileCount = entries.filter(e => e.isFile).length; + console.log(` 📦 Unpacking ${this.sourceFolderName}/: ${dirCount} directories, ${fileCount} files`); for (const entry of entries) { const src = path.join(nestedPath, entry.name); const dest = path.join(this.destDir, entry.name);