angular/packages/compiler/src
Alex Rickabaugh 7d954dffd0 feat(ivy): detect cycles and use remote scoping of components if needed (#28169)
By its nature, Ivy alters the import graph of a TS program, adding imports
where template dependencies exist. For example, if ComponentA uses PipeB
in its template, Ivy will insert an import of PipeB into the file in which
ComponentA is declared.

Any insertion of an import into a program has the potential to introduce a
cycle into the import graph. If for some reason the file in which PipeB is
declared imports the file in which ComponentA is declared (maybe it makes
use of a service or utility function that happens to be in the same file as
ComponentA) then this could create an import cycle. This turns out to
happen quite regularly in larger Angular codebases.

TypeScript and the Ivy runtime have no issues with such cycles. However,
other tools are not so accepting. In particular the Closure Compiler is
very anti-cycle.

To mitigate this problem, it's necessary to detect when the insertion of
an import would create a cycle. ngtsc can then use a different strategy,
known as "remote scoping", instead of directly writing a reference from
one component to another. Under remote scoping, a function
'setComponentScope' is called after the declaration of the component's
module, which does not require the addition of new imports.

FW-647 #resolve

PR Close #28169
2019-01-28 12:10:25 -08:00
..
aot feat(ivy): updated translation const names (that include message ids) (#27185) 2018-11-30 10:00:54 -08:00
compiler_util fix(ivy): fix bug with banana-in-a-box expressions in nested templates (#25321) 2018-08-07 11:45:32 -07:00
css_parser build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
expression_parser style(compiler): typo fix (#26934) 2018-11-05 09:49:22 -08:00
i18n feat(ivy): ICU support for Ivy (#26794) 2018-11-16 16:09:30 -08:00
jit fix(compiler): Fix look up of entryComponents in AOT Summaries (#24892) 2018-09-11 16:23:17 -07:00
ml_parser refactor: remove redundant error in catch (#25478) 2019-01-04 15:42:19 -08:00
output feat(ivy): ICU support for Ivy (#26794) 2018-11-16 16:09:30 -08:00
render3 feat(ivy): detect cycles and use remote scoping of components if needed (#28169) 2019-01-28 12:10:25 -08:00
schema fix(core): size regression with closure compiler (#25531) 2018-08-30 21:22:40 -07:00
template_parser fix(ivy): validate props and attrs with "on" prefix at runtime (#28054) 2019-01-14 10:53:03 -08:00
view_compiler feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
assertions.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
ast_path.ts style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975) 2018-03-27 14:51:53 -04:00
chars.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
compile_metadata.ts feat(ivy): patch animations into metadata (#25828) 2018-09-07 13:46:06 -07:00
compile_reflector.ts feat(ivy): @NgModule -> ngInjectorDef compilation (#22458) 2018-03-16 12:57:11 -07:00
compiler.ts feat(ivy): detect cycles and use remote scoping of components if needed (#28169) 2019-01-28 12:10:25 -08:00
compiler_facade_interface.ts refactor(ivy): revert onChanges change back to a feature (#28187) 2019-01-23 10:59:33 -08:00
config.ts feat: add TypeScript 3 support (#25275) 2018-08-27 21:07:53 -04:00
constant_pool.ts feat(ivy): ICU support for Ivy (#26794) 2018-11-16 16:09:30 -08:00
core.ts fix(ivy): merge static style rendering across elements, directives and components (#27661) 2018-12-21 18:14:44 -05:00
directive_normalizer.ts style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975) 2018-03-27 14:51:53 -04:00
directive_resolver.ts feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
identifiers.ts feat(ivy): setClassMetadata() for assigning decorator metadata (#26860) 2018-10-31 19:52:36 -04:00
injectable_compiler.ts feat(ivy): support injection even if no injector present (#23345) 2018-04-13 14:29:52 -07:00
injectable_compiler_2.ts fix(ivy): ngtsc should include generic types on injectable definitions (#27037) 2018-12-06 13:33:13 -08:00
jit_compiler_facade.ts fix(ivy): ensure @animation host bindings/listeners work properly (#27896) 2019-01-04 14:12:29 -08:00
lifecycle_reflector.ts feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
metadata_resolver.ts feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
ng_module_compiler.ts feat(compiler): lower @NgModule ids if needed (#23031) 2018-03-28 09:15:16 -07:00
ng_module_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
parse_util.ts feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
pipe_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
provider_analyzer.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
resource_loader.ts refactor(compiler): allow sync AOT compilation (#16832). 2017-05-23 10:41:23 -06:00
selector.ts feat(ivy): add generics to the SelectorMatcher API (#26203) 2018-10-04 10:11:17 -07:00
shadow_css.ts fix(compiler): Don't strip /*# sourceURL ... */ (#16088) 2018-01-24 12:35:30 -08:00
style_compiler.ts feat(ivy): bridge component styles into the component renderer (#25255) 2018-08-23 16:51:15 -04:00
style_url_resolver.ts fix(compiler): Don't strip CSS source maps 2017-08-15 16:30:09 -07:00
summary_resolver.ts fix(compiler): allow to use flat modules and summaries 2017-09-28 14:20:20 -07:00
url_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
util.ts fix(core): Remove static dependency from @angular/core to @angular/compiler (#26734) 2018-10-31 14:15:06 -04:00
version.ts style: remove empty comments (#23404) 2018-05-10 15:48:13 -07:00