Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 10b8d47a55 | |||
| 52e1a25948 | |||
| 3b8ebd41f4 | |||
| 9e839b3047 | |||
| 7ce22b0c4d | |||
| b2ce02a4fb | |||
| ca27db1d75 | |||
| c8a1582ec4 |
22
changelog.md
22
changelog.md
@@ -1,5 +1,27 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@git.zone/tsbuild",
|
"name": "@git.zone/tsbuild",
|
||||||
"version": "4.1.1",
|
"version": "4.1.5",
|
||||||
"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
2783
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -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.5',
|
||||||
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.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ export class TsCompiler {
|
|||||||
const options: CompilerOptions = {
|
const options: CompilerOptions = {
|
||||||
...customOptions,
|
...customOptions,
|
||||||
outDir: destDir,
|
outDir: destDir,
|
||||||
|
listEmittedFiles: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
currentTask++;
|
currentTask++;
|
||||||
@@ -364,17 +365,42 @@ export class TsCompiler {
|
|||||||
emittedFiles.push(...result.emittedFiles);
|
emittedFiles.push(...result.emittedFiles);
|
||||||
errorSummaries.push(result.errorSummary);
|
errorSummaries.push(result.errorSummary);
|
||||||
|
|
||||||
|
// DIAGNOSTIC: Log directory contents after compilation
|
||||||
|
if (!isQuiet && !isJson) {
|
||||||
|
try {
|
||||||
|
const fs = await import('fs');
|
||||||
|
const dirEntries = fs.readdirSync(destDir, { withFileTypes: true });
|
||||||
|
const dirs = dirEntries.filter((e: any) => e.isDirectory()).map((e: any) => e.name).sort();
|
||||||
|
const fileCount = dirEntries.filter((e: any) => e.isFile()).length;
|
||||||
|
console.log(` 📋 [DIAG] After emit: ${dirs.length} dirs [${dirs.join(', ')}], ${fileCount} top-level files`);
|
||||||
|
console.log(` 📋 [DIAG] emittedFiles.length=${result.emittedFiles.length}, totalErrors=${result.errorSummary.totalErrors}`);
|
||||||
|
} catch (e: any) { console.log(` 📋 [DIAG] Error reading destDir: ${e.message}`); }
|
||||||
|
}
|
||||||
|
|
||||||
// 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);
|
await performUnpack(pattern, destDir, this.cwd);
|
||||||
|
|
||||||
|
// DIAGNOSTIC: Log directory contents after unpack
|
||||||
|
if (!isQuiet && !isJson) {
|
||||||
|
try {
|
||||||
|
const fs = await import('fs');
|
||||||
|
const dirEntries = fs.readdirSync(destDir, { withFileTypes: true });
|
||||||
|
const dirs = dirEntries.filter((e: any) => e.isDirectory()).map((e: any) => e.name).sort();
|
||||||
|
const fileCount = dirEntries.filter((e: any) => e.isFile()).length;
|
||||||
|
console.log(` 📋 [DIAG] After unpack: ${dirs.length} dirs [${dirs.join(', ')}], ${fileCount} top-level files`);
|
||||||
|
} catch (e: any) { console.log(` 📋 [DIAG] Error reading destDir after unpack: ${e.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
|
||||||
// This must happen after ALL compilations so all destination folders exist
|
// This must happen after ALL compilations so all destination folders exist
|
||||||
|
// Use fromProjectDirectory to detect ALL ts_* folders, not just the ones being compiled
|
||||||
if (successfulOutputDirs.length > 0) {
|
if (successfulOutputDirs.length > 0) {
|
||||||
const rewriter = TsPathRewriter.fromGlobPatterns(globPatterns);
|
const rewriter = await TsPathRewriter.fromProjectDirectory(this.cwd);
|
||||||
let totalRewritten = 0;
|
let totalRewritten = 0;
|
||||||
for (const outputDir of successfulOutputDirs) {
|
for (const outputDir of successfulOutputDirs) {
|
||||||
totalRewritten += await rewriter.rewriteDirectory(outputDir);
|
totalRewritten += await rewriter.rewriteDirectory(outputDir);
|
||||||
|
|||||||
@@ -51,6 +51,39 @@ export class TsPathRewriter {
|
|||||||
return new TsPathRewriter(mappings);
|
return new TsPathRewriter(mappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a TsPathRewriter by auto-detecting all ts_* folders in the project directory.
|
||||||
|
* This ensures that cross-module imports are rewritten even when compiling a single module.
|
||||||
|
*
|
||||||
|
* For example, if the project has ts/, ts_shared/, ts_web/ folders:
|
||||||
|
* - ts → dist_ts
|
||||||
|
* - ts_shared → dist_ts_shared
|
||||||
|
* - ts_web → dist_ts_web
|
||||||
|
*
|
||||||
|
* @param cwd - The project root directory
|
||||||
|
* @returns TsPathRewriter instance with all detected folder mappings
|
||||||
|
*/
|
||||||
|
public static async fromProjectDirectory(cwd: string): Promise<TsPathRewriter> {
|
||||||
|
const mappings: IFolderMapping[] = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
const entries = await FsHelpers.listDirectory(cwd);
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
// Match folders starting with 'ts' (ts, ts_shared, ts_web, ts_core, etc.)
|
||||||
|
if (entry.isDirectory && /^ts(_|$)/.test(entry.name)) {
|
||||||
|
const sourceFolder = entry.name;
|
||||||
|
const destFolder = `dist_${sourceFolder}`;
|
||||||
|
mappings.push({ sourceFolder, destFolder });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Directory listing failed, return empty mappings
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TsPathRewriter(mappings);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current folder mappings
|
* Get the current folder mappings
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -87,16 +87,30 @@ export class TsUnpacker {
|
|||||||
public async unpack(): Promise<boolean> {
|
public async unpack(): Promise<boolean> {
|
||||||
// Check if we should unpack based on config
|
// Check if we should unpack based on config
|
||||||
if (!(await this.shouldUnpack())) {
|
if (!(await this.shouldUnpack())) {
|
||||||
|
console.log(` 📋 [DIAG-UNPACK] Skipping unpack: shouldUnpack=false`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if nested structure exists
|
// Check if nested structure exists
|
||||||
if (!(await this.detectNesting())) {
|
const hasNesting = await this.detectNesting();
|
||||||
|
console.log(` 📋 [DIAG-UNPACK] detectNesting=${hasNesting}, nestedPath=${this.getNestedPath()}`);
|
||||||
|
if (!hasNesting) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nestedPath = this.getNestedPath();
|
const nestedPath = this.getNestedPath();
|
||||||
|
|
||||||
|
// DIAGNOSTIC: Log contents before unpack
|
||||||
|
try {
|
||||||
|
const destEntries = fs.readdirSync(this.destDir, { withFileTypes: true });
|
||||||
|
const destDirs = destEntries.filter(e => e.isDirectory()).map(e => e.name).sort();
|
||||||
|
console.log(` 📋 [DIAG-UNPACK] Before removeSibling: destDir dirs=[${destDirs.join(', ')}]`);
|
||||||
|
const nestedEntries = fs.readdirSync(nestedPath, { withFileTypes: true });
|
||||||
|
const nestedDirs = nestedEntries.filter(e => e.isDirectory()).map(e => e.name).sort();
|
||||||
|
const nestedFiles = nestedEntries.filter(e => e.isFile()).length;
|
||||||
|
console.log(` 📋 [DIAG-UNPACK] Nested dir (${this.sourceFolderName}/): ${nestedDirs.length} dirs [${nestedDirs.join(', ')}], ${nestedFiles} files`);
|
||||||
|
} catch (e: any) { console.log(` 📋 [DIAG-UNPACK] Error reading: ${e.message}`); }
|
||||||
|
|
||||||
// Delete sibling folders (not the source folder)
|
// Delete sibling folders (not the source folder)
|
||||||
await this.removeSiblingDirectories();
|
await this.removeSiblingDirectories();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user