Refactor transpileFile function to remove unused parameter and update sourcefile reference (#294867)

This commit is contained in:
Johannes Rieken
2026-02-12 12:53:38 +01:00
committed by GitHub
parent 5f6c0faea4
commit 3a8ad661c4

View File

@@ -699,11 +699,11 @@ const transformOptions: esbuild.TransformOptions = {
}),
};
async function transpileFile(srcPath: string, destPath: string, relativePath: string): Promise<void> {
async function transpileFile(srcPath: string, destPath: string): Promise<void> {
const source = await fs.promises.readFile(srcPath, 'utf-8');
const result = await esbuild.transform(source, {
...transformOptions,
sourcefile: relativePath,
sourcefile: srcPath,
});
await fs.promises.mkdir(path.dirname(destPath), { recursive: true });
@@ -728,7 +728,7 @@ async function transpile(outDir: string, excludeTests: boolean): Promise<void> {
await Promise.all(files.map(file => {
const srcPath = path.join(REPO_ROOT, SRC_DIR, file);
const destPath = path.join(REPO_ROOT, outDir, file.replace(/\.ts$/, '.js'));
return transpileFile(srcPath, destPath, file);
return transpileFile(srcPath, destPath);
}));
}
@@ -996,7 +996,7 @@ async function watch(): Promise<void> {
await Promise.all(tsFiles.map(srcPath => {
const relativePath = path.relative(path.join(REPO_ROOT, SRC_DIR), srcPath);
const destPath = path.join(REPO_ROOT, outDir, relativePath.replace(/\.ts$/, '.js'));
return transpileFile(srcPath, destPath, relativePath);
return transpileFile(srcPath, destPath);
}));
}