fix(ivy): use ReflectionHost in AbsoluteModuleStrategy (#30200)

The AbsoluteModuleStrategy in ngtsc assumed that the source code is
formatted as TypeScript with regards to module exports.

In ngcc this is not always the case, so this commit changes
`AbsoluteModuleStrategy` so that it relies upon a `ReflectionHost`  to
compute the exports of a module.

PR Close #30200
This commit is contained in:
Pete Bacon Darwin
2019-05-01 14:58:59 +01:00
committed by Jason Aden
parent 02523debe5
commit 76391f8999
4 changed files with 18 additions and 33 deletions

View File

@ -438,7 +438,8 @@ export class NgtscProgram implements api.Program {
// First, try to use local identifiers if available.
new LocalIdentifierStrategy(),
// Next, attempt to use an absolute import.
new AbsoluteModuleStrategy(this.tsProgram, checker, this.options, this.host),
new AbsoluteModuleStrategy(
this.tsProgram, checker, this.options, this.host, this.reflector),
// Finally, check if the reference is being written into a file within the project's logical
// file system, and use a relative import if so. If this fails, ReferenceEmitter will throw
// an error.