From d3e3905e7f4469ab5229bb404e1754c684e9fb90 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Thu, 5 Mar 2026 13:22:17 +0000 Subject: [PATCH] fix(mod_compiler): replace runtime require calls with top-level imports and use execSync/path.join for filesystem sync and traversal --- changelog.md | 8 ++++++++ ts/00_commitinfo_data.ts | 2 +- ts/mod_compiler/classes.tscompiler.ts | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 09c1023..987d331 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2026-03-05 - 4.1.12 - fix(mod_compiler) +replace runtime require calls with top-level imports and use execSync/path.join for filesystem sync and traversal + +- Added top-level imports: path and execSync from child_process +- Replaced require('child_process').execSync('sync') with execSync('sync') to force fs sync +- Replaced require('path').join(...) with path.join(...) when recursing directories +- Refactor is purely local/maintenance-focused (consistency and slight performance/readability improvement); no functional change expected + ## 2026-03-05 - 4.1.11 - fix(mod_compiler) flush directory entries before unpack to avoid XFS delayed-log causing partial readdir results diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 8982b73..730406b 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.11', + version: '4.1.12', 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 6f6ed80..cf7c2cf 100644 --- a/ts/mod_compiler/classes.tscompiler.ts +++ b/ts/mod_compiler/classes.tscompiler.ts @@ -1,6 +1,8 @@ import type { CompilerOptions, Diagnostic, Program } from 'typescript'; import typescript from 'typescript'; import * as fs from 'fs'; +import * as path from 'path'; +import { execSync } from 'child_process'; import * as smartdelay from '@push.rocks/smartdelay'; import * as smartpromise from '@push.rocks/smartpromise'; import * as smartpath from '@push.rocks/smartpath'; @@ -371,7 +373,7 @@ export class TsCompiler { // Force XFS to commit all pending directory entries before unpacking. // TypeScript's writeFileSync creates entries that may reside in XFS's // delayed log. Without sync, readdir can return partial results. - require('child_process').execSync('sync'); + execSync('sync'); this.syncDirectoryTree(destDir); try { @@ -515,7 +517,7 @@ export class TsCompiler { const entries = fs.readdirSync(dirPath, { withFileTypes: true }); for (const entry of entries) { if (entry.isDirectory()) { - this.syncDirectoryTree(require('path').join(dirPath, entry.name)); + this.syncDirectoryTree(path.join(dirPath, entry.name)); } } } catch {