Skip to content

Commit

Permalink
refactor(core): move the code to avoid circular dependencies (#46685)
Browse files Browse the repository at this point in the history
This commit refactors the code to move some functions around to avoid circular dependencies in TS imports. The newly added functions are now located in the `packages/core/src/render3/component.ts` file (instead of `packages/core/src/render3/component_ref.ts`), which is a better place for them anyway.

PR Close #46685
  • Loading branch information
AndrewKushnir authored and thePunderWoman committed Jul 14, 2022
1 parent 10becab commit 7006f33
Show file tree
Hide file tree
Showing 9 changed files with 373 additions and 385 deletions.
2 changes: 1 addition & 1 deletion goldens/public-api/core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ export interface ContentChildrenDecorator {

// @public
export function createComponent<C>(component: Type<C>, options: {
hostElement?: Element;
environmentInjector: EnvironmentInjector;
hostElement?: Element;
elementInjector?: Injector;
projectableNodes?: Node[][];
}): ComponentRef<C>;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export * from './core_render3_private_export';
export {SecurityContext} from './sanitization/security';
export {Sanitizer} from './sanitization/sanitizer';
export {createNgModule, createNgModuleRef, createEnvironmentInjector} from './render3/ng_module_ref';
export {createComponent, reflectComponentType, ComponentMirror} from './render3/component_ref';
export {createComponent, reflectComponentType, ComponentMirror} from './render3/component';

import {global} from './util/global';
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/linker/component_factory_resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Injector} from '../di/injector';
import {Type} from '../interface/type';
import {stringify} from '../util/stringify';

import {ComponentFactory, ComponentRef} from './component_factory';
import {NgModuleRef} from './ng_module_factory';
import {ComponentFactory} from './component_factory';

export function noComponentFactoryError(component: Function) {
const error = Error(`No component factory found for ${
Expand Down

0 comments on commit 7006f33

Please sign in to comment.