angular-cn/packages/compiler-cli/src/ngcc
Alex Rickabaugh 1c39ad38d3 feat(ivy): reference external classes by their exported name (#27743)
Previously, ngtsc would assume that a given directive/pipe being imported
from an external package was importable using the same name by which it
was declared. This isn't always true; sometimes a package will export a
directive under a different name. For example, Angular frequently prefixes
directive names with the 'ɵ' character to indicate that they're part of
the package's private API, and not for public consumption.

This commit introduces the TsReferenceResolver class which, given a
declaration to import and a module name to import it from, can determine
the exported name of the declared class within the module. This allows
ngtsc to pick the correct name by which to import the class instead of
making assumptions about how it was exported.

This resolver is used to select a correct symbol name when creating an
AbsoluteReference.

FW-517 #resolve
FW-536 #resolve

PR Close #27743
2019-01-08 16:36:18 -08:00
..
src feat(ivy): reference external classes by their exported name (#27743) 2019-01-08 16:36:18 -08:00
test feat(ivy): reference external classes by their exported name (#27743) 2019-01-08 16:36:18 -08:00
BUILD.bazel refactor(ivy): split apart the 'metadata' package in the ngtsc compiler (#27743) 2019-01-08 16:36:18 -08:00
README.md build: use bazel version from node modules (#26691) 2018-10-30 16:19:13 -04:00
index.ts feat(ivy): ngcc project skeleton (#24897) 2018-07-27 17:15:31 -07:00
main-ngcc.ts feat(ivy): ngcc project skeleton (#24897) 2018-07-27 17:15:31 -07:00

README.md

Angular Compatibility Compiler (ngcc)

This compiler will convert node_modules compiled with ngc, into node_modules which appear to have been compiled with ngtsc.

This conversion will allow such "legacy" packages to be used by the Ivy rendering engine.

Building

The project is built using Bazel:

yarn bazel build //packages/compiler-cli/src/ngcc

Unit Testing

The unit tests are built and run using Bazel:

yarn bazel test //packages/compiler-cli/src/ngcc/test

Integration Testing

There are tests that check the behaviour of the overall executable:

yarn bazel test //packages/compiler-cli/test/ngcc