mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
Refactor transpileFile function to remove unused parameter and update sourcefile reference (#294867)
This commit is contained in:
@@ -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);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user