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:
2026-03-05 13:22:17 +00:00
parent fe60a21c59
commit d3e3905e7f
3 changed files with 13 additions and 3 deletions

View File

@@ -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 {