@angular/compiler-cli 22.0.0-next.4 → 22.0.0-next.5
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-AI2LKYE3.js → chunk-456UYWVI.js} +4 -3
- package/bundles/{chunk-AI2LKYE3.js.map → chunk-456UYWVI.js.map} +1 -1
- package/bundles/{chunk-ARNGIZEA.js → chunk-AQWJY4QK.js} +5030 -486
- package/bundles/chunk-AQWJY4QK.js.map +6 -0
- package/bundles/{chunk-BCQGTZBZ.js → chunk-F56AXDTP.js} +1813 -6367
- package/bundles/chunk-F56AXDTP.js.map +6 -0
- package/bundles/{chunk-TXJNNYJ4.js → chunk-G4HQADYD.js} +2 -2
- package/bundles/{chunk-6IEU2J75.js → chunk-RALPCPVT.js} +42 -36
- package/bundles/{chunk-6IEU2J75.js.map → chunk-RALPCPVT.js.map} +1 -1
- package/bundles/{chunk-33PKOB6H.js → chunk-TQQE4HRK.js} +8 -8
- package/bundles/index.js +10 -8
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +1 -1
- package/bundles/linker/index.js +1 -1
- package/bundles/private/hybrid_analysis.js +3 -1
- package/bundles/private/migrations.js +17 -17
- package/bundles/private/testing.js +2 -2
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +5 -5
- package/bundles/src/bin/ngc.js +5 -5
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +3 -3
- package/private/hybrid_analysis.d.ts +2 -2
- package/src/ngtsc/annotations/directive/src/shared.d.ts +5 -3
- package/src/ngtsc/core/api/src/public_options.d.ts +1 -1
- package/src/ngtsc/core/src/compiler.d.ts +6 -1
- package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
- package/src/ngtsc/typecheck/api/index.d.ts +1 -0
- package/src/ngtsc/typecheck/api/oob.d.ts +140 -0
- package/src/ngtsc/typecheck/src/context.d.ts +6 -3
- package/src/ngtsc/typecheck/src/host_bindings.d.ts +51 -9
- package/src/ngtsc/typecheck/src/oob.d.ts +5 -131
- package/src/ngtsc/typecheck/src/ops/context.d.ts +3 -4
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -3
- package/src/ngtsc/typecheck/src/type_check_file.d.ts +2 -3
- package/bundles/chunk-ARNGIZEA.js.map +0 -6
- package/bundles/chunk-BCQGTZBZ.js.map +0 -6
- /package/bundles/{chunk-TXJNNYJ4.js.map → chunk-G4HQADYD.js.map} +0 -0
- /package/bundles/{chunk-33PKOB6H.js.map → chunk-TQQE4HRK.js.map} +0 -0
package/bundles/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts", "../private/tooling.ts", "../src/ngtsc/tsc_plugin.ts", "../index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAQ,eAAc;AAEf,IAAM,UAAU,IAAI,QAAQ,mBAAmB;;;ACO/C,IAAM,yBAAyB;EACpC,WAAW;EACX,mBAAmB;;AAGd,IAAM,kCAAkC;EAC7C,GAAG;EACH,WAAW;;AASN,IAAM,0CAA0C,CACrD,SACA,SAAS,UAC+B;AACxC,SAAO,+BAA+B,SAAS,MAAM;AACvD;;;AC6BM,IAAO,cAAP,MAAkB;EAcF;EAbpB,OAAO;EAEC,UAAoC;EACpC,OAA8B;EAC9B,YAA+B;EAEvC,IAAI,WAAQ;AACV,QAAI,KAAK,cAAc,MAAM;AAC3B,YAAM,IAAI,MAAM,2DAA2D;IAC7E;AACA,WAAO,KAAK;EACd;EAEA,YAAoB,WAAa;AAAb,SAAA,YAAA;AAClB,kBAAc,IAAI,iBAAgB,CAAE;EACtC;EAEA,SACE,MACA,YACA,SAA2B;AAK3B,SAAK,UAAU,EAAC,GAAG,KAAK,WAAW,GAAG,QAAO;AAC7C,SAAK,OAAO,eAAe;MAAK;MAAM;MAAY,KAAK;;MAA0B;IAAI;AACrF,WAAO,KAAK;EACd;EAEA,iBACE,SACA,YAAuB;AAWvB,UAAM,eAAe,mBAAmB,YAAW;AACnD,QAAI,KAAK,SAAS,QAAQ,KAAK,YAAY,MAAM;AAC/C,YAAM,IAAI,MAAM,wDAAwD;IAC1E;AACA,SAAK,KAAK,2BAA0B;AACpC,UAAM,gBAAgB,IAAI,sBACxB,SACA,KAAK,MACL,KAAK,SACL,KAAK,KAAK,qBAAqB;AAEjC,UAAM,WAAW,IAAI,uCAAsC;AAC3D,UAAM,WAAW,eAAe,SAAY,SAAS,oBAAoB,UAAU,IAAI;AACvF,QAAI;AAEJ,UAAM,wBAAwB,oBAAI,IAAG;AACrC,QAAI,KAAK,KAAK,6BAA6B,QAAW;AACpD,iBAAW,gBAAgB,KAAK,KAAK,yBAAwB,KAAM,CAAA,GAAI;AACrE,8BAAsB,IAAI,QAAQ,YAAY,CAAC;MACjD;IACF;AAEA,QAAI,eAAe,UAAa,aAAa,MAAM;AACjD,eAAS;QACP;QACA,KAAK;QACL;QACA;QACA;;QACgC;;QACV;MAAK;IAE/B,OAAO;AACL,eAAS,oBAAmB,EAAG,oBAAoB,UAAU;AAC7D,eAAS,2BACP,YACA,UACA,SACA,KAAK,SACL,UACA,eACA,uBACA,cACA,OACA,KAAK;IAET;AACA,SAAK,YAAY,WAAW,WAAW,QAAQ,KAAK,IAAI;AACxD,WAAO;MACL,sBAAsB,KAAK,UAAU;MACrC,eAAe,KAAK,UAAU;;EAElC;EAEA,eAAe,MAAoB;AACjC,QAAI,SAAS,QAAW;AACtB,aAAO,KAAK,SAAS,eAAc;IACrC;AACA,WAAO,KAAK,SAAS,sBAAsB,MAAM,YAAY,YAAY;EAC3E;EAEA,uBAAoB;AAClB,WAAO,KAAK,SAAS,qBAAoB;EAC3C;EAEA,iBAAc;AACZ,WAAO,KAAK,SAAS,kBAAiB;EACxC;EAEA,qBAAkB;AAGhB,SAAK,SAAS,aAAa,MAAM,UAAU,cAAc;AACzD,WAAO,KAAK,SAAS,YAAW,EAAG;EACrC;;;;ACvIF,cAAc,IAAI,iBAAiB,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/bundles/linker/index.js
CHANGED
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
ImportManager,
|
|
9
9
|
RegistryDomSchemaChecker,
|
|
10
10
|
TcbGenericContextBehavior,
|
|
11
|
+
createHostElement,
|
|
11
12
|
generateTypeCheckBlock
|
|
12
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-F56AXDTP.js";
|
|
13
14
|
import "../chunk-L35AQF75.js";
|
|
14
15
|
import "../chunk-UTWH365F.js";
|
|
15
16
|
import "../chunk-KWAGEHJJ.js";
|
|
@@ -20,6 +21,7 @@ export {
|
|
|
20
21
|
ImportManager,
|
|
21
22
|
RegistryDomSchemaChecker,
|
|
22
23
|
TcbGenericContextBehavior,
|
|
24
|
+
createHostElement,
|
|
23
25
|
generateTypeCheckBlock
|
|
24
26
|
};
|
|
25
27
|
/**
|
|
@@ -5,36 +5,36 @@
|
|
|
5
5
|
import {
|
|
6
6
|
DiagnosticCategoryLabel,
|
|
7
7
|
NgCompiler
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-RALPCPVT.js";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
CompilationMode,
|
|
11
|
+
DtsMetadataReader,
|
|
12
|
+
DynamicValue,
|
|
13
|
+
PartialEvaluator,
|
|
14
|
+
StaticInterpreter,
|
|
15
|
+
createForwardRefResolver,
|
|
13
16
|
extractDecoratorQueryMetadata,
|
|
14
17
|
extractTemplate,
|
|
18
|
+
findAngularDecorator,
|
|
19
|
+
getAngularDecorators,
|
|
15
20
|
isShim,
|
|
16
21
|
parseDecoratorInputTransformFunction,
|
|
17
|
-
queryDecoratorNames
|
|
18
|
-
|
|
22
|
+
queryDecoratorNames,
|
|
23
|
+
unwrapExpression
|
|
24
|
+
} from "../chunk-AQWJY4QK.js";
|
|
19
25
|
import {
|
|
20
|
-
CompilationMode,
|
|
21
|
-
DtsMetadataReader,
|
|
22
|
-
DynamicValue,
|
|
23
26
|
FatalDiagnosticError,
|
|
24
27
|
ImportManager,
|
|
25
|
-
|
|
28
|
+
PotentialImportKind,
|
|
29
|
+
PotentialImportMode,
|
|
26
30
|
Reference,
|
|
27
31
|
ReferenceEmitKind,
|
|
28
32
|
ReferenceEmitter,
|
|
29
|
-
|
|
33
|
+
SymbolKind,
|
|
30
34
|
TypeScriptReflectionHost,
|
|
31
|
-
createForwardRefResolver,
|
|
32
|
-
findAngularDecorator,
|
|
33
|
-
getAngularDecorators,
|
|
34
35
|
getRootDirs,
|
|
35
|
-
reflectObjectLiteral
|
|
36
|
-
|
|
37
|
-
} from "../chunk-BCQGTZBZ.js";
|
|
36
|
+
reflectObjectLiteral
|
|
37
|
+
} from "../chunk-F56AXDTP.js";
|
|
38
38
|
import "../chunk-L35AQF75.js";
|
|
39
39
|
import {
|
|
40
40
|
getFileSystem,
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
getInitializerApiJitTransform
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-AQWJY4QK.js";
|
|
8
8
|
import {
|
|
9
9
|
ImportedSymbolsTracker,
|
|
10
10
|
TypeScriptReflectionHost
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-F56AXDTP.js";
|
|
12
12
|
import "../chunk-L35AQF75.js";
|
|
13
13
|
import {
|
|
14
14
|
InvalidFileSystem,
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
angularJitApplicationTransform
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-AQWJY4QK.js";
|
|
8
|
+
import "../chunk-F56AXDTP.js";
|
|
9
9
|
import "../chunk-L35AQF75.js";
|
|
10
10
|
import "../chunk-UTWH365F.js";
|
|
11
11
|
import "../chunk-KWAGEHJJ.js";
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
import {
|
|
7
7
|
main,
|
|
8
8
|
readCommandLineAndConfiguration
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-G4HQADYD.js";
|
|
10
10
|
import {
|
|
11
11
|
EmitFlags
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-TQQE4HRK.js";
|
|
13
|
+
import "../../chunk-RALPCPVT.js";
|
|
14
|
+
import "../../chunk-AQWJY4QK.js";
|
|
15
|
+
import "../../chunk-F56AXDTP.js";
|
|
16
16
|
import "../../chunk-L35AQF75.js";
|
|
17
17
|
import {
|
|
18
18
|
setFileSystem
|
package/bundles/src/bin/ngc.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-G4HQADYD.js";
|
|
9
|
+
import "../../chunk-TQQE4HRK.js";
|
|
10
|
+
import "../../chunk-RALPCPVT.js";
|
|
11
|
+
import "../../chunk-AQWJY4QK.js";
|
|
12
|
+
import "../../chunk-F56AXDTP.js";
|
|
13
13
|
import "../../chunk-L35AQF75.js";
|
|
14
14
|
import {
|
|
15
15
|
setFileSystem
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { ConstantPool, R3PartialDeclaration } from '@angular/compiler';
|
|
9
9
|
import { AstObject } from '../../ast/ast_value';
|
|
10
10
|
import { GetSourceFileFn } from '../get_source_file';
|
|
11
|
-
import { LinkedDefinition, PartialLinker } from './partial_linker';
|
|
12
11
|
import { AbsoluteFsPath } from '../../../../src/ngtsc/file_system/src/types';
|
|
12
|
+
import { LinkedDefinition, PartialLinker } from './partial_linker';
|
|
13
13
|
/**
|
|
14
14
|
* A `PartialLinker` that is designed to process `ɵɵngDeclareComponent()` call expressions.
|
|
15
15
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
|
|
9
9
|
import { AstObject, AstValue } from '../../ast/ast_value';
|
|
10
|
-
export declare const PLACEHOLDER_VERSION = "22.0.0-next.
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "22.0.0-next.5";
|
|
11
11
|
export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
|
|
12
12
|
/**
|
|
13
13
|
* Parses the value of an enum from the AST value's symbol name.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "22.0.0-next.
|
|
3
|
+
"version": "22.0.0-next.5",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"yargs": "^18.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"typescript": "
|
|
43
|
+
"typescript": "6.0.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@angular/compiler": "22.0.0-next.
|
|
46
|
+
"@angular/compiler": "22.0.0-next.5",
|
|
47
47
|
"typescript": ">=5.9 <6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
export { generateTypeCheckBlock } from '../src/ngtsc/typecheck/src/type_check_block';
|
|
9
|
-
export type { TypeCheckingConfig, TcbComponentMetadata, TcbTypeCheckBlockMetadata, TcbTypeParameter, TypeCheckId, TcbDirectiveMetadata, TemplateDiagnostic, TcbReferenceMetadata, SourceMapping, } from '../src/ngtsc/typecheck/api';
|
|
9
|
+
export type { TypeCheckingConfig, TcbComponentMetadata, TcbTypeCheckBlockMetadata, TcbTypeParameter, TypeCheckId, TcbDirectiveMetadata, TemplateDiagnostic, TcbReferenceMetadata, SourceMapping, OutOfBandDiagnosticRecorder, OutOfBadDiagnosticCategory, } from '../src/ngtsc/typecheck/api';
|
|
10
10
|
export { DomSchemaChecker, RegistryDomSchemaChecker } from '../src/ngtsc/typecheck/src/dom';
|
|
11
11
|
export { Environment } from '../src/ngtsc/typecheck/src/environment';
|
|
12
|
-
export { OutOfBandDiagnosticRecorder } from '../src/ngtsc/typecheck/src/oob';
|
|
13
12
|
export { TcbGenericContextBehavior } from '../src/ngtsc/typecheck/src/ops/context';
|
|
14
13
|
export { ImportManager } from '../src/ngtsc/translator';
|
|
15
14
|
export type { ReferenceEmitter } from '../src/ngtsc/imports';
|
|
16
15
|
export type { ReflectionHost, ClassDeclaration } from '../src/ngtsc/reflection';
|
|
17
16
|
export { ClassPropertyMapping } from '../src/ngtsc/metadata/src/property_mapping';
|
|
18
17
|
export type { TypeCheckSourceResolver } from '../src/ngtsc/typecheck/src/tcb_util';
|
|
18
|
+
export { createHostElement, type SourceNode, type StaticSourceNode, type HostObjectLiteralBinding, type HostListenerDecorator, type HostBindingDecorator, } from '../src/ngtsc/typecheck/src/host_bindings';
|
|
@@ -13,12 +13,14 @@ import { DynamicValue, PartialEvaluator } from '../../../partial_evaluator';
|
|
|
13
13
|
import { ClassDeclaration, Decorator, ReflectionHost } from '../../../reflection';
|
|
14
14
|
import { CompilationMode } from '../../../transform';
|
|
15
15
|
import { ReferencesRegistry, UndecoratedMetadataExtractor } from '../../common';
|
|
16
|
+
import { HostObjectLiteralBinding, HostListenerDecorator, HostBindingDecorator } from '../../../typecheck/src/host_bindings';
|
|
16
17
|
type QueryDecoratorName = 'ViewChild' | 'ViewChildren' | 'ContentChild' | 'ContentChildren';
|
|
17
18
|
export declare const queryDecoratorNames: QueryDecoratorName[];
|
|
18
19
|
export interface HostBindingNodes {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
hostObjectLiteralBindings: HostObjectLiteralBinding[];
|
|
21
|
+
hostBindingDecorators: HostBindingDecorator[];
|
|
22
|
+
hostListenerDecorators: HostListenerDecorator[];
|
|
23
|
+
rawNodes: ts.Node[];
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Helper function to extract metadata from a `Directive` or `Component`. `Directive`s without a
|
|
@@ -93,7 +93,7 @@ export interface TypeCheckingOptions {
|
|
|
93
93
|
*
|
|
94
94
|
* This flag is a superset of the deprecated `fullTemplateTypeCheck` option.
|
|
95
95
|
*
|
|
96
|
-
* Defaults to `
|
|
96
|
+
* Defaults to `true`
|
|
97
97
|
*/
|
|
98
98
|
strictTemplates?: boolean;
|
|
99
99
|
/**
|
|
@@ -10,7 +10,7 @@ import { DocEntry } from '../../docs';
|
|
|
10
10
|
import { AbsoluteFsPath } from '../../file_system';
|
|
11
11
|
import { IncrementalBuildStrategy, IncrementalCompilation, IncrementalState } from '../../incremental';
|
|
12
12
|
import { IndexedComponent } from '../../indexer';
|
|
13
|
-
import {
|
|
13
|
+
import { DirectiveMeta, DirectiveResources, PipeMeta } from '../../metadata';
|
|
14
14
|
import { ActivePerfRecorder } from '../../perf';
|
|
15
15
|
import { ProgramDriver } from '../../program_driver';
|
|
16
16
|
import { DeclarationNode } from '../../reflection';
|
|
@@ -263,6 +263,11 @@ export declare class NgCompiler {
|
|
|
263
263
|
private ensureAnalyzed;
|
|
264
264
|
private analyzeSync;
|
|
265
265
|
private resolveCompilation;
|
|
266
|
+
/**
|
|
267
|
+
* strictTemplate is `true` by default.
|
|
268
|
+
* Explicit opt-out is required to disable strictness
|
|
269
|
+
*/
|
|
270
|
+
private get strictTemplates();
|
|
266
271
|
private get fullTemplateTypeCheck();
|
|
267
272
|
private getTypeCheckingConfig;
|
|
268
273
|
private getTemplateDiagnostics;
|
|
@@ -371,6 +371,10 @@ export declare enum ErrorCode {
|
|
|
371
371
|
DEFER_TRIGGER_MISCONFIGURATION = 8021,
|
|
372
372
|
/** Raised when the user has an unsupported binding on a `FormField` directive. */
|
|
373
373
|
FORM_FIELD_UNSUPPORTED_BINDING = 8022,
|
|
374
|
+
/**
|
|
375
|
+
* Raised when multiple components in the compilation scope match a given element in a template.
|
|
376
|
+
*/
|
|
377
|
+
MULTIPLE_MATCHING_COMPONENTS = 8023,
|
|
374
378
|
/**
|
|
375
379
|
* A two way binding in a template has an incorrect syntax,
|
|
376
380
|
* parentheses outside brackets. For example:
|
|
@@ -0,0 +1,140 @@
|
|
|
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 { AST, BindingPipe, PropertyRead, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstForLoopBlock, TmplAstForLoopBlockEmpty, TmplAstHoverDeferredTrigger, TmplAstIfBlockBranch, TmplAstInteractionDeferredTrigger, TmplAstLetDeclaration, TmplAstReference, TmplAstSwitchBlockCase, TmplAstTemplate, TmplAstTextAttribute, TmplAstVariable, TmplAstViewportDeferredTrigger } from '@angular/compiler';
|
|
9
|
+
import { TcbDirectiveMetadata, TypeCheckId } from './api';
|
|
10
|
+
/** Categories of diagnostics that can be reported by a `OutOfBandDiagnosticRecorder`. */
|
|
11
|
+
export declare enum OutOfBadDiagnosticCategory {
|
|
12
|
+
Error = 0,
|
|
13
|
+
Warning = 1
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Collects diagnostics on problems which occur in the template which aren't directly sourced
|
|
17
|
+
* from type check blocks.
|
|
18
|
+
*
|
|
19
|
+
* During the creation of a type check block, the template is traversed and the
|
|
20
|
+
* `OutOfBandDiagnosticRecorder` is called to record cases when a correct interpretation for the
|
|
21
|
+
* template cannot be found. These operations create diagnostics which are stored by the
|
|
22
|
+
* recorder for later display.
|
|
23
|
+
*/
|
|
24
|
+
export interface OutOfBandDiagnosticRecorder<T> {
|
|
25
|
+
readonly diagnostics: ReadonlyArray<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Reports a `#ref="target"` expression in the template for which a target directive could not be
|
|
28
|
+
* found.
|
|
29
|
+
*
|
|
30
|
+
* @param id the type-checking ID of the template which contains the broken reference.
|
|
31
|
+
* @param ref the `TmplAstReference` which could not be matched to a directive.
|
|
32
|
+
*/
|
|
33
|
+
missingReferenceTarget(id: TypeCheckId, ref: TmplAstReference): void;
|
|
34
|
+
/**
|
|
35
|
+
* Reports usage of a `| pipe` expression in the template for which the named pipe could not be
|
|
36
|
+
* found.
|
|
37
|
+
*
|
|
38
|
+
* @param id the type-checking ID of the template which contains the unknown pipe.
|
|
39
|
+
* @param ast the `BindingPipe` invocation of the pipe which could not be found.
|
|
40
|
+
* @param isStandalone whether the host component is standalone.
|
|
41
|
+
*/
|
|
42
|
+
missingPipe(id: TypeCheckId, ast: BindingPipe, isStandalone: boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* Reports usage of a pipe imported via `@Component.deferredImports` outside
|
|
45
|
+
* of a `@defer` block in a template.
|
|
46
|
+
*
|
|
47
|
+
* @param id the type-checking ID of the template which contains the unknown pipe.
|
|
48
|
+
* @param ast the `BindingPipe` invocation of the pipe which could not be found.
|
|
49
|
+
*/
|
|
50
|
+
deferredPipeUsedEagerly(id: TypeCheckId, ast: BindingPipe): void;
|
|
51
|
+
/**
|
|
52
|
+
* Reports usage of a component/directive imported via `@Component.deferredImports` outside
|
|
53
|
+
* of a `@defer` block in a template.
|
|
54
|
+
*
|
|
55
|
+
* @param id the type-checking ID of the template which contains the unknown pipe.
|
|
56
|
+
* @param element the element which hosts a component that was defer-loaded.
|
|
57
|
+
*/
|
|
58
|
+
deferredComponentUsedEagerly(id: TypeCheckId, element: TmplAstElement): void;
|
|
59
|
+
/**
|
|
60
|
+
* Reports a duplicate declaration of a template variable.
|
|
61
|
+
*
|
|
62
|
+
* @param id the type-checking ID of the template which contains the duplicate
|
|
63
|
+
* declaration.
|
|
64
|
+
* @param variable the `TmplAstVariable` which duplicates a previously declared variable.
|
|
65
|
+
* @param firstDecl the first variable declaration which uses the same name as `variable`.
|
|
66
|
+
*/
|
|
67
|
+
duplicateTemplateVar(id: TypeCheckId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void;
|
|
68
|
+
/**
|
|
69
|
+
* Report a warning when structural directives support context guards, but the current
|
|
70
|
+
* type-checking configuration prohibits their usage.
|
|
71
|
+
*/
|
|
72
|
+
suboptimalTypeInference(id: TypeCheckId, variables: TmplAstVariable[]): void;
|
|
73
|
+
/**
|
|
74
|
+
* Reports a split two way binding error message.
|
|
75
|
+
*/
|
|
76
|
+
splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: Pick<TcbDirectiveMetadata, 'name' | 'isComponent' | 'ref'>, outputConsumer: Pick<TcbDirectiveMetadata, 'name' | 'isComponent' | 'ref'> | TmplAstElement): void;
|
|
77
|
+
/** Reports required inputs that haven't been bound. */
|
|
78
|
+
missingRequiredInputs(id: TypeCheckId, element: TmplAstElement | TmplAstTemplate | TmplAstComponent | TmplAstDirective, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
|
|
79
|
+
/**
|
|
80
|
+
* Reports accesses of properties that aren't available in a `for` block's tracking expression.
|
|
81
|
+
*/
|
|
82
|
+
illegalForLoopTrackAccess(id: TypeCheckId, block: TmplAstForLoopBlock, access: PropertyRead): void;
|
|
83
|
+
/**
|
|
84
|
+
* Reports deferred triggers that cannot access the element they're referring to.
|
|
85
|
+
*/
|
|
86
|
+
inaccessibleDeferredTriggerElement(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
|
|
87
|
+
/**
|
|
88
|
+
* Reports cases where control flow nodes prevent content projection.
|
|
89
|
+
*/
|
|
90
|
+
controlFlowPreventingContentProjection(id: TypeCheckId, category: OutOfBadDiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void;
|
|
91
|
+
/** Reports cases where users are writing to `@let` declarations. */
|
|
92
|
+
illegalWriteToLetDeclaration(id: TypeCheckId, node: AST, target: TmplAstLetDeclaration): void;
|
|
93
|
+
/** Reports cases where users are accessing an `@let` before it is defined.. */
|
|
94
|
+
letUsedBeforeDefinition(id: TypeCheckId, node: PropertyRead, target: TmplAstLetDeclaration): void;
|
|
95
|
+
/**
|
|
96
|
+
* Reports a `@let` declaration that conflicts with another symbol in the same scope.
|
|
97
|
+
*
|
|
98
|
+
* @param id the type-checking ID of the template which contains the declaration.
|
|
99
|
+
* @param current the `TmplAstLetDeclaration` which is invalid.
|
|
100
|
+
*/
|
|
101
|
+
conflictingDeclaration(id: TypeCheckId, current: TmplAstLetDeclaration): void;
|
|
102
|
+
/**
|
|
103
|
+
* Reports that a named template dependency (e.g. `<Missing/>`) is not available.
|
|
104
|
+
* @param id Type checking ID of the template in which the dependency is declared.
|
|
105
|
+
* @param node Node that declares the dependency.
|
|
106
|
+
*/
|
|
107
|
+
missingNamedTemplateDependency(id: TypeCheckId, node: TmplAstComponent | TmplAstDirective): void;
|
|
108
|
+
/**
|
|
109
|
+
* Reports that a templace dependency of the wrong kind has been referenced at a specific position
|
|
110
|
+
* (e.g. `<SomeDirective/>`).
|
|
111
|
+
* @param id Type checking ID of the template in which the dependency is declared.
|
|
112
|
+
* @param node Node that declares the dependency.
|
|
113
|
+
*/
|
|
114
|
+
incorrectTemplateDependencyType(id: TypeCheckId, node: TmplAstComponent | TmplAstDirective): void;
|
|
115
|
+
/**
|
|
116
|
+
* Reports a binding inside directive syntax that does not match any of the inputs/outputs of
|
|
117
|
+
* the directive.
|
|
118
|
+
* @param id Type checking ID of the template in which the directive was defined.
|
|
119
|
+
* @param directive Directive that contains the binding.
|
|
120
|
+
* @param node Node declaring the binding.
|
|
121
|
+
*/
|
|
122
|
+
unclaimedDirectiveBinding(id: TypeCheckId, directive: TmplAstDirective, node: TmplAstBoundAttribute | TmplAstTextAttribute | TmplAstBoundEvent): void;
|
|
123
|
+
/**
|
|
124
|
+
* Reports that an implicit deferred trigger is set on a block that does not have a placeholder.
|
|
125
|
+
*/
|
|
126
|
+
deferImplicitTriggerMissingPlaceholder(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
|
|
127
|
+
/**
|
|
128
|
+
* Reports that an implicit deferred trigger is set on a block whose placeholder is not set up
|
|
129
|
+
* correctly (e.g. more than one root node).
|
|
130
|
+
*/
|
|
131
|
+
deferImplicitTriggerInvalidPlaceholder(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
|
|
132
|
+
/**
|
|
133
|
+
* Reports an unsupported binding on a form `FormField` node.
|
|
134
|
+
*/
|
|
135
|
+
formFieldUnsupportedBinding(id: TypeCheckId, node: TmplAstBoundAttribute | TmplAstTextAttribute): void;
|
|
136
|
+
/**
|
|
137
|
+
* Reports that multiple components in the compilation scope match a given element.
|
|
138
|
+
*/
|
|
139
|
+
multipleMatchingComponents(id: TypeCheckId, element: TmplAstElement, componentNames: string[]): void;
|
|
140
|
+
}
|
|
@@ -12,9 +12,8 @@ import { Reference, ReferenceEmitter } from '../../imports';
|
|
|
12
12
|
import { PerfRecorder } from '../../perf';
|
|
13
13
|
import { FileUpdate } from '../../program_driver';
|
|
14
14
|
import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
15
|
-
import { HostBindingsContext, TemplateDiagnostic, TypeCheckId, SourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata, TemplateContext } from '../api';
|
|
15
|
+
import { HostBindingsContext, TemplateDiagnostic, TypeCheckId, SourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata, TemplateContext, OutOfBandDiagnosticRecorder } from '../api';
|
|
16
16
|
import { DomSchemaChecker } from './dom';
|
|
17
|
-
import { OutOfBandDiagnosticRecorder } from './oob';
|
|
18
17
|
import { DirectiveSourceManager } from './source';
|
|
19
18
|
import { TypeCheckFile } from './type_check_file';
|
|
20
19
|
export interface ShimTypeCheckingData {
|
|
@@ -82,7 +81,7 @@ export interface PendingShimData {
|
|
|
82
81
|
/**
|
|
83
82
|
* Recorder for out-of-band diagnostics which are raised during generation.
|
|
84
83
|
*/
|
|
85
|
-
oobRecorder: OutOfBandDiagnosticRecorder
|
|
84
|
+
oobRecorder: OutOfBandDiagnosticRecorder<TemplateDiagnostic>;
|
|
86
85
|
/**
|
|
87
86
|
* The `DomSchemaChecker` in use for this template, which records any schema-related diagnostics.
|
|
88
87
|
*/
|
|
@@ -95,6 +94,10 @@ export interface PendingShimData {
|
|
|
95
94
|
* Map of `TypeCheckId` to information collected about the template as it's ingested.
|
|
96
95
|
*/
|
|
97
96
|
data: Map<TypeCheckId, TypeCheckData>;
|
|
97
|
+
/**
|
|
98
|
+
* Diagnostics produced during shim creation.
|
|
99
|
+
*/
|
|
100
|
+
shimDiagnostics: TemplateDiagnostic[] | null;
|
|
98
101
|
}
|
|
99
102
|
/**
|
|
100
103
|
* Adapts the `TypeCheckContextImpl` to the larger template type-checking system.
|
|
@@ -5,20 +5,62 @@
|
|
|
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 { TmplAstHostElement } from '@angular/compiler';
|
|
8
|
+
import { ParseSourceSpan, TmplAstHostElement } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
|
-
|
|
10
|
+
/** Represents information extracted from the source AST. */
|
|
11
|
+
export type SourceNode = StaticSourceNode | {
|
|
12
|
+
kind: 'unspecified';
|
|
13
|
+
sourceSpan: ParseSourceSpan;
|
|
14
|
+
};
|
|
15
|
+
/** A `SourceNode` which represents a static expression. */
|
|
16
|
+
export interface StaticSourceNode {
|
|
17
|
+
kind: 'string' | 'identifier';
|
|
18
|
+
/** Raw source code of the node (e.g. strings include the quotes). */
|
|
19
|
+
source: string;
|
|
20
|
+
/** Actual text of the node (e.g. value inside the quotes in strings). */
|
|
21
|
+
text: string;
|
|
22
|
+
/** Location information about the node. */
|
|
23
|
+
sourceSpan: ParseSourceSpan;
|
|
24
|
+
}
|
|
25
|
+
/** A single binding inside the `host` object of a directive. */
|
|
26
|
+
export interface HostObjectLiteralBinding {
|
|
27
|
+
/** Node representing the key of the binding. */
|
|
28
|
+
key: SourceNode;
|
|
29
|
+
/** Node representing the value of the binding. */
|
|
30
|
+
value: SourceNode;
|
|
31
|
+
/** Location information about the entire binding. */
|
|
32
|
+
sourceSpan: ParseSourceSpan;
|
|
33
|
+
}
|
|
34
|
+
/** A single binding declared by a `@HostListener` decorator on a class member. */
|
|
35
|
+
export interface HostListenerDecorator {
|
|
36
|
+
/** Node declaring the name of the event (e.g. first argument of `@HostListener`). */
|
|
37
|
+
eventName: SourceNode | null;
|
|
38
|
+
/** Node representing the name of the member that was decorated. */
|
|
39
|
+
memberName: StaticSourceNode;
|
|
40
|
+
/** Location information about the member that the decorator is set on. */
|
|
41
|
+
memberSpan: ParseSourceSpan;
|
|
42
|
+
/** Arguments passed to the event. */
|
|
43
|
+
arguments: SourceNode[];
|
|
44
|
+
/** Location information about the decorator. */
|
|
45
|
+
decoratorSpan: ParseSourceSpan;
|
|
46
|
+
}
|
|
47
|
+
/** A single binding declared by the `@HostBinding` decorator on a class member. */
|
|
48
|
+
export interface HostBindingDecorator {
|
|
49
|
+
/** Node representing the name of the member that was decorated. */
|
|
50
|
+
memberName: StaticSourceNode;
|
|
51
|
+
/** Location information about the member that the decorator is set on. */
|
|
52
|
+
memberSpan: ParseSourceSpan;
|
|
53
|
+
/** Arguments passed into the decorator */
|
|
54
|
+
arguments: SourceNode[];
|
|
55
|
+
/** Location information about the decorator. */
|
|
56
|
+
decoratorSpan: ParseSourceSpan;
|
|
57
|
+
}
|
|
11
58
|
/**
|
|
12
59
|
* Creates an AST node that represents the host element of a directive.
|
|
13
60
|
* Can return null if there are no valid bindings to be checked.
|
|
14
|
-
* @param
|
|
15
|
-
* @param selector Selector of the directive.
|
|
16
|
-
* @param sourceNode Class declaration for the directive.
|
|
17
|
-
* @param literal `host` object literal from the decorator.
|
|
18
|
-
* @param bindingDecorators `HostBinding` decorators discovered on the node.
|
|
19
|
-
* @param listenerDecorators `HostListener` decorators discovered on the node.
|
|
61
|
+
* @param meta Metadata used to construct the host element.
|
|
20
62
|
*/
|
|
21
|
-
export declare function createHostElement(type: 'component' | 'directive', selector: string | null,
|
|
63
|
+
export declare function createHostElement(type: 'component' | 'directive', selector: string | null, nameSpan: ParseSourceSpan, hostObjectLiteralBindings: HostObjectLiteralBinding[], hostBindingDecorators: HostBindingDecorator[], hostListenerDecorators: HostListenerDecorator[]): TmplAstHostElement | null;
|
|
22
64
|
/**
|
|
23
65
|
* Creates an AST node that can be used as a guard in `if` statements to distinguish TypeScript
|
|
24
66
|
* nodes used for checking host bindings from ones used for checking templates.
|