@angular/compiler-cli 21.2.2 → 21.2.3
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-RJ3Y43GR.js → chunk-6JHVJEKD.js} +5 -5
- package/bundles/chunk-FLWAEX6T.js +1 -1
- package/bundles/{chunk-SPPRVX7S.js → chunk-KJC7YNMY.js} +2 -2
- package/bundles/{chunk-OECV6WLT.js → chunk-L3PEIUBN.js} +723 -440
- package/bundles/{chunk-32EO3D75.js → chunk-NU2SXS64.js} +1 -1
- package/bundles/index.js +4 -4
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/testing.js +1 -1
- package/bundles/private/tooling.js +1 -1
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- package/src/ngtsc/annotations/common/src/diagnostics.d.ts +7 -7
- package/src/ngtsc/core/api/src/adapter.d.ts +1 -1
- package/src/ngtsc/incremental/src/incremental.d.ts +1 -1
- package/src/ngtsc/typecheck/api/api.d.ts +80 -4
- package/src/ngtsc/typecheck/src/checker.d.ts +1 -1
- package/src/ngtsc/typecheck/src/context.d.ts +1 -1
- package/src/ngtsc/typecheck/src/environment.d.ts +4 -3
- package/src/ngtsc/typecheck/src/oob.d.ts +5 -4
- package/src/ngtsc/typecheck/src/ops/bindings.d.ts +3 -5
- package/src/ngtsc/typecheck/src/ops/context.d.ts +4 -5
- package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +3 -3
- package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +3 -3
- package/src/ngtsc/typecheck/src/ops/events.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/inputs.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/references.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/scope.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/signal_forms.d.ts +6 -6
- package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +18 -1
- package/src/ngtsc/typecheck/src/tcb_adapter.d.ts +20 -0
- package/src/ngtsc/typecheck/src/tcb_util.d.ts +2 -1
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -4
- package/src/ngtsc/typecheck/src/type_check_file.d.ts +1 -0
- package/src/ngtsc/typecheck/src/type_constructor.d.ts +2 -2
package/bundles/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isTsDiagnostic,
|
|
18
18
|
performCompilation,
|
|
19
19
|
readConfiguration
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-KJC7YNMY.js";
|
|
21
21
|
import {
|
|
22
22
|
ConsoleLogger,
|
|
23
23
|
LogLevel
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
freshCompilationTicket,
|
|
35
35
|
incrementalFromStateTicket,
|
|
36
36
|
isDocEntryWithSourceInfo
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-6JHVJEKD.js";
|
|
38
38
|
import {
|
|
39
39
|
ActivePerfRecorder,
|
|
40
40
|
ErrorCode,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
getInitializerApiJitTransform,
|
|
47
47
|
isLocalCompilationDiagnostics,
|
|
48
48
|
ngErrorCode
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-L3PEIUBN.js";
|
|
50
50
|
import "./chunk-CSUVPNMK.js";
|
|
51
51
|
import {
|
|
52
52
|
InvalidFileSystem,
|
|
@@ -77,7 +77,7 @@ import "./chunk-G7GFT6BU.js";
|
|
|
77
77
|
|
|
78
78
|
// packages/compiler-cli/src/version.js
|
|
79
79
|
import { Version } from "@angular/compiler";
|
|
80
|
-
var VERSION = new Version("21.2.
|
|
80
|
+
var VERSION = new Version("21.2.3");
|
|
81
81
|
|
|
82
82
|
// packages/compiler-cli/private/tooling.js
|
|
83
83
|
var GLOBAL_DEFS_FOR_TERSER = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
DiagnosticCategoryLabel,
|
|
7
7
|
NgCompiler
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-6JHVJEKD.js";
|
|
9
9
|
import {
|
|
10
10
|
CompilationMode,
|
|
11
11
|
DtsMetadataReader,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
queryDecoratorNames,
|
|
33
33
|
reflectObjectLiteral,
|
|
34
34
|
unwrapExpression
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-L3PEIUBN.js";
|
|
36
36
|
import "../chunk-CSUVPNMK.js";
|
|
37
37
|
import {
|
|
38
38
|
getFileSystem,
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
import {
|
|
7
7
|
main,
|
|
8
8
|
readCommandLineAndConfiguration
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-NU2SXS64.js";
|
|
10
10
|
import {
|
|
11
11
|
EmitFlags
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-KJC7YNMY.js";
|
|
13
|
+
import "../../chunk-6JHVJEKD.js";
|
|
14
|
+
import "../../chunk-L3PEIUBN.js";
|
|
15
15
|
import "../../chunk-CSUVPNMK.js";
|
|
16
16
|
import {
|
|
17
17
|
setFileSystem
|
package/bundles/src/bin/ngc.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-NU2SXS64.js";
|
|
9
|
+
import "../../chunk-KJC7YNMY.js";
|
|
10
|
+
import "../../chunk-6JHVJEKD.js";
|
|
11
|
+
import "../../chunk-L3PEIUBN.js";
|
|
12
12
|
import "../../chunk-CSUVPNMK.js";
|
|
13
13
|
import {
|
|
14
14
|
setFileSystem
|
|
@@ -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 = "21.2.
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "21.2.3";
|
|
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": "21.2.
|
|
3
|
+
"version": "21.2.3",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typescript": "5.9.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@angular/compiler": "21.2.
|
|
46
|
+
"@angular/compiler": "21.2.3",
|
|
47
47
|
"typescript": ">=5.9 <6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
8
|
import ts from 'typescript';
|
|
9
9
|
import { FatalDiagnosticError } from '../../../diagnostics';
|
|
10
10
|
import { Reference } from '../../../imports';
|
|
@@ -56,7 +56,7 @@ export declare function findInheritedCtor(node: ClassDeclaration, injectableRegi
|
|
|
56
56
|
* from external files. This is a common scenario for errors in local compilation mode,
|
|
57
57
|
* and so this helper can be used to quickly generate the relevant errors.
|
|
58
58
|
*
|
|
59
|
-
* @param nodeToHighlight Node to be highlighted in
|
|
59
|
+
* @param nodeToHighlight Node to be highlighted in the error message.
|
|
60
60
|
* Will default to value.node if not provided.
|
|
61
61
|
*/
|
|
62
62
|
export declare function assertLocalCompilationUnresolvedConst(compilationMode: CompilationMode, value: ResolvedValue, nodeToHighlight: ts.Node | null, errorMessage: string): void;
|
|
@@ -12,7 +12,7 @@ import { ExtendedTsCompilerHost, UnifiedModulesHost } from './interfaces';
|
|
|
12
12
|
* Names of methods from `ExtendedTsCompilerHost` that need to be provided by the
|
|
13
13
|
* `NgCompilerAdapter`.
|
|
14
14
|
*/
|
|
15
|
-
export type ExtendedCompilerHostMethods = 'getCanonicalFileName' | 'resolveModuleNames' | 'getCurrentDirectory' | 'getModifiedResourceFiles' | 'readResource' | 'resourceNameToFileName' | 'transformResource';
|
|
15
|
+
export type ExtendedCompilerHostMethods = 'getCanonicalFileName' | 'getSourceFile' | 'resolveModuleNames' | 'getCurrentDirectory' | 'getModifiedResourceFiles' | 'readResource' | 'resourceNameToFileName' | 'transformResource';
|
|
16
16
|
/**
|
|
17
17
|
* Adapter for `NgCompiler` that allows it to be used in various circumstances, such as
|
|
18
18
|
* command-line `ngc`, as a plugin to `ts_library` in Bazel, or from the Language Service.
|
|
@@ -35,7 +35,7 @@ export declare class IncrementalCompilation implements IncrementalBuild<ClassRec
|
|
|
35
35
|
/**
|
|
36
36
|
* Begin a fresh `IncrementalCompilation`.
|
|
37
37
|
*/
|
|
38
|
-
static fresh(
|
|
38
|
+
static fresh(versions: Map<AbsoluteFsPath, string> | null): IncrementalCompilation;
|
|
39
39
|
static incremental(program: ts.Program, newVersions: Map<AbsoluteFsPath, string> | null, oldProgram: ts.Program, oldState: IncrementalState, modifiedResourceFiles: Set<AbsoluteFsPath> | null, perf: PerfRecorder): IncrementalCompilation;
|
|
40
40
|
get state(): IncrementalState;
|
|
41
41
|
get semanticDepGraphUpdater(): SemanticDepGraphUpdater;
|
|
@@ -5,12 +5,89 @@
|
|
|
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 { AbsoluteSourceSpan, BoundTarget, DirectiveMeta, ParseSourceSpan, SchemaMetadata } from '@angular/compiler';
|
|
8
|
+
import { AbsoluteSourceSpan, BoundTarget, DirectiveMeta, LegacyAnimationTriggerNames, ParseSourceSpan, SchemaMetadata } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ErrorCode } from '../../diagnostics';
|
|
11
11
|
import { Reference } from '../../imports';
|
|
12
|
-
import { ClassPropertyMapping, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping, PipeMeta } from '../../metadata';
|
|
12
|
+
import { ClassPropertyMapping, ClassPropertyName, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping, InputOrOutput, PipeMeta, TemplateGuardMeta } from '../../metadata';
|
|
13
13
|
import { ClassDeclaration } from '../../reflection';
|
|
14
|
+
export interface TcbReferenceMetadata {
|
|
15
|
+
/** The name of the class */
|
|
16
|
+
name: string;
|
|
17
|
+
/** The module path where the symbol is located, or null if local/ambient */
|
|
18
|
+
moduleName: string | null;
|
|
19
|
+
/** True if the symbol successfully emitted locally (no external import required) */
|
|
20
|
+
isLocal: boolean;
|
|
21
|
+
/** If the reference could not be externally emitted, this string holds the diagnostic reason why */
|
|
22
|
+
unexportedDiagnostic: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Defines the `AbsoluteSourceSpan` of the target's node name, if available.
|
|
25
|
+
*/
|
|
26
|
+
nodeNameSpan?: AbsoluteSourceSpan;
|
|
27
|
+
/**
|
|
28
|
+
* The absolute path to the file containing the reference node, if available.
|
|
29
|
+
*/
|
|
30
|
+
nodeFilePath?: string;
|
|
31
|
+
}
|
|
32
|
+
export type TcbReferenceKey = string & {
|
|
33
|
+
__brand: 'TcbReferenceKey';
|
|
34
|
+
};
|
|
35
|
+
export interface TcbTypeParameter {
|
|
36
|
+
name: string;
|
|
37
|
+
representation: string;
|
|
38
|
+
representationWithDefault: string;
|
|
39
|
+
}
|
|
40
|
+
export type TcbInputMapping = InputOrOutput & {
|
|
41
|
+
required: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* AST-free string representation of the transform type of the input, if available.
|
|
44
|
+
*/
|
|
45
|
+
transformType?: string;
|
|
46
|
+
};
|
|
47
|
+
export interface TcbPipeMetadata {
|
|
48
|
+
name: string;
|
|
49
|
+
ref: TcbReferenceMetadata;
|
|
50
|
+
isExplicitlyDeferred: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface TcbDirectiveMetadata {
|
|
53
|
+
ref: TcbReferenceMetadata;
|
|
54
|
+
name: string;
|
|
55
|
+
selector: string | null;
|
|
56
|
+
isComponent: boolean;
|
|
57
|
+
isGeneric: boolean;
|
|
58
|
+
isStructural: boolean;
|
|
59
|
+
isStandalone: boolean;
|
|
60
|
+
isExplicitlyDeferred: boolean;
|
|
61
|
+
preserveWhitespaces: boolean;
|
|
62
|
+
exportAs: string[] | null;
|
|
63
|
+
/** Type parameters of the directive, if available. */
|
|
64
|
+
typeParameters: TcbTypeParameter[] | null;
|
|
65
|
+
inputs: ClassPropertyMapping<TcbInputMapping>;
|
|
66
|
+
outputs: ClassPropertyMapping;
|
|
67
|
+
hasRequiresInlineTypeCtor: boolean;
|
|
68
|
+
ngTemplateGuards: TemplateGuardMeta[];
|
|
69
|
+
hasNgTemplateContextGuard: boolean;
|
|
70
|
+
hasNgFieldDirective: boolean;
|
|
71
|
+
coercedInputFields: Set<ClassPropertyName>;
|
|
72
|
+
restrictedInputFields: Set<ClassPropertyName>;
|
|
73
|
+
stringLiteralInputFields: Set<ClassPropertyName>;
|
|
74
|
+
undeclaredInputFields: Set<ClassPropertyName>;
|
|
75
|
+
publicMethods: Set<string>;
|
|
76
|
+
ngContentSelectors: string[] | null;
|
|
77
|
+
animationTriggerNames: LegacyAnimationTriggerNames | null;
|
|
78
|
+
}
|
|
79
|
+
export interface TcbComponentMetadata {
|
|
80
|
+
ref: TcbReferenceMetadata;
|
|
81
|
+
typeParameters: TcbTypeParameter[] | null;
|
|
82
|
+
}
|
|
83
|
+
export interface TcbTypeCheckBlockMetadata {
|
|
84
|
+
id: TypeCheckId;
|
|
85
|
+
boundTarget: BoundTarget<TcbDirectiveMetadata>;
|
|
86
|
+
pipes: Map<string, TcbPipeMetadata> | null;
|
|
87
|
+
schemas: SchemaMetadata[];
|
|
88
|
+
isStandalone: boolean;
|
|
89
|
+
preserveWhitespaces: boolean;
|
|
90
|
+
}
|
|
14
91
|
/**
|
|
15
92
|
* Extension of `DirectiveMeta` that includes additional information required to type-check the
|
|
16
93
|
* usage of a particular directive.
|
|
@@ -90,8 +167,7 @@ export interface TypeCtorMetadata {
|
|
|
90
167
|
* Input, output, and query field names in the type which should be included as constructor input.
|
|
91
168
|
*/
|
|
92
169
|
fields: {
|
|
93
|
-
inputs: ClassPropertyMapping<
|
|
94
|
-
queries: string[];
|
|
170
|
+
inputs: ClassPropertyMapping<TcbInputMapping>;
|
|
95
171
|
};
|
|
96
172
|
/**
|
|
97
173
|
* `Set` of field names which have type coercion enabled.
|
|
@@ -75,7 +75,7 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
|
|
|
75
75
|
private elementTagCache;
|
|
76
76
|
private isComplete;
|
|
77
77
|
private priorResultsAdopted;
|
|
78
|
-
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
|
+
constructor(originalProgram: ts.Program, programDriver: ProgramDriver, typeCheckAdapter: ProgramTypeCheckAdapter, config: TypeCheckingConfig, refEmitter: ReferenceEmitter, reflector: ReflectionHost, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName' | 'getSourceFile'>, priorBuild: IncrementalBuild<unknown, FileTypeCheckingData>, metaReader: MetadataReader, localMetaReader: MetadataReaderWithIndex, ngModuleIndex: NgModuleIndex, componentScopeReader: ComponentScopeReader, typeCheckScopeRegistry: TypeCheckScopeRegistry, perf: PerfRecorder);
|
|
79
79
|
getTemplate(component: ts.ClassDeclaration, optimizeFor?: OptimizeFor): TmplAstNode[] | null;
|
|
80
80
|
getHostElement(directive: ts.ClassDeclaration, optimizeFor?: OptimizeFor): TmplAstHostElement | null;
|
|
81
81
|
getDirectivesOfNode(component: ts.ClassDeclaration, node: TmplAstElement | TmplAstTemplate): TypeCheckableDirectiveMeta[] | null;
|
|
@@ -153,7 +153,7 @@ export declare class TypeCheckContextImpl implements TypeCheckContext {
|
|
|
153
153
|
private inlining;
|
|
154
154
|
private perf;
|
|
155
155
|
private fileMap;
|
|
156
|
-
constructor(config: TypeCheckingConfig, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>, refEmitter: ReferenceEmitter, reflector: ReflectionHost, host: TypeCheckingHost, inlining: InliningMode, perf: PerfRecorder);
|
|
156
|
+
constructor(config: TypeCheckingConfig, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName' | 'getSourceFile'>, refEmitter: ReferenceEmitter, reflector: ReflectionHost, host: TypeCheckingHost, inlining: InliningMode, perf: PerfRecorder);
|
|
157
157
|
/**
|
|
158
158
|
* A `Map` of `ts.SourceFile`s that the context has seen to the operations (additions of methods
|
|
159
159
|
* or type-check blocks) that need to be eventually performed on that file.
|
|
@@ -9,7 +9,7 @@ import ts from 'typescript';
|
|
|
9
9
|
import { Reference, ReferenceEmitter } from '../../imports';
|
|
10
10
|
import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
11
11
|
import { ImportManager } from '../../translator';
|
|
12
|
-
import {
|
|
12
|
+
import { TcbDirectiveMetadata, TcbPipeMetadata, TcbReferenceKey, TcbReferenceMetadata, TypeCheckingConfig } from '../api';
|
|
13
13
|
import { ReferenceEmitEnvironment } from './reference_emit_environment';
|
|
14
14
|
import { TcbExpr } from './ops/codegen';
|
|
15
15
|
/**
|
|
@@ -37,8 +37,8 @@ export declare class Environment extends ReferenceEmitEnvironment {
|
|
|
37
37
|
* Depending on the shape of the directive itself, this could be either a reference to a declared
|
|
38
38
|
* type constructor, or to an inline type constructor.
|
|
39
39
|
*/
|
|
40
|
-
typeCtorFor(dir:
|
|
41
|
-
pipeInst(
|
|
40
|
+
typeCtorFor(dir: TcbDirectiveMetadata): TcbExpr;
|
|
41
|
+
pipeInst(pipe: TcbPipeMetadata): TcbExpr;
|
|
42
42
|
/**
|
|
43
43
|
* Generate a `ts.Expression` that references the given node.
|
|
44
44
|
*
|
|
@@ -48,3 +48,4 @@ export declare class Environment extends ReferenceEmitEnvironment {
|
|
|
48
48
|
private emitTypeParameters;
|
|
49
49
|
getPreludeStatements(): TcbExpr[];
|
|
50
50
|
}
|
|
51
|
+
export declare function getTcbReferenceKey(ref: TcbReferenceMetadata): TcbReferenceKey;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { AST, BindingPipe, PropertyRead, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstForLoopBlock, TmplAstForLoopBlockEmpty, TmplAstHoverDeferredTrigger, TmplAstIfBlockBranch, TmplAstInteractionDeferredTrigger, TmplAstLetDeclaration, TmplAstReference, TmplAstSwitchBlockCase, TmplAstTemplate, TmplAstTextAttribute, TmplAstVariable, TmplAstViewportDeferredTrigger } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ClassDeclaration } from '../../reflection';
|
|
11
|
-
import { TemplateDiagnostic, TypeCheckId } from '../api';
|
|
11
|
+
import { TcbDirectiveMetadata, TemplateDiagnostic, TypeCheckId } from '../api';
|
|
12
12
|
import { TypeCheckSourceResolver } from './tcb_util';
|
|
13
13
|
/**
|
|
14
14
|
* Collects `ts.Diagnostic`s on problems which occur in the template which aren't directly sourced
|
|
@@ -73,7 +73,7 @@ export interface OutOfBandDiagnosticRecorder {
|
|
|
73
73
|
/**
|
|
74
74
|
* Reports a split two way binding error message.
|
|
75
75
|
*/
|
|
76
|
-
splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer:
|
|
76
|
+
splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: Pick<TcbDirectiveMetadata, 'name' | 'isComponent' | 'ref'>, outputConsumer: Pick<TcbDirectiveMetadata, 'name' | 'isComponent' | 'ref'> | TmplAstElement): void;
|
|
77
77
|
/** Reports required inputs that haven't been bound. */
|
|
78
78
|
missingRequiredInputs(id: TypeCheckId, element: TmplAstElement | TmplAstTemplate | TmplAstComponent | TmplAstDirective, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
|
|
79
79
|
/**
|
|
@@ -136,6 +136,7 @@ export interface OutOfBandDiagnosticRecorder {
|
|
|
136
136
|
}
|
|
137
137
|
export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnosticRecorder {
|
|
138
138
|
private resolver;
|
|
139
|
+
private getSourceFile;
|
|
139
140
|
private readonly _diagnostics;
|
|
140
141
|
/**
|
|
141
142
|
* Tracks which `BindingPipe` nodes have already been recorded as invalid, so only one diagnostic
|
|
@@ -144,7 +145,7 @@ export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnos
|
|
|
144
145
|
private readonly recordedPipes;
|
|
145
146
|
/** Common pipes that can be suggested to users. */
|
|
146
147
|
private readonly pipeSuggestions;
|
|
147
|
-
constructor(resolver: TypeCheckSourceResolver);
|
|
148
|
+
constructor(resolver: TypeCheckSourceResolver, getSourceFile?: (fileName: string) => ts.SourceFile | undefined);
|
|
148
149
|
get diagnostics(): ReadonlyArray<TemplateDiagnostic>;
|
|
149
150
|
missingReferenceTarget(id: TypeCheckId, ref: TmplAstReference): void;
|
|
150
151
|
missingPipe(id: TypeCheckId, ast: BindingPipe, isStandalone: boolean): void;
|
|
@@ -154,7 +155,7 @@ export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnos
|
|
|
154
155
|
requiresInlineTcb(id: TypeCheckId, node: ClassDeclaration): void;
|
|
155
156
|
requiresInlineTypeConstructors(id: TypeCheckId, node: ClassDeclaration, directives: ClassDeclaration[]): void;
|
|
156
157
|
suboptimalTypeInference(id: TypeCheckId, variables: TmplAstVariable[]): void;
|
|
157
|
-
splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer:
|
|
158
|
+
splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: Pick<TcbDirectiveMetadata, 'name' | 'isComponent' | 'ref'>, outputConsumer: Pick<TcbDirectiveMetadata, 'name' | 'isComponent' | 'ref'> | TmplAstElement): void;
|
|
158
159
|
missingRequiredInputs(id: TypeCheckId, element: TmplAstElement | TmplAstTemplate | TmplAstComponent | TmplAstDirective, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
|
|
159
160
|
illegalForLoopTrackAccess(id: TypeCheckId, block: TmplAstForLoopBlock, access: PropertyRead): void;
|
|
160
161
|
inaccessibleDeferredTriggerElement(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
|
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, ParseSourceSpan, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstTemplate } from '@angular/compiler';
|
|
9
|
-
import
|
|
10
|
-
import { TypeCheckableDirectiveMeta } from '../../api';
|
|
9
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
11
10
|
import { ClassPropertyName } from '../../../metadata';
|
|
12
|
-
import { Reference } from '../../../imports';
|
|
13
11
|
import { Context } from './context';
|
|
14
12
|
import { TcbExpr } from './codegen';
|
|
15
13
|
export interface TcbBoundAttribute {
|
|
@@ -20,7 +18,7 @@ export interface TcbBoundAttribute {
|
|
|
20
18
|
fieldName: ClassPropertyName;
|
|
21
19
|
required: boolean;
|
|
22
20
|
isSignal: boolean;
|
|
23
|
-
transformType
|
|
21
|
+
transformType?: string;
|
|
24
22
|
isTwoWayBinding: boolean;
|
|
25
23
|
}[];
|
|
26
24
|
}
|
|
@@ -61,7 +59,7 @@ export interface TcbDirectiveUnsetInput {
|
|
|
61
59
|
field: string;
|
|
62
60
|
}
|
|
63
61
|
export type TcbDirectiveInput = TcbDirectiveBoundInput | TcbDirectiveUnsetInput;
|
|
64
|
-
export declare function getBoundAttributes(directive:
|
|
62
|
+
export declare function getBoundAttributes(directive: TcbDirectiveMetadata, node: TmplAstTemplate | TmplAstElement | TmplAstComponent | TmplAstDirective): TcbBoundAttribute[];
|
|
65
63
|
export declare function checkSplitTwoWayBinding(inputName: string, output: TmplAstBoundEvent, inputs: TmplAstBoundAttribute[], tcb: Context): boolean;
|
|
66
64
|
/**
|
|
67
65
|
* Potentially widens the type of `expr` according to the type-checking configuration.
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
import { BoundTarget, SchemaMetadata } from '@angular/compiler';
|
|
9
9
|
import { DomSchemaChecker } from '../dom';
|
|
10
10
|
import { OutOfBandDiagnosticRecorder } from '../oob';
|
|
11
|
-
import {
|
|
12
|
-
import { PipeMeta } from '../../../metadata';
|
|
11
|
+
import { TypeCheckId, TcbDirectiveMetadata, TcbPipeMetadata } from '../../api';
|
|
13
12
|
import { Environment } from '../environment';
|
|
14
13
|
/**
|
|
15
14
|
* Controls how generics for the component context class will be handled during TCB generation.
|
|
@@ -48,13 +47,13 @@ export declare class Context {
|
|
|
48
47
|
readonly domSchemaChecker: DomSchemaChecker;
|
|
49
48
|
readonly oobRecorder: OutOfBandDiagnosticRecorder;
|
|
50
49
|
readonly id: TypeCheckId;
|
|
51
|
-
readonly boundTarget: BoundTarget<
|
|
50
|
+
readonly boundTarget: BoundTarget<TcbDirectiveMetadata>;
|
|
52
51
|
private pipes;
|
|
53
52
|
readonly schemas: SchemaMetadata[];
|
|
54
53
|
readonly hostIsStandalone: boolean;
|
|
55
54
|
readonly hostPreserveWhitespaces: boolean;
|
|
56
55
|
private nextId;
|
|
57
|
-
constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TypeCheckId, boundTarget: BoundTarget<
|
|
56
|
+
constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TypeCheckId, boundTarget: BoundTarget<TcbDirectiveMetadata>, pipes: Map<string, TcbPipeMetadata> | null, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean);
|
|
58
57
|
/**
|
|
59
58
|
* Allocate a new variable name for use within the `Context`.
|
|
60
59
|
*
|
|
@@ -62,5 +61,5 @@ export declare class Context {
|
|
|
62
61
|
* might change depending on the type of data being stored.
|
|
63
62
|
*/
|
|
64
63
|
allocateId(): string;
|
|
65
|
-
getPipeByName(name: string):
|
|
64
|
+
getPipeByName(name: string): TcbPipeMetadata | null;
|
|
66
65
|
}
|
|
@@ -10,7 +10,7 @@ import { TcbOp } from './base';
|
|
|
10
10
|
import { TcbExpr } from './codegen';
|
|
11
11
|
import { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
|
-
import {
|
|
13
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
14
14
|
import { CustomFormControlType } from './signal_forms';
|
|
15
15
|
/**
|
|
16
16
|
* A `TcbOp` which constructs an instance of a directive with types inferred from its inputs. The
|
|
@@ -30,7 +30,7 @@ export declare class TcbDirectiveCtorOp extends TcbOp {
|
|
|
30
30
|
private node;
|
|
31
31
|
private dir;
|
|
32
32
|
private customFormControlType;
|
|
33
|
-
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, dir:
|
|
33
|
+
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, dir: TcbDirectiveMetadata, customFormControlType: CustomFormControlType | null);
|
|
34
34
|
get optional(): boolean;
|
|
35
35
|
execute(): TcbExpr;
|
|
36
36
|
circularFallback(): TcbOp;
|
|
@@ -53,7 +53,7 @@ export declare class TcbDirectiveCtorCircularFallbackOp extends TcbOp {
|
|
|
53
53
|
private tcb;
|
|
54
54
|
private scope;
|
|
55
55
|
private dir;
|
|
56
|
-
constructor(tcb: Context, scope: Scope, dir:
|
|
56
|
+
constructor(tcb: Context, scope: Scope, dir: TcbDirectiveMetadata);
|
|
57
57
|
get optional(): boolean;
|
|
58
58
|
execute(): TcbExpr;
|
|
59
59
|
}
|
|
@@ -10,7 +10,7 @@ import type { Context } from './context';
|
|
|
10
10
|
import type { Scope } from './scope';
|
|
11
11
|
import { TcbOp } from './base';
|
|
12
12
|
import { TcbExpr } from './codegen';
|
|
13
|
-
import {
|
|
13
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
14
14
|
/**
|
|
15
15
|
* A `TcbOp` which constructs an instance of a directive. For generic directives, generic
|
|
16
16
|
* parameters are set to `any` type.
|
|
@@ -19,8 +19,8 @@ export declare abstract class TcbDirectiveTypeOpBase extends TcbOp {
|
|
|
19
19
|
protected tcb: Context;
|
|
20
20
|
protected scope: Scope;
|
|
21
21
|
protected node: DirectiveOwner;
|
|
22
|
-
protected dir:
|
|
23
|
-
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, dir:
|
|
22
|
+
protected dir: TcbDirectiveMetadata;
|
|
23
|
+
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, dir: TcbDirectiveMetadata);
|
|
24
24
|
get optional(): boolean;
|
|
25
25
|
execute(): TcbExpr;
|
|
26
26
|
}
|
|
@@ -10,7 +10,7 @@ import { TcbOp } from './base';
|
|
|
10
10
|
import { TcbExpr } from './codegen';
|
|
11
11
|
import type { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
|
-
import {
|
|
13
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
14
14
|
import { LocalSymbol } from './references';
|
|
15
15
|
/**
|
|
16
16
|
* Similar to `tcbExpression`, this function converts the provided `AST` expression into a
|
|
@@ -31,7 +31,7 @@ export declare class TcbDirectiveOutputsOp extends TcbOp {
|
|
|
31
31
|
private inputs;
|
|
32
32
|
private outputs;
|
|
33
33
|
private dir;
|
|
34
|
-
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, inputs: TmplAstBoundAttribute[] | null, outputs: TmplAstBoundEvent[], dir:
|
|
34
|
+
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, inputs: TmplAstBoundAttribute[] | null, outputs: TmplAstBoundEvent[], dir: TcbDirectiveMetadata);
|
|
35
35
|
get optional(): boolean;
|
|
36
36
|
execute(): null;
|
|
37
37
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { AST, TmplAstBoundAttribute, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstTemplate } from '@angular/compiler';
|
|
9
9
|
import type { Context } from './context';
|
|
10
10
|
import type { Scope } from './scope';
|
|
11
|
-
import {
|
|
11
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
12
12
|
import { TcbOp } from './base';
|
|
13
13
|
import { TcbExpr } from './codegen';
|
|
14
14
|
import { CustomFormControlType } from './signal_forms';
|
|
@@ -30,7 +30,7 @@ export declare class TcbDirectiveInputsOp extends TcbOp {
|
|
|
30
30
|
private dir;
|
|
31
31
|
private isFormControl;
|
|
32
32
|
private customFormControlType;
|
|
33
|
-
constructor(tcb: Context, scope: Scope, node: TmplAstTemplate | TmplAstElement | TmplAstComponent | TmplAstDirective, dir:
|
|
33
|
+
constructor(tcb: Context, scope: Scope, node: TmplAstTemplate | TmplAstElement | TmplAstComponent | TmplAstDirective, dir: TcbDirectiveMetadata, isFormControl: boolean | undefined, customFormControlType: CustomFormControlType | null);
|
|
34
34
|
get optional(): boolean;
|
|
35
35
|
execute(): null;
|
|
36
36
|
private checkRequiredInputs;
|
|
@@ -10,7 +10,7 @@ import { TcbOp } from './base';
|
|
|
10
10
|
import { TcbExpr } from './codegen';
|
|
11
11
|
import type { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
|
-
import {
|
|
13
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
14
14
|
/** Types that can referenced locally in a template. */
|
|
15
15
|
export type LocalSymbol = TmplAstElement | TmplAstTemplate | TmplAstVariable | TmplAstLetDeclaration | TmplAstReference | TmplAstHostElement | TmplAstComponent | TmplAstDirective;
|
|
16
16
|
/**
|
|
@@ -39,7 +39,7 @@ export declare class TcbReferenceOp extends TcbOp {
|
|
|
39
39
|
private readonly node;
|
|
40
40
|
private readonly host;
|
|
41
41
|
private readonly target;
|
|
42
|
-
constructor(tcb: Context, scope: Scope, node: TmplAstReference, host: TmplAstElement | TmplAstTemplate | TmplAstComponent | TmplAstDirective, target:
|
|
42
|
+
constructor(tcb: Context, scope: Scope, node: TmplAstReference, host: TmplAstElement | TmplAstTemplate | TmplAstComponent | TmplAstDirective, target: TcbDirectiveMetadata | TmplAstTemplate | TmplAstElement);
|
|
43
43
|
readonly optional = true;
|
|
44
44
|
execute(): TcbExpr;
|
|
45
45
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstForLoopBlock, TmplAstHostElement, TmplAstIfBlockBranch, TmplAstLetDeclaration, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
|
|
9
9
|
import { TcbExpr } from './codegen';
|
|
10
|
-
import {
|
|
10
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
11
11
|
import { Context } from './context';
|
|
12
12
|
import { LocalSymbol } from './references';
|
|
13
13
|
/**
|
|
@@ -123,7 +123,7 @@ export declare class Scope {
|
|
|
123
123
|
* @param directive if present, a directive type on a `TmplAstElement` or `TmplAstTemplate` to
|
|
124
124
|
* look up instead of the default for an element or template node.
|
|
125
125
|
*/
|
|
126
|
-
resolve(node: LocalSymbol, directive?:
|
|
126
|
+
resolve(node: LocalSymbol, directive?: TcbDirectiveMetadata): TcbExpr;
|
|
127
127
|
/**
|
|
128
128
|
* Add a statement to this scope.
|
|
129
129
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { DirectiveOwner, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstNode, TmplAstTemplate } from '@angular/compiler';
|
|
9
|
-
import {
|
|
9
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
10
10
|
import { TcbOp } from './base';
|
|
11
11
|
import { TcbBoundAttribute } from './bindings';
|
|
12
12
|
import type { Context } from './context';
|
|
@@ -39,12 +39,12 @@ export declare class TcbNativeRadioButtonFieldOp extends TcbNativeFieldOp {
|
|
|
39
39
|
execute(): null;
|
|
40
40
|
}
|
|
41
41
|
/** Expands the set of bound inputs with the ones from custom field directives. */
|
|
42
|
-
export declare function expandBoundAttributesForField(directive:
|
|
43
|
-
export declare function isFieldDirective(meta:
|
|
42
|
+
export declare function expandBoundAttributesForField(directive: TcbDirectiveMetadata, node: TmplAstTemplate | TmplAstElement | TmplAstComponent | TmplAstDirective, customFormControlType: CustomFormControlType | null): TcbBoundAttribute[] | null;
|
|
43
|
+
export declare function isFieldDirective(meta: TcbDirectiveMetadata): boolean;
|
|
44
44
|
/** Determines if a directive is a custom field and its type. */
|
|
45
|
-
export declare function getCustomFieldDirectiveType(meta:
|
|
45
|
+
export declare function getCustomFieldDirectiveType(meta: TcbDirectiveMetadata): CustomFormControlType | null;
|
|
46
46
|
/** Determines if a directive usage is on a native field. */
|
|
47
|
-
export declare function isNativeField(dir:
|
|
47
|
+
export declare function isNativeField(dir: TcbDirectiveMetadata, node: TmplAstNode, allDirectiveMatches: TcbDirectiveMetadata[]): node is TmplAstElement & {
|
|
48
48
|
name: 'input' | 'select' | 'textarea';
|
|
49
49
|
};
|
|
50
50
|
/** Checks whether a node has bindings that aren't supported on fields. */
|
|
@@ -55,4 +55,4 @@ export declare function checkUnsupportedFieldBindings(node: DirectiveOwner, unsu
|
|
|
55
55
|
* A node is a form control if it has a matching `FormField` directive, and no other directives match
|
|
56
56
|
* the `field` input.
|
|
57
57
|
*/
|
|
58
|
-
export declare function isFormControl(allDirectiveMatches:
|
|
58
|
+
export declare function isFormControl(allDirectiveMatches: TcbDirectiveMetadata[]): boolean;
|