feat(ngcc): implement a program-based entry-point finder (#37075)

This finder is designed to only process entry-points that are reachable
by the program defined by a tsconfig.json file.

It is triggered by calling `mainNgcc()` with the `findEntryPointsFromTsConfigProgram`
option set to true. It is ignored if a `targetEntryPointPath` has been
provided as well.

It is triggered from the command line by adding the `--use-program-dependencies`
option, which is also ignored if the `--target` option has been provided.

Using this option can speed up processing in cases where there is a large
number of dependencies installed but only a small proportion of the
entry-points are actually imported into the application.

PR Close #37075
This commit is contained in:
Pete Bacon Darwin
2020-06-04 08:43:05 +01:00
committed by atscott
parent 07a8016118
commit 57411c85b9
11 changed files with 549 additions and 216 deletions

View File

@ -257,6 +257,16 @@ runInEachFileSystem(() => {
.toEqual(new ResolvedExternalModule(_('/dist/package-4/secondary-entry-point')));
});
});
describe('with mapped path relative paths', () => {
it('should resolve to a relative file if found via a paths mapping', () => {
const resolver = new ModuleResolver(
getFileSystem(), {baseUrl: '/', paths: {'mapped/*': ['libs/local-package/*']}});
expect(resolver.resolveModuleImport('mapped/x', _('/libs/local-package/index.js')))
.toEqual(new ResolvedRelativeModule(_('/libs/local-package/x.js')));
});
});
});
});
});