fix(ngcc): handle entry-points within container folders (#36305)

The previous optimizations in #35756 to the
`DirectoryWalkerEntryPointFinder` were over zealous
with regard to packages that have entry-points stored
in "container" directories in the package, where the
container directory was not an entry-point itself.

Now we will also walk such "container" folders as long
as they do not contain `.js` files, which we regard as an
indicator that the directory will not contain entry-points.

Fixes #36216

PR Close #36305
This commit is contained in:
Pete Bacon Darwin
2020-03-30 11:40:00 +01:00
committed by Alex Rickabaugh
parent 29dcb5bf68
commit 392ef93c2b
2 changed files with 27 additions and 2 deletions

View File

@ -156,12 +156,21 @@ export class DirectoryWalkerEntryPointFinder implements EntryPointFinder {
isEntryPoint = true;
}
if (!isDirectory || !isEntryPoint) {
// This path is not an entry-point directory so we are done
if (!isDirectory) {
// This path is not a directory so we are done.
continue;
}
// This directory may contain entry-points of its own.
const childPaths = this.fs.readdir(absolutePath);
if (!isEntryPoint &&
childPaths.some(
childPath => childPath.endsWith('.js') &&
this.fs.stat(this.fs.resolve(absolutePath, childPath)).isFile())) {
// We do not consider non-entry-point directories that contain JS files as they are very
// unlikely to be containers for sub-entry-points.
continue;
}
this.collectSecondaryEntryPoints(entryPoints, packagePath, absolutePath, childPaths);
}
}