angular-cn/packages/compiler-cli
JoostK 35450c78f7 fix(compiler-cli): prefer non-aliased exports in reference emitters (#41866)
This commit changes the reference emitters in the Ivy compiler to prefer
non-aliased exports if they exist. This avoids selecting "private
exports" that may not be stable, e.g. the reexports that have been added
by the View Engine compiler. Such reexports are not stable and are
therefore not suitable to be emitted into partial compilations, as the
output of partial compilations should only reference stable symbols
from upstream libraries.

An alternative solution has been considered where ViewEngine-generated
exports would gain a certain prefix, such that the Ivy compiler could
just exclude those exports (see #41443). However, that solution would
be insufficient in case a library is built using partial compilation and
while depending itself on a VE-compiled library from earlier versions of
Angular, where the magic prefix would be missing. For such libraries,
ngcc would have generated reexports using the declared name if not already
present so this change does result in choosing the correct export.

Because ngcc always generates reexports using the declared name even if
an aliased export is present, this change causes those ngcc-generated
exports to be chosen in downstream libraries using partial compilation.
This is unfortunate as it means that the declared names become
effectively public even if the library author was intentionally
exporting it using an alias. This commit does not address this problem;
it is expected that this should not result in widespread issues across
the library ecosystem.

Fixes #41277

PR Close #41866
2021-04-30 14:15:10 -07:00
..
integrationtest refactor(compiler): remove dependency on fs-extra (#41445) 2021-04-05 15:04:50 -07:00
linker fix(compiler-cli): match string indexed partial declarations (#41747) 2021-04-22 10:43:08 -07:00
ngcc refactor(compiler-cli): replace the `IncrementalDriver` with a new design (#41475) 2021-04-13 13:05:35 -07:00
src fix(compiler-cli): prefer non-aliased exports in reference emitters (#41866) 2021-04-30 14:15:10 -07:00
test fix(compiler-cli): prefer non-aliased exports in reference emitters (#41866) 2021-04-30 14:15:10 -07:00
BUILD.bazel build: update several dependencies (#41434) 2021-04-12 16:46:29 -07:00
index.ts perf(compiler-cli): refactor the performance tracing infrastructure (#41125) 2021-03-24 13:42:24 -07:00
package.json fix(compiler-cli): update supported range of node versions to only include LTS versions (#41822) 2021-04-26 15:21:13 -07:00
tsconfig-build.json build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00
tsconfig.json perf(ivy): ngcc - only find dependencies when targeting a single entry-point (#30525) 2019-07-09 09:40:46 -07:00