Compare commits

...

12 Commits

7 changed files with 1983 additions and 883 deletions

View File

@@ -1,5 +1,49 @@
# Changelog # 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
- Use fs.promises.rm with force, maxRetries and retryDelay in removeDirectory to reduce intermittent failures during removals.
- Handle ENOTEMPTY in removeEmptyDirectory by falling back to a recursive rm and ignore ENOENT to avoid errors from transient filesystem metadata lag.
- Remove several diagnostic/verbose console logs in the compiler and unpacker paths to reduce noisy output and simplify flow.
- Short-circuit unpack logic when no nesting is detected to avoid unnecessary work and logs.
- No public API or behavior-breaking changes; suitable for a patch release.
## 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)
add diagnostic logging around compilation and unpack to aid troubleshooting
- Enable TypeScript CompilerOptions.listEmittedFiles to surface emitted file info
- Log destination directory contents and emitted file/error counts after compile and after unpack (only when not quiet and not json)
- Add unpack-specific diagnostic logs: shouldUnpack skip, detectNesting result and nestedPath, and nested/destination directory listings before removing sibling directories
- All logs use console.log and are wrapped in try/catch to avoid throwing; changes are informational and non-breaking
## 2026-03-05 - 4.1.4 - fix(deps)
bump @git.zone/tspublish dependency to ^1.11.2
- Updated @git.zone/tspublish from ^1.11.0 to ^1.11.2 in package.json
## 2026-03-04 - 4.1.3 - fix(deps)
bump dependencies: @push.rocks/smartcli, @push.rocks/smartlog, @git.zone/tstest, and @types/node to their newer versions
- @push.rocks/smartcli: ^4.0.19 -> ^4.0.20
- @push.rocks/smartlog: ^3.1.10 -> ^3.2.1
- @git.zone/tstest: ^3.1.4 -> ^3.2.0
- @types/node: ^25.0.3 -> ^25.3.3
- Non-breaking dependency version bumps
## 2026-01-04 - 4.1.0 - feat(docs) ## 2026-01-04 - 4.1.0 - feat(docs)
update README with improved docs and monorepo/tspublish guidance; namespace and extend npmextra.json with release registries; bump several dependencies update README with improved docs and monorepo/tspublish guidance; namespace and extend npmextra.json with release registries; bump several dependencies

View File

@@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tsbuild", "name": "@git.zone/tsbuild",
"version": "4.1.2", "version": "4.1.8",
"private": false, "private": false,
"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.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@@ -36,21 +36,21 @@
}, },
"homepage": "https://code.foss.global/git.zone/tsbuild#README", "homepage": "https://code.foss.global/git.zone/tsbuild#README",
"dependencies": { "dependencies": {
"@git.zone/tspublish": "^1.11.0", "@git.zone/tspublish": "^1.11.2",
"@push.rocks/early": "^4.0.4", "@push.rocks/early": "^4.0.4",
"@push.rocks/smartcli": "^4.0.19", "@push.rocks/smartcli": "^4.0.20",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^13.1.2", "@push.rocks/smartfile": "^13.1.2",
"@push.rocks/smartfs": "^1.3.1", "@push.rocks/smartfs": "^1.3.1",
"@push.rocks/smartlog": "^3.1.10", "@push.rocks/smartlog": "^3.2.1",
"@push.rocks/smartpath": "^6.0.0", "@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartpromise": "^4.2.3", "@push.rocks/smartpromise": "^4.2.3",
"typescript": "5.9.3" "typescript": "5.9.3"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsrun": "^2.0.1", "@git.zone/tsrun": "^2.0.1",
"@git.zone/tstest": "^3.1.4", "@git.zone/tstest": "^3.2.0",
"@types/node": "^25.0.3" "@types/node": "^25.3.3"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

2783
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -349,6 +349,7 @@ export class TsCompiler {
const options: CompilerOptions = { const options: CompilerOptions = {
...customOptions, ...customOptions,
outDir: destDir, outDir: destDir,
listEmittedFiles: true,
}; };
currentTask++; currentTask++;
@@ -366,9 +367,15 @@ export class TsCompiler {
// Perform unpack if compilation succeeded // Perform unpack if compilation succeeded
if (result.errorSummary.totalErrors === 0) { 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); successfulOutputDirs.push(destDir);
} }
} }
// Rewrite import paths in all output directories to handle cross-module references // Rewrite import paths in all output directories to handle cross-module references

View File

@@ -125,7 +125,7 @@ export class FsHelpers {
* Remove a directory recursively * Remove a directory recursively
*/ */
public static async removeDirectory(dirPath: string): Promise<void> { public static async removeDirectory(dirPath: string): Promise<void> {
await fs.promises.rm(dirPath, { recursive: true }); await fs.promises.rm(dirPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
} }
/** /**
@@ -139,6 +139,15 @@ export class FsHelpers {
* Remove an empty directory * Remove an empty directory
*/ */
public static async removeEmptyDirectory(dirPath: string): Promise<void> { public static async removeEmptyDirectory(dirPath: string): Promise<void> {
await fs.promises.rmdir(dirPath); try {
await fs.promises.rmdir(dirPath);
} catch (err: any) {
if (err.code === 'ENOTEMPTY') {
// Filesystem metadata lag — use recursive rm as fallback
await fs.promises.rm(dirPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
} else if (err.code !== 'ENOENT') {
throw err;
}
}
} }
} }

View File

@@ -128,6 +128,9 @@ export class TsUnpacker {
private async moveNestedContentsUp(): Promise<void> { private async moveNestedContentsUp(): Promise<void> {
const nestedPath = this.getNestedPath(); const nestedPath = this.getNestedPath();
const entries = await FsHelpers.listDirectory(nestedPath); 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) { for (const entry of entries) {
const src = path.join(nestedPath, entry.name); const src = path.join(nestedPath, entry.name);
const dest = path.join(this.destDir, entry.name); const dest = path.join(this.destDir, entry.name);