@angular/compiler-cli 22.0.0-next.1 → 22.0.0-next.2

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.
Files changed (44) hide show
  1. package/bundles/chunk-2KXHLD7K.js +11981 -0
  2. package/bundles/chunk-FLWAEX6T.js +1 -1
  3. package/bundles/{chunk-S54YHUIA.js → chunk-M42SPZWZ.js} +8 -6
  4. package/bundles/{chunk-CNKW2AJK.js → chunk-NUARCIAS.js} +1 -1
  5. package/bundles/chunk-OBSXELUC.js +11371 -0
  6. package/bundles/{chunk-WI7ANR5X.js → chunk-RA2TLETR.js} +35 -33
  7. package/bundles/index.js +22 -8
  8. package/bundles/private/hybrid_analysis.js +31 -0
  9. package/bundles/private/migrations.js +12 -10
  10. package/bundles/private/testing.js +5 -3
  11. package/bundles/private/tooling.js +2 -1
  12. package/bundles/src/bin/ng_xi18n.js +5 -4
  13. package/bundles/src/bin/ngc.js +5 -4
  14. package/index.d.ts +1 -0
  15. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  16. package/package.json +2 -2
  17. package/private/hybrid_analysis.d.ts +18 -0
  18. package/src/ngtsc/annotations/common/src/diagnostics.d.ts +7 -7
  19. package/src/ngtsc/core/api/src/adapter.d.ts +1 -1
  20. package/src/ngtsc/incremental/src/incremental.d.ts +1 -1
  21. package/src/ngtsc/typecheck/api/api.d.ts +80 -4
  22. package/src/ngtsc/typecheck/index.d.ts +0 -1
  23. package/src/ngtsc/typecheck/src/checker.d.ts +1 -1
  24. package/src/ngtsc/typecheck/src/context.d.ts +1 -1
  25. package/src/ngtsc/typecheck/src/diagnostics.d.ts +1 -31
  26. package/src/ngtsc/typecheck/src/environment.d.ts +6 -12
  27. package/src/ngtsc/typecheck/src/oob.d.ts +5 -4
  28. package/src/ngtsc/typecheck/src/ops/bindings.d.ts +3 -5
  29. package/src/ngtsc/typecheck/src/ops/context.d.ts +4 -5
  30. package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +3 -3
  31. package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +3 -3
  32. package/src/ngtsc/typecheck/src/ops/events.d.ts +2 -2
  33. package/src/ngtsc/typecheck/src/ops/inputs.d.ts +2 -2
  34. package/src/ngtsc/typecheck/src/ops/references.d.ts +2 -2
  35. package/src/ngtsc/typecheck/src/ops/scope.d.ts +2 -2
  36. package/src/ngtsc/typecheck/src/ops/signal_forms.d.ts +6 -6
  37. package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +6 -8
  38. package/src/ngtsc/typecheck/src/tcb_adapter.d.ts +20 -0
  39. package/src/ngtsc/typecheck/src/tcb_util.d.ts +2 -1
  40. package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -4
  41. package/src/ngtsc/typecheck/src/type_check_block.d.ts +3 -6
  42. package/src/ngtsc/typecheck/src/type_check_file.d.ts +1 -1
  43. package/src/ngtsc/typecheck/src/type_constructor.d.ts +2 -2
  44. package/bundles/chunk-V5JJK5O4.js +0 -22908
@@ -6,10 +6,10 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import ts from 'typescript';
9
- import { Reference, ReferenceEmitter } from '../../imports';
10
- import { ClassDeclaration, ReflectionHost } from '../../reflection';
9
+ import { ReferenceEmitter } from '../../imports';
10
+ import { ReflectionHost } from '../../reflection';
11
11
  import { ImportManager } from '../../translator';
12
- import { TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
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,14 +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: TypeCheckableDirectiveMeta): TcbExpr;
41
- pipeInst(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>): TcbExpr;
42
- /**
43
- * Generate a `ts.Expression` that references the given node.
44
- *
45
- * This may involve importing the node into the file if it's not declared there already.
46
- */
47
- reference(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>): TcbExpr;
48
- private emitTypeParameters;
40
+ typeCtorFor(dir: TcbDirectiveMetadata): TcbExpr;
41
+ pipeInst(pipe: TcbPipeMetadata): TcbExpr;
49
42
  getPreludeStatements(): TcbExpr[];
50
43
  }
44
+ 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: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void;
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: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void;
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 ts from 'typescript';
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: Reference<ts.TypeNode> | null;
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: TypeCheckableDirectiveMeta, node: TmplAstTemplate | TmplAstElement | TmplAstComponent | TmplAstDirective): TcbBoundAttribute[];
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 { TypeCheckableDirectiveMeta, TypeCheckId } from '../../api';
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<TypeCheckableDirectiveMeta>;
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<TypeCheckableDirectiveMeta>, pipes: Map<string, PipeMeta> | null, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean);
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): PipeMeta | null;
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 { TypeCheckableDirectiveMeta } from '../../api';
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: TypeCheckableDirectiveMeta, customFormControlType: CustomFormControlType | null);
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: TypeCheckableDirectiveMeta);
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 { TypeCheckableDirectiveMeta } from '../../api';
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: TypeCheckableDirectiveMeta;
23
- constructor(tcb: Context, scope: Scope, node: DirectiveOwner, dir: TypeCheckableDirectiveMeta);
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 { TypeCheckableDirectiveMeta } from '../../api';
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: TypeCheckableDirectiveMeta);
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 { TypeCheckableDirectiveMeta } from '../../api';
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: TypeCheckableDirectiveMeta, isFormControl: boolean | undefined, customFormControlType: CustomFormControlType | null);
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 { TypeCheckableDirectiveMeta } from '../../api';
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: TypeCheckableDirectiveMeta | TmplAstTemplate | TmplAstElement);
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 { TypeCheckableDirectiveMeta } from '../../api';
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?: TypeCheckableDirectiveMeta): TcbExpr;
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 { TypeCheckableDirectiveMeta } from '../../api';
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: TypeCheckableDirectiveMeta, node: TmplAstTemplate | TmplAstElement | TmplAstComponent | TmplAstDirective, customFormControlType: CustomFormControlType | null): TcbBoundAttribute[] | null;
43
- export declare function isFieldDirective(meta: TypeCheckableDirectiveMeta): boolean;
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: TypeCheckableDirectiveMeta): CustomFormControlType | null;
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: TypeCheckableDirectiveMeta, node: TmplAstNode, allDirectiveMatches: TypeCheckableDirectiveMeta[]): node is TmplAstElement & {
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: TypeCheckableDirectiveMeta[]): boolean;
58
+ export declare function isFormControl(allDirectiveMatches: TcbDirectiveMetadata[]): boolean;
@@ -5,11 +5,12 @@
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 { TransplantedType, Type } from '@angular/compiler';
8
+ import { TransplantedType } from '@angular/compiler';
9
9
  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
- protected refEmitter: ReferenceEmitter;
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,14 +31,11 @@ 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;
33
- referenceExternalSymbol(moduleName: string, name: string): TcbExpr;
34
34
  /**
35
- * Generate a `ts.TypeNode` that references a given type from the provided module.
36
- *
37
- * This will involve importing the type into the file, and will also add type parameters if
38
- * provided.
35
+ * Generates a `TcbExpr` from a `TcbReferenceMetadata` object.
39
36
  */
40
- referenceExternalType(moduleName: string, name: string, typeParams?: Type[]): ts.TypeNode;
37
+ referenceTcbValue(ref: TcbReferenceMetadata): TcbExpr;
38
+ referenceExternalSymbol(moduleName: string, name: string): TcbExpr;
41
39
  /**
42
40
  * Generates a `ts.TypeNode` representing a type that is being referenced from a different place
43
41
  * in the program. Any type references inside the transplanted type will be rewritten so that
@@ -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[];
@@ -7,10 +7,6 @@
7
7
  */
8
8
  import ts from 'typescript';
9
9
  export declare function isAccessExpression(node: ts.Node): node is ts.ElementAccessExpression | ts.PropertyAccessExpression;
10
- /**
11
- * Creates a TypeScript node representing a numeric value.
12
- */
13
- export declare function tsNumericExpression(value: number): ts.NumericLiteral | ts.PrefixUnaryExpression;
14
10
  /**
15
11
  * Check if a node represents a directive declaration in a TypeCheck Block.
16
12
  * Directive declarations can be either:
@@ -5,10 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- import ts from 'typescript';
9
- import { Reference } from '../../imports';
10
- import { ClassDeclaration } from '../../reflection';
11
- import { TypeCheckBlockMetadata } from '../api';
8
+ import { TcbComponentMetadata, TcbTypeCheckBlockMetadata } from '../api';
12
9
  import { DomSchemaChecker } from './dom';
13
10
  import { Environment } from './environment';
14
11
  import { OutOfBandDiagnosticRecorder } from './oob';
@@ -28,7 +25,7 @@ import { TcbGenericContextBehavior } from './ops/context';
28
25
  *
29
26
  * @param env an `Environment` into which type-checking code will be generated.
30
27
  * @param ref a `Reference` to the component class which should be type-checked.
31
- * @param name a `ts.Identifier` to use for the generated `ts.FunctionDeclaration`.
28
+ * @param name Name of the generated function.
32
29
  * @param meta metadata about the component's template and the function being generated.
33
30
  * @param domSchemaChecker used to check and record errors regarding improper usage of DOM elements
34
31
  * and bindings.
@@ -37,4 +34,4 @@ import { TcbGenericContextBehavior } from './ops/context';
37
34
  * @param genericContextBehavior controls how generic parameters (especially parameters with generic
38
35
  * bounds) will be referenced from the generated TCB code.
39
36
  */
40
- export declare function generateTypeCheckBlock(env: Environment, ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, name: ts.Identifier, meta: TypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, genericContextBehavior: TcbGenericContextBehavior): string;
37
+ export declare function generateTypeCheckBlock(env: Environment, component: TcbComponentMetadata, name: string, 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'>);
@@ -32,4 +33,3 @@ export declare class TypeCheckFile extends Environment {
32
33
  render(): string;
33
34
  getPreludeStatements(): TcbExpr[];
34
35
  }
35
- export declare function typeCheckFilePath(rootDirs: AbsoluteFsPath[]): AbsoluteFsPath;
@@ -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: ts.TypeParameterDeclaration[] | undefined): TcbExpr;
13
+ export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironment, meta: TypeCtorMetadata, nodeTypeRef: TcbExpr, typeParams: TcbTypeParameter[] | undefined): TcbExpr;
14
14
  /**
15
15
  * Generate an inline type constructor for the given class and metadata.
16
16
  *