@angular/compiler-cli 21.2.1 → 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-PW54LIP6.js → chunk-6JHVJEKD.js} +5 -5
- package/bundles/chunk-FLWAEX6T.js +1 -1
- package/bundles/{chunk-VO3Q626H.js → chunk-KJC7YNMY.js} +2 -2
- package/bundles/{chunk-IG22BDVK.js → chunk-L3PEIUBN.js} +1296 -1323
- package/bundles/{chunk-WBUBKNAO.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/comments.d.ts +0 -7
- package/src/ngtsc/typecheck/src/context.d.ts +1 -1
- package/src/ngtsc/typecheck/src/environment.d.ts +9 -7
- package/src/ngtsc/typecheck/src/expression.d.ts +3 -15
- package/src/ngtsc/typecheck/src/host_bindings.d.ts +1 -1
- package/src/ngtsc/typecheck/src/oob.d.ts +5 -4
- package/src/ngtsc/typecheck/src/ops/base.d.ts +3 -3
- package/src/ngtsc/typecheck/src/ops/bindings.d.ts +11 -8
- package/src/ngtsc/typecheck/src/ops/codegen.d.ts +74 -0
- package/src/ngtsc/typecheck/src/ops/context.d.ts +5 -7
- package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +6 -6
- package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +7 -7
- package/src/ngtsc/typecheck/src/ops/element.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/events.d.ts +4 -4
- package/src/ngtsc/typecheck/src/ops/expression.d.ts +5 -5
- package/src/ngtsc/typecheck/src/ops/for_block.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/host.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/inputs.d.ts +4 -4
- package/src/ngtsc/typecheck/src/ops/let.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/references.d.ts +5 -5
- package/src/ngtsc/typecheck/src/ops/schema.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/scope.d.ts +10 -10
- package/src/ngtsc/typecheck/src/ops/selectorless.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/signal_forms.d.ts +6 -6
- package/src/ngtsc/typecheck/src/ops/template.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/variables.d.ts +6 -6
- package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +18 -4
- 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/ts_util.d.ts +0 -37
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -4
- package/src/ngtsc/typecheck/src/type_check_file.d.ts +4 -2
- package/src/ngtsc/typecheck/src/type_constructor.d.ts +4 -3
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { DirectiveOwner } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
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,9 +30,9 @@ 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
|
-
execute():
|
|
35
|
+
execute(): TcbExpr;
|
|
36
36
|
circularFallback(): TcbOp;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -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
|
-
execute():
|
|
58
|
+
execute(): TcbExpr;
|
|
59
59
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { DirectiveOwner } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import type { Context } from './context';
|
|
11
10
|
import type { Scope } from './scope';
|
|
12
11
|
import { TcbOp } from './base';
|
|
13
|
-
import {
|
|
12
|
+
import { TcbExpr } from './codegen';
|
|
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,10 +19,10 @@ 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
|
-
execute():
|
|
25
|
+
execute(): TcbExpr;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* A `TcbOp` which constructs an instance of a non-generic directive _without_ setting any of its
|
|
@@ -38,7 +38,7 @@ export declare class TcbNonGenericDirectiveTypeOp extends TcbDirectiveTypeOpBase
|
|
|
38
38
|
* Creates a variable declaration for this op's directive of the argument type. Returns the id of
|
|
39
39
|
* the newly created variable.
|
|
40
40
|
*/
|
|
41
|
-
execute():
|
|
41
|
+
execute(): TcbExpr;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* A `TcbOp` which constructs an instance of a generic directive with its generic parameters set
|
|
@@ -49,5 +49,5 @@ export declare class TcbNonGenericDirectiveTypeOp extends TcbDirectiveTypeOpBase
|
|
|
49
49
|
* type parameters set to `any`.
|
|
50
50
|
*/
|
|
51
51
|
export declare class TcbGenericDirectiveTypeWithAnyParamsOp extends TcbDirectiveTypeOpBase {
|
|
52
|
-
execute():
|
|
52
|
+
execute(): TcbExpr;
|
|
53
53
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstElement } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
10
|
+
import { TcbExpr } from './codegen';
|
|
11
11
|
import type { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
13
|
/**
|
|
@@ -22,5 +22,5 @@ export declare class TcbElementOp extends TcbOp {
|
|
|
22
22
|
private element;
|
|
23
23
|
constructor(tcb: Context, scope: Scope, element: TmplAstElement);
|
|
24
24
|
get optional(): boolean;
|
|
25
|
-
execute():
|
|
25
|
+
execute(): TcbExpr;
|
|
26
26
|
}
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, DirectiveOwner, TmplAstBoundAttribute, TmplAstBoundEvent } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
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
|
|
17
17
|
* `ts.Expression`, with special handling of the `$event` variable that can be used within event
|
|
18
18
|
* bindings.
|
|
19
19
|
*/
|
|
20
|
-
export declare function tcbEventHandlerExpression(ast: AST, tcb: Context, scope: Scope):
|
|
20
|
+
export declare function tcbEventHandlerExpression(ast: AST, tcb: Context, scope: Scope): TcbExpr;
|
|
21
21
|
/**
|
|
22
22
|
* A `TcbOp` which generates code to check event bindings on an element that correspond with the
|
|
23
23
|
* outputs of a directive.
|
|
@@ -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
|
}
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, PropertyRead, TmplAstLetDeclaration } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
10
|
+
import { TcbExpr } from './codegen';
|
|
11
11
|
import type { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
13
|
/**
|
|
14
14
|
* Process an `AST` expression and convert it into a `ts.Expression`, generating references to the
|
|
15
15
|
* correct identifiers in the current scope.
|
|
16
16
|
*/
|
|
17
|
-
export declare function tcbExpression(ast: AST, tcb: Context, scope: Scope):
|
|
17
|
+
export declare function tcbExpression(ast: AST, tcb: Context, scope: Scope): TcbExpr;
|
|
18
18
|
/**
|
|
19
19
|
* Wraps an expression in an `unwrapSignal` call which extracts the signal's value.
|
|
20
20
|
*/
|
|
21
|
-
export declare function unwrapWritableSignal(expression:
|
|
21
|
+
export declare function unwrapWritableSignal(expression: TcbExpr, tcb: Context): TcbExpr;
|
|
22
22
|
/**
|
|
23
23
|
* A `TcbOp` which renders an Angular expression (e.g. `{{foo() && bar.baz}}`).
|
|
24
24
|
*
|
|
@@ -51,14 +51,14 @@ export declare class TcbExpressionTranslator {
|
|
|
51
51
|
protected tcb: Context;
|
|
52
52
|
protected scope: Scope;
|
|
53
53
|
constructor(tcb: Context, scope: Scope);
|
|
54
|
-
translate(ast: AST):
|
|
54
|
+
translate(ast: AST): TcbExpr;
|
|
55
55
|
/**
|
|
56
56
|
* Resolve an `AST` expression within the given scope.
|
|
57
57
|
*
|
|
58
58
|
* Some `AST` expressions refer to top-level concepts (references, variables, the component
|
|
59
59
|
* context). This method assists in resolving those.
|
|
60
60
|
*/
|
|
61
|
-
protected resolve(ast: AST):
|
|
61
|
+
protected resolve(ast: AST): TcbExpr | null;
|
|
62
62
|
private getTargetNodeExpression;
|
|
63
63
|
protected isValidLetDeclarationAccess(target: TmplAstLetDeclaration, ast: PropertyRead): boolean;
|
|
64
64
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, TmplAstForLoopBlock } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbExpressionTranslator } from './expression';
|
|
11
10
|
import type { Context } from './context';
|
|
12
11
|
import type { Scope } from './scope';
|
|
13
12
|
import { TcbOp } from './base';
|
|
13
|
+
import { TcbExpr } from './codegen';
|
|
14
14
|
/**
|
|
15
15
|
* A `TcbOp` which renders a `for` block as a TypeScript `for...of` loop.
|
|
16
16
|
*
|
|
@@ -28,5 +28,5 @@ export declare class TcbForLoopTrackTranslator extends TcbExpressionTranslator {
|
|
|
28
28
|
private block;
|
|
29
29
|
private allowedVariables;
|
|
30
30
|
constructor(tcb: Context, scope: Scope, block: TmplAstForLoopBlock);
|
|
31
|
-
protected resolve(ast: AST):
|
|
31
|
+
protected resolve(ast: AST): TcbExpr | null;
|
|
32
32
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstHostElement } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
10
|
+
import { TcbExpr } from './codegen';
|
|
11
11
|
import type { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
13
|
/**
|
|
@@ -21,5 +21,5 @@ export declare class TcbHostElementOp extends TcbOp {
|
|
|
21
21
|
private element;
|
|
22
22
|
readonly optional = true;
|
|
23
23
|
constructor(tcb: Context, scope: Scope, element: TmplAstHostElement);
|
|
24
|
-
execute():
|
|
24
|
+
execute(): TcbExpr;
|
|
25
25
|
}
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, TmplAstBoundAttribute, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstTemplate } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import type { Context } from './context';
|
|
11
10
|
import type { Scope } from './scope';
|
|
12
|
-
import {
|
|
11
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
13
12
|
import { TcbOp } from './base';
|
|
13
|
+
import { TcbExpr } from './codegen';
|
|
14
14
|
import { CustomFormControlType } from './signal_forms';
|
|
15
15
|
import { LocalSymbol } from './references';
|
|
16
16
|
/**
|
|
17
17
|
* Translates the given attribute binding to a `ts.Expression`.
|
|
18
18
|
*/
|
|
19
|
-
export declare function translateInput(value: AST | string, tcb: Context, scope: Scope):
|
|
19
|
+
export declare function translateInput(value: AST | string, tcb: Context, scope: Scope): TcbExpr;
|
|
20
20
|
/**
|
|
21
21
|
* A `TcbOp` which generates code to check input bindings on an element that correspond with the
|
|
22
22
|
* members of a directive.
|
|
@@ -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;
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstLetDeclaration } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { Context } from './context';
|
|
11
10
|
import type { Scope } from './scope';
|
|
12
11
|
import { TcbOp } from './base';
|
|
12
|
+
import { TcbExpr } from './codegen';
|
|
13
13
|
/**
|
|
14
14
|
* A `TcbOp` which generates a constant for a `TmplAstLetDeclaration`.
|
|
15
15
|
*
|
|
@@ -25,5 +25,5 @@ export declare class TcbLetDeclarationOp extends TcbOp {
|
|
|
25
25
|
* should be checked even if they aren't referenced anywhere.
|
|
26
26
|
*/
|
|
27
27
|
readonly optional = false;
|
|
28
|
-
execute():
|
|
28
|
+
execute(): TcbExpr;
|
|
29
29
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstHostElement, TmplAstLetDeclaration, TmplAstReference, TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
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,9 +39,9 @@ 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
|
-
execute():
|
|
44
|
+
execute(): TcbExpr;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* A `TcbOp` which is used when the target of a reference is missing. This operation generates a
|
|
@@ -53,5 +53,5 @@ export declare class TcbInvalidReferenceOp extends TcbOp {
|
|
|
53
53
|
private readonly scope;
|
|
54
54
|
constructor(tcb: Context, scope: Scope);
|
|
55
55
|
readonly optional = true;
|
|
56
|
-
execute():
|
|
56
|
+
execute(): TcbExpr;
|
|
57
57
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstComponent, TmplAstElement, TmplAstHostElement } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
10
|
+
import { TcbExpr } from './codegen';
|
|
11
11
|
import { Context } from './context';
|
|
12
12
|
/**
|
|
13
13
|
* A `TcbOp` which feeds elements and unclaimed properties to the `DomSchemaChecker`.
|
|
@@ -26,6 +26,6 @@ export declare class TcbDomSchemaCheckerOp extends TcbOp {
|
|
|
26
26
|
private claimedInputs;
|
|
27
27
|
constructor(tcb: Context, element: TmplAstElement | TmplAstComponent | TmplAstHostElement, checkElement: boolean, claimedInputs: Set<string> | null);
|
|
28
28
|
get optional(): boolean;
|
|
29
|
-
execute():
|
|
29
|
+
execute(): TcbExpr | null;
|
|
30
30
|
private getTagName;
|
|
31
31
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstForLoopBlock, TmplAstHostElement, TmplAstIfBlockBranch, TmplAstLetDeclaration, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
9
|
+
import { TcbExpr } from './codegen';
|
|
10
|
+
import { TcbDirectiveMetadata } from '../../api';
|
|
11
11
|
import { Context } from './context';
|
|
12
12
|
import { LocalSymbol } from './references';
|
|
13
13
|
/**
|
|
@@ -30,7 +30,7 @@ export declare class Scope {
|
|
|
30
30
|
/**
|
|
31
31
|
* A queue of operations which need to be performed to generate the TCB code for this scope.
|
|
32
32
|
*
|
|
33
|
-
* This array can contain either a `TcbOp` which has yet to be executed, or a `
|
|
33
|
+
* This array can contain either a `TcbOp` which has yet to be executed, or a `TcbExpr|null`
|
|
34
34
|
* representing the memoized result of executing the operation. As operations are executed, their
|
|
35
35
|
* results are written into the `opQueue`, overwriting the original operation.
|
|
36
36
|
*
|
|
@@ -101,7 +101,7 @@ export declare class Scope {
|
|
|
101
101
|
* @param children Child nodes that should be appended to the TCB.
|
|
102
102
|
* @param guard an expression that is applied to this scope for type narrowing purposes.
|
|
103
103
|
*/
|
|
104
|
-
static forNodes(tcb: Context, parentScope: Scope | null, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard:
|
|
104
|
+
static forNodes(tcb: Context, parentScope: Scope | null, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard: TcbExpr | null): Scope;
|
|
105
105
|
/** Registers a local variable with a scope. */
|
|
106
106
|
private static registerVariable;
|
|
107
107
|
/**
|
|
@@ -123,20 +123,20 @@ 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
|
*/
|
|
130
|
-
addStatement(stmt:
|
|
130
|
+
addStatement(stmt: TcbExpr): void;
|
|
131
131
|
/**
|
|
132
132
|
* Get the statements.
|
|
133
133
|
*/
|
|
134
|
-
render():
|
|
134
|
+
render(): TcbExpr[];
|
|
135
135
|
/**
|
|
136
136
|
* Returns an expression of all template guards that apply to this scope, including those of
|
|
137
137
|
* parent scopes. If no guards have been applied, null is returned.
|
|
138
138
|
*/
|
|
139
|
-
guards():
|
|
139
|
+
guards(): TcbExpr | null;
|
|
140
140
|
/** Returns whether a template symbol is defined locally within the current scope. */
|
|
141
141
|
isLocal(node: TmplAstVariable | TmplAstLetDeclaration | TmplAstReference): boolean;
|
|
142
142
|
/**
|
|
@@ -150,10 +150,10 @@ export declare class Scope {
|
|
|
150
150
|
* @param children Child nodes that should be appended to the TCB.
|
|
151
151
|
* @param guard an expression that is applied to this scope for type narrowing purposes.
|
|
152
152
|
*/
|
|
153
|
-
createChildScope(parentScope: Scope, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard:
|
|
153
|
+
createChildScope(parentScope: Scope, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard: TcbExpr | null): Scope;
|
|
154
154
|
private resolveLocal;
|
|
155
155
|
/**
|
|
156
|
-
* Like `executeOp`, but assert that the operation actually returned `
|
|
156
|
+
* Like `executeOp`, but assert that the operation actually returned `TcbExpr`.
|
|
157
157
|
*/
|
|
158
158
|
private resolveOp;
|
|
159
159
|
/**
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstComponent } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
10
|
+
import { TcbExpr } from './codegen';
|
|
11
11
|
import { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
13
|
export declare function getComponentTagName(node: TmplAstComponent): string;
|
|
@@ -22,5 +22,5 @@ export declare class TcbComponentNodeOp extends TcbOp {
|
|
|
22
22
|
private component;
|
|
23
23
|
readonly optional = true;
|
|
24
24
|
constructor(tcb: Context, scope: Scope, component: TmplAstComponent);
|
|
25
|
-
execute():
|
|
25
|
+
execute(): TcbExpr;
|
|
26
26
|
}
|
|
@@ -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;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstTemplate } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
10
|
+
import { TcbExpr } from './codegen';
|
|
11
11
|
import type { Context } from './context';
|
|
12
12
|
import type { Scope } from './scope';
|
|
13
13
|
/**
|
|
@@ -20,7 +20,7 @@ export declare class TcbTemplateContextOp extends TcbOp {
|
|
|
20
20
|
private scope;
|
|
21
21
|
constructor(tcb: Context, scope: Scope);
|
|
22
22
|
readonly optional = true;
|
|
23
|
-
execute():
|
|
23
|
+
execute(): TcbExpr;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* A `TcbOp` which descends into a `TmplAstTemplate`'s children and generates type-checking code for
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbOp } from './base';
|
|
11
10
|
import type { Context } from './context';
|
|
12
11
|
import type { Scope } from './scope';
|
|
12
|
+
import { TcbExpr } from './codegen';
|
|
13
13
|
/**
|
|
14
14
|
* A `TcbOp` which renders a variable that is implicitly available within a block (e.g. `$count`
|
|
15
15
|
* in a `@for` block).
|
|
@@ -21,9 +21,9 @@ export declare class TcbBlockImplicitVariableOp extends TcbOp {
|
|
|
21
21
|
private scope;
|
|
22
22
|
private type;
|
|
23
23
|
private variable;
|
|
24
|
-
constructor(tcb: Context, scope: Scope, type:
|
|
24
|
+
constructor(tcb: Context, scope: Scope, type: TcbExpr, variable: TmplAstVariable);
|
|
25
25
|
readonly optional = true;
|
|
26
|
-
execute():
|
|
26
|
+
execute(): TcbExpr;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* A `TcbOp` which creates an expression for particular let- `TmplAstVariable` on a
|
|
@@ -38,7 +38,7 @@ export declare class TcbTemplateVariableOp extends TcbOp {
|
|
|
38
38
|
private variable;
|
|
39
39
|
constructor(tcb: Context, scope: Scope, template: TmplAstTemplate, variable: TmplAstVariable);
|
|
40
40
|
get optional(): boolean;
|
|
41
|
-
execute():
|
|
41
|
+
execute(): TcbExpr;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* A `TcbOp` which renders a variable defined inside of block syntax (e.g. `@if (expr; as var) {}`).
|
|
@@ -50,7 +50,7 @@ export declare class TcbBlockVariableOp extends TcbOp {
|
|
|
50
50
|
private scope;
|
|
51
51
|
private initializer;
|
|
52
52
|
private variable;
|
|
53
|
-
constructor(tcb: Context, scope: Scope, initializer:
|
|
53
|
+
constructor(tcb: Context, scope: Scope, initializer: TcbExpr, variable: TmplAstVariable);
|
|
54
54
|
get optional(): boolean;
|
|
55
|
-
execute():
|
|
55
|
+
execute(): TcbExpr;
|
|
56
56
|
}
|
|
@@ -10,6 +10,8 @@ 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';
|
|
14
|
+
import { TcbExpr } from './ops/codegen';
|
|
13
15
|
/**
|
|
14
16
|
* An environment for a given source file that can be used to emit references.
|
|
15
17
|
*
|
|
@@ -18,7 +20,7 @@ import { ImportManager } from '../../translator';
|
|
|
18
20
|
*/
|
|
19
21
|
export declare class ReferenceEmitEnvironment {
|
|
20
22
|
readonly importManager: ImportManager;
|
|
21
|
-
|
|
23
|
+
refEmitter: ReferenceEmitter;
|
|
22
24
|
readonly reflector: ReflectionHost;
|
|
23
25
|
contextFile: ts.SourceFile;
|
|
24
26
|
constructor(importManager: ImportManager, refEmitter: ReferenceEmitter, reflector: ReflectionHost, contextFile: ts.SourceFile);
|
|
@@ -30,10 +32,22 @@ export declare class ReferenceEmitEnvironment {
|
|
|
30
32
|
*/
|
|
31
33
|
referenceType(ref: Reference, flags?: ImportFlags): ts.TypeNode;
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
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.
|
|
35
48
|
*/
|
|
36
|
-
|
|
49
|
+
referenceTcbValue(ref: TcbReferenceMetadata): TcbExpr;
|
|
50
|
+
referenceExternalSymbol(moduleName: string, name: string): TcbExpr;
|
|
37
51
|
/**
|
|
38
52
|
* Generate a `ts.TypeNode` that references a given type from the provided module.
|
|
39
53
|
*
|
|
@@ -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,43 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
|
-
export declare function tsCastToAny(expr: ts.Expression): ts.Expression;
|
|
10
|
-
/**
|
|
11
|
-
* Create an expression which instantiates an element by its HTML tagName.
|
|
12
|
-
*
|
|
13
|
-
* Thanks to narrowing of `document.createElement()`, this expression will have its type inferred
|
|
14
|
-
* based on the tag name, including for custom elements that have appropriate .d.ts definitions.
|
|
15
|
-
*/
|
|
16
|
-
export declare function tsCreateElement(...tagNames: string[]): ts.Expression;
|
|
17
|
-
/**
|
|
18
|
-
* Create a `ts.VariableStatement` which declares a variable without explicit initialization.
|
|
19
|
-
*
|
|
20
|
-
* The initializer `null!` is used to bypass strict variable initialization checks.
|
|
21
|
-
*
|
|
22
|
-
* Unlike with `tsCreateVariable`, the type of the variable is explicitly specified.
|
|
23
|
-
*/
|
|
24
|
-
export declare function tsDeclareVariable(id: ts.Identifier, type: ts.TypeNode): ts.VariableStatement;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a `ts.TypeQueryNode` for a coerced input.
|
|
27
|
-
*
|
|
28
|
-
* For example: `typeof MatInput.ngAcceptInputType_value`, where MatInput is `typeName` and `value`
|
|
29
|
-
* is the `coercedInputName`.
|
|
30
|
-
*
|
|
31
|
-
* @param typeName The `EntityName` of the Directive where the static coerced input is defined.
|
|
32
|
-
* @param coercedInputName The field name of the coerced input.
|
|
33
|
-
*/
|
|
34
|
-
export declare function tsCreateTypeQueryForCoercedInput(typeName: ts.EntityName, coercedInputName: string): ts.TypeQueryNode;
|
|
35
|
-
/**
|
|
36
|
-
* Create a `ts.VariableStatement` that initializes a variable with a given expression.
|
|
37
|
-
*
|
|
38
|
-
* Unlike with `tsDeclareVariable`, the type of the variable is inferred from the initializer
|
|
39
|
-
* expression.
|
|
40
|
-
*/
|
|
41
|
-
export declare function tsCreateVariable(id: ts.Identifier, initializer: ts.Expression, flags?: ts.NodeFlags | null): ts.VariableStatement;
|
|
42
|
-
/**
|
|
43
|
-
* Construct a `ts.CallExpression` that calls a method on a receiver.
|
|
44
|
-
*/
|
|
45
|
-
export declare function tsCallMethod(receiver: ts.Expression, methodName: string, args?: ts.Expression[]): ts.CallExpression;
|
|
46
9
|
export declare function isAccessExpression(node: ts.Node): node is ts.ElementAccessExpression | ts.PropertyAccessExpression;
|
|
47
10
|
/**
|
|
48
11
|
* Creates a TypeScript node representing a numeric value.
|
|
@@ -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;
|