@angular/compiler-cli 20.0.0-next.2 → 20.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-7HRFJETP.js → chunk-2DGDPAPS.js} +45 -47
- package/bundles/chunk-2DGDPAPS.js.map +6 -0
- package/bundles/{chunk-B73DMM7T.js → chunk-4SDRFXKJ.js} +5 -5
- package/bundles/{chunk-77D5CI2U.js → chunk-5UDS2TPQ.js} +7 -7
- package/bundles/{chunk-RFDMMGNB.js → chunk-7CTS3DE5.js} +160 -127
- package/bundles/{chunk-RFDMMGNB.js.map → chunk-7CTS3DE5.js.map} +3 -3
- package/bundles/{chunk-SWJRL4N4.js → chunk-DT3KYPVN.js} +31 -31
- package/bundles/{chunk-FKXFEX7K.js → chunk-GBKXY6BH.js} +3 -3
- package/bundles/{chunk-CD575TJ6.js → chunk-GDREVFAO.js} +7624 -7182
- package/bundles/chunk-GDREVFAO.js.map +6 -0
- package/bundles/{chunk-PAYJFU4V.js → chunk-HIV6YFKL.js} +12 -12
- package/bundles/{chunk-Q2WE7ECN.js → chunk-I6R3GL3L.js} +5 -5
- package/bundles/{chunk-37JMVF7H.js → chunk-STORTTKY.js} +8 -8
- package/bundles/{chunk-FVYXSSAL.js → chunk-YUAM2GYT.js} +3 -3
- package/bundles/index.js +12 -12
- package/bundles/linker/babel/index.js +12 -12
- package/bundles/linker/index.js +4 -4
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +4 -4
- package/bundles/private/tooling.js +6 -6
- package/bundles/src/bin/ng_xi18n.js +10 -10
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles_metadata.json +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +3 -3
- package/src/ngtsc/annotations/component/src/handler.d.ts +2 -1
- package/src/ngtsc/annotations/component/src/metadata.d.ts +3 -0
- package/src/ngtsc/annotations/directive/src/handler.d.ts +12 -3
- package/src/ngtsc/annotations/directive/src/shared.d.ts +10 -4
- package/src/ngtsc/core/api/src/options.d.ts +2 -2
- package/src/ngtsc/core/api/src/public_options.d.ts +4 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
- package/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.d.ts +2 -1
- package/src/ngtsc/metadata/src/resource_registry.d.ts +4 -1
- package/src/ngtsc/typecheck/api/api.d.ts +1 -1
- package/src/ngtsc/typecheck/api/checker.d.ts +5 -1
- package/src/ngtsc/typecheck/api/context.d.ts +11 -2
- package/src/ngtsc/typecheck/extended/checks/unparenthesized_nullish_coalescing/index.d.ts +10 -0
- package/src/ngtsc/typecheck/index.d.ts +1 -0
- package/src/ngtsc/typecheck/src/checker.d.ts +2 -1
- package/src/ngtsc/typecheck/src/context.d.ts +7 -3
- package/src/ngtsc/typecheck/src/dom.d.ts +15 -4
- package/src/ngtsc/typecheck/src/host_bindings.d.ts +31 -0
- package/src/ngtsc/typecheck/src/source.d.ts +5 -13
- package/src/ngtsc/typecheck/src/tcb_util.d.ts +8 -0
- package/src/ngtsc/typecheck/src/ts_util.d.ts +1 -1
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +7 -3
- package/bundles/chunk-7HRFJETP.js.map +0 -6
- package/bundles/chunk-CD575TJ6.js.map +0 -6
- /package/bundles/{chunk-B73DMM7T.js.map → chunk-4SDRFXKJ.js.map} +0 -0
- /package/bundles/{chunk-77D5CI2U.js.map → chunk-5UDS2TPQ.js.map} +0 -0
- /package/bundles/{chunk-SWJRL4N4.js.map → chunk-DT3KYPVN.js.map} +0 -0
- /package/bundles/{chunk-FKXFEX7K.js.map → chunk-GBKXY6BH.js.map} +0 -0
- /package/bundles/{chunk-PAYJFU4V.js.map → chunk-HIV6YFKL.js.map} +0 -0
- /package/bundles/{chunk-Q2WE7ECN.js.map → chunk-I6R3GL3L.js.map} +0 -0
- /package/bundles/{chunk-37JMVF7H.js.map → chunk-STORTTKY.js.map} +0 -0
- /package/bundles/{chunk-FVYXSSAL.js.map → chunk-YUAM2GYT.js.map} +0 -0
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
|
|
9
9
|
import { AstObject, AstValue } from '../../ast/ast_value';
|
|
10
|
-
export declare const PLACEHOLDER_VERSION = "20.0.0-next.
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "20.0.0-next.4";
|
|
11
11
|
export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
|
|
12
12
|
/**
|
|
13
13
|
* Parses the value of an enum from the AST value's symbol name.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "20.0.0-next.
|
|
3
|
+
"version": "20.0.0-next.4",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@babel/core": "7.26.
|
|
45
|
+
"@babel/core": "7.26.10",
|
|
46
46
|
"@jridgewell/sourcemap-codec": "^1.4.14",
|
|
47
47
|
"reflect-metadata": "^0.2.0",
|
|
48
48
|
"chokidar": "^4.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"yargs": "^17.2.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@angular/compiler": "20.0.0-next.
|
|
55
|
+
"@angular/compiler": "20.0.0-next.4",
|
|
56
56
|
"typescript": ">=5.8 <5.9"
|
|
57
57
|
},
|
|
58
58
|
"repository": {
|
|
@@ -73,7 +73,8 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
|
|
|
73
73
|
private readonly strictStandalone;
|
|
74
74
|
private readonly enableHmr;
|
|
75
75
|
private readonly implicitStandaloneValue;
|
|
76
|
-
|
|
76
|
+
private readonly typeCheckHostBindings;
|
|
77
|
+
constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, metaReader: MetadataReader, scopeReader: ComponentScopeReader, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>, scopeRegistry: LocalModuleScopeRegistry, typeCheckScopeRegistry: TypeCheckScopeRegistry, resourceRegistry: ResourceRegistry, isCore: boolean, strictCtorDeps: boolean, resourceLoader: ResourceLoader, rootDirs: ReadonlyArray<string>, defaultPreserveWhitespaces: boolean, i18nUseExternalIds: boolean, enableI18nLegacyMessageIdFormat: boolean, usePoisonedData: boolean, i18nNormalizeLineEndingsInICUs: boolean, moduleResolver: ModuleResolver, cycleAnalyzer: CycleAnalyzer, cycleHandlingStrategy: CycleHandlingStrategy, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, depTracker: DependencyTracker | null, injectableRegistry: InjectableClassRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, hostDirectivesResolver: HostDirectivesResolver, importTracker: ImportedSymbolsTracker, includeClassMetadata: boolean, compilationMode: CompilationMode, deferredSymbolTracker: DeferredSymbolTracker, forbidOrphanRendering: boolean, enableBlockSyntax: boolean, enableLetSyntax: boolean, externalRuntimeStyles: boolean, localCompilationExtraImportsTracker: LocalCompilationExtraImportsTracker | null, jitDeclarationRegistry: JitDeclarationRegistry, i18nPreserveSignificantWhitespace: boolean, strictStandalone: boolean, enableHmr: boolean, implicitStandaloneValue: boolean, typeCheckHostBindings: boolean);
|
|
77
78
|
private literalCache;
|
|
78
79
|
private elementSchemaRegistry;
|
|
79
80
|
/**
|
|
@@ -12,6 +12,7 @@ import { ClassPropertyMapping, DirectiveResources, DirectiveTypeCheckMeta, HostD
|
|
|
12
12
|
import { ClassDeclaration } from '../../../reflection';
|
|
13
13
|
import { SubsetOfKeys } from '../../../util/src/typescript';
|
|
14
14
|
import { ParsedTemplateWithSource, StyleUrlMeta } from './resources';
|
|
15
|
+
import { HostBindingNodes } from '../../directive';
|
|
15
16
|
/**
|
|
16
17
|
* These fields of `R3ComponentMetadata` are updated in the `resolve` phase.
|
|
17
18
|
*
|
|
@@ -68,6 +69,8 @@ export interface ComponentAnalysisData {
|
|
|
68
69
|
hostDirectives: HostDirectiveMeta[] | null;
|
|
69
70
|
/** Raw expression that defined the host directives array. Used for diagnostics. */
|
|
70
71
|
rawHostDirectives: ts.Expression | null;
|
|
72
|
+
/** Raw nodes representing the host bindings of the directive. */
|
|
73
|
+
hostBindingNodes: HostBindingNodes;
|
|
71
74
|
}
|
|
72
75
|
export interface ComponentResolutionData {
|
|
73
76
|
declarations: R3TemplateDependencyMetadata[];
|
|
@@ -9,15 +9,17 @@ import { ConstantPool, R3ClassMetadata, R3DirectiveMetadata } from '@angular/com
|
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ImportedSymbolsTracker, Reference, ReferenceEmitter } from '../../../imports';
|
|
11
11
|
import { SemanticDepGraphUpdater } from '../../../incremental/semantic_graph';
|
|
12
|
-
import { ClassPropertyMapping, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping, MetadataReader, MetadataRegistry } from '../../../metadata';
|
|
12
|
+
import { ClassPropertyMapping, DirectiveResources, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping, MetadataReader, MetadataRegistry, ResourceRegistry } from '../../../metadata';
|
|
13
13
|
import { PartialEvaluator } from '../../../partial_evaluator';
|
|
14
14
|
import { PerfRecorder } from '../../../perf';
|
|
15
15
|
import { ClassDeclaration, Decorator, ReflectionHost } from '../../../reflection';
|
|
16
|
-
import { LocalModuleScopeRegistry } from '../../../scope';
|
|
16
|
+
import { LocalModuleScopeRegistry, TypeCheckScopeRegistry } from '../../../scope';
|
|
17
17
|
import { AnalysisOutput, CompilationMode, CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence, ResolveResult } from '../../../transform';
|
|
18
18
|
import { InjectableClassRegistry, ReferencesRegistry } from '../../common';
|
|
19
|
+
import { HostBindingNodes } from './shared';
|
|
19
20
|
import { DirectiveSymbol } from './symbol';
|
|
20
21
|
import { JitDeclarationRegistry } from '../../common/src/jit_declaration_registry';
|
|
22
|
+
import { TypeCheckContext } from '../../../typecheck/api';
|
|
21
23
|
export interface DirectiveHandlerData {
|
|
22
24
|
baseClass: Reference<ClassDeclaration> | 'dynamic' | null;
|
|
23
25
|
typeCheckMeta: DirectiveTypeCheckMeta;
|
|
@@ -32,6 +34,8 @@ export interface DirectiveHandlerData {
|
|
|
32
34
|
decorator: ts.Decorator | null;
|
|
33
35
|
hostDirectives: HostDirectiveMeta[] | null;
|
|
34
36
|
rawHostDirectives: ts.Expression | null;
|
|
37
|
+
hostBindingNodes: HostBindingNodes;
|
|
38
|
+
resources: DirectiveResources;
|
|
35
39
|
}
|
|
36
40
|
export declare class DirectiveDecoratorHandler implements DecoratorHandler<Decorator | null, DirectiveHandlerData, DirectiveSymbol, unknown> {
|
|
37
41
|
private reflector;
|
|
@@ -49,17 +53,22 @@ export declare class DirectiveDecoratorHandler implements DecoratorHandler<Decor
|
|
|
49
53
|
private perf;
|
|
50
54
|
private importTracker;
|
|
51
55
|
private includeClassMetadata;
|
|
56
|
+
private typeCheckScopeRegistry;
|
|
52
57
|
private readonly compilationMode;
|
|
53
58
|
private readonly jitDeclarationRegistry;
|
|
59
|
+
private readonly resourceRegistry;
|
|
54
60
|
private readonly strictStandalone;
|
|
55
61
|
private readonly implicitStandaloneValue;
|
|
56
|
-
|
|
62
|
+
private readonly usePoisonedData;
|
|
63
|
+
private readonly typeCheckHostBindings;
|
|
64
|
+
constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, metaReader: MetadataReader, injectableRegistry: InjectableClassRegistry, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, isCore: boolean, strictCtorDeps: boolean, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, importTracker: ImportedSymbolsTracker, includeClassMetadata: boolean, typeCheckScopeRegistry: TypeCheckScopeRegistry, compilationMode: CompilationMode, jitDeclarationRegistry: JitDeclarationRegistry, resourceRegistry: ResourceRegistry, strictStandalone: boolean, implicitStandaloneValue: boolean, usePoisonedData: boolean, typeCheckHostBindings: boolean);
|
|
57
65
|
readonly precedence = HandlerPrecedence.PRIMARY;
|
|
58
66
|
readonly name = "DirectiveDecoratorHandler";
|
|
59
67
|
detect(node: ClassDeclaration, decorators: Decorator[] | null): DetectResult<Decorator | null> | undefined;
|
|
60
68
|
analyze(node: ClassDeclaration, decorator: Readonly<Decorator | null>): AnalysisOutput<DirectiveHandlerData>;
|
|
61
69
|
symbol(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>): DirectiveSymbol;
|
|
62
70
|
register(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>): void;
|
|
71
|
+
typeCheck(ctx: TypeCheckContext, node: ClassDeclaration, meta: Readonly<DirectiveHandlerData>): void;
|
|
63
72
|
resolve(node: ClassDeclaration, analysis: DirectiveHandlerData, symbol: DirectiveSymbol): ResolveResult<unknown>;
|
|
64
73
|
compileFull(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, resolution: Readonly<unknown>, pool: ConstantPool): CompileResult[];
|
|
65
74
|
compilePartial(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, resolution: Readonly<unknown>): CompileResult[];
|
|
@@ -5,16 +5,21 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { R3DirectiveMetadata, R3QueryMetadata } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ImportedSymbolsTracker, Reference, ReferenceEmitter } from '../../../imports';
|
|
11
|
-
import { ClassPropertyMapping, DecoratorInputTransform, HostDirectiveMeta, InputMapping } from '../../../metadata';
|
|
11
|
+
import { ClassPropertyMapping, DecoratorInputTransform, HostDirectiveMeta, InputMapping, Resource } from '../../../metadata';
|
|
12
12
|
import { DynamicValue, PartialEvaluator } from '../../../partial_evaluator';
|
|
13
|
-
import { ClassDeclaration,
|
|
13
|
+
import { ClassDeclaration, Decorator, ReflectionHost } from '../../../reflection';
|
|
14
14
|
import { CompilationMode } from '../../../transform';
|
|
15
15
|
import { ReferencesRegistry } from '../../common';
|
|
16
16
|
type QueryDecoratorName = 'ViewChild' | 'ViewChildren' | 'ContentChild' | 'ContentChildren';
|
|
17
17
|
export declare const queryDecoratorNames: QueryDecoratorName[];
|
|
18
|
+
export interface HostBindingNodes {
|
|
19
|
+
literal: ts.ObjectLiteralExpression | null;
|
|
20
|
+
bindingDecorators: Set<ts.Decorator>;
|
|
21
|
+
listenerDecorators: Set<ts.Decorator>;
|
|
22
|
+
}
|
|
18
23
|
/**
|
|
19
24
|
* Helper function to extract metadata from a `Directive` or `Component`. `Directive`s without a
|
|
20
25
|
* selector are allowed to be used for abstract base classes. These abstract directives should not
|
|
@@ -31,11 +36,11 @@ export declare function extractDirectiveMetadata(clazz: ClassDeclaration, decora
|
|
|
31
36
|
hostDirectives: HostDirectiveMeta[] | null;
|
|
32
37
|
rawHostDirectives: ts.Expression | null;
|
|
33
38
|
inputFieldNamesFromMetadataArray: Set<string>;
|
|
39
|
+
hostBindingNodes: HostBindingNodes;
|
|
34
40
|
} | {
|
|
35
41
|
jitForced: true;
|
|
36
42
|
};
|
|
37
43
|
export declare function extractDecoratorQueryMetadata(exprNode: ts.Node, name: string, args: ReadonlyArray<ts.Expression>, propertyName: string, reflector: ReflectionHost, evaluator: PartialEvaluator): R3QueryMetadata;
|
|
38
|
-
export declare function extractHostBindings(members: ClassMember[], evaluator: PartialEvaluator, coreModule: string | undefined, compilationMode: CompilationMode, metadata?: Map<string, ts.Expression>): ParsedHostBindings;
|
|
39
44
|
export declare function parseDirectiveStyles(directive: Map<string, ts.Expression>, evaluator: PartialEvaluator, compilationMode: CompilationMode): null | string[];
|
|
40
45
|
export declare function parseFieldStringArrayValue(directive: Map<string, ts.Expression>, field: string, evaluator: PartialEvaluator): null | string[];
|
|
41
46
|
/**
|
|
@@ -50,4 +55,5 @@ export declare function parseFieldStringArrayValue(directive: Map<string, ts.Exp
|
|
|
50
55
|
*
|
|
51
56
|
*/
|
|
52
57
|
export declare function parseDecoratorInputTransformFunction(clazz: ClassDeclaration, classPropertyName: string, value: DynamicValue | Reference, reflector: ReflectionHost, refEmitter: ReferenceEmitter, compilationMode: CompilationMode): DecoratorInputTransform;
|
|
58
|
+
export declare function extractHostBindingResources(nodes: HostBindingNodes): ReadonlySet<Resource>;
|
|
53
59
|
export {};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
|
-
import { BazelAndG3Options, DiagnosticOptions, I18nOptions, LegacyNgcOptions, MiscOptions,
|
|
9
|
+
import { BazelAndG3Options, DiagnosticOptions, I18nOptions, LegacyNgcOptions, MiscOptions, TypeCheckingOptions, TargetOptions } from './public_options';
|
|
10
10
|
/**
|
|
11
11
|
* Non-public options which are useful during testing of the compiler.
|
|
12
12
|
*/
|
|
@@ -53,6 +53,6 @@ export interface InternalOptions {
|
|
|
53
53
|
*
|
|
54
54
|
* Also includes a few miscellaneous options.
|
|
55
55
|
*/
|
|
56
|
-
export interface NgCompilerOptions extends ts.CompilerOptions, LegacyNgcOptions, BazelAndG3Options, DiagnosticOptions,
|
|
56
|
+
export interface NgCompilerOptions extends ts.CompilerOptions, LegacyNgcOptions, BazelAndG3Options, DiagnosticOptions, TypeCheckingOptions, TestOnlyOptions, I18nOptions, TargetOptions, InternalOptions, MiscOptions {
|
|
57
57
|
[prop: string]: any;
|
|
58
58
|
}
|
|
@@ -81,11 +81,13 @@ export interface LegacyNgcOptions {
|
|
|
81
81
|
preserveWhitespaces?: boolean;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* Options related to
|
|
84
|
+
* Options related to Angular-specific type-checking and its strictness.
|
|
85
85
|
*
|
|
86
86
|
* @publicApi
|
|
87
87
|
*/
|
|
88
|
-
export interface
|
|
88
|
+
export interface TypeCheckingOptions {
|
|
89
|
+
/** Whether type checking of host bindings is enabled. */
|
|
90
|
+
typeCheckHostBindings?: boolean;
|
|
89
91
|
/**
|
|
90
92
|
* If `true`, implies all template strictness flags below (unless individually disabled).
|
|
91
93
|
*
|
|
@@ -444,6 +444,10 @@ export declare enum ErrorCode {
|
|
|
444
444
|
* A symbol referenced in `@Component.imports` isn't being used within the template.
|
|
445
445
|
*/
|
|
446
446
|
UNUSED_STANDALONE_IMPORTS = 8113,
|
|
447
|
+
/**
|
|
448
|
+
* An expression mixes nullish coalescing and logical and/or without parentheses.
|
|
449
|
+
*/
|
|
450
|
+
UNPARENTHESIZED_NULLISH_COALESCING = 8114,
|
|
447
451
|
/**
|
|
448
452
|
* The template type-checking engine would need to generate an inline type check block for a
|
|
449
453
|
* component, but the current type-checking environment doesn't support it.
|
|
@@ -27,5 +27,6 @@ export declare enum ExtendedTemplateDiagnosticName {
|
|
|
27
27
|
INTERPOLATED_SIGNAL_NOT_INVOKED = "interpolatedSignalNotInvoked",
|
|
28
28
|
CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION = "controlFlowPreventingContentProjection",
|
|
29
29
|
UNUSED_LET_DECLARATION = "unusedLetDeclaration",
|
|
30
|
-
UNUSED_STANDALONE_IMPORTS = "unusedStandaloneImports"
|
|
30
|
+
UNUSED_STANDALONE_IMPORTS = "unusedStandaloneImports",
|
|
31
|
+
UNPARENTHESIZED_NULLISH_COALESCING = "unparenthesizedNullishCoalescing"
|
|
31
32
|
}
|
|
@@ -17,7 +17,7 @@ import { ClassDeclaration } from '../../reflection';
|
|
|
17
17
|
*/
|
|
18
18
|
export interface Resource {
|
|
19
19
|
path: AbsoluteFsPath | null;
|
|
20
|
-
|
|
20
|
+
node: ts.Node;
|
|
21
21
|
}
|
|
22
22
|
export interface ExternalResource extends Resource {
|
|
23
23
|
path: AbsoluteFsPath;
|
|
@@ -32,6 +32,7 @@ export declare function isExternalResource(resource: Resource): resource is Exte
|
|
|
32
32
|
export interface DirectiveResources {
|
|
33
33
|
template: Resource | null;
|
|
34
34
|
styles: ReadonlySet<Resource> | null;
|
|
35
|
+
hostBindings: ReadonlySet<Resource> | null;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* Tracks the mapping between external resources and the directives(s) which use them.
|
|
@@ -45,6 +46,7 @@ export declare class ResourceRegistry {
|
|
|
45
46
|
private componentToTemplateMap;
|
|
46
47
|
private componentToStylesMap;
|
|
47
48
|
private externalStyleToComponentsMap;
|
|
49
|
+
private directiveToHostBindingsMap;
|
|
48
50
|
getComponentsWithTemplate(template: AbsoluteFsPath): ReadonlySet<ClassDeclaration>;
|
|
49
51
|
registerResources(resources: DirectiveResources, directive: ClassDeclaration): void;
|
|
50
52
|
private registerTemplate;
|
|
@@ -52,4 +54,5 @@ export declare class ResourceRegistry {
|
|
|
52
54
|
private registerStyle;
|
|
53
55
|
getStyles(component: ClassDeclaration): Set<Resource>;
|
|
54
56
|
getComponentsWithStyle(styleUrl: AbsoluteFsPath): ReadonlySet<ClassDeclaration>;
|
|
57
|
+
getHostBindings(directive: ClassDeclaration): ReadonlySet<Resource> | null;
|
|
55
58
|
}
|
|
@@ -317,7 +317,7 @@ export type SourceMapping = DirectSourceMapping | IndirectSourceMapping | Extern
|
|
|
317
317
|
*/
|
|
318
318
|
export interface DirectSourceMapping {
|
|
319
319
|
type: 'direct';
|
|
320
|
-
node: ts.
|
|
320
|
+
node: ts.Node;
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* A mapping to a node which is still in a TS file, but where the positions in any
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TemplateEntity, TmplAstElement, TmplAstNode, TmplAstTemplate, TmplAstTextAttribute } from '@angular/compiler';
|
|
8
|
+
import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TemplateEntity, TmplAstElement, TmplAstHostElement, TmplAstNode, TmplAstTemplate, TmplAstTextAttribute } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { AbsoluteFsPath } from '../../../../src/ngtsc/file_system';
|
|
11
11
|
import { ErrorCode } from '../../diagnostics';
|
|
@@ -34,6 +34,10 @@ export interface TemplateTypeChecker {
|
|
|
34
34
|
* Retrieve the template in use for the given component.
|
|
35
35
|
*/
|
|
36
36
|
getTemplate(component: ts.ClassDeclaration, optimizeFor?: OptimizeFor): TmplAstNode[] | null;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve the host element of the given directive.
|
|
39
|
+
*/
|
|
40
|
+
getHostElement(directive: ts.ClassDeclaration, optimizeFor?: OptimizeFor): TmplAstHostElement | null;
|
|
37
41
|
/**
|
|
38
42
|
* Get all `ts.Diagnostic`s currently available for the given `ts.SourceFile`.
|
|
39
43
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { ParseError, ParseSourceFile, R3TargetBinder, SchemaMetadata, TmplAstNode } from '@angular/compiler';
|
|
8
|
+
import { ParseError, ParseSourceFile, R3TargetBinder, SchemaMetadata, TmplAstHostElement, TmplAstNode } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
11
|
import { PipeMeta } from '../../metadata';
|
|
@@ -26,6 +26,13 @@ export interface TemplateContext {
|
|
|
26
26
|
/** Whether the template preserves whitespaces. */
|
|
27
27
|
preserveWhitespaces: boolean;
|
|
28
28
|
}
|
|
29
|
+
/** Contextual data for type checking the host bindings of a directive. */
|
|
30
|
+
export interface HostBindingsContext {
|
|
31
|
+
/** AST node representing the host element of the directive. */
|
|
32
|
+
node: TmplAstHostElement;
|
|
33
|
+
/** Describes the source of the host bindings. Used for mapping errors back. */
|
|
34
|
+
sourceMapping: SourceMapping;
|
|
35
|
+
}
|
|
29
36
|
/**
|
|
30
37
|
* A currently pending type checking operation, into which templates for type-checking can be
|
|
31
38
|
* registered.
|
|
@@ -44,9 +51,11 @@ export interface TypeCheckContext {
|
|
|
44
51
|
* @param schemas Schemas that will apply when checking the directive.
|
|
45
52
|
* @param templateContext Contextual information necessary for checking the template.
|
|
46
53
|
* Only relevant for component classes.
|
|
54
|
+
* @param hostBindingContext Contextual information necessary for checking the host bindings of
|
|
55
|
+
* a directive.
|
|
47
56
|
* @param isStandalone a boolean indicating whether the directive is standalone.
|
|
48
57
|
*/
|
|
49
|
-
addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, isStandalone: boolean): void;
|
|
58
|
+
addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, hostBindingContext: HostBindingsContext | null, isStandalone: boolean): void;
|
|
50
59
|
}
|
|
51
60
|
/**
|
|
52
61
|
* Interface to trigger generation of type-checking code for a program given a new
|
|
@@ -0,0 +1,10 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { ErrorCode, ExtendedTemplateDiagnosticName } from '../../../../diagnostics';
|
|
9
|
+
import { TemplateCheckFactory } from '../../api';
|
|
10
|
+
export declare const factory: TemplateCheckFactory<ErrorCode.UNPARENTHESIZED_NULLISH_COALESCING, ExtendedTemplateDiagnosticName.UNPARENTHESIZED_NULLISH_COALESCING>;
|
|
@@ -9,3 +9,4 @@ export { FileTypeCheckingData, TemplateTypeCheckerImpl } from './src/checker';
|
|
|
9
9
|
export { TypeCheckContextImpl, getTemplateDiagnostics } from './src/context';
|
|
10
10
|
export { TypeCheckShimGenerator } from './src/shim';
|
|
11
11
|
export { typeCheckFilePath } from './src/type_check_file';
|
|
12
|
+
export { createHostElement } from './src/host_bindings';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TemplateEntity, TmplAstElement, TmplAstNode, TmplAstTemplate, TmplAstTextAttribute } from '@angular/compiler';
|
|
8
|
+
import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TemplateEntity, TmplAstElement, TmplAstHostElement, TmplAstNode, TmplAstTemplate, TmplAstTextAttribute } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ErrorCode } from '../../diagnostics';
|
|
11
11
|
import { AbsoluteFsPath } from '../../file_system';
|
|
@@ -76,6 +76,7 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
|
|
|
76
76
|
private isComplete;
|
|
77
77
|
constructor(originalProgram: ts.Program, programDriver: ProgramDriver, typeCheckAdapter: ProgramTypeCheckAdapter, config: TypeCheckingConfig, refEmitter: ReferenceEmitter, reflector: ReflectionHost, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>, priorBuild: IncrementalBuild<unknown, FileTypeCheckingData>, metaReader: MetadataReader, localMetaReader: MetadataReaderWithIndex, ngModuleIndex: NgModuleIndex, componentScopeReader: ComponentScopeReader, typeCheckScopeRegistry: TypeCheckScopeRegistry, perf: PerfRecorder);
|
|
78
78
|
getTemplate(component: ts.ClassDeclaration, optimizeFor?: OptimizeFor): TmplAstNode[] | null;
|
|
79
|
+
getHostElement(directive: ts.ClassDeclaration, optimizeFor?: OptimizeFor): TmplAstHostElement | null;
|
|
79
80
|
getUsedDirectives(component: ts.ClassDeclaration): TypeCheckableDirectiveMeta[] | null;
|
|
80
81
|
getUsedPipes(component: ts.ClassDeclaration): string[] | null;
|
|
81
82
|
private getLatestComponentState;
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { BoundTarget, ParseError, R3TargetBinder, SchemaMetadata, TmplAstNode } from '@angular/compiler';
|
|
8
|
+
import { BoundTarget, ParseError, R3TargetBinder, SchemaMetadata, TmplAstHostElement, TmplAstNode } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { AbsoluteFsPath } from '../../file_system';
|
|
11
11
|
import { Reference, ReferenceEmitter } from '../../imports';
|
|
12
12
|
import { PerfRecorder } from '../../perf';
|
|
13
13
|
import { FileUpdate } from '../../program_driver';
|
|
14
14
|
import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
15
|
-
import { TemplateDiagnostic, TypeCheckId, SourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata, TemplateContext } from '../api';
|
|
15
|
+
import { HostBindingsContext, TemplateDiagnostic, TypeCheckId, SourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata, TemplateContext } from '../api';
|
|
16
16
|
import { DomSchemaChecker } from './dom';
|
|
17
17
|
import { OutOfBandDiagnosticRecorder } from './oob';
|
|
18
18
|
import { DirectiveSourceManager } from './source';
|
|
@@ -55,6 +55,10 @@ export interface TypeCheckData {
|
|
|
55
55
|
* Errors found while parsing the template, which have been converted to diagnostics.
|
|
56
56
|
*/
|
|
57
57
|
templateParsingDiagnostics: TemplateDiagnostic[];
|
|
58
|
+
/**
|
|
59
|
+
* Element representing the host bindings of a directive.
|
|
60
|
+
*/
|
|
61
|
+
hostElement: TmplAstHostElement | null;
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* Data for an input file which is still in the process of template type-checking code generation.
|
|
@@ -165,7 +169,7 @@ export declare class TypeCheckContextImpl implements TypeCheckContext {
|
|
|
165
169
|
*
|
|
166
170
|
* Implements `TypeCheckContext.addTemplate`.
|
|
167
171
|
*/
|
|
168
|
-
addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, isStandalone: boolean): void;
|
|
172
|
+
addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, hostBindingContext: HostBindingsContext | null, isStandalone: boolean): void;
|
|
169
173
|
/**
|
|
170
174
|
* Record a type constructor for the given `node` with the given `ctorMetadata`.
|
|
171
175
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { ParseSourceSpan, SchemaMetadata, TmplAstElement } from '@angular/compiler';
|
|
8
|
+
import { ParseSourceSpan, SchemaMetadata, TmplAstElement, TmplAstHostElement } from '@angular/compiler';
|
|
9
9
|
import { TemplateDiagnostic, TypeCheckId } from '../api';
|
|
10
10
|
import { TypeCheckSourceResolver } from './tcb_util';
|
|
11
11
|
/**
|
|
@@ -37,7 +37,7 @@ export interface DomSchemaChecker {
|
|
|
37
37
|
/**
|
|
38
38
|
* Check a property binding on an element and record any diagnostics about it.
|
|
39
39
|
*
|
|
40
|
-
* @param id the
|
|
40
|
+
* @param id the type check ID, suitable for resolution with a `TcbSourceResolver`.
|
|
41
41
|
* @param element the element node in question.
|
|
42
42
|
* @param name the name of the property being checked.
|
|
43
43
|
* @param span the source span of the binding. This is redundant with `element.attributes` but is
|
|
@@ -45,7 +45,17 @@ export interface DomSchemaChecker {
|
|
|
45
45
|
* @param schemas any active schemas for the template, which might affect the validity of the
|
|
46
46
|
* property.
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
checkTemplateElementProperty(id: string, element: TmplAstElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
|
|
49
|
+
/**
|
|
50
|
+
* Check a property binding on a host element and record any diagnostics about it.
|
|
51
|
+
* @param id the type check ID, suitable for resolution with a `TcbSourceResolver`.
|
|
52
|
+
* @param element the element node in question.
|
|
53
|
+
* @param name the name of the property being checked.
|
|
54
|
+
* @param span the source span of the binding.
|
|
55
|
+
* @param schemas any active schemas for the template, which might affect the validity of the
|
|
56
|
+
* property.
|
|
57
|
+
*/
|
|
58
|
+
checkHostElementProperty(id: string, element: TmplAstHostElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[]): void;
|
|
49
59
|
}
|
|
50
60
|
/**
|
|
51
61
|
* Checks non-Angular elements and properties against the `DomElementSchemaRegistry`, a schema
|
|
@@ -57,5 +67,6 @@ export declare class RegistryDomSchemaChecker implements DomSchemaChecker {
|
|
|
57
67
|
get diagnostics(): ReadonlyArray<TemplateDiagnostic>;
|
|
58
68
|
constructor(resolver: TypeCheckSourceResolver);
|
|
59
69
|
checkElement(id: TypeCheckId, element: TmplAstElement, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
|
|
60
|
-
|
|
70
|
+
checkTemplateElementProperty(id: TypeCheckId, element: TmplAstElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
|
|
71
|
+
checkHostElementProperty(id: TypeCheckId, element: TmplAstHostElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[]): void;
|
|
61
72
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { TmplAstHostElement } from '@angular/compiler';
|
|
9
|
+
import ts from 'typescript';
|
|
10
|
+
import { ClassDeclaration } from '../../reflection';
|
|
11
|
+
/**
|
|
12
|
+
* Creates an AST node that represents the host element of a directive.
|
|
13
|
+
* Can return null if there are no valid bindings to be checked.
|
|
14
|
+
* @param type Whether the host element is for a directive or a component.
|
|
15
|
+
* @param selector Selector of the directive.
|
|
16
|
+
* @param sourceNode Class declaration for the directive.
|
|
17
|
+
* @param literal `host` object literal from the decorator.
|
|
18
|
+
* @param bindingDecorators `HostBinding` decorators discovered on the node.
|
|
19
|
+
* @param listenerDecorators `HostListener` decorators discovered on the node.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createHostElement(type: 'component' | 'directive', selector: string | null, sourceNode: ClassDeclaration, literal: ts.ObjectLiteralExpression | null, bindingDecorators: Iterable<ts.Decorator>, listenerDecorators: Iterable<ts.Decorator>): TmplAstHostElement | null;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an AST node that can be used as a guard in `if` statements to distinguish TypeScript
|
|
24
|
+
* nodes used for checking host bindings from ones used for checking templates.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createHostBindingsBlockGuard(): ts.Expression;
|
|
27
|
+
/**
|
|
28
|
+
* Determines if a given node is a guard that indicates that descendant nodes are used to check
|
|
29
|
+
* host bindings.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isHostBindingsBlockGuard(node: ts.Node): boolean;
|
|
@@ -9,19 +9,6 @@ import { AbsoluteSourceSpan, ParseSourceFile, ParseSourceSpan } from '@angular/c
|
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { TypeCheckId, SourceMapping } from '../api';
|
|
11
11
|
import { TypeCheckSourceResolver } from './tcb_util';
|
|
12
|
-
/**
|
|
13
|
-
* Represents the source of a template that was processed during type-checking. This information is
|
|
14
|
-
* used when translating parse offsets in diagnostics back to their original line/column location.
|
|
15
|
-
*/
|
|
16
|
-
export declare class TemplateSource {
|
|
17
|
-
readonly mapping: SourceMapping;
|
|
18
|
-
private file;
|
|
19
|
-
private lineStarts;
|
|
20
|
-
constructor(mapping: SourceMapping, file: ParseSourceFile);
|
|
21
|
-
toParseSourceSpan(start: number, end: number): ParseSourceSpan;
|
|
22
|
-
private toParseLocation;
|
|
23
|
-
private acquireLineStarts;
|
|
24
|
-
}
|
|
25
12
|
/**
|
|
26
13
|
* Assigns IDs for type checking and keeps track of their origins.
|
|
27
14
|
*
|
|
@@ -34,8 +21,13 @@ export declare class DirectiveSourceManager implements TypeCheckSourceResolver {
|
|
|
34
21
|
* diagnostics produced for TCB code to their source location in the template.
|
|
35
22
|
*/
|
|
36
23
|
private templateSources;
|
|
24
|
+
/** Keeps track of type check IDs and the source location of their host bindings. */
|
|
25
|
+
private hostBindingSources;
|
|
37
26
|
getTypeCheckId(node: ts.ClassDeclaration): TypeCheckId;
|
|
38
27
|
captureTemplateSource(id: TypeCheckId, mapping: SourceMapping, file: ParseSourceFile): void;
|
|
28
|
+
captureHostBindingsMapping(id: TypeCheckId, mapping: SourceMapping, file: ParseSourceFile): void;
|
|
39
29
|
getTemplateSourceMapping(id: TypeCheckId): SourceMapping;
|
|
30
|
+
getHostBindingsMapping(id: TypeCheckId): SourceMapping;
|
|
40
31
|
toTemplateParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
|
|
32
|
+
toHostParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
|
|
41
33
|
}
|
|
@@ -28,6 +28,14 @@ export interface TypeCheckSourceResolver {
|
|
|
28
28
|
* numbers in addition to only absolute offsets and gives access to the original source code.
|
|
29
29
|
*/
|
|
30
30
|
toTemplateParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
|
|
31
|
+
/** For the given type checking id, retrieve the source mapping of its host bindings. */
|
|
32
|
+
getHostBindingsMapping(id: TypeCheckId): SourceMapping;
|
|
33
|
+
/**
|
|
34
|
+
* Convert an absolute source span coming from a host binding associated with the given type
|
|
35
|
+
* checking id into a full `ParseSourceSpan`. The returned parse span has line and column
|
|
36
|
+
* numbers in addition to only absolute offsets and gives access to the original source code.
|
|
37
|
+
*/
|
|
38
|
+
toHostParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
41
|
* Indicates whether a particular component requires an inline type check block.
|
|
@@ -13,7 +13,7 @@ export declare function tsCastToAny(expr: ts.Expression): ts.Expression;
|
|
|
13
13
|
* Thanks to narrowing of `document.createElement()`, this expression will have its type inferred
|
|
14
14
|
* based on the tag name, including for custom elements that have appropriate .d.ts definitions.
|
|
15
15
|
*/
|
|
16
|
-
export declare function tsCreateElement(
|
|
16
|
+
export declare function tsCreateElement(...tagNames: string[]): ts.Expression;
|
|
17
17
|
/**
|
|
18
18
|
* Create a `ts.VariableStatement` which declares a variable without explicit initialization.
|
|
19
19
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { BoundTarget, SchemaMetadata, TmplAstElement, TmplAstForLoopBlock, TmplAstIfBlockBranch, TmplAstLetDeclaration, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
|
|
8
|
+
import { BoundTarget, SchemaMetadata, TmplAstElement, TmplAstForLoopBlock, TmplAstIfBlockBranch, TmplAstLetDeclaration, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstVariable, TmplAstHostElement } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
11
|
import { PipeMeta } from '../../metadata';
|
|
@@ -65,7 +65,7 @@ export declare enum TcbGenericContextBehavior {
|
|
|
65
65
|
*/
|
|
66
66
|
export declare function generateTypeCheckBlock(env: Environment, ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, name: ts.Identifier, meta: TypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, genericContextBehavior: TcbGenericContextBehavior): ts.FunctionDeclaration;
|
|
67
67
|
/** Types that can referenced locally in a template. */
|
|
68
|
-
type LocalSymbol = TmplAstElement | TmplAstTemplate | TmplAstVariable | TmplAstLetDeclaration | TmplAstReference;
|
|
68
|
+
type LocalSymbol = TmplAstElement | TmplAstTemplate | TmplAstVariable | TmplAstLetDeclaration | TmplAstReference | TmplAstHostElement;
|
|
69
69
|
/**
|
|
70
70
|
* A code generation operation that's involved in the construction of a Type Check Block.
|
|
71
71
|
*
|
|
@@ -179,6 +179,10 @@ declare class Scope {
|
|
|
179
179
|
* A map of `TmplAstElement`s to the index of their `TcbElementOp` in the `opQueue`
|
|
180
180
|
*/
|
|
181
181
|
private elementOpMap;
|
|
182
|
+
/**
|
|
183
|
+
* A map of `TmplAstHostElement`s to the index of their `TcbHostElementOp` in the `opQueue`
|
|
184
|
+
*/
|
|
185
|
+
private hostElementOpMap;
|
|
182
186
|
/**
|
|
183
187
|
* A map of maps which tracks the index of `TcbDirectiveCtorOp`s in the `opQueue` for each
|
|
184
188
|
* directive on a `TmplAstElement` or `TmplAstTemplate` node.
|
|
@@ -227,7 +231,7 @@ declare class Scope {
|
|
|
227
231
|
* @param children Child nodes that should be appended to the TCB.
|
|
228
232
|
* @param guard an expression that is applied to this scope for type narrowing purposes.
|
|
229
233
|
*/
|
|
230
|
-
static forNodes(tcb: Context, parentScope: Scope | null, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | null, children: TmplAstNode[], guard: ts.Expression | null): Scope;
|
|
234
|
+
static forNodes(tcb: Context, parentScope: Scope | null, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard: ts.Expression | null): Scope;
|
|
231
235
|
/** Registers a local variable with a scope. */
|
|
232
236
|
private static registerVariable;
|
|
233
237
|
/**
|