angular-cn/packages/compiler-cli/ngcc/test
JoostK 9e70bcb34f fix(ngcc): consistently delegate to TypeScript host for typing files (#36089)
When ngcc is compiling an entry-point, it uses a `ReflectionHost` that
is specific to its format, e.g. ES2015, ES5, UMD or CommonJS. During the
compilation of that entry-point however, the reflector may be used to
reflect into external libraries using their declaration files.

Up until now this was achieved by letting all `ReflectionHost` classes
consider their parent class for reflector queries, thereby ending up in
the `TypeScriptReflectionHost` that is a common base class for all
reflector hosts. This approach has proven to be prone to bugs, as
failing to call into the base class would cause incompatibilities with
reading from declaration files.

The observation can be made that there's only two distinct kinds of
reflection host queries:
1. the reflector query is about code that is part of the entry-point
   that is being compiled, or
2. the reflector query is for an external library that the entry-point
   depends on, in which case the information is reflected
   from the declaration files.

The `ReflectionHost` that was chosen for the entry-point should serve
only reflector queries for the first case, whereas a regular
`TypeScriptReflectionHost` should be used for the second case. This
avoids the problem where a format-specific `ReflectionHost` fails to
handle the second case correctly, as it isn't even considered for such
reflector queries.

This commit introduces a `ReflectionHost` that delegates to the
`TypeScriptReflectionHost` for AST nodes within declaration files,
otherwise delegating to the format-specific `ReflectionHost`.

Fixes #35078
Resolves FW-1859

PR Close #36089
2020-03-17 13:34:04 -07:00
..
analysis fix(ngcc): do not attempt compilation when analysis fails (#34889) 2020-01-23 14:47:03 -08:00
dependencies fix(ngcc): allow deep-import warnings to be ignored (#35683) 2020-02-27 10:48:48 -08:00
entry_point_finder perf(ngcc): use the `EntryPointManifest` in `DirectoryWalkerEntryPointFinder` (#35931) 2020-03-11 15:01:59 -07:00
execution refactor(ngcc): move locking code into its own folder (#35861) 2020-03-05 18:17:15 -05:00
helpers refactor(ngcc): move locking code into its own folder (#35861) 2020-03-05 18:17:15 -05:00
host fix(ngcc): consistently delegate to TypeScript host for typing files (#36089) 2020-03-17 13:34:04 -07:00
integration fix(ngcc): consistently delegate to TypeScript host for typing files (#36089) 2020-03-17 13:34:04 -07:00
locking refactor(ngcc): remove unused `LockFileWithSignalHandlers` (#35938) 2020-03-12 09:46:18 -07:00
logging refactor(ngcc): expose logging level on the logger (#35861) 2020-03-05 18:17:15 -05:00
migrations feat(ivy): error in ivy when inheriting a ctor from an undecorated base (#34460) 2019-12-18 15:04:49 -08:00
packages refactor(ngcc): add entry-point manifest functionality (#35931) 2020-03-11 15:01:59 -07:00
rendering fix(ngcc): handle mappings outside the content when flattening source-maps (#35718) 2020-02-27 16:09:36 -05:00
sourcemaps perf(ngcc): store the position of SegmentMarkers to avoid unnecessary computation (#36027) 2020-03-13 08:00:29 -07:00
writing perf(ngcc): reduce directory traversing (#35756) 2020-03-05 15:57:31 -05:00
BUILD.bazel feat(ngcc): implement source-map flattening (#35132) 2020-02-26 12:51:35 -08:00
utils_spec.ts fix(ngcc): correctly detect emitted TS helpers in ES5 (#35191) 2020-02-21 09:06:46 -08:00