@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.
- package/bundles/{chunk-STORTTKY.js → chunk-37JMVF7H.js} +8 -8
- package/bundles/{chunk-5UDS2TPQ.js → chunk-77D5CI2U.js} +7 -7
- package/bundles/{chunk-5B64KRP2.js → chunk-7HRFJETP.js} +49 -42
- package/bundles/{chunk-5B64KRP2.js.map → chunk-7HRFJETP.js.map} +1 -1
- package/bundles/{chunk-NSLVDBJJ.js → chunk-B73DMM7T.js} +5 -5
- package/bundles/{chunk-2MJ6YSB2.js → chunk-CD575TJ6.js} +406 -333
- package/bundles/chunk-CD575TJ6.js.map +6 -0
- package/bundles/{chunk-GBKXY6BH.js → chunk-FKXFEX7K.js} +3 -3
- package/bundles/{chunk-HXSKCJMP.js → chunk-FVYXSSAL.js} +3 -3
- package/bundles/{chunk-KDHDNSXW.js → chunk-PAYJFU4V.js} +12 -12
- package/bundles/{chunk-I6R3GL3L.js → chunk-Q2WE7ECN.js} +5 -5
- package/bundles/{chunk-UCG5K4BI.js → chunk-RFDMMGNB.js} +289 -257
- package/bundles/chunk-RFDMMGNB.js.map +6 -0
- package/bundles/{chunk-SXMUFI7N.js → chunk-SWJRL4N4.js} +33 -33
- package/bundles/index.js +15 -15
- package/bundles/linker/babel/index.js +12 -12
- package/bundles/linker/index.js +4 -4
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +6 -6
- package/bundles/private/tooling.js +6 -6
- package/bundles/src/bin/ng_xi18n.js +10 -10
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles_metadata.json +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +3 -4
- package/private/migrations.d.ts +1 -1
- package/src/ngtsc/annotations/common/src/evaluation.d.ts +1 -1
- package/src/ngtsc/annotations/common/src/util.d.ts +19 -2
- package/src/ngtsc/annotations/component/src/metadata.d.ts +2 -2
- package/src/ngtsc/annotations/component/src/resources.d.ts +3 -2
- package/src/ngtsc/annotations/index.d.ts +1 -1
- package/src/ngtsc/core/api/src/options.d.ts +8 -0
- package/src/ngtsc/core/src/compiler.d.ts +3 -3
- package/src/ngtsc/docs/src/function_extractor.d.ts +1 -1
- package/src/ngtsc/hmr/src/update_declaration.d.ts +3 -2
- package/src/ngtsc/metadata/index.d.ts +1 -1
- package/src/ngtsc/metadata/src/resource_registry.d.ts +9 -8
- package/src/ngtsc/translator/src/translator.d.ts +1 -0
- package/src/ngtsc/typecheck/api/api.d.ts +22 -24
- package/src/ngtsc/typecheck/api/checker.d.ts +3 -3
- package/src/ngtsc/typecheck/api/context.d.ts +26 -17
- package/src/ngtsc/typecheck/diagnostics/src/diagnostic.d.ts +2 -2
- package/src/ngtsc/typecheck/diagnostics/src/id.d.ts +2 -2
- package/src/ngtsc/typecheck/src/checker.d.ts +6 -6
- package/src/ngtsc/typecheck/src/completion.d.ts +2 -2
- package/src/ngtsc/typecheck/src/context.d.ts +24 -26
- package/src/ngtsc/typecheck/src/diagnostics.d.ts +5 -5
- package/src/ngtsc/typecheck/src/dom.d.ts +5 -5
- package/src/ngtsc/typecheck/src/oob.d.ts +41 -45
- package/src/ngtsc/typecheck/src/source.d.ts +11 -11
- package/src/ngtsc/typecheck/src/tcb_util.d.ts +15 -15
- package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +3 -3
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +3 -3
- package/bundles/chunk-2MJ6YSB2.js.map +0 -6
- package/bundles/chunk-UCG5K4BI.js.map +0 -6
- package/bundles/ngcc/index.js +0 -52
- package/bundles/ngcc/index.js.map +0 -6
- package/ngcc/index.d.ts +0 -11
- /package/bundles/{chunk-STORTTKY.js.map → chunk-37JMVF7H.js.map} +0 -0
- /package/bundles/{chunk-5UDS2TPQ.js.map → chunk-77D5CI2U.js.map} +0 -0
- /package/bundles/{chunk-NSLVDBJJ.js.map → chunk-B73DMM7T.js.map} +0 -0
- /package/bundles/{chunk-GBKXY6BH.js.map → chunk-FKXFEX7K.js.map} +0 -0
- /package/bundles/{chunk-HXSKCJMP.js.map → chunk-FVYXSSAL.js.map} +0 -0
- /package/bundles/{chunk-KDHDNSXW.js.map → chunk-PAYJFU4V.js.map} +0 -0
- /package/bundles/{chunk-I6R3GL3L.js.map → chunk-Q2WE7ECN.js.map} +0 -0
- /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,
|
|
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,
|
|
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 {
|
|
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 `
|
|
36
|
+
* Map of `TypeCheckId` to information collected about the template during the template
|
|
38
37
|
* type-checking process.
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
data: Map<TypeCheckId, TypeCheckData>;
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
|
-
* Data tracked for each
|
|
42
|
+
* Data tracked for each class processed by the type-checking system.
|
|
44
43
|
*/
|
|
45
|
-
export interface
|
|
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
|
|
55
|
+
* Errors found while parsing the template, which have been converted to diagnostics.
|
|
57
56
|
*/
|
|
58
|
-
|
|
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:
|
|
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 `
|
|
91
|
+
* Map of `TypeCheckId` to information collected about the template as it's ingested.
|
|
93
92
|
*/
|
|
94
|
-
|
|
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 `
|
|
104
|
+
* Retrieve the `DirectiveSourceManager` responsible for directives in the given input file path.
|
|
106
105
|
*/
|
|
107
|
-
getSourceManager(sfPath: AbsoluteFsPath):
|
|
106
|
+
getSourceManager(sfPath: AbsoluteFsPath): DirectiveSourceManager;
|
|
108
107
|
/**
|
|
109
|
-
* Whether a particular
|
|
108
|
+
* Whether a particular class should be included in the current type-checking pass.
|
|
110
109
|
*
|
|
111
|
-
* Not all
|
|
112
|
-
* example, the
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
182
|
+
private pendingShimForClass;
|
|
185
183
|
private dataForFile;
|
|
186
184
|
}
|
|
187
|
-
export declare function getTemplateDiagnostics(parseErrors: ParseError[], templateId:
|
|
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,
|
|
11
|
-
import {
|
|
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
|
|
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
|
|
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:
|
|
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,
|
|
10
|
-
import {
|
|
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:
|
|
59
|
-
checkElement(id:
|
|
60
|
-
checkProperty(id:
|
|
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,
|
|
12
|
-
import {
|
|
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
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
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(
|
|
55
|
+
deferredComponentUsedEagerly(id: TypeCheckId, element: TmplAstElement): void;
|
|
60
56
|
/**
|
|
61
57
|
* Reports a duplicate declaration of a template variable.
|
|
62
58
|
*
|
|
63
|
-
* @param
|
|
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(
|
|
69
|
-
requiresInlineTcb(
|
|
70
|
-
requiresInlineTypeConstructors(
|
|
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(
|
|
71
|
+
suboptimalTypeInference(id: TypeCheckId, variables: TmplAstVariable[]): void;
|
|
76
72
|
/**
|
|
77
73
|
* Reports a split two way binding error message.
|
|
78
74
|
*/
|
|
79
|
-
splitTwoWayBinding(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
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:
|
|
110
|
+
constructor(resolver: TypeCheckSourceResolver);
|
|
115
111
|
get diagnostics(): ReadonlyArray<TemplateDiagnostic>;
|
|
116
|
-
missingReferenceTarget(
|
|
117
|
-
missingPipe(
|
|
118
|
-
deferredPipeUsedEagerly(
|
|
119
|
-
deferredComponentUsedEagerly(
|
|
120
|
-
duplicateTemplateVar(
|
|
121
|
-
requiresInlineTcb(
|
|
122
|
-
requiresInlineTypeConstructors(
|
|
123
|
-
suboptimalTypeInference(
|
|
124
|
-
splitTwoWayBinding(
|
|
125
|
-
missingRequiredInputs(
|
|
126
|
-
illegalForLoopTrackAccess(
|
|
127
|
-
inaccessibleDeferredTriggerElement(
|
|
128
|
-
controlFlowPreventingContentProjection(
|
|
129
|
-
illegalWriteToLetDeclaration(
|
|
130
|
-
letUsedBeforeDefinition(
|
|
131
|
-
conflictingDeclaration(
|
|
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 {
|
|
11
|
-
import {
|
|
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:
|
|
17
|
+
readonly mapping: SourceMapping;
|
|
18
18
|
private file;
|
|
19
19
|
private lineStarts;
|
|
20
|
-
constructor(mapping:
|
|
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
|
|
26
|
+
* Assigns IDs for type checking and keeps track of their origins.
|
|
27
27
|
*
|
|
28
|
-
* Implements `
|
|
28
|
+
* Implements `TypeCheckSourceResolver` to resolve the source of a template based on these IDs.
|
|
29
29
|
*/
|
|
30
|
-
export declare class
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 {
|
|
12
|
+
import { FullSourceMapping, SourceLocation, TypeCheckId, SourceMapping } from '../api';
|
|
13
13
|
import { ReferenceEmitEnvironment } from './reference_emit_environment';
|
|
14
14
|
/**
|
|
15
|
-
* Adapter interface which allows the
|
|
16
|
-
* in a TCB and map them back to original locations
|
|
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
|
|
19
|
-
|
|
18
|
+
export interface TypeCheckSourceResolver {
|
|
19
|
+
getTypeCheckId(node: ts.ClassDeclaration): TypeCheckId;
|
|
20
20
|
/**
|
|
21
|
-
* For the given
|
|
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
|
-
|
|
24
|
+
getTemplateSourceMapping(id: TypeCheckId): SourceMapping;
|
|
25
25
|
/**
|
|
26
|
-
* Convert an absolute source span
|
|
27
|
-
* `ParseSourceSpan`. The returned parse span has line and column
|
|
28
|
-
* absolute offsets and gives access to the original
|
|
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
|
-
|
|
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
|
|
55
|
-
export declare function
|
|
56
|
-
export declare function findTypeCheckBlock(file: ts.SourceFile, id:
|
|
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 {
|
|
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
|
|
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,
|
|
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 {
|
|
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:
|
|
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:
|
|
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
|
*
|