fix(mod_compiler): replace runtime require calls with top-level imports and use execSync/path.join for filesystem sync and traversal
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# 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)
|
## 2026-03-05 - 4.1.11 - fix(mod_compiler)
|
||||||
flush directory entries before unpack to avoid XFS delayed-log causing partial readdir results
|
flush directory entries before unpack to avoid XFS delayed-log causing partial readdir results
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tsbuild',
|
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.'
|
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import type { CompilerOptions, Diagnostic, Program } from 'typescript';
|
import type { CompilerOptions, Diagnostic, Program } from 'typescript';
|
||||||
import typescript from 'typescript';
|
import typescript from 'typescript';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
import * as smartdelay from '@push.rocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smartpromise from '@push.rocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartpath from '@push.rocks/smartpath';
|
import * as smartpath from '@push.rocks/smartpath';
|
||||||
@@ -371,7 +373,7 @@ export class TsCompiler {
|
|||||||
// Force XFS to commit all pending directory entries before unpacking.
|
// Force XFS to commit all pending directory entries before unpacking.
|
||||||
// TypeScript's writeFileSync creates entries that may reside in XFS's
|
// TypeScript's writeFileSync creates entries that may reside in XFS's
|
||||||
// delayed log. Without sync, readdir can return partial results.
|
// delayed log. Without sync, readdir can return partial results.
|
||||||
require('child_process').execSync('sync');
|
execSync('sync');
|
||||||
this.syncDirectoryTree(destDir);
|
this.syncDirectoryTree(destDir);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -515,7 +517,7 @@ export class TsCompiler {
|
|||||||
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
this.syncDirectoryTree(require('path').join(dirPath, entry.name));
|
this.syncDirectoryTree(path.join(dirPath, entry.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user