[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import * as o from './output/output_ast';
|
---|
| 9 | import { R3DependencyMetadata } from './render3/r3_factory';
|
---|
| 10 | import { R3CompiledExpression, R3Reference } from './render3/util';
|
---|
| 11 | export interface R3InjectableMetadata {
|
---|
| 12 | name: string;
|
---|
| 13 | type: R3Reference;
|
---|
| 14 | internalType: o.Expression;
|
---|
| 15 | typeArgumentCount: number;
|
---|
| 16 | providedIn: R3ProviderExpression;
|
---|
| 17 | useClass?: R3ProviderExpression;
|
---|
| 18 | useFactory?: o.Expression;
|
---|
| 19 | useExisting?: R3ProviderExpression;
|
---|
| 20 | useValue?: R3ProviderExpression;
|
---|
| 21 | deps?: R3DependencyMetadata[];
|
---|
| 22 | }
|
---|
| 23 | /**
|
---|
| 24 | * An expression used when instantiating an injectable.
|
---|
| 25 | *
|
---|
| 26 | * This is the type of the `useClass`, `useExisting` and `useValue` properties of
|
---|
| 27 | * `R3InjectableMetadata` since those can refer to types that may eagerly reference types that have
|
---|
| 28 | * not yet been defined.
|
---|
| 29 | */
|
---|
| 30 | export interface R3ProviderExpression<T extends o.Expression = o.Expression> {
|
---|
| 31 | /**
|
---|
| 32 | * The expression that is used to instantiate the Injectable.
|
---|
| 33 | */
|
---|
| 34 | expression: T;
|
---|
| 35 | /**
|
---|
| 36 | * If true, then the `expression` contains a reference to something that has not yet been
|
---|
| 37 | * defined.
|
---|
| 38 | *
|
---|
| 39 | * This means that the expression must not be eagerly evaluated. Instead it must be wrapped in a
|
---|
| 40 | * function closure that will be evaluated lazily to allow the definition of the expression to be
|
---|
| 41 | * evaluated first.
|
---|
| 42 | *
|
---|
| 43 | * In some cases the expression will naturally be placed inside such a function closure, such as
|
---|
| 44 | * in a fully compiled factory function. In those case nothing more needs to be done.
|
---|
| 45 | *
|
---|
| 46 | * But in other cases, such as partial-compilation the expression will be located in top level
|
---|
| 47 | * code so will need to be wrapped in a function that is passed to a `forwardRef()` call.
|
---|
| 48 | */
|
---|
| 49 | isForwardRef: boolean;
|
---|
| 50 | }
|
---|
| 51 | export declare function createR3ProviderExpression<T extends o.Expression>(expression: T, isForwardRef: boolean): R3ProviderExpression<T>;
|
---|
| 52 | export declare function compileInjectable(meta: R3InjectableMetadata, resolveForwardRefs: boolean): R3CompiledExpression;
|
---|
| 53 | export declare function createInjectableType(meta: R3InjectableMetadata): o.ExpressionType;
|
---|