perf(ngcc): do not copy files that have been processed (#40429)
When using the `NewEntryPointWriter`, we must copy over all files from the entry-point bundle to the new entry-point. But since we are going to write out the modified files directly, there is no need to copy those. This commit skips copying the files that have been modified. PR Close #40429
This commit is contained in:
parent
ad0fb9c6bb
commit
b971bc6f70
|
@ -40,7 +40,7 @@ export class NewEntryPointFileWriter extends InPlaceFileWriter {
|
||||||
// The new folder is at the root of the overall package
|
// The new folder is at the root of the overall package
|
||||||
const entryPoint = bundle.entryPoint;
|
const entryPoint = bundle.entryPoint;
|
||||||
const ngccFolder = this.fs.join(entryPoint.packagePath, NGCC_DIRECTORY);
|
const ngccFolder = this.fs.join(entryPoint.packagePath, NGCC_DIRECTORY);
|
||||||
this.copyBundle(bundle, entryPoint.packagePath, ngccFolder);
|
this.copyBundle(bundle, entryPoint.packagePath, ngccFolder, transformedFiles);
|
||||||
transformedFiles.forEach(file => this.writeFile(file, entryPoint.packagePath, ngccFolder));
|
transformedFiles.forEach(file => this.writeFile(file, entryPoint.packagePath, ngccFolder));
|
||||||
this.updatePackageJson(entryPoint, formatProperties, ngccFolder);
|
this.updatePackageJson(entryPoint, formatProperties, ngccFolder);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,14 @@ export class NewEntryPointFileWriter extends InPlaceFileWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected copyBundle(
|
protected copyBundle(
|
||||||
bundle: EntryPointBundle, packagePath: AbsoluteFsPath, ngccFolder: AbsoluteFsPath) {
|
bundle: EntryPointBundle, packagePath: AbsoluteFsPath, ngccFolder: AbsoluteFsPath,
|
||||||
|
transformedFiles: FileToWrite[]) {
|
||||||
|
const doNotCopy = new Set(transformedFiles.map(f => f.path));
|
||||||
bundle.src.program.getSourceFiles().forEach(sourceFile => {
|
bundle.src.program.getSourceFiles().forEach(sourceFile => {
|
||||||
const originalPath = absoluteFromSourceFile(sourceFile);
|
const originalPath = absoluteFromSourceFile(sourceFile);
|
||||||
|
if (doNotCopy.has(originalPath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const relativePath = this.fs.relative(packagePath, originalPath);
|
const relativePath = this.fs.relative(packagePath, originalPath);
|
||||||
const isInsidePackage = isLocalRelativePath(relativePath);
|
const isInsidePackage = isLocalRelativePath(relativePath);
|
||||||
if (!sourceFile.isDeclarationFile && isInsidePackage) {
|
if (!sourceFile.isDeclarationFile && isInsidePackage) {
|
||||||
|
|
Loading…
Reference in New Issue