refactor(compiler): avoid duplication between FactoryTarget type (#61472)

Avoids duplication of the `FactoryTarget` enums. This is necessary
now because we are exposing the previously deeply-imported JIT facade
now via the exports; and the typing integration tests surface a type
conflict due to the different duplicated enums.

PR Close #61472
This commit is contained in:
Paul Gschwendtner 2025-05-19 15:01:17 +00:00 committed by Jessica Janiuk
parent 082cc5579d
commit 7e571069bc
6 changed files with 8 additions and 20 deletions

View file

@ -191,7 +191,6 @@ export {
} from './render3/r3_class_metadata_compiler';
export {
compileFactoryFunction,
FactoryTarget,
R3DependencyMetadata,
R3FactoryMetadata,
} from './render3/r3_factory';
@ -252,6 +251,7 @@ export {Version, escapeRegExp} from './util';
export * from './version';
export {outputAst};
export {CompilerFacadeImpl} from './jit_compiler_facade';
export {FactoryTarget} from './compiler_facade_interface';
// This file only reexports content of the `src` folder. Keep it that way.

View file

@ -6,10 +6,10 @@
* found in the LICENSE file at https://angular.dev/license
*/
import {FactoryTarget} from './compiler_facade_interface';
import * as o from './output/output_ast';
import {
compileFactoryFunction,
FactoryTarget,
R3DependencyMetadata,
R3FactoryDelegateType,
R3FactoryMetadata,

View file

@ -10,6 +10,7 @@ import {
CompilerFacade,
CoreEnvironment,
ExportedCompilerFacade,
FactoryTarget,
LegacyInputPartialMapping,
OpaqueValue,
R3ComponentMetadataFacade,
@ -57,7 +58,7 @@ import {
import {JitEvaluator} from './output/output_jit';
import {ParseError, ParseSourceSpan, r3JitTypeSourceSpan} from './parse_util';
import {DeferredBlock} from './render3/r3_ast';
import {compileFactoryFunction, FactoryTarget, R3DependencyMetadata} from './render3/r3_factory';
import {compileFactoryFunction, R3DependencyMetadata} from './render3/r3_factory';
import {compileInjector, R3InjectorMetadata} from './render3/r3_injector_compiler';
import {R3JitReflector} from './render3/r3_jit';
import {

View file

@ -5,6 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {FactoryTarget} from '../../compiler_facade_interface';
import {ChangeDetectionStrategy, ViewEncapsulation} from '../../core';
import * as o from '../../output/output_ast';
@ -443,14 +444,6 @@ export interface R3DeclareFactoryMetadata extends R3PartialDeclaration {
target: FactoryTarget;
}
export enum FactoryTarget {
Directive = 0,
Component = 1,
Injectable = 2,
Pipe = 3,
NgModule = 4,
}
/**
* Describes the shape of the object that the `ɵɵngDeclareInjectable()` function accepts.
*

View file

@ -5,8 +5,9 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {FactoryTarget} from '../../compiler_facade_interface';
import * as o from '../../output/output_ast';
import {createFactoryType, FactoryTarget, R3FactoryMetadata} from '../r3_factory';
import {createFactoryType, R3FactoryMetadata} from '../r3_factory';
import {Identifiers as R3} from '../r3_identifiers';
import {R3CompiledExpression} from '../util';
import {DefinitionMap} from '../view/util';

View file

@ -5,6 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {FactoryTarget} from '../compiler_facade_interface';
import {InjectFlags} from '../core';
import * as o from '../output/output_ast';
import {Identifiers as R3} from '../render3/r3_identifiers';
@ -64,14 +65,6 @@ export type R3FactoryMetadata =
| R3DelegatedFnOrClassMetadata
| R3ExpressionFactoryMetadata;
export enum FactoryTarget {
Directive = 0,
Component = 1,
Injectable = 2,
Pipe = 3,
NgModule = 4,
}
export interface R3DependencyMetadata {
/**
* An expression representing the token or value to be injected.