angular/packages/compiler-cli
Alex Rickabaugh f0bf29a24d fix(compiler-cli): preserve forwardRef for component scopes (#46139)
Angular generally supports cycles between components in the same NgModule.
We have a mechanism of moving the component scope declaration into the
NgModule file in this case. This ensures that Angular never itself
introduces an import which creates a cycle.

What happens if the cycle already exists in the user's program, though, is a
bit different. In these cases, the "correct" emit for Angular is to generate
the component scope (whether direct or remote) inside of a closure, to
prevent evaluating the scope's references until module evaluation is
complete and all cyclic imports have been resolved. We don't want to do this
for *all* scopes because the code size cost of emitting a function wrapper
is non-zero.

In this fix, we take the presence of a `forwardRef` in a component's
`imports` or in an NgModule `declarations` or `imports` as a sign that
component scopes emitted into those files need to be protected against
cyclic references. In a future commit, we may introduce a warning or error
if cyclic imports are not protected behind `forwardRef` in these cases, but
this will take some time to implement.

PR Close #46139
2022-05-26 17:42:01 -07:00
..
integrationtest fix(router): Remove deprecated initialNavigation option (#45729) 2022-04-28 14:40:03 -07:00
linker ci: fix formatting for babel_ast_host.ts file after recent changes (#46082) 2022-05-23 13:30:38 -07:00
ngcc fix(language-service): Add resource files as roots to their associated projects (#45601) 2022-05-10 09:36:26 -07:00
private refactor(localize): update version of Babel (#44931) 2022-02-24 21:42:54 +00:00
src fix(compiler-cli): preserve forwardRef for component scopes (#46139) 2022-05-26 17:42:01 -07:00
test fix(compiler-cli): preserve forwardRef for component scopes (#46139) 2022-05-26 17:42:01 -07:00
BUILD.bazel build: migrate more usages from @bazel/typescript to @bazel/concatjs (#45431) 2022-03-25 12:18:34 -07:00
esbuild.config.js refactor: setup bundling for @angular/compiler-cli package (#43431) 2021-10-01 18:28:42 +00:00
import_meta_url.d.ts refactor(compiler-cli): do not use __filename or __dirname global for ESM compatibility (#43431) 2021-10-01 18:28:45 +00:00
index.ts build: switch all instances from ng_rollup_bundle to app_bundle (#44490) 2022-01-04 12:14:14 -08:00
package.json build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00
tsconfig-build.json refactor(compiler-cli): dismantle View Engine implementation of ngc (#44269) 2021-12-01 10:36:30 -08:00
tsconfig.json build: update tsconfigs to use ES2020 as target and module (#43431) 2021-10-01 18:28:42 +00:00