@angular/compiler-cli 20.0.0-next.0 → 20.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 (67) hide show
  1. package/bundles/{chunk-STORTTKY.js → chunk-37JMVF7H.js} +8 -8
  2. package/bundles/{chunk-5UDS2TPQ.js → chunk-77D5CI2U.js} +7 -7
  3. package/bundles/{chunk-5B64KRP2.js → chunk-7HRFJETP.js} +49 -42
  4. package/bundles/{chunk-5B64KRP2.js.map → chunk-7HRFJETP.js.map} +1 -1
  5. package/bundles/{chunk-NSLVDBJJ.js → chunk-B73DMM7T.js} +5 -5
  6. package/bundles/{chunk-2MJ6YSB2.js → chunk-CD575TJ6.js} +406 -333
  7. package/bundles/chunk-CD575TJ6.js.map +6 -0
  8. package/bundles/{chunk-GBKXY6BH.js → chunk-FKXFEX7K.js} +3 -3
  9. package/bundles/{chunk-HXSKCJMP.js → chunk-FVYXSSAL.js} +3 -3
  10. package/bundles/{chunk-KDHDNSXW.js → chunk-PAYJFU4V.js} +12 -12
  11. package/bundles/{chunk-I6R3GL3L.js → chunk-Q2WE7ECN.js} +5 -5
  12. package/bundles/{chunk-UCG5K4BI.js → chunk-RFDMMGNB.js} +289 -257
  13. package/bundles/chunk-RFDMMGNB.js.map +6 -0
  14. package/bundles/{chunk-SXMUFI7N.js → chunk-SWJRL4N4.js} +33 -33
  15. package/bundles/index.js +15 -15
  16. package/bundles/linker/babel/index.js +12 -12
  17. package/bundles/linker/index.js +4 -4
  18. package/bundles/private/bazel.js +1 -1
  19. package/bundles/private/localize.js +3 -3
  20. package/bundles/private/migrations.js +6 -6
  21. package/bundles/private/tooling.js +6 -6
  22. package/bundles/src/bin/ng_xi18n.js +10 -10
  23. package/bundles/src/bin/ngc.js +8 -8
  24. package/bundles_metadata.json +1 -1
  25. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  26. package/package.json +3 -4
  27. package/private/migrations.d.ts +1 -1
  28. package/src/ngtsc/annotations/common/src/evaluation.d.ts +1 -1
  29. package/src/ngtsc/annotations/common/src/util.d.ts +19 -2
  30. package/src/ngtsc/annotations/component/src/metadata.d.ts +2 -2
  31. package/src/ngtsc/annotations/component/src/resources.d.ts +3 -2
  32. package/src/ngtsc/annotations/index.d.ts +1 -1
  33. package/src/ngtsc/core/api/src/options.d.ts +8 -0
  34. package/src/ngtsc/core/src/compiler.d.ts +3 -3
  35. package/src/ngtsc/docs/src/function_extractor.d.ts +1 -1
  36. package/src/ngtsc/hmr/src/update_declaration.d.ts +3 -2
  37. package/src/ngtsc/metadata/index.d.ts +1 -1
  38. package/src/ngtsc/metadata/src/resource_registry.d.ts +9 -8
  39. package/src/ngtsc/translator/src/translator.d.ts +1 -0
  40. package/src/ngtsc/typecheck/api/api.d.ts +22 -24
  41. package/src/ngtsc/typecheck/api/checker.d.ts +3 -3
  42. package/src/ngtsc/typecheck/api/context.d.ts +26 -17
  43. package/src/ngtsc/typecheck/diagnostics/src/diagnostic.d.ts +2 -2
  44. package/src/ngtsc/typecheck/diagnostics/src/id.d.ts +2 -2
  45. package/src/ngtsc/typecheck/src/checker.d.ts +6 -6
  46. package/src/ngtsc/typecheck/src/completion.d.ts +2 -2
  47. package/src/ngtsc/typecheck/src/context.d.ts +24 -26
  48. package/src/ngtsc/typecheck/src/diagnostics.d.ts +5 -5
  49. package/src/ngtsc/typecheck/src/dom.d.ts +5 -5
  50. package/src/ngtsc/typecheck/src/oob.d.ts +41 -45
  51. package/src/ngtsc/typecheck/src/source.d.ts +11 -11
  52. package/src/ngtsc/typecheck/src/tcb_util.d.ts +15 -15
  53. package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +3 -3
  54. package/src/ngtsc/typecheck/src/type_check_block.d.ts +3 -3
  55. package/bundles/chunk-2MJ6YSB2.js.map +0 -6
  56. package/bundles/chunk-UCG5K4BI.js.map +0 -6
  57. package/bundles/ngcc/index.js +0 -52
  58. package/bundles/ngcc/index.js.map +0 -6
  59. package/ngcc/index.d.ts +0 -11
  60. /package/bundles/{chunk-STORTTKY.js.map → chunk-37JMVF7H.js.map} +0 -0
  61. /package/bundles/{chunk-5UDS2TPQ.js.map → chunk-77D5CI2U.js.map} +0 -0
  62. /package/bundles/{chunk-NSLVDBJJ.js.map → chunk-B73DMM7T.js.map} +0 -0
  63. /package/bundles/{chunk-GBKXY6BH.js.map → chunk-FKXFEX7K.js.map} +0 -0
  64. /package/bundles/{chunk-HXSKCJMP.js.map → chunk-FVYXSSAL.js.map} +0 -0
  65. /package/bundles/{chunk-KDHDNSXW.js.map → chunk-PAYJFU4V.js.map} +0 -0
  66. /package/bundles/{chunk-I6R3GL3L.js.map → chunk-Q2WE7ECN.js.map} +0 -0
  67. /package/bundles/{chunk-SXMUFI7N.js.map → chunk-SWJRL4N4.js.map} +0 -0
@@ -5,18 +5,17 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- import { BoundTarget, ParseError, ParseSourceFile, R3TargetBinder, SchemaMetadata, TmplAstNode } from '@angular/compiler';
8
+ import { BoundTarget, ParseError, R3TargetBinder, SchemaMetadata, TmplAstNode } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { AbsoluteFsPath } from '../../file_system';
11
11
  import { Reference, ReferenceEmitter } from '../../imports';
12
- import { PipeMeta } from '../../metadata';
13
12
  import { PerfRecorder } from '../../perf';
14
13
  import { FileUpdate } from '../../program_driver';
15
14
  import { ClassDeclaration, ReflectionHost } from '../../reflection';
16
- import { TemplateDiagnostic, TemplateId, TemplateSourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata } from '../api';
15
+ import { TemplateDiagnostic, TypeCheckId, SourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata, TemplateContext } from '../api';
17
16
  import { DomSchemaChecker } from './dom';
18
17
  import { OutOfBandDiagnosticRecorder } from './oob';
19
- import { TemplateSourceManager } from './source';
18
+ import { DirectiveSourceManager } from './source';
20
19
  import { TypeCheckFile } from './type_check_file';
21
20
  export interface ShimTypeCheckingData {
22
21
  /**
@@ -34,28 +33,28 @@ export interface ShimTypeCheckingData {
34
33
  */
35
34
  hasInlines: boolean;
36
35
  /**
37
- * Map of `TemplateId` to information collected about the template during the template
36
+ * Map of `TypeCheckId` to information collected about the template during the template
38
37
  * type-checking process.
39
38
  */
40
- templates: Map<TemplateId, TemplateData>;
39
+ data: Map<TypeCheckId, TypeCheckData>;
41
40
  }
42
41
  /**
43
- * Data tracked for each template processed by the template type-checking system.
42
+ * Data tracked for each class processed by the type-checking system.
44
43
  */
45
- export interface TemplateData {
44
+ export interface TypeCheckData {
46
45
  /**
47
46
  * Template nodes for which the TCB was generated.
48
47
  */
49
- template: TmplAstNode[];
48
+ template: TmplAstNode[] | null;
50
49
  /**
51
50
  * `BoundTarget` which was used to generate the TCB, and contains bindings for the associated
52
51
  * template nodes.
53
52
  */
54
53
  boundTarget: BoundTarget<TypeCheckableDirectiveMeta>;
55
54
  /**
56
- * Errors found while parsing them template, which have been converted to diagnostics.
55
+ * Errors found while parsing the template, which have been converted to diagnostics.
57
56
  */
58
- templateDiagnostics: TemplateDiagnostic[];
57
+ templateParsingDiagnostics: TemplateDiagnostic[];
59
58
  }
60
59
  /**
61
60
  * Data for an input file which is still in the process of template type-checking code generation.
@@ -69,7 +68,7 @@ export interface PendingFileTypeCheckingData {
69
68
  * Source mapping information for mapping diagnostics from inlined type check blocks back to the
70
69
  * original template.
71
70
  */
72
- sourceManager: TemplateSourceManager;
71
+ sourceManager: DirectiveSourceManager;
73
72
  /**
74
73
  * Map of in-progress shim data for shims generated from this input file.
75
74
  */
@@ -89,9 +88,9 @@ export interface PendingShimData {
89
88
  */
90
89
  file: TypeCheckFile;
91
90
  /**
92
- * Map of `TemplateId` to information collected about the template as it's ingested.
91
+ * Map of `TypeCheckId` to information collected about the template as it's ingested.
93
92
  */
94
- templates: Map<TemplateId, TemplateData>;
93
+ data: Map<TypeCheckId, TypeCheckData>;
95
94
  }
96
95
  /**
97
96
  * Adapts the `TypeCheckContextImpl` to the larger template type-checking system.
@@ -102,23 +101,23 @@ export interface PendingShimData {
102
101
  */
103
102
  export interface TypeCheckingHost {
104
103
  /**
105
- * Retrieve the `TemplateSourceManager` responsible for components in the given input file path.
104
+ * Retrieve the `DirectiveSourceManager` responsible for directives in the given input file path.
106
105
  */
107
- getSourceManager(sfPath: AbsoluteFsPath): TemplateSourceManager;
106
+ getSourceManager(sfPath: AbsoluteFsPath): DirectiveSourceManager;
108
107
  /**
109
- * Whether a particular component class should be included in the current type-checking pass.
108
+ * Whether a particular class should be included in the current type-checking pass.
110
109
  *
111
- * Not all components offered to the `TypeCheckContext` for checking may require processing. For
112
- * example, the component may have results already available from a prior pass or from a previous
110
+ * Not all classes offered to the `TypeCheckContext` for checking may require processing. For
111
+ * example, the directive may have results already available from a prior pass or from a previous
113
112
  * program.
114
113
  */
115
- shouldCheckComponent(node: ts.ClassDeclaration): boolean;
114
+ shouldCheckClass(node: ts.ClassDeclaration): boolean;
116
115
  /**
117
116
  * Report data from a shim generated from the given input file path.
118
117
  */
119
118
  recordShimData(sfPath: AbsoluteFsPath, data: ShimTypeCheckingData): void;
120
119
  /**
121
- * Record that all of the components within the given input file path had code generated - that
120
+ * Record that all of the classes within the given input file path had code generated - that
122
121
  * is, coverage for the file can be considered complete.
123
122
  */
124
123
  recordComplete(sfPath: AbsoluteFsPath): void;
@@ -139,8 +138,7 @@ export declare enum InliningMode {
139
138
  /**
140
139
  * A template type checking context for a program.
141
140
  *
142
- * The `TypeCheckContext` allows registration of components and their templates which need to be
143
- * type checked.
141
+ * The `TypeCheckContext` allows registration of directives to be type checked.
144
142
  */
145
143
  export declare class TypeCheckContextImpl implements TypeCheckContext {
146
144
  private config;
@@ -167,7 +165,7 @@ export declare class TypeCheckContextImpl implements TypeCheckContext {
167
165
  *
168
166
  * Implements `TypeCheckContext.addTemplate`.
169
167
  */
170
- addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, PipeMeta>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null, isStandalone: boolean, preserveWhitespaces: boolean): void;
168
+ addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, isStandalone: boolean): void;
171
169
  /**
172
170
  * Record a type constructor for the given `node` with the given `ctorMetadata`.
173
171
  */
@@ -181,7 +179,7 @@ export declare class TypeCheckContextImpl implements TypeCheckContext {
181
179
  transform(sf: ts.SourceFile): string | null;
182
180
  finalize(): Map<AbsoluteFsPath, FileUpdate>;
183
181
  private addInlineTypeCheckBlock;
184
- private pendingShimForComponent;
182
+ private pendingShimForClass;
185
183
  private dataForFile;
186
184
  }
187
- export declare function getTemplateDiagnostics(parseErrors: ParseError[], templateId: TemplateId, sourceMapping: TemplateSourceMapping): TemplateDiagnostic[];
185
+ export declare function getTemplateDiagnostics(parseErrors: ParseError[], templateId: TypeCheckId, sourceMapping: SourceMapping): TemplateDiagnostic[];
@@ -7,8 +7,8 @@
7
7
  */
8
8
  import { AbsoluteSourceSpan, ParseSourceSpan } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
- import { TemplateDiagnostic, TemplateId } from '../api';
11
- import { TemplateSourceResolver } from './tcb_util';
10
+ import { TemplateDiagnostic, TypeCheckId } from '../api';
11
+ import { TypeCheckSourceResolver } from './tcb_util';
12
12
  /**
13
13
  * Wraps the node in parenthesis such that inserted span comments become attached to the proper
14
14
  * node. This is an alias for `ts.factory.createParenthesizedExpression` with the benefit that it
@@ -34,10 +34,10 @@ export declare function wrapForTypeChecker(expr: ts.Expression): ts.Expression;
34
34
  */
35
35
  export declare function addParseSpanInfo(node: ts.Node, span: AbsoluteSourceSpan | ParseSourceSpan): void;
36
36
  /**
37
- * Adds a synthetic comment to the function declaration that contains the template id
37
+ * Adds a synthetic comment to the function declaration that contains the type checking ID
38
38
  * of the class declaration.
39
39
  */
40
- export declare function addTemplateId(tcb: ts.FunctionDeclaration, id: TemplateId): void;
40
+ export declare function addTypeCheckId(tcb: ts.FunctionDeclaration, id: TypeCheckId): void;
41
41
  /**
42
42
  * Determines if the diagnostic should be reported. Some diagnostics are produced because of the
43
43
  * way TCBs are generated; those diagnostics should not be reported as type check errors of the
@@ -52,4 +52,4 @@ export declare function shouldReportDiagnostic(diagnostic: ts.Diagnostic): boole
52
52
  * should not be reported at all. This prevents diagnostics from non-TCB code in a user's source
53
53
  * file from being reported as type-check errors.
54
54
  */
55
- export declare function translateDiagnostic(diagnostic: ts.Diagnostic, resolver: TemplateSourceResolver): TemplateDiagnostic | null;
55
+ export declare function translateDiagnostic(diagnostic: ts.Diagnostic, resolver: TypeCheckSourceResolver): TemplateDiagnostic | null;
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { ParseSourceSpan, SchemaMetadata, TmplAstElement } from '@angular/compiler';
9
- import { TemplateDiagnostic, TemplateId } from '../api';
10
- import { TemplateSourceResolver } from './tcb_util';
9
+ import { TemplateDiagnostic, TypeCheckId } from '../api';
10
+ import { TypeCheckSourceResolver } from './tcb_util';
11
11
  /**
12
12
  * Checks every non-Angular element/property processed in a template and potentially produces
13
13
  * `ts.Diagnostic`s related to improper usage.
@@ -55,7 +55,7 @@ export declare class RegistryDomSchemaChecker implements DomSchemaChecker {
55
55
  private resolver;
56
56
  private _diagnostics;
57
57
  get diagnostics(): ReadonlyArray<TemplateDiagnostic>;
58
- constructor(resolver: TemplateSourceResolver);
59
- checkElement(id: TemplateId, element: TmplAstElement, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
60
- checkProperty(id: TemplateId, element: TmplAstElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
58
+ constructor(resolver: TypeCheckSourceResolver);
59
+ checkElement(id: TypeCheckId, element: TmplAstElement, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
60
+ checkProperty(id: TypeCheckId, element: TmplAstElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
61
61
  }
@@ -8,8 +8,8 @@
8
8
  import { BindingPipe, PropertyRead, PropertyWrite, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstElement, TmplAstForLoopBlock, TmplAstForLoopBlockEmpty, TmplAstHoverDeferredTrigger, TmplAstIfBlockBranch, TmplAstInteractionDeferredTrigger, TmplAstLetDeclaration, TmplAstReference, TmplAstSwitchBlockCase, TmplAstTemplate, TmplAstVariable, TmplAstViewportDeferredTrigger } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { ClassDeclaration } from '../../reflection';
11
- import { TemplateDiagnostic, TemplateId } from '../api';
12
- import { TemplateSourceResolver } from './tcb_util';
11
+ import { TemplateDiagnostic, TypeCheckId } from '../api';
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
15
15
  * from Type Check Blocks.
@@ -25,83 +25,79 @@ export interface OutOfBandDiagnosticRecorder {
25
25
  * Reports a `#ref="target"` expression in the template for which a target directive could not be
26
26
  * found.
27
27
  *
28
- * @param templateId the template type-checking ID of the template which contains the broken
29
- * reference.
28
+ * @param id the type-checking ID of the template which contains the broken reference.
30
29
  * @param ref the `TmplAstReference` which could not be matched to a directive.
31
30
  */
32
- missingReferenceTarget(templateId: TemplateId, ref: TmplAstReference): void;
31
+ missingReferenceTarget(id: TypeCheckId, ref: TmplAstReference): void;
33
32
  /**
34
33
  * Reports usage of a `| pipe` expression in the template for which the named pipe could not be
35
34
  * found.
36
35
  *
37
- * @param templateId the template type-checking ID of the template which contains the unknown
38
- * pipe.
36
+ * @param id the type-checking ID of the template which contains the unknown pipe.
39
37
  * @param ast the `BindingPipe` invocation of the pipe which could not be found.
40
38
  */
41
- missingPipe(templateId: TemplateId, ast: BindingPipe): void;
39
+ missingPipe(id: TypeCheckId, ast: BindingPipe): void;
42
40
  /**
43
41
  * Reports usage of a pipe imported via `@Component.deferredImports` outside
44
42
  * of a `@defer` block in a template.
45
43
  *
46
- * @param templateId the template type-checking ID of the template which contains the unknown
47
- * pipe.
44
+ * @param id the type-checking ID of the template which contains the unknown pipe.
48
45
  * @param ast the `BindingPipe` invocation of the pipe which could not be found.
49
46
  */
50
- deferredPipeUsedEagerly(templateId: TemplateId, ast: BindingPipe): void;
47
+ deferredPipeUsedEagerly(id: TypeCheckId, ast: BindingPipe): void;
51
48
  /**
52
49
  * Reports usage of a component/directive imported via `@Component.deferredImports` outside
53
50
  * of a `@defer` block in a template.
54
51
  *
55
- * @param templateId the template type-checking ID of the template which contains the unknown
56
- * pipe.
52
+ * @param id the type-checking ID of the template which contains the unknown pipe.
57
53
  * @param element the element which hosts a component that was defer-loaded.
58
54
  */
59
- deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void;
55
+ deferredComponentUsedEagerly(id: TypeCheckId, element: TmplAstElement): void;
60
56
  /**
61
57
  * Reports a duplicate declaration of a template variable.
62
58
  *
63
- * @param templateId the template type-checking ID of the template which contains the duplicate
59
+ * @param id the type-checking ID of the template which contains the duplicate
64
60
  * declaration.
65
61
  * @param variable the `TmplAstVariable` which duplicates a previously declared variable.
66
62
  * @param firstDecl the first variable declaration which uses the same name as `variable`.
67
63
  */
68
- duplicateTemplateVar(templateId: TemplateId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void;
69
- requiresInlineTcb(templateId: TemplateId, node: ClassDeclaration): void;
70
- requiresInlineTypeConstructors(templateId: TemplateId, node: ClassDeclaration, directives: ClassDeclaration[]): void;
64
+ duplicateTemplateVar(id: TypeCheckId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void;
65
+ requiresInlineTcb(id: TypeCheckId, node: ClassDeclaration): void;
66
+ requiresInlineTypeConstructors(id: TypeCheckId, node: ClassDeclaration, directives: ClassDeclaration[]): void;
71
67
  /**
72
68
  * Report a warning when structural directives support context guards, but the current
73
69
  * type-checking configuration prohibits their usage.
74
70
  */
75
- suboptimalTypeInference(templateId: TemplateId, variables: TmplAstVariable[]): void;
71
+ suboptimalTypeInference(id: TypeCheckId, variables: TmplAstVariable[]): void;
76
72
  /**
77
73
  * Reports a split two way binding error message.
78
74
  */
79
- splitTwoWayBinding(templateId: TemplateId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void;
75
+ splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void;
80
76
  /** Reports required inputs that haven't been bound. */
81
- missingRequiredInputs(templateId: TemplateId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
77
+ missingRequiredInputs(id: TypeCheckId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
82
78
  /**
83
79
  * Reports accesses of properties that aren't available in a `for` block's tracking expression.
84
80
  */
85
- illegalForLoopTrackAccess(templateId: TemplateId, block: TmplAstForLoopBlock, access: PropertyRead): void;
81
+ illegalForLoopTrackAccess(id: TypeCheckId, block: TmplAstForLoopBlock, access: PropertyRead): void;
86
82
  /**
87
83
  * Reports deferred triggers that cannot access the element they're referring to.
88
84
  */
89
- inaccessibleDeferredTriggerElement(templateId: TemplateId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
85
+ inaccessibleDeferredTriggerElement(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
90
86
  /**
91
87
  * Reports cases where control flow nodes prevent content projection.
92
88
  */
93
- controlFlowPreventingContentProjection(templateId: TemplateId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void;
89
+ controlFlowPreventingContentProjection(id: TypeCheckId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void;
94
90
  /** Reports cases where users are writing to `@let` declarations. */
95
- illegalWriteToLetDeclaration(templateId: TemplateId, node: PropertyWrite, target: TmplAstLetDeclaration): void;
91
+ illegalWriteToLetDeclaration(id: TypeCheckId, node: PropertyWrite, target: TmplAstLetDeclaration): void;
96
92
  /** Reports cases where users are accessing an `@let` before it is defined.. */
97
- letUsedBeforeDefinition(templateId: TemplateId, node: PropertyRead, target: TmplAstLetDeclaration): void;
93
+ letUsedBeforeDefinition(id: TypeCheckId, node: PropertyRead, target: TmplAstLetDeclaration): void;
98
94
  /**
99
95
  * Reports a `@let` declaration that conflicts with another symbol in the same scope.
100
96
  *
101
- * @param templateId the template type-checking ID of the template which contains the declaration.
97
+ * @param id the type-checking ID of the template which contains the declaration.
102
98
  * @param current the `TmplAstLetDeclaration` which is invalid.
103
99
  */
104
- conflictingDeclaration(templateId: TemplateId, current: TmplAstLetDeclaration): void;
100
+ conflictingDeclaration(id: TypeCheckId, current: TmplAstLetDeclaration): void;
105
101
  }
106
102
  export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnosticRecorder {
107
103
  private resolver;
@@ -111,22 +107,22 @@ export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnos
111
107
  * is ever produced per node.
112
108
  */
113
109
  private recordedPipes;
114
- constructor(resolver: TemplateSourceResolver);
110
+ constructor(resolver: TypeCheckSourceResolver);
115
111
  get diagnostics(): ReadonlyArray<TemplateDiagnostic>;
116
- missingReferenceTarget(templateId: TemplateId, ref: TmplAstReference): void;
117
- missingPipe(templateId: TemplateId, ast: BindingPipe): void;
118
- deferredPipeUsedEagerly(templateId: TemplateId, ast: BindingPipe): void;
119
- deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void;
120
- duplicateTemplateVar(templateId: TemplateId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void;
121
- requiresInlineTcb(templateId: TemplateId, node: ClassDeclaration): void;
122
- requiresInlineTypeConstructors(templateId: TemplateId, node: ClassDeclaration, directives: ClassDeclaration[]): void;
123
- suboptimalTypeInference(templateId: TemplateId, variables: TmplAstVariable[]): void;
124
- splitTwoWayBinding(templateId: TemplateId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void;
125
- missingRequiredInputs(templateId: TemplateId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
126
- illegalForLoopTrackAccess(templateId: TemplateId, block: TmplAstForLoopBlock, access: PropertyRead): void;
127
- inaccessibleDeferredTriggerElement(templateId: TemplateId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
128
- controlFlowPreventingContentProjection(templateId: TemplateId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void;
129
- illegalWriteToLetDeclaration(templateId: TemplateId, node: PropertyWrite, target: TmplAstLetDeclaration): void;
130
- letUsedBeforeDefinition(templateId: TemplateId, node: PropertyRead, target: TmplAstLetDeclaration): void;
131
- conflictingDeclaration(templateId: TemplateId, decl: TmplAstLetDeclaration): void;
112
+ missingReferenceTarget(id: TypeCheckId, ref: TmplAstReference): void;
113
+ missingPipe(id: TypeCheckId, ast: BindingPipe): void;
114
+ deferredPipeUsedEagerly(id: TypeCheckId, ast: BindingPipe): void;
115
+ deferredComponentUsedEagerly(id: TypeCheckId, element: TmplAstElement): void;
116
+ duplicateTemplateVar(id: TypeCheckId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void;
117
+ requiresInlineTcb(id: TypeCheckId, node: ClassDeclaration): void;
118
+ requiresInlineTypeConstructors(id: TypeCheckId, node: ClassDeclaration, directives: ClassDeclaration[]): void;
119
+ suboptimalTypeInference(id: TypeCheckId, variables: TmplAstVariable[]): void;
120
+ splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void;
121
+ missingRequiredInputs(id: TypeCheckId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
122
+ illegalForLoopTrackAccess(id: TypeCheckId, block: TmplAstForLoopBlock, access: PropertyRead): void;
123
+ inaccessibleDeferredTriggerElement(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
124
+ controlFlowPreventingContentProjection(id: TypeCheckId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void;
125
+ illegalWriteToLetDeclaration(id: TypeCheckId, node: PropertyWrite, target: TmplAstLetDeclaration): void;
126
+ letUsedBeforeDefinition(id: TypeCheckId, node: PropertyRead, target: TmplAstLetDeclaration): void;
127
+ conflictingDeclaration(id: TypeCheckId, decl: TmplAstLetDeclaration): void;
132
128
  }
@@ -7,35 +7,35 @@
7
7
  */
8
8
  import { AbsoluteSourceSpan, ParseSourceFile, ParseSourceSpan } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
- import { TemplateId, TemplateSourceMapping } from '../api';
11
- import { TemplateSourceResolver } from './tcb_util';
10
+ import { TypeCheckId, SourceMapping } from '../api';
11
+ import { TypeCheckSourceResolver } from './tcb_util';
12
12
  /**
13
13
  * Represents the source of a template that was processed during type-checking. This information is
14
14
  * used when translating parse offsets in diagnostics back to their original line/column location.
15
15
  */
16
16
  export declare class TemplateSource {
17
- readonly mapping: TemplateSourceMapping;
17
+ readonly mapping: SourceMapping;
18
18
  private file;
19
19
  private lineStarts;
20
- constructor(mapping: TemplateSourceMapping, file: ParseSourceFile);
20
+ constructor(mapping: SourceMapping, file: ParseSourceFile);
21
21
  toParseSourceSpan(start: number, end: number): ParseSourceSpan;
22
22
  private toParseLocation;
23
23
  private acquireLineStarts;
24
24
  }
25
25
  /**
26
- * Assigns IDs to templates and keeps track of their origins.
26
+ * Assigns IDs for type checking and keeps track of their origins.
27
27
  *
28
- * Implements `TemplateSourceResolver` to resolve the source of a template based on these IDs.
28
+ * Implements `TypeCheckSourceResolver` to resolve the source of a template based on these IDs.
29
29
  */
30
- export declare class TemplateSourceManager implements TemplateSourceResolver {
30
+ export declare class DirectiveSourceManager implements TypeCheckSourceResolver {
31
31
  /**
32
32
  * This map keeps track of all template sources that have been type-checked by the id that is
33
33
  * attached to a TCB's function declaration as leading trivia. This enables translation of
34
34
  * diagnostics produced for TCB code to their source location in the template.
35
35
  */
36
36
  private templateSources;
37
- getTemplateId(node: ts.ClassDeclaration): TemplateId;
38
- captureSource(node: ts.ClassDeclaration, mapping: TemplateSourceMapping, file: ParseSourceFile): TemplateId;
39
- getSourceMapping(id: TemplateId): TemplateSourceMapping;
40
- toParseSourceSpan(id: TemplateId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
37
+ getTypeCheckId(node: ts.ClassDeclaration): TypeCheckId;
38
+ captureTemplateSource(id: TypeCheckId, mapping: SourceMapping, file: ParseSourceFile): void;
39
+ getTemplateSourceMapping(id: TypeCheckId): SourceMapping;
40
+ toTemplateParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
41
41
  }
@@ -9,25 +9,25 @@ 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 { FullTemplateMapping, SourceLocation, TemplateId, TemplateSourceMapping } from '../api';
12
+ import { FullSourceMapping, SourceLocation, TypeCheckId, SourceMapping } from '../api';
13
13
  import { ReferenceEmitEnvironment } from './reference_emit_environment';
14
14
  /**
15
- * Adapter interface which allows the template type-checking diagnostics code to interpret offsets
16
- * in a TCB and map them back to original locations in the template.
15
+ * Adapter interface which allows the directive type-checking diagnostics code to interpret offsets
16
+ * in a TCB and map them back to their original locations.
17
17
  */
18
- export interface TemplateSourceResolver {
19
- getTemplateId(node: ts.ClassDeclaration): TemplateId;
18
+ export interface TypeCheckSourceResolver {
19
+ getTypeCheckId(node: ts.ClassDeclaration): TypeCheckId;
20
20
  /**
21
- * For the given template id, retrieve the original source mapping which describes how the offsets
22
- * in the template should be interpreted.
21
+ * For the given type checking id, retrieve the original source mapping which describes how the
22
+ * offsets in the template should be interpreted.
23
23
  */
24
- getSourceMapping(id: TemplateId): TemplateSourceMapping;
24
+ getTemplateSourceMapping(id: TypeCheckId): SourceMapping;
25
25
  /**
26
- * Convert an absolute source span associated with the given template id into a full
27
- * `ParseSourceSpan`. The returned parse span has line and column numbers in addition to only
28
- * absolute offsets and gives access to the original template source.
26
+ * Convert an absolute source span coming from the template associated with the given type
27
+ * checking id into a full `ParseSourceSpan`. The returned parse span has line and column
28
+ * numbers in addition to only absolute offsets and gives access to the original source code.
29
29
  */
30
- toParseSourceSpan(id: TemplateId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
30
+ toTemplateParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null;
31
31
  }
32
32
  /**
33
33
  * Indicates whether a particular component requires an inline type check block.
@@ -51,9 +51,9 @@ export declare enum TcbInliningRequirement {
51
51
  None = 2
52
52
  }
53
53
  export declare function requiresInlineTypeCheckBlock(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, env: ReferenceEmitEnvironment, usedPipes: Reference<ClassDeclaration<ts.ClassDeclaration>>[], reflector: ReflectionHost): TcbInliningRequirement;
54
- /** Maps a shim position back to a template location. */
55
- export declare function getTemplateMapping(shimSf: ts.SourceFile, position: number, resolver: TemplateSourceResolver, isDiagnosticRequest: boolean): FullTemplateMapping | null;
56
- export declare function findTypeCheckBlock(file: ts.SourceFile, id: TemplateId, isDiagnosticRequest: boolean): ts.Node | null;
54
+ /** Maps a shim position back to a source code location. */
55
+ export declare function getSourceMapping(shimSf: ts.SourceFile, position: number, resolver: TypeCheckSourceResolver, isDiagnosticRequest: boolean): FullSourceMapping | null;
56
+ export declare function findTypeCheckBlock(file: ts.SourceFile, id: TypeCheckId, isDiagnosticRequest: boolean): ts.Node | null;
57
57
  /**
58
58
  * Traverses up the AST starting from the given node to extract the source location from comments
59
59
  * that have been emitted into the TCB. If the node does not exist within a TCB, or if an ignore
@@ -10,7 +10,7 @@ import ts from 'typescript';
10
10
  import { AbsoluteFsPath } from '../../file_system';
11
11
  import { ComponentScopeReader } from '../../scope';
12
12
  import { ElementSymbol, LetDeclarationSymbol, ReferenceSymbol, Symbol, TemplateSymbol, VariableSymbol } from '../api';
13
- import { TemplateData } from './context';
13
+ import { TypeCheckData } from './context';
14
14
  /**
15
15
  * Generates and caches `Symbol`s for various template structures for a given component.
16
16
  *
@@ -21,11 +21,11 @@ export declare class SymbolBuilder {
21
21
  private readonly tcbPath;
22
22
  private readonly tcbIsShim;
23
23
  private readonly typeCheckBlock;
24
- private readonly templateData;
24
+ private readonly typeCheckData;
25
25
  private readonly componentScopeReader;
26
26
  private readonly getTypeChecker;
27
27
  private symbolCache;
28
- constructor(tcbPath: AbsoluteFsPath, tcbIsShim: boolean, typeCheckBlock: ts.Node, templateData: TemplateData, componentScopeReader: ComponentScopeReader, getTypeChecker: () => ts.TypeChecker);
28
+ constructor(tcbPath: AbsoluteFsPath, tcbIsShim: boolean, typeCheckBlock: ts.Node, typeCheckData: TypeCheckData, componentScopeReader: ComponentScopeReader, getTypeChecker: () => ts.TypeChecker);
29
29
  getSymbol(node: TmplAstTemplate | TmplAstElement): TemplateSymbol | ElementSymbol | null;
30
30
  getSymbol(node: TmplAstReference | TmplAstVariable | TmplAstLetDeclaration): ReferenceSymbol | VariableSymbol | LetDeclarationSymbol | null;
31
31
  getSymbol(node: AST | TmplAstNode): Symbol | null;
@@ -10,7 +10,7 @@ import ts from 'typescript';
10
10
  import { Reference } from '../../imports';
11
11
  import { PipeMeta } from '../../metadata';
12
12
  import { ClassDeclaration } from '../../reflection';
13
- import { TemplateId, TypeCheckableDirectiveMeta, TypeCheckBlockMetadata } from '../api';
13
+ import { TypeCheckId, TypeCheckableDirectiveMeta, TypeCheckBlockMetadata } from '../api';
14
14
  import { DomSchemaChecker } from './dom';
15
15
  import { Environment } from './environment';
16
16
  import { OutOfBandDiagnosticRecorder } from './oob';
@@ -127,14 +127,14 @@ export declare class Context {
127
127
  readonly env: Environment;
128
128
  readonly domSchemaChecker: DomSchemaChecker;
129
129
  readonly oobRecorder: OutOfBandDiagnosticRecorder;
130
- readonly id: TemplateId;
130
+ readonly id: TypeCheckId;
131
131
  readonly boundTarget: BoundTarget<TypeCheckableDirectiveMeta>;
132
132
  private pipes;
133
133
  readonly schemas: SchemaMetadata[];
134
134
  readonly hostIsStandalone: boolean;
135
135
  readonly hostPreserveWhitespaces: boolean;
136
136
  private nextId;
137
- constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, PipeMeta>, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean);
137
+ constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TypeCheckId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, PipeMeta> | null, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean);
138
138
  /**
139
139
  * Allocate a new variable name for use within the `Context`.
140
140
  *