@angular/compiler-cli 17.1.0-rc.0 → 17.1.0
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-OQ7ITPZT.js → chunk-3WRR7A6G.js} +69 -42
- package/bundles/chunk-3WRR7A6G.js.map +6 -0
- package/bundles/{chunk-FIHKBAQF.js → chunk-5KZ4IU2X.js} +5 -5
- package/bundles/{chunk-SBDNBITT.js → chunk-CF2CT7RQ.js} +3 -3
- package/bundles/{chunk-YS2EFQ7B.js → chunk-GM44CTB7.js} +405 -220
- package/bundles/chunk-GM44CTB7.js.map +6 -0
- package/bundles/{chunk-QPMYDNZG.js → chunk-I3M5LXMW.js} +7 -7
- package/bundles/{chunk-R4KQI5XI.js → chunk-JOIB3454.js} +5 -5
- package/bundles/{chunk-AJU3W7PS.js → chunk-MLI2QFE3.js} +6 -6
- package/bundles/{chunk-R5FBSX7J.js → chunk-P34DHQ65.js} +32 -30
- package/bundles/{chunk-R5FBSX7J.js.map → chunk-P34DHQ65.js.map} +1 -1
- package/bundles/{chunk-Q5Y7HH3O.js → chunk-TGR3NXO6.js} +5 -5
- package/bundles/{chunk-WCD6LVCP.js → chunk-WMUBJYYX.js} +7 -7
- package/bundles/{chunk-75SXFAVW.js → chunk-YFIBJR5K.js} +184 -132
- package/bundles/chunk-YFIBJR5K.js.map +6 -0
- package/bundles/index.js +12 -12
- package/bundles/linker/babel/index.js +12 -12
- package/bundles/linker/index.js +4 -4
- package/bundles/ngcc/index.js +1 -1
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +5 -5
- package/bundles/private/tooling.js +5 -5
- 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 +2 -2
- package/src/ngtsc/annotations/component/src/handler.d.ts +21 -1
- package/src/ngtsc/annotations/component/src/metadata.d.ts +7 -1
- package/src/ngtsc/annotations/component/src/util.d.ts +1 -1
- package/src/ngtsc/annotations/directive/src/handler.d.ts +1 -1
- package/src/ngtsc/annotations/src/injectable.d.ts +1 -1
- package/src/ngtsc/core/api/src/public_options.d.ts +10 -0
- package/src/ngtsc/diagnostics/src/error_code.d.ts +20 -0
- package/src/ngtsc/imports/src/deferred_symbol_tracker.d.ts +16 -2
- package/src/ngtsc/metadata/src/api.d.ts +11 -0
- package/src/ngtsc/scope/src/api.d.ts +1 -0
- package/src/ngtsc/scope/src/typecheck.d.ts +3 -3
- package/src/ngtsc/scope/src/util.d.ts +1 -0
- package/src/ngtsc/transform/src/api.d.ts +1 -1
- package/src/ngtsc/typecheck/api/api.d.ts +3 -2
- package/src/ngtsc/typecheck/api/context.d.ts +2 -1
- package/src/ngtsc/typecheck/src/context.d.ts +2 -1
- package/src/ngtsc/typecheck/src/oob.d.ts +20 -0
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +3 -2
- package/bundles/chunk-75SXFAVW.js.map +0 -6
- package/bundles/chunk-OQ7ITPZT.js.map +0 -6
- package/bundles/chunk-YS2EFQ7B.js.map +0 -6
- /package/bundles/{chunk-FIHKBAQF.js.map → chunk-5KZ4IU2X.js.map} +0 -0
- /package/bundles/{chunk-SBDNBITT.js.map → chunk-CF2CT7RQ.js.map} +0 -0
- /package/bundles/{chunk-QPMYDNZG.js.map → chunk-I3M5LXMW.js.map} +0 -0
- /package/bundles/{chunk-R4KQI5XI.js.map → chunk-JOIB3454.js.map} +0 -0
- /package/bundles/{chunk-AJU3W7PS.js.map → chunk-MLI2QFE3.js.map} +0 -0
- /package/bundles/{chunk-Q5Y7HH3O.js.map → chunk-TGR3NXO6.js.map} +0 -0
- /package/bundles/{chunk-WCD6LVCP.js.map → chunk-WMUBJYYX.js.map} +0 -0
|
@@ -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 = "17.1.0
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "17.1.0";
|
|
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": "17.1.0
|
|
3
|
+
"version": "17.1.0",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"yargs": "^17.2.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@angular/compiler": "17.1.0
|
|
56
|
+
"@angular/compiler": "17.1.0",
|
|
57
57
|
"typescript": ">=5.2 <5.4"
|
|
58
58
|
},
|
|
59
59
|
"repository": {
|
|
@@ -88,7 +88,21 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
|
|
|
88
88
|
updateResources(node: ClassDeclaration, analysis: ComponentAnalysisData): void;
|
|
89
89
|
compileFull(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, resolution: Readonly<ComponentResolutionData>, pool: ConstantPool): CompileResult[];
|
|
90
90
|
compilePartial(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, resolution: Readonly<ComponentResolutionData>): CompileResult[];
|
|
91
|
-
compileLocal(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, pool: ConstantPool): CompileResult[];
|
|
91
|
+
compileLocal(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, resolution: Readonly<Partial<ComponentResolutionData>>, pool: ConstantPool): CompileResult[];
|
|
92
|
+
/**
|
|
93
|
+
* Locates defer blocks in case scope information is not available.
|
|
94
|
+
* For example, this happens in the local compilation mode.
|
|
95
|
+
*/
|
|
96
|
+
private locateDeferBlocksWithoutScope;
|
|
97
|
+
/**
|
|
98
|
+
* Computes a list of deferrable symbols based on dependencies from
|
|
99
|
+
* the `@Component.imports` field and their usage in `@defer` blocks.
|
|
100
|
+
*/
|
|
101
|
+
private collectDeferredSymbols;
|
|
102
|
+
/**
|
|
103
|
+
* Collects deferrable symbols from the `@Component.deferredImports` field.
|
|
104
|
+
*/
|
|
105
|
+
private collectExplicitlyDeferredSymbols;
|
|
92
106
|
/**
|
|
93
107
|
* Check whether adding an import from `origin` to the source-file corresponding to `expr` would
|
|
94
108
|
* create a cyclic import.
|
|
@@ -102,6 +116,12 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
|
|
|
102
116
|
* available for the final `compile` step.
|
|
103
117
|
*/
|
|
104
118
|
private resolveDeferBlocks;
|
|
119
|
+
/**
|
|
120
|
+
* Inspects provided imports expression (either `@Component.imports` or
|
|
121
|
+
* `@Component.deferredImports`) and registers imported types as deferrable
|
|
122
|
+
* candidates.
|
|
123
|
+
*/
|
|
124
|
+
private registerDeferrableCandidates;
|
|
105
125
|
/** Resolves the triggers of the defer block to the elements that they're pointing to. */
|
|
106
126
|
private resolveDeferTriggers;
|
|
107
127
|
}
|
|
@@ -18,7 +18,7 @@ import { ParsedTemplateWithSource, StyleUrlMeta } from './resources';
|
|
|
18
18
|
* The `keyof R3ComponentMetadata &` condition ensures that only fields of `R3ComponentMetadata` can
|
|
19
19
|
* be included here.
|
|
20
20
|
*/
|
|
21
|
-
export type ComponentMetadataResolvedFields = SubsetOfKeys<R3ComponentMetadata<R3TemplateDependencyMetadata>, 'declarations' | 'declarationListEmitMode' | 'deferBlocks' | 'deferrableDeclToImportDecl'>;
|
|
21
|
+
export type ComponentMetadataResolvedFields = SubsetOfKeys<R3ComponentMetadata<R3TemplateDependencyMetadata>, 'declarations' | 'declarationListEmitMode' | 'deferBlocks' | 'deferrableDeclToImportDecl' | 'deferrableTypes' | 'deferBlockDepsEmitMode'>;
|
|
22
22
|
export interface ComponentAnalysisData {
|
|
23
23
|
/**
|
|
24
24
|
* `meta` includes those fields of `R3ComponentMetadata` which are calculated at `analyze` time
|
|
@@ -55,6 +55,12 @@ export interface ComponentAnalysisData {
|
|
|
55
55
|
animationTriggerNames: AnimationTriggerNames | null;
|
|
56
56
|
rawImports: ts.Expression | null;
|
|
57
57
|
resolvedImports: Reference<ClassDeclaration>[] | null;
|
|
58
|
+
rawDeferredImports: ts.Expression | null;
|
|
59
|
+
resolvedDeferredImports: Reference<ClassDeclaration>[] | null;
|
|
60
|
+
/**
|
|
61
|
+
* Map of symbol name -> import path for types from `@Component.deferredImports` field.
|
|
62
|
+
*/
|
|
63
|
+
explicitlyDeferredTypes: Map<string, string> | null;
|
|
58
64
|
schemas: SchemaMetadata[] | null;
|
|
59
65
|
decorator: ts.Decorator | null;
|
|
60
66
|
/** Additional directives applied to the component host. */
|
|
@@ -19,7 +19,7 @@ import { ClassDeclaration } from '../../../reflection';
|
|
|
19
19
|
export declare function collectAnimationNames(value: ResolvedValue, animationTriggerNames: AnimationTriggerNames): void;
|
|
20
20
|
export declare function isAngularAnimationsReference(reference: Reference, symbolName: string): boolean;
|
|
21
21
|
export declare const animationTriggerResolver: ForeignFunctionResolver;
|
|
22
|
-
export declare function validateAndFlattenComponentImports(imports: ResolvedValue, expr: ts.Expression): {
|
|
22
|
+
export declare function validateAndFlattenComponentImports(imports: ResolvedValue, expr: ts.Expression, isDeferred: boolean): {
|
|
23
23
|
imports: Reference<ClassDeclaration>[];
|
|
24
24
|
diagnostics: ts.Diagnostic[];
|
|
25
25
|
};
|
|
@@ -57,7 +57,7 @@ export declare class DirectiveDecoratorHandler implements DecoratorHandler<Decor
|
|
|
57
57
|
resolve(node: ClassDeclaration, analysis: DirectiveHandlerData, symbol: DirectiveSymbol): ResolveResult<unknown>;
|
|
58
58
|
compileFull(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, resolution: Readonly<unknown>, pool: ConstantPool): CompileResult[];
|
|
59
59
|
compilePartial(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, resolution: Readonly<unknown>): CompileResult[];
|
|
60
|
-
compileLocal(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, pool: ConstantPool): CompileResult[];
|
|
60
|
+
compileLocal(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, resolution: Readonly<unknown>, pool: ConstantPool): CompileResult[];
|
|
61
61
|
/**
|
|
62
62
|
* Checks if a given class uses Angular features and returns the TypeScript node
|
|
63
63
|
* that indicated the usage. Classes are considered using Angular features if they
|
|
@@ -50,7 +50,7 @@ export declare class InjectableDecoratorHandler implements DecoratorHandler<Deco
|
|
|
50
50
|
analyze(node: ClassDeclaration, decorator: Readonly<Decorator>): AnalysisOutput<InjectableHandlerData>;
|
|
51
51
|
symbol(): null;
|
|
52
52
|
register(node: ClassDeclaration, analysis: InjectableHandlerData): void;
|
|
53
|
-
resolve(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData
|
|
53
|
+
resolve(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>): ResolveResult<unknown>;
|
|
54
54
|
compileFull(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>): CompileResult[];
|
|
55
55
|
compilePartial(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>): CompileResult[];
|
|
56
56
|
compileLocal(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>): CompileResult[];
|
|
@@ -292,6 +292,16 @@ export interface BazelAndG3Options {
|
|
|
292
292
|
* Insert JSDoc type annotations needed by Closure Compiler
|
|
293
293
|
*/
|
|
294
294
|
annotateForClosureCompiler?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Specifies whether Angular compiler should rely on explicit imports
|
|
297
|
+
* via `@Component.deferredImports` field for `@defer` blocks and generate
|
|
298
|
+
* dynamic imports only for types from that list.
|
|
299
|
+
*
|
|
300
|
+
* This flag is needed to enable stricter behavior internally to make sure
|
|
301
|
+
* that local compilation with specific internal configuration can support
|
|
302
|
+
* `@defer` blocks.
|
|
303
|
+
*/
|
|
304
|
+
onlyExplicitDeferDependencyImports?: boolean;
|
|
295
305
|
}
|
|
296
306
|
/**
|
|
297
307
|
* Options related to i18n compilation support.
|
|
@@ -100,6 +100,11 @@ export declare enum ErrorCode {
|
|
|
100
100
|
CONFLICTING_INPUT_TRANSFORM = 2020,
|
|
101
101
|
/** Raised when a component has both `styleUrls` and `styleUrl`. */
|
|
102
102
|
COMPONENT_INVALID_STYLE_URLS = 2021,
|
|
103
|
+
/**
|
|
104
|
+
* Raised when a type in the `deferredImports` of a component is not a component, directive or
|
|
105
|
+
* pipe.
|
|
106
|
+
*/
|
|
107
|
+
COMPONENT_UNKNOWN_DEFERRED_IMPORT = 2022,
|
|
103
108
|
SYMBOL_NOT_EXPORTED = 3001,
|
|
104
109
|
/**
|
|
105
110
|
* Raised when a relationship between directives and/or pipes would cause a cyclic import to be
|
|
@@ -258,6 +263,21 @@ export declare enum ErrorCode {
|
|
|
258
263
|
* ```
|
|
259
264
|
*/
|
|
260
265
|
CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION = 8011,
|
|
266
|
+
/**
|
|
267
|
+
* A pipe imported via `@Component.deferredImports` is
|
|
268
|
+
* used outside of a `@defer` block in a template.
|
|
269
|
+
*/
|
|
270
|
+
DEFERRED_PIPE_USED_EAGERLY = 8012,
|
|
271
|
+
/**
|
|
272
|
+
* A directive/component imported via `@Component.deferredImports` is
|
|
273
|
+
* used outside of a `@defer` block in a template.
|
|
274
|
+
*/
|
|
275
|
+
DEFERRED_DIRECTIVE_USED_EAGERLY = 8013,
|
|
276
|
+
/**
|
|
277
|
+
* A directive/component/pipe imported via `@Component.deferredImports` is
|
|
278
|
+
* also included into the `@Component.imports` list.
|
|
279
|
+
*/
|
|
280
|
+
DEFERRED_DEPENDENCY_IMPORTED_EAGERLY = 8014,
|
|
261
281
|
/**
|
|
262
282
|
* A two way binding in a template has an incorrect syntax,
|
|
263
283
|
* parentheses outside brackets. For example:
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
|
+
import { ClassDeclaration } from '../../reflection';
|
|
9
10
|
/**
|
|
10
11
|
* Allows to register a symbol as deferrable and keep track of its usage.
|
|
11
12
|
*
|
|
@@ -15,8 +16,14 @@ import ts from 'typescript';
|
|
|
15
16
|
*/
|
|
16
17
|
export declare class DeferredSymbolTracker {
|
|
17
18
|
private readonly typeChecker;
|
|
19
|
+
private onlyExplicitDeferDependencyImports;
|
|
18
20
|
private readonly imports;
|
|
19
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Map of a component class -> all import declarations that bring symbols
|
|
23
|
+
* used within `@Component.deferredImports` field.
|
|
24
|
+
*/
|
|
25
|
+
private readonly explicitlyDeferredImports;
|
|
26
|
+
constructor(typeChecker: ts.TypeChecker, onlyExplicitDeferDependencyImports: boolean);
|
|
20
27
|
/**
|
|
21
28
|
* Given an import declaration node, extract the names of all imported symbols
|
|
22
29
|
* and return them as a map where each symbol is a key and `AssumeEager` is a value.
|
|
@@ -28,11 +35,18 @@ export declare class DeferredSymbolTracker {
|
|
|
28
35
|
* Case 3: `import * as x from 'a'`
|
|
29
36
|
*/
|
|
30
37
|
private extractImportedSymbols;
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves a list of import declarations that contain symbols used within
|
|
40
|
+
* `@Component.deferredImports` of a specific component class, but those imports
|
|
41
|
+
* can not be removed, since there are other symbols imported alongside deferred
|
|
42
|
+
* components.
|
|
43
|
+
*/
|
|
44
|
+
getNonRemovableDeferredImports(sourceFile: ts.SourceFile, classDecl: ClassDeclaration): ts.ImportDeclaration[];
|
|
31
45
|
/**
|
|
32
46
|
* Marks a given identifier and an associated import declaration as a candidate
|
|
33
47
|
* for defer loading.
|
|
34
48
|
*/
|
|
35
|
-
markAsDeferrableCandidate(identifier: ts.Identifier, importDecl: ts.ImportDeclaration): void;
|
|
49
|
+
markAsDeferrableCandidate(identifier: ts.Identifier, importDecl: ts.ImportDeclaration, componentClassDecl: ClassDeclaration, isExplicitlyDeferred: boolean): void;
|
|
36
50
|
/**
|
|
37
51
|
* Whether all symbols from a given import declaration have no references
|
|
38
52
|
* in a source file, thus it's safe to use dynamic imports.
|
|
@@ -192,6 +192,11 @@ export interface DirectiveMeta extends T2DirectiveMeta, DirectiveTypeCheckMeta {
|
|
|
192
192
|
* For standalone components, the list of imported types.
|
|
193
193
|
*/
|
|
194
194
|
imports: Reference<ClassDeclaration>[] | null;
|
|
195
|
+
/**
|
|
196
|
+
* For standalone components, the list of imported types that can be used
|
|
197
|
+
* in `@defer` blocks (when only explicit dependencies are allowed).
|
|
198
|
+
*/
|
|
199
|
+
deferredImports: Reference<ClassDeclaration>[] | null;
|
|
195
200
|
/**
|
|
196
201
|
* For standalone components, the list of schemas declared.
|
|
197
202
|
*/
|
|
@@ -208,6 +213,11 @@ export interface DirectiveMeta extends T2DirectiveMeta, DirectiveTypeCheckMeta {
|
|
|
208
213
|
* Whether the directive should be assumed to export providers if imported as a standalone type.
|
|
209
214
|
*/
|
|
210
215
|
assumedToExportProviders: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Whether this class was imported into a standalone component's
|
|
218
|
+
* scope via `@Component.deferredImports` field.
|
|
219
|
+
*/
|
|
220
|
+
isExplicitlyDeferred: boolean;
|
|
211
221
|
}
|
|
212
222
|
/** Metadata collected about an additional directive that is being applied to a directive host. */
|
|
213
223
|
export interface HostDirectiveMeta {
|
|
@@ -251,6 +261,7 @@ export interface PipeMeta {
|
|
|
251
261
|
nameExpr: ts.Expression | null;
|
|
252
262
|
isStandalone: boolean;
|
|
253
263
|
decorator: ts.Decorator | null;
|
|
264
|
+
isExplicitlyDeferred: boolean;
|
|
254
265
|
}
|
|
255
266
|
/**
|
|
256
267
|
* Reads metadata for directives, pipes, and modules from a particular source, such as .d.ts files
|
|
@@ -58,6 +58,7 @@ export interface LocalModuleScope extends ExportScope {
|
|
|
58
58
|
export interface StandaloneScope {
|
|
59
59
|
kind: ComponentScopeKind.Standalone;
|
|
60
60
|
dependencies: Array<DirectiveMeta | PipeMeta | NgModuleMeta>;
|
|
61
|
+
deferredDependencies: Array<DirectiveMeta | PipeMeta>;
|
|
61
62
|
component: ClassDeclaration;
|
|
62
63
|
schemas: SchemaMetadata[];
|
|
63
64
|
isPoisoned: boolean;
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { SchemaMetadata, SelectorMatcher } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { Reference } from '../../imports';
|
|
11
|
-
import { DirectiveMeta, HostDirectivesResolver, MetadataReader } from '../../metadata';
|
|
10
|
+
import { DirectiveMeta, HostDirectivesResolver, MetadataReader, PipeMeta } from '../../metadata';
|
|
12
11
|
import { ClassDeclaration } from '../../reflection';
|
|
13
12
|
import { ComponentScopeReader } from './api';
|
|
14
13
|
/**
|
|
@@ -27,7 +26,7 @@ export interface TypeCheckScope {
|
|
|
27
26
|
/**
|
|
28
27
|
* The pipes that are available in the compilation scope.
|
|
29
28
|
*/
|
|
30
|
-
pipes: Map<string,
|
|
29
|
+
pipes: Map<string, PipeMeta>;
|
|
31
30
|
/**
|
|
32
31
|
* The schemas that are used in this scope.
|
|
33
32
|
*/
|
|
@@ -62,4 +61,5 @@ export declare class TypeCheckScopeRegistry {
|
|
|
62
61
|
*/
|
|
63
62
|
getTypeCheckScope(node: ClassDeclaration): TypeCheckScope;
|
|
64
63
|
getTypeCheckDirectiveMetadata(ref: Reference<ClassDeclaration>): DirectiveMeta | null;
|
|
64
|
+
private applyExplicitlyDeferredFlag;
|
|
65
65
|
}
|
|
@@ -12,3 +12,4 @@ import { ComponentScopeReader } from './api';
|
|
|
12
12
|
export declare function getDiagnosticNode(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression | null): ts.Expression;
|
|
13
13
|
export declare function makeNotStandaloneDiagnostic(scopeReader: ComponentScopeReader, ref: Reference<ClassDeclaration>, rawExpr: ts.Expression | null, kind: 'component' | 'directive' | 'pipe'): ts.Diagnostic;
|
|
14
14
|
export declare function makeUnknownComponentImportDiagnostic(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression): ts.DiagnosticWithLocation;
|
|
15
|
+
export declare function makeUnknownComponentDeferredImportDiagnostic(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression): ts.DiagnosticWithLocation;
|
|
@@ -167,7 +167,7 @@ export interface DecoratorHandler<D, A, S extends SemanticSymbol | null, R> {
|
|
|
167
167
|
* Generates code based on each individual source file without using its
|
|
168
168
|
* dependencies (suitable for local dev edit/refresh workflow)
|
|
169
169
|
*/
|
|
170
|
-
compileLocal(node: ClassDeclaration, analysis: Readonly<A>, constantPool: ConstantPool): CompileResult | CompileResult[];
|
|
170
|
+
compileLocal(node: ClassDeclaration, analysis: Readonly<A>, resolution: Readonly<Partial<R>>, constantPool: ConstantPool): CompileResult | CompileResult[];
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* The output of detecting a trait for a declaration as the result of the first phase of the
|
|
@@ -9,7 +9,7 @@ import { AbsoluteSourceSpan, BoundTarget, DirectiveMeta, ParseSourceSpan, Schema
|
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ErrorCode } from '../../diagnostics';
|
|
11
11
|
import { Reference } from '../../imports';
|
|
12
|
-
import { ClassPropertyMapping, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping } from '../../metadata';
|
|
12
|
+
import { ClassPropertyMapping, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping, PipeMeta } from '../../metadata';
|
|
13
13
|
import { ClassDeclaration } from '../../reflection';
|
|
14
14
|
/**
|
|
15
15
|
* Extension of `DirectiveMeta` that includes additional information required to type-check the
|
|
@@ -24,6 +24,7 @@ export interface TypeCheckableDirectiveMeta extends DirectiveMeta, DirectiveType
|
|
|
24
24
|
isSignal: boolean;
|
|
25
25
|
hostDirectives: HostDirectiveMeta[] | null;
|
|
26
26
|
decorator: ts.Decorator | null;
|
|
27
|
+
isExplicitlyDeferred: boolean;
|
|
27
28
|
}
|
|
28
29
|
export type TemplateId = string & {
|
|
29
30
|
__brand: 'TemplateId';
|
|
@@ -63,7 +64,7 @@ export interface TypeCheckBlockMetadata {
|
|
|
63
64
|
* Semantic information about the template of the component.
|
|
64
65
|
*/
|
|
65
66
|
boundTarget: BoundTarget<TypeCheckableDirectiveMeta>;
|
|
66
|
-
pipes: Map<string,
|
|
67
|
+
pipes: Map<string, PipeMeta>;
|
|
67
68
|
/**
|
|
68
69
|
* Schemas that apply to this template.
|
|
69
70
|
*/
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { ParseError, ParseSourceFile, R3TargetBinder, SchemaMetadata, TmplAstNode } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
|
+
import { PipeMeta } from '../../metadata';
|
|
11
12
|
import { ClassDeclaration } from '../../reflection';
|
|
12
13
|
import { TemplateSourceMapping, TypeCheckableDirectiveMeta } from './api';
|
|
13
14
|
/**
|
|
@@ -36,7 +37,7 @@ export interface TypeCheckContext {
|
|
|
36
37
|
* @param preserveWhitespaces a boolean indicating whether the component's template preserves
|
|
37
38
|
* whitespaces.
|
|
38
39
|
*/
|
|
39
|
-
addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string,
|
|
40
|
+
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;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* Interface to trigger generation of type-checking code for a program given a new
|
|
@@ -9,6 +9,7 @@ import { BoundTarget, ParseError, ParseSourceFile, R3TargetBinder, SchemaMetadat
|
|
|
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';
|
|
12
13
|
import { PerfRecorder } from '../../perf';
|
|
13
14
|
import { FileUpdate } from '../../program_driver';
|
|
14
15
|
import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
@@ -166,7 +167,7 @@ export declare class TypeCheckContextImpl implements TypeCheckContext {
|
|
|
166
167
|
*
|
|
167
168
|
* Implements `TypeCheckContext.addTemplate`.
|
|
168
169
|
*/
|
|
169
|
-
addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string,
|
|
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;
|
|
170
171
|
/**
|
|
171
172
|
* Record a type constructor for the given `node` with the given `ctorMetadata`.
|
|
172
173
|
*/
|
|
@@ -39,6 +39,24 @@ export interface OutOfBandDiagnosticRecorder {
|
|
|
39
39
|
* @param ast the `BindingPipe` invocation of the pipe which could not be found.
|
|
40
40
|
*/
|
|
41
41
|
missingPipe(templateId: TemplateId, ast: BindingPipe): void;
|
|
42
|
+
/**
|
|
43
|
+
* Reports usage of a pipe imported via `@Component.deferredImports` outside
|
|
44
|
+
* of a `@defer` block in a template.
|
|
45
|
+
*
|
|
46
|
+
* @param templateId the template type-checking ID of the template which contains the unknown
|
|
47
|
+
* pipe.
|
|
48
|
+
* @param ast the `BindingPipe` invocation of the pipe which could not be found.
|
|
49
|
+
*/
|
|
50
|
+
deferredPipeUsedEagerly(templateId: TemplateId, 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 templateId the template type-checking ID of the template which contains the unknown
|
|
56
|
+
* pipe.
|
|
57
|
+
* @param element the element which hosts a component that was defer-loaded.
|
|
58
|
+
*/
|
|
59
|
+
deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void;
|
|
42
60
|
illegalAssignmentToTemplateVar(templateId: TemplateId, assignment: PropertyWrite, target: TmplAstVariable): void;
|
|
43
61
|
/**
|
|
44
62
|
* Reports a duplicate declaration of a template variable.
|
|
@@ -87,6 +105,8 @@ export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnos
|
|
|
87
105
|
get diagnostics(): ReadonlyArray<TemplateDiagnostic>;
|
|
88
106
|
missingReferenceTarget(templateId: TemplateId, ref: TmplAstReference): void;
|
|
89
107
|
missingPipe(templateId: TemplateId, ast: BindingPipe): void;
|
|
108
|
+
deferredPipeUsedEagerly(templateId: TemplateId, ast: BindingPipe): void;
|
|
109
|
+
deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void;
|
|
90
110
|
illegalAssignmentToTemplateVar(templateId: TemplateId, assignment: PropertyWrite, target: TmplAstVariable): void;
|
|
91
111
|
duplicateTemplateVar(templateId: TemplateId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void;
|
|
92
112
|
requiresInlineTcb(templateId: TemplateId, node: ClassDeclaration): void;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { BoundTarget, SchemaMetadata, TmplAstElement, TmplAstForLoopBlock, TmplAstIfBlockBranch, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
|
+
import { PipeMeta } from '../../metadata';
|
|
11
12
|
import { ClassDeclaration } from '../../reflection';
|
|
12
13
|
import { TemplateId, TypeCheckableDirectiveMeta, TypeCheckBlockMetadata } from '../api';
|
|
13
14
|
import { DomSchemaChecker } from './dom';
|
|
@@ -131,7 +132,7 @@ export declare class Context {
|
|
|
131
132
|
readonly hostIsStandalone: boolean;
|
|
132
133
|
readonly hostPreserveWhitespaces: boolean;
|
|
133
134
|
private nextId;
|
|
134
|
-
constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string,
|
|
135
|
+
constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, PipeMeta>, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean);
|
|
135
136
|
/**
|
|
136
137
|
* Allocate a new variable name for use within the `Context`.
|
|
137
138
|
*
|
|
@@ -139,7 +140,7 @@ export declare class Context {
|
|
|
139
140
|
* might change depending on the type of data being stored.
|
|
140
141
|
*/
|
|
141
142
|
allocateId(): ts.Identifier;
|
|
142
|
-
getPipeByName(name: string):
|
|
143
|
+
getPipeByName(name: string): PipeMeta | null;
|
|
143
144
|
}
|
|
144
145
|
/**
|
|
145
146
|
* Local scope within the type check block for a particular template.
|