@angular/compiler-cli 21.2.2 → 21.2.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-32EO3D75.js → chunk-6XM6Y45F.js} +2 -1
- package/bundles/chunk-6XM6Y45F.js.map +6 -0
- package/bundles/{chunk-FLWAEX6T.js → chunk-HFKTR5QY.js} +4 -3
- package/bundles/chunk-HFKTR5QY.js.map +6 -0
- package/bundles/{chunk-CSUVPNMK.js → chunk-I6T4FEIP.js} +1 -0
- package/bundles/chunk-I6T4FEIP.js.map +6 -0
- package/bundles/{chunk-G7GFT6BU.js → chunk-IEBNHER4.js} +1 -0
- package/bundles/chunk-IEBNHER4.js.map +6 -0
- package/bundles/{chunk-XYYEESKY.js → chunk-KWAGEHJJ.js} +2 -1
- package/bundles/chunk-KWAGEHJJ.js.map +6 -0
- package/bundles/{chunk-SPPRVX7S.js → chunk-NJNVVM2O.js} +4 -3
- package/bundles/chunk-NJNVVM2O.js.map +6 -0
- package/bundles/{chunk-RJ3Y43GR.js → chunk-QHHWSWGY.js} +7 -6
- package/bundles/chunk-QHHWSWGY.js.map +6 -0
- package/bundles/{chunk-6HOSNZU5.js → chunk-SEJGUMO2.js} +1 -0
- package/bundles/chunk-SEJGUMO2.js.map +6 -0
- package/bundles/{chunk-CEBE44Q5.js → chunk-UTWH365F.js} +1 -0
- package/bundles/chunk-UTWH365F.js.map +6 -0
- package/bundles/{chunk-OECV6WLT.js → chunk-XWQSF6XG.js} +726 -442
- package/bundles/chunk-XWQSF6XG.js.map +6 -0
- package/bundles/{chunk-HYJ2H3FU.js → chunk-Y5V7YWTG.js} +1 -0
- package/bundles/chunk-Y5V7YWTG.js.map +6 -0
- package/bundles/index.js +10 -9
- package/bundles/index.js.map +6 -0
- package/bundles/linker/babel/index.js +7 -6
- package/bundles/linker/babel/index.js.map +6 -0
- package/bundles/linker/index.js +5 -4
- package/bundles/linker/index.js.map +6 -0
- package/bundles/private/localize.js +6 -5
- package/bundles/private/localize.js.map +6 -0
- package/bundles/private/migrations.js +7 -6
- package/bundles/private/migrations.js.map +6 -0
- package/bundles/private/testing.js +6 -5
- package/bundles/private/testing.js.map +6 -0
- package/bundles/private/tooling.js +6 -5
- package/bundles/private/tooling.js.map +6 -0
- package/bundles/src/bin/ng_xi18n.js +9 -8
- package/bundles/src/bin/ng_xi18n.js.map +6 -0
- package/bundles/src/bin/ngc.js +9 -8
- package/bundles/src/bin/ngc.js.map +6 -0
- 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
|
@@ -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;
|
|
@@ -10,6 +10,7 @@ import ts from 'typescript';
|
|
|
10
10
|
import { ImportFlags, Reference, ReferenceEmitter } from '../../imports';
|
|
11
11
|
import { ReflectionHost } from '../../reflection';
|
|
12
12
|
import { ImportManager } from '../../translator';
|
|
13
|
+
import { TcbReferenceMetadata } from '../api';
|
|
13
14
|
import { TcbExpr } from './ops/codegen';
|
|
14
15
|
/**
|
|
15
16
|
* An environment for a given source file that can be used to emit references.
|
|
@@ -19,7 +20,7 @@ import { TcbExpr } from './ops/codegen';
|
|
|
19
20
|
*/
|
|
20
21
|
export declare class ReferenceEmitEnvironment {
|
|
21
22
|
readonly importManager: ImportManager;
|
|
22
|
-
|
|
23
|
+
refEmitter: ReferenceEmitter;
|
|
23
24
|
readonly reflector: ReflectionHost;
|
|
24
25
|
contextFile: ts.SourceFile;
|
|
25
26
|
constructor(importManager: ImportManager, refEmitter: ReferenceEmitter, reflector: ReflectionHost, contextFile: ts.SourceFile);
|
|
@@ -30,6 +31,22 @@ export declare class ReferenceEmitEnvironment {
|
|
|
30
31
|
* This may involve importing the node into the file if it's not declared there already.
|
|
31
32
|
*/
|
|
32
33
|
referenceType(ref: Reference, flags?: ImportFlags): ts.TypeNode;
|
|
34
|
+
/**
|
|
35
|
+
* Generates a `ts.TypeNode` from a `TcbReferenceMetadata` object.
|
|
36
|
+
* This is used by the TCB operations which do not hold on to the original `ts.Declaration`.
|
|
37
|
+
*
|
|
38
|
+
* Note: It's important that we do not try to evaluate the `typeParameters` here and pad them
|
|
39
|
+
* out with `any` type arguments. If we supply `any` to a generic pipe (e.g. `var _pipe1: MyPipe<any>;`),
|
|
40
|
+
* it destroys the generic constraints and degrades the `transform` signature. When they are omitted
|
|
41
|
+
* entirely, TypeScript implicitly flags an error, which the Angular compiler filters out, and
|
|
42
|
+
* crucially recovers by falling back to constraint inference (e.g. `var _pipe1: MyPipe;` infers
|
|
43
|
+
* bounds safely).
|
|
44
|
+
*/
|
|
45
|
+
referenceTcbType(ref: TcbReferenceMetadata): ts.TypeNode;
|
|
46
|
+
/**
|
|
47
|
+
* Generates a `TcbExpr` from a `TcbReferenceMetadata` object.
|
|
48
|
+
*/
|
|
49
|
+
referenceTcbValue(ref: TcbReferenceMetadata): TcbExpr;
|
|
33
50
|
referenceExternalSymbol(moduleName: string, name: string): TcbExpr;
|
|
34
51
|
/**
|
|
35
52
|
* Generate a `ts.TypeNode` that references a given type from the provided module.
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { TypeCheckBlockMetadata, TcbTypeCheckBlockMetadata, TcbComponentMetadata } from '../api';
|
|
9
|
+
import { Environment } from './environment';
|
|
10
|
+
import { Reference } from '../../imports';
|
|
11
|
+
import { ClassDeclaration } from '../../reflection';
|
|
12
|
+
import ts from 'typescript';
|
|
13
|
+
/**
|
|
14
|
+
* Adapts the compiler's `TypeCheckBlockMetadata` (which includes full TS AST nodes)
|
|
15
|
+
* into a purely detached `TcbTypeCheckBlockMetadata` that can be mapped to JSON.
|
|
16
|
+
*/
|
|
17
|
+
export declare function adaptTypeCheckBlockMetadata(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, meta: TypeCheckBlockMetadata, env: Environment): {
|
|
18
|
+
tcbMeta: TcbTypeCheckBlockMetadata;
|
|
19
|
+
component: TcbComponentMetadata;
|
|
20
|
+
};
|
|
@@ -9,7 +9,7 @@ import { AbsoluteSourceSpan, ParseSourceSpan } from '@angular/compiler';
|
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ClassDeclaration, ReflectionHost } from '../../../../src/ngtsc/reflection';
|
|
11
11
|
import { Reference } from '../../imports';
|
|
12
|
-
import { FullSourceMapping, SourceLocation, TypeCheckId, SourceMapping } from '../api';
|
|
12
|
+
import { FullSourceMapping, SourceLocation, TypeCheckId, SourceMapping, TcbTypeParameter } from '../api';
|
|
13
13
|
import { ReferenceEmitEnvironment } from './reference_emit_environment';
|
|
14
14
|
/**
|
|
15
15
|
* Adapter interface which allows the directive type-checking diagnostics code to interpret offsets
|
|
@@ -78,3 +78,4 @@ export declare function ensureTypeCheckFilePreparationImports(env: ReferenceEmit
|
|
|
78
78
|
export declare function checkIfGenericTypeBoundsCanBeEmitted(node: ClassDeclaration<ts.ClassDeclaration>, reflector: ReflectionHost, env: ReferenceEmitEnvironment): boolean;
|
|
79
79
|
export declare function findNodeInFile<T extends ts.Node>(file: ts.SourceFile, predicate: (node: ts.Node) => node is T): T | null;
|
|
80
80
|
export declare function findNodeInFile(file: ts.SourceFile, predicate: (node: ts.Node) => boolean): ts.Node | null;
|
|
81
|
+
export declare function generateTcbTypeParameters(typeParameters: ReadonlyArray<ts.TypeParameterDeclaration>, sourceFile: ts.SourceFile): TcbTypeParameter[];
|
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
|
-
import {
|
|
10
|
-
import { ClassDeclaration } from '../../reflection';
|
|
11
|
-
import { TypeCheckBlockMetadata } from '../api';
|
|
9
|
+
import { TcbComponentMetadata, TcbTypeCheckBlockMetadata } from '../api';
|
|
12
10
|
import { DomSchemaChecker } from './dom';
|
|
13
11
|
import { Environment } from './environment';
|
|
14
12
|
import { OutOfBandDiagnosticRecorder } from './oob';
|
|
@@ -37,4 +35,4 @@ import { TcbGenericContextBehavior } from './ops/context';
|
|
|
37
35
|
* @param genericContextBehavior controls how generic parameters (especially parameters with generic
|
|
38
36
|
* bounds) will be referenced from the generated TCB code.
|
|
39
37
|
*/
|
|
40
|
-
export declare function generateTypeCheckBlock(env: Environment,
|
|
38
|
+
export declare function generateTypeCheckBlock(env: Environment, component: TcbComponentMetadata, name: ts.Identifier, meta: TcbTypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, genericContextBehavior: TcbGenericContextBehavior): string;
|
|
@@ -25,6 +25,7 @@ import { TcbExpr } from './ops/codegen';
|
|
|
25
25
|
*/
|
|
26
26
|
export declare class TypeCheckFile extends Environment {
|
|
27
27
|
readonly fileName: AbsoluteFsPath;
|
|
28
|
+
readonly isTypeCheckFile = true;
|
|
28
29
|
private nextTcbId;
|
|
29
30
|
private tcbStatements;
|
|
30
31
|
constructor(fileName: AbsoluteFsPath, config: TypeCheckingConfig, refEmitter: ReferenceEmitter, reflector: ReflectionHost, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>);
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
9
|
import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
10
|
-
import { TypeCtorMetadata } from '../api';
|
|
10
|
+
import { TypeCtorMetadata, TcbTypeParameter } from '../api';
|
|
11
11
|
import { ReferenceEmitEnvironment } from './reference_emit_environment';
|
|
12
12
|
import { TcbExpr } from './ops/codegen';
|
|
13
|
-
export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironment, meta: TypeCtorMetadata, nodeTypeRef: ts.EntityName, typeParams:
|
|
13
|
+
export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironment, meta: TypeCtorMetadata, nodeTypeRef: ts.EntityName, typeParams: TcbTypeParameter[] | undefined): TcbExpr;
|
|
14
14
|
/**
|
|
15
15
|
* Generate an inline type constructor for the given class and metadata.
|
|
16
16
|
*
|