refactor(ngcc): rename EntryPoint#package to EntryPoint#packagePath (#37040)

Rename the `package` property to `packagePath` on the `EntryPoint`
interface. This makes it more clear that the `packagePath` property
holds the absolute path to the containing package (similar to how `path`
holds the path to the entry-point). This will also align with the
`packageName` property that will be added in a subsequent commit.

This commit also re-orders the `EntryPoint` properties to group related
properties together and to match the order of properties on instances
with that on the interface.

PR Close #37040
This commit is contained in:
George Kalpakas
2020-06-08 22:04:28 +03:00
committed by Misko Hevery
parent e7a0e87c41
commit 8197557fcf
23 changed files with 89 additions and 85 deletions

View File

@ -451,7 +451,8 @@ runInEachFileSystem(() => {
function dumpEntryPointPaths(
basePath: AbsoluteFsPath, entryPoints: EntryPoint[]): [string, string][] {
return entryPoints.map(x => [relative(basePath, x.package), relative(basePath, x.path)]);
return entryPoints.map(
x => [relative(basePath, x.packagePath), relative(basePath, x.path)]);
}
});
});

View File

@ -159,7 +159,8 @@ runInEachFileSystem(() => {
function dumpEntryPointPaths(
basePath: AbsoluteFsPath, entryPoints: EntryPoint[]): [string, string][] {
return entryPoints.map(x => [relative(basePath, x.package), relative(basePath, x.path)]);
return entryPoints.map(
x => [relative(basePath, x.packagePath), relative(basePath, x.path)]);
}
});
});

View File

@ -318,7 +318,7 @@ runInEachFileSystem(() => {
const entryPoint = entryPoints[0];
expect(entryPoint.name).toEqual('secondary');
expect(entryPoint.path).toEqual(_Abs('/path_mapped/dist/primary/secondary'));
expect(entryPoint.package).toEqual(_Abs('/path_mapped/dist/primary'));
expect(entryPoint.packagePath).toEqual(_Abs('/path_mapped/dist/primary'));
});
it('should correctly compute an entry-point whose path starts with the same string as another entry-point, via pathMappings',
@ -381,7 +381,8 @@ runInEachFileSystem(() => {
function dumpEntryPointPaths(
basePath: AbsoluteFsPath, entryPoints: EntryPoint[]): [string, string][] {
return entryPoints.map(x => [relative(basePath, x.package), relative(basePath, x.path)]);
return entryPoints.map(
x => [relative(basePath, x.packagePath), relative(basePath, x.path)]);
}
});