angular/packages/compiler-cli/test/ngtsc
Alex Rickabaugh 1e07a112b0 fix(compiler-cli): use existing imports for standalone dependencies (#46029)
This commit fixes a small issue in the logic around the calculation of
template scopes for standalone components. These scopes include a
`Reference` for each dependency of a standalone component, which is used to
generate references to that dependency in various contexts.

Previously, the `Reference` used for a dependency was the one generated from
its own metadata. For example, a referenced directive used the `Reference`
that was created when analyzing the directive declaration itself. This still
works, as the compiler is always able to emit a reference to any valid
`Reference`. However, it's not optimal.

The `Reference` which should be used instead is the one generated from
analyzing the standalone component's `imports` array, which has knowledge of
how the dependency is referenced from within the standalone component's file
itself. This allows the compiler to skip creating a new import for the
dependency when emitting the standalone component, and use the existing,
user-authored import instead. This saves on code size and avoids taxing the
bundler with unnecessary imports.

PR Close #46029
2022-05-18 08:55:31 -07:00
..
BUILD.bazel refactor(compiler-cli): add validation to extended template diagnostics configuration (#44391) 2022-01-11 17:33:16 +00:00
component_indexing_spec.ts refactor(compiler-cli): update to use new file-system interfaces (#40281) 2021-01-08 09:34:44 -08:00
env.ts refactor: replace deprecated String.prototype.substr() (#45397) 2022-03-24 11:48:09 -07:00
extended_template_diagnostics_spec.ts refactor(compiler-cli): remove leftover _extendedTemplateDiagnostics flag (#44920) 2022-02-01 18:24:10 +00:00
imports_spec.ts refactor(compiler-cli): improve DX for reference emit failures (#44587) 2022-01-06 23:44:24 +00:00
incremental_error_spec.ts perf(compiler-cli): detect semantic changes and their effect on an incremental rebuild (#40947) 2021-03-08 08:41:19 -08:00
incremental_semantic_changes_spec.ts refactor(compiler-cli): Adjust generated TCB when checkTypeOfPipes is false (#40523) 2021-05-06 17:54:14 -04:00
incremental_spec.ts refactor(core): change component emit to 'dependencies' (#45672) 2022-04-20 05:45:56 -07:00
incremental_typecheck_spec.ts refactor: make all imports compatible with ESM/CJS output. (#43431) 2021-10-01 18:28:45 +00:00
monorepo_spec.ts test(compiler-cli): move testing utils to separate package (#39594) 2020-11-17 11:59:56 -08:00
ngtsc_spec.ts Revert "feat(compiler-cli): exclude abstract classes from strictInjectionParameters requirement (#44615)" (#45862) 2022-05-03 17:03:25 -07:00
scope_spec.ts feat(compiler-cli): standalone types imported into NgModule scopes (#44973) 2022-03-29 13:06:26 -07:00
sourcemap_utils.ts fix(compiler-cli): update type castings for JSON.parse usage (#40710) 2021-02-09 10:48:43 -08:00
standalone_spec.ts fix(compiler-cli): use existing imports for standalone dependencies (#46029) 2022-05-18 08:55:31 -07:00
template_mapping_spec.ts fix(compiler): include leading whitespace in source-spans of i18n messages (#43132) 2021-09-16 18:15:51 +00:00
template_typecheck_spec.ts refactor(compiler-cli): add validation to extended template diagnostics configuration (#44391) 2022-01-11 17:33:16 +00:00
xi18n_spec.ts test(compiler): fix deprecation warning (#45285) 2022-03-07 11:36:47 -08:00