refactor(compiler-cli): ngcc - track non-Angular entry-points (#29643)

Previously we completely ignored entry-points that had not been
compiled with Angular, since we do not need to compile them
with ngcc. But this makes it difficult to reason about dependencies
between entry-points that were compiled with Angular and those that
were not.

Now we do track these non-Angular compiled entry-points but they
are marked as `compiledByAngular: false`.

PR Close #29643
This commit is contained in:
Pete Bacon Darwin
2019-04-28 20:47:56 +01:00
committed by Andrew Kushnir
parent c2cf500da9
commit 321da5cc83
4 changed files with 69 additions and 38 deletions

View File

@ -30,6 +30,7 @@ describe('getEntryPointInfo()', () => {
path: _('/some_package/valid_entry_point'),
typings: _(`/some_package/valid_entry_point/valid_entry_point.d.ts`),
packageJson: loadPackageJson('/some_package/valid_entry_point'),
compiledByAngular: true,
});
});
@ -45,17 +46,19 @@ describe('getEntryPointInfo()', () => {
expect(entryPoint).toBe(null);
});
it('should return null if there is no esm2015 nor fesm2015 field in the package.json', () => {
const entryPoint =
getEntryPointInfo(new MockLogger(), SOME_PACKAGE, _('/some_package/missing_esm2015'));
expect(entryPoint).toBe(null);
});
it('should return null if there is no metadata.json file next to the typing file', () => {
const entryPoint =
getEntryPointInfo(new MockLogger(), SOME_PACKAGE, _('/some_package/missing_metadata.json'));
expect(entryPoint).toBe(null);
});
it('should return an object with `compiledByAngular` set to false if there is no metadata.json file next to the typing file',
() => {
const entryPoint =
getEntryPointInfo(new MockLogger(), SOME_PACKAGE, _('/some_package/missing_metadata'));
expect(entryPoint).toEqual({
name: 'some-package/missing_metadata',
package: SOME_PACKAGE,
path: _('/some_package/missing_metadata'),
typings: _(`/some_package/missing_metadata/missing_metadata.d.ts`),
packageJson: loadPackageJson('/some_package/missing_metadata'),
compiledByAngular: false,
});
});
it('should work if the typings field is named `types', () => {
const entryPoint = getEntryPointInfo(
@ -66,6 +69,7 @@ describe('getEntryPointInfo()', () => {
path: _('/some_package/types_rather_than_typings'),
typings: _(`/some_package/types_rather_than_typings/types_rather_than_typings.d.ts`),
packageJson: loadPackageJson('/some_package/types_rather_than_typings'),
compiledByAngular: true,
});
});
@ -78,6 +82,7 @@ describe('getEntryPointInfo()', () => {
path: _('/some_package/material_style'),
typings: _(`/some_package/material_style/material_style.d.ts`),
packageJson: JSON.parse(readFileSync('/some_package/material_style/package.json', 'utf8')),
compiledByAngular: true,
});
});