angular/packages/compiler/src
Alex Rickabaugh 27b4af7240 fix(compiler-cli): full side-effectful registration of NgModules with ids (#45024)
Angular contains an NgModule registry, which allows a user to declare
NgModules with string ids and retrieve them via those ids, using the
`getNgModuleById` API.

Previously, we attempted to structure this registration in a clever fashion
to allow for tree-shaking of registered NgModules (that is, those with ids).
This sort of worked due to the accidental alignment of behaviors from the
different tree-shakers involved. However, this trick relies on the
generation of `.ngfactory` files and how they're specifically processed in
various bundling scenarios. We intend to remove `.ngfactory` files, hence
we can no longer rely on them in this way.

The correct solution here is to recognize that `@NgModule({id})` is
inherently declaring a global side-effect, and such classes should not
really be eligible for tree-shaking in the first place. This commit removes
all the old registration machinery, and standardizes on generating a side-
effectful call to `registerNgModuleType` for NgModules that have ids.

There is some risk here that NgModules with unnecessary `id`s may not
tree-shake as a result of this change, whereas they would have in previous
circumstances. The fix here should be to remove the `id` if it's not needed.
Specifying an `id` is a request that the NgModule be retained regardless of
any other references, in case it is later looked up by string id.

PR Close #45024
2022-03-22 11:11:53 -07:00
..
compiler_util refactor(compiler): remove ViewEngine identifiers (#44676) 2022-02-02 00:04:13 +00:00
expression_parser fix(compiler): compute correct offsets when interpolations have HTML entities (#44811) 2022-03-08 10:23:07 -08:00
i18n refactor(compiler): delete View Engine components of @angular/compiler (#44368) 2021-12-06 13:12:36 -05:00
ml_parser refactor(compiler): remove unused AstPath (#44411) 2022-01-04 15:54:09 -08:00
output refactor(compiler): add @suppress {msgDescriptions} if no description is present on an i18n message (#44787) 2022-02-02 15:33:44 -08:00
render3 fix(compiler-cli): full side-effectful registration of NgModules with ids (#45024) 2022-03-22 11:11:53 -07:00
schema fix(language-service): provide dom event completions (#43299) 2021-09-27 10:45:58 -07:00
template_parser fix(compiler): compute correct offsets when interpolations have HTML entities (#44811) 2022-03-08 10:23:07 -08:00
assertions.ts refactor(compiler): remove unused assertion function (#44411) 2022-01-04 15:54:09 -08:00
chars.ts refactor(compiler): share isQuote() via chars.ts (#43129) 2021-08-16 13:07:23 -07:00
compiler.ts refactor(compiler): change NgModule scoping emit flag to enum (#45024) 2022-03-22 11:11:53 -07:00
compiler_facade_interface.ts feat(compiler-cli): initial implementation of standalone components (#44812) 2022-02-03 08:55:25 -08:00
config.ts refactor(compiler): remove extra imports (#37246) 2020-06-11 19:00:33 -07:00
constant_pool.ts refactor(compiler): store modifiers in a bitmask instead of an array (#44731) 2022-01-18 14:51:08 -08:00
core.ts refactor(compiler): remove unused type declarations (#44411) 2022-01-04 15:54:09 -08:00
injectable_compiler_2.ts fix(compiler): ensure that partially compiled queries can handle forward references (#44113) 2021-11-10 18:25:16 +00:00
jit_compiler_facade.ts refactor(compiler): change NgModule scoping emit flag to enum (#45024) 2022-03-22 11:11:53 -07:00
parse_util.ts refactor(compiler): remove syntax error logic (#44411) 2022-01-04 15:54:09 -08:00
resource_loader.ts refactor(compiler): ensure compatibility with noImplicitOverride (#42512) 2021-07-12 13:11:14 -07:00
selector.ts feat(compiler): support directive selectors with attributes containing $ (#41567) 2021-05-04 21:06:58 -07:00
shadow_css.ts fix(compiler): scope css rules within @layer blocks (#45396) 2022-03-21 14:51:45 -07:00
style_url_resolver.ts refactor(compiler): make template preparser null-safe (#44411) 2022-01-04 15:54:10 -08:00
util.ts refactor(compiler): cleanup AST fixup of listener instructions (#44411) 2022-01-04 15:54:09 -08:00
version.ts docs: fix package name in version.ts files in different packages (#41208) 2021-05-10 10:26:34 -04:00