fix(ivy): ngcc - handle missing entry-point dependencies better (#30270)
If an entry-point has a missing dependency then all the entry-points that would have pointed to that dependency are also removed from the dependency graph. Previously we were still processing the dependencies of an entry-point even if it had already been removed from the graph because it depended upon a missing dependency that had previously been removed due to another entry-point depending upon it. This caused the dependency processing to crash rather than gracefully logging and handling the missing invalid entry-point. Fixes #29624 PR Close #30270
This commit is contained in:
parent
f5b2ae616f
commit
c59717571e
@ -128,9 +128,11 @@ export class DependencyResolver {
|
||||
} else {
|
||||
dependencies.forEach(dependencyPath => {
|
||||
if (graph.hasNode(dependencyPath)) {
|
||||
// The dependency path maps to an entry point that exists in the graph
|
||||
// so add the dependency.
|
||||
graph.addDependency(entryPoint.path, dependencyPath);
|
||||
if (graph.hasNode(entryPoint.path)) {
|
||||
// The entry-point is still valid (i.e. has no missing dependencies) and
|
||||
// the dependency maps to an entry point that exists in the graph so add it
|
||||
graph.addDependency(entryPoint.path, dependencyPath);
|
||||
}
|
||||
} else if (invalidEntryPoints.some(i => i.entryPoint.path === dependencyPath)) {
|
||||
// The dependency path maps to an entry-point that was previously removed
|
||||
// from the graph, so remove this entry-point as well.
|
||||
|
@ -78,7 +78,7 @@ describe('DependencyResolver', () => {
|
||||
|
||||
it('should remove entry points that depended upon an invalid entry-point', () => {
|
||||
spyOn(host, 'findDependencies').and.callFake(createFakeComputeDependencies({
|
||||
[_('/first/index.js')]: {resolved: [second.path], missing: []},
|
||||
[_('/first/index.js')]: {resolved: [second.path, third.path], missing: []},
|
||||
[_('/second/sub/index.js')]: {resolved: [], missing: ['/missing']},
|
||||
[_('/third/index.js')]: {resolved: [], missing: []},
|
||||
}));
|
||||
@ -93,7 +93,7 @@ describe('DependencyResolver', () => {
|
||||
|
||||
it('should remove entry points that will depend upon an invalid entry-point', () => {
|
||||
spyOn(host, 'findDependencies').and.callFake(createFakeComputeDependencies({
|
||||
[_('/first/index.js')]: {resolved: [second.path], missing: []},
|
||||
[_('/first/index.js')]: {resolved: [second.path, third.path], missing: []},
|
||||
[_('/second/sub/index.js')]: {resolved: [], missing: ['/missing']},
|
||||
[_('/third/index.js')]: {resolved: [], missing: []},
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user