angular-cn/packages/compiler-cli/test
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
..
compliance fix(ivy): proper i18n postprocessing in case of nested templates (#28209) 2019-01-25 12:54:29 -08:00
diagnostics fix(compiler-cli): create LiteralLikeNode for String and Number literal (#27536) 2018-12-18 13:20:01 -08:00
metadata test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471) 2018-10-23 08:57:42 -07:00
ngcc test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471) 2018-10-23 08:57:42 -07:00
ngtsc feat(ivy): detect cycles and use remote scoping of components if needed (#28169) 2019-01-28 12:10:25 -08:00
transformers feat(compiler-cli): resolve generated Sass/Less files to .css inputs (#28166) 2019-01-18 09:49:19 -08:00
BUILD.bazel test(ivy): remove state fixme from packages/compiler-cli/test:ngtools_api (#27638) 2018-12-13 14:57:38 -08:00
extract_i18n_spec.ts feat(compiler): add "original" placeholder value on extracted XMB (#25079) 2018-07-30 16:49:00 -07:00
mocks.ts fix(compiler-cli): Use typescript to resolve modules for metadata (#22856) 2018-07-10 11:11:48 -07:00
ngc_spec.ts fix(compiler-cli): create LiteralLikeNode for String and Number literal (#27536) 2018-12-18 13:20:01 -08:00
ngtools_api_spec.ts test(ivy): add ability to find already passing tests (#27449) 2018-12-05 09:34:52 -08:00
perform_compile_spec.ts feat(compiler-cli): add support to extend `angularCompilerOptions` (#22717) 2018-09-19 16:17:28 -07:00
perform_watch_spec.ts build: upgrade to TypeScript 2.6 (#21144) 2017-12-22 20:15:47 -08:00
test_support.ts build(bazel): turn on --nolegacy-external-runfiles (#26770) 2018-11-14 12:23:38 -08:00