@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
|
@@ -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 = "20.0.0-next.
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "20.0.0-next.2";
|
|
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,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "20.0.0-next.
|
|
3
|
+
"version": "20.0.0-next.2",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
7
|
-
"ngcc": "./bundles/ngcc/index.js",
|
|
8
7
|
"ngc": "./bundles/src/bin/ngc.js",
|
|
9
8
|
"ng-xi18n": "./bundles/src/bin/ng_xi18n.js"
|
|
10
9
|
},
|
|
@@ -53,8 +52,8 @@
|
|
|
53
52
|
"yargs": "^17.2.1"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
|
-
"@angular/compiler": "20.0.0-next.
|
|
57
|
-
"typescript": ">=5.
|
|
55
|
+
"@angular/compiler": "20.0.0-next.2",
|
|
56
|
+
"typescript": ">=5.8 <5.9"
|
|
58
57
|
},
|
|
59
58
|
"repository": {
|
|
60
59
|
"type": "git",
|
package/private/migrations.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @fileoverview The API from compiler-cli that the `@angular/core`
|
|
10
10
|
* package requires for migration schematics.
|
|
11
11
|
*/
|
|
12
|
-
export {
|
|
12
|
+
export { createForwardRefResolver } from '../src/ngtsc/annotations';
|
|
13
13
|
export { AbsoluteFsPath } from '../src/ngtsc/file_system';
|
|
14
14
|
export { Reference } from '../src/ngtsc/imports';
|
|
15
15
|
export { DynamicValue, PartialEvaluator, ResolvedValue, ResolvedValueMap, StaticInterpreter, } from '../src/ngtsc/partial_evaluator';
|
|
@@ -9,7 +9,7 @@ import ts from 'typescript';
|
|
|
9
9
|
import { Reference } from '../../../imports';
|
|
10
10
|
import { PartialEvaluator, ResolvedValue } from '../../../partial_evaluator';
|
|
11
11
|
import { ClassDeclaration, Decorator } from '../../../reflection';
|
|
12
|
-
export declare function resolveEnumValue(evaluator: PartialEvaluator, metadata: Map<string, ts.Expression>, field: string, enumSymbolName: string): number | null;
|
|
12
|
+
export declare function resolveEnumValue(evaluator: PartialEvaluator, metadata: Map<string, ts.Expression>, field: string, enumSymbolName: string, isCore: boolean): number | null;
|
|
13
13
|
/**
|
|
14
14
|
* Resolves a EncapsulationEnum expression locally on best effort without having to calculate the
|
|
15
15
|
* reference. This suites local compilation mode where each file is compiled individually.
|
|
@@ -26,7 +26,24 @@ export declare function toR3Reference(origin: ts.Node, ref: Reference, context:
|
|
|
26
26
|
export declare function isAngularCore(decorator: Decorator): decorator is Decorator & {
|
|
27
27
|
import: Import;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* This function is used for verifying that a given reference is declared
|
|
31
|
+
* inside `@angular/core` and corresponds to the given symbol name.
|
|
32
|
+
*
|
|
33
|
+
* In some cases, due to the compiler face duplicating many symbols as
|
|
34
|
+
* an independent bridge between core and the compiler, the dts bundler may
|
|
35
|
+
* decide to alias declarations in the `.d.ts`, to avoid conflicts.
|
|
36
|
+
*
|
|
37
|
+
* e.g.
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
40
|
+
* declare enum ViewEncapsulation {} // from the facade
|
|
41
|
+
* declare enum ViewEncapsulation$1 {} // the real one exported to users.
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* This function accounts for such potential re-namings.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isAngularCoreReferenceWithPotentialAliasing(reference: Reference, symbolName: string, isCore: boolean): boolean;
|
|
30
47
|
export declare function findAngularDecorator(decorators: Decorator[], name: string, isCore: boolean): Decorator | undefined;
|
|
31
48
|
export declare function isAngularDecorator(decorator: Decorator, name: string, isCore: boolean): boolean;
|
|
32
49
|
export declare function getAngularDecorators(decorators: Decorator[], names: readonly string[], isCore: boolean): Decorator[];
|
|
@@ -55,7 +72,7 @@ export declare function tryUnwrapForwardRef(node: ts.Expression, reflector: Refl
|
|
|
55
72
|
* @param args the arguments to the invocation of the forwardRef expression
|
|
56
73
|
* @returns an unwrapped argument if `ref` pointed to forwardRef, or null otherwise
|
|
57
74
|
*/
|
|
58
|
-
export declare
|
|
75
|
+
export declare function createForwardRefResolver(isCore: boolean): ForeignFunctionResolver;
|
|
59
76
|
/**
|
|
60
77
|
* Combines an array of resolver functions into a one.
|
|
61
78
|
* @param resolvers Resolvers to be combined.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { AnimationTriggerNames, DeclarationListEmitMode, DeferBlockDepsEmitMode, R3ClassDebugInfo, R3ClassMetadata, R3ComponentMetadata, R3DeferPerBlockDependency, R3DeferPerComponentDependency, R3TemplateDependencyMetadata, SchemaMetadata, TmplAstDeferredBlock } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { Reference } from '../../../imports';
|
|
11
|
-
import { ClassPropertyMapping,
|
|
11
|
+
import { ClassPropertyMapping, DirectiveResources, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping } from '../../../metadata';
|
|
12
12
|
import { ClassDeclaration } from '../../../reflection';
|
|
13
13
|
import { SubsetOfKeys } from '../../../util/src/typescript';
|
|
14
14
|
import { ParsedTemplateWithSource, StyleUrlMeta } from './resources';
|
|
@@ -43,7 +43,7 @@ export interface ComponentAnalysisData {
|
|
|
43
43
|
* require an Angular factory definition at runtime.
|
|
44
44
|
*/
|
|
45
45
|
viewProvidersRequiringFactory: Set<Reference<ClassDeclaration>> | null;
|
|
46
|
-
resources:
|
|
46
|
+
resources: DirectiveResources;
|
|
47
47
|
/**
|
|
48
48
|
* `styleUrls` extracted from the decorator, if present.
|
|
49
49
|
*/
|
|
@@ -13,7 +13,7 @@ import { Resource } from '../../../metadata';
|
|
|
13
13
|
import { PartialEvaluator } from '../../../partial_evaluator';
|
|
14
14
|
import { ClassDeclaration, DeclarationNode, Decorator } from '../../../reflection';
|
|
15
15
|
import { CompilationMode } from '../../../transform';
|
|
16
|
-
import {
|
|
16
|
+
import { SourceMapping } from '../../../typecheck/api';
|
|
17
17
|
import { ResourceLoader } from '../../common';
|
|
18
18
|
/**
|
|
19
19
|
* The literal style url extracted from the decorator, along with metadata for diagnostics.
|
|
@@ -58,7 +58,7 @@ export interface ParsedComponentTemplate extends ParsedTemplate {
|
|
|
58
58
|
export interface ParsedTemplateWithSource extends ParsedComponentTemplate {
|
|
59
59
|
/** The string contents of the template. */
|
|
60
60
|
content: string;
|
|
61
|
-
sourceMapping:
|
|
61
|
+
sourceMapping: SourceMapping;
|
|
62
62
|
declaration: TemplateDeclaration;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
@@ -104,6 +104,7 @@ export interface ExtractTemplateOptions {
|
|
|
104
104
|
preserveSignificantWhitespace?: boolean;
|
|
105
105
|
}
|
|
106
106
|
export declare function extractTemplate(node: ClassDeclaration, template: TemplateDeclaration, evaluator: PartialEvaluator, depTracker: DependencyTracker | null, resourceLoader: ResourceLoader, options: ExtractTemplateOptions, compilationMode: CompilationMode): ParsedTemplateWithSource;
|
|
107
|
+
export declare function createEmptyTemplate(componentClass: ClassDeclaration, component: Map<string, ts.Expression>, containingFile: string): ParsedTemplateWithSource;
|
|
107
108
|
export declare function parseTemplateDeclaration(node: ClassDeclaration, decorator: Decorator, component: Map<string, ts.Expression>, containingFile: string, evaluator: PartialEvaluator, depTracker: DependencyTracker | null, resourceLoader: ResourceLoader, defaultPreserveWhitespaces: boolean): TemplateDeclaration;
|
|
108
109
|
export declare function preloadAndParseTemplate(evaluator: PartialEvaluator, resourceLoader: ResourceLoader, depTracker: DependencyTracker | null, preanalyzeTemplateCache: Map<DeclarationNode, ParsedTemplateWithSource>, node: ClassDeclaration, decorator: Decorator, component: Map<string, ts.Expression>, containingFile: string, defaultPreserveWhitespaces: boolean, options: ExtractTemplateOptions, compilationMode: CompilationMode): Promise<ParsedTemplateWithSource | null>;
|
|
109
110
|
export declare function makeResourceNotFoundError(file: string, nodeForError: ts.Node, resourceType: ResourceTypeForDiagnostics): FatalDiagnosticError;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
8
|
+
export { createForwardRefResolver, findAngularDecorator, getAngularDecorators, isAngularDecorator, NoopReferencesRegistry, ReferencesRegistry, ResourceLoader, ResourceLoaderContext, JitDeclarationRegistry, } from './common';
|
|
9
9
|
export { ComponentDecoratorHandler } from './component';
|
|
10
10
|
export { DirectiveDecoratorHandler, InitializerApiFunction, INPUT_INITIALIZER_FN, MODEL_INITIALIZER_FN, OUTPUT_INITIALIZER_FNS, QUERY_INITIALIZER_FNS, queryDecoratorNames, QueryFunctionName, tryParseInitializerApi, tryParseInitializerBasedOutput, tryParseSignalInputMapping, tryParseSignalModelMapping, tryParseSignalQueryFromInitializer, } from './directive';
|
|
11
11
|
export { NgModuleDecoratorHandler } from './ng_module';
|
|
@@ -38,6 +38,14 @@ export interface InternalOptions {
|
|
|
38
38
|
* Whether to check the event side of two-way bindings.
|
|
39
39
|
*/
|
|
40
40
|
_checkTwoWayBoundEvents?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether this is a compilation of Angular core itself.
|
|
43
|
+
*
|
|
44
|
+
* By default, we detect this automatically based on the existence of `r3_symbols.ts`
|
|
45
|
+
* in the compilation, but there are other test targets within the `core` package that
|
|
46
|
+
* import e.g. `Component` relatively and should be detected by the compiler.
|
|
47
|
+
*/
|
|
48
|
+
_isAngularCoreCompilation?: boolean;
|
|
41
49
|
}
|
|
42
50
|
/**
|
|
43
51
|
* A merged interface of all of the various Angular compiler options, as well as the standard
|
|
@@ -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 { DirectiveResources, DirectiveMeta, PipeMeta } from '../../metadata';
|
|
14
14
|
import { ActivePerfRecorder } from '../../perf';
|
|
15
15
|
import { ProgramDriver } from '../../program_driver';
|
|
16
16
|
import { DeclarationNode } from '../../reflection';
|
|
@@ -208,9 +208,9 @@ export declare class NgCompiler {
|
|
|
208
208
|
*/
|
|
209
209
|
getComponentsWithStyleFile(styleFilePath: string): ReadonlySet<DeclarationNode>;
|
|
210
210
|
/**
|
|
211
|
-
* Retrieves external resources for the given
|
|
211
|
+
* Retrieves external resources for the given directive.
|
|
212
212
|
*/
|
|
213
|
-
|
|
213
|
+
getDirectiveResources(classDecl: DeclarationNode): DirectiveResources | null;
|
|
214
214
|
getMeta(classDecl: DeclarationNode): PipeMeta | DirectiveMeta | null;
|
|
215
215
|
/**
|
|
216
216
|
* Perform Angular's analysis step (as a precursor to `getDiagnostics` or `prepareEmit`)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
9
|
import { EntryType, FunctionEntry, ParameterEntry } from './entities';
|
|
10
|
-
export type FunctionLike = ts.FunctionDeclaration | ts.MethodDeclaration | ts.MethodSignature | ts.CallSignatureDeclaration | ts.ConstructSignatureDeclaration;
|
|
10
|
+
export type FunctionLike = ts.FunctionDeclaration | ts.MethodDeclaration | ts.MethodSignature | ts.CallSignatureDeclaration | ts.ConstructSignatureDeclaration | ts.ConstructorDeclaration;
|
|
11
11
|
export declare class FunctionExtractor {
|
|
12
12
|
private name;
|
|
13
13
|
private exportDeclaration;
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { R3HmrMetadata, outputAst as o } from '@angular/compiler';
|
|
9
9
|
import { CompileResult } from '../../transform';
|
|
10
|
+
import { ClassDeclaration } from '../../reflection';
|
|
10
11
|
import ts from 'typescript';
|
|
11
12
|
/**
|
|
12
13
|
* Gets the declaration for the function that replaces the metadata of a class during HMR.
|
|
13
14
|
* @param compilationResults Code generated for the class during compilation.
|
|
14
15
|
* @param meta HMR metadata about the class.
|
|
15
|
-
* @param
|
|
16
|
+
* @param declaration Class for which the update declaration is being generated.
|
|
16
17
|
*/
|
|
17
|
-
export declare function getHmrUpdateDeclaration(compilationResults: CompileResult[], constantStatements: o.Statement[], meta: R3HmrMetadata,
|
|
18
|
+
export declare function getHmrUpdateDeclaration(compilationResults: CompileResult[], constantStatements: o.Statement[], meta: R3HmrMetadata, declaration: ClassDeclaration): ts.FunctionDeclaration;
|
|
@@ -9,7 +9,7 @@ export * from './src/api';
|
|
|
9
9
|
export { DtsMetadataReader } from './src/dts';
|
|
10
10
|
export { flattenInheritedDirectiveMetadata } from './src/inheritance';
|
|
11
11
|
export { CompoundMetadataRegistry, LocalMetadataRegistry } from './src/registry';
|
|
12
|
-
export { ResourceRegistry, Resource,
|
|
12
|
+
export { ResourceRegistry, Resource, DirectiveResources, isExternalResource, ExternalResource, } from './src/resource_registry';
|
|
13
13
|
export { extractDirectiveTypeCheckMeta, hasInjectableFields, CompoundMetadataReader, isHostDirectiveMetaForGlobalMode, } from './src/util';
|
|
14
14
|
export { BindingPropertyName, ClassPropertyMapping, ClassPropertyName, InputOrOutput, } from './src/property_mapping';
|
|
15
15
|
export { ExportedProviderStatusResolver } from './src/providers';
|
|
@@ -24,16 +24,17 @@ export interface ExternalResource extends Resource {
|
|
|
24
24
|
}
|
|
25
25
|
export declare function isExternalResource(resource: Resource): resource is ExternalResource;
|
|
26
26
|
/**
|
|
27
|
-
* Represents the either inline or external resources of a
|
|
27
|
+
* Represents the either inline or external resources of a directive.
|
|
28
28
|
*
|
|
29
29
|
* A resource with a `path` of `null` is considered inline.
|
|
30
|
+
* The template will be present for components, but will be null for directives.
|
|
30
31
|
*/
|
|
31
|
-
export interface
|
|
32
|
-
template: Resource;
|
|
33
|
-
styles: ReadonlySet<Resource
|
|
32
|
+
export interface DirectiveResources {
|
|
33
|
+
template: Resource | null;
|
|
34
|
+
styles: ReadonlySet<Resource> | null;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
|
-
* Tracks the mapping between external
|
|
37
|
+
* Tracks the mapping between external resources and the directives(s) which use them.
|
|
37
38
|
*
|
|
38
39
|
* This information is produced during analysis of the program and is used mainly to support
|
|
39
40
|
* external tooling, for which such a mapping is challenging to determine without compiler
|
|
@@ -45,10 +46,10 @@ export declare class ResourceRegistry {
|
|
|
45
46
|
private componentToStylesMap;
|
|
46
47
|
private externalStyleToComponentsMap;
|
|
47
48
|
getComponentsWithTemplate(template: AbsoluteFsPath): ReadonlySet<ClassDeclaration>;
|
|
48
|
-
registerResources(resources:
|
|
49
|
-
registerTemplate
|
|
49
|
+
registerResources(resources: DirectiveResources, directive: ClassDeclaration): void;
|
|
50
|
+
private registerTemplate;
|
|
50
51
|
getTemplate(component: ClassDeclaration): Resource | null;
|
|
51
|
-
registerStyle
|
|
52
|
+
private registerStyle;
|
|
52
53
|
getStyles(component: ClassDeclaration): Set<Resource>;
|
|
53
54
|
getComponentsWithStyle(styleUrl: AbsoluteFsPath): ReadonlySet<ClassDeclaration>;
|
|
54
55
|
}
|
|
@@ -62,6 +62,7 @@ export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression>
|
|
|
62
62
|
visitTypeofExpr(ast: o.TypeofExpr, context: Context): TExpression;
|
|
63
63
|
visitVoidExpr(ast: o.VoidExpr, context: Context): TExpression;
|
|
64
64
|
visitUnaryOperatorExpr(ast: o.UnaryOperatorExpr, context: Context): TExpression;
|
|
65
|
+
visitParenthesizedExpr(ast: o.ParenthesizedExpr, context: any): TExpression;
|
|
65
66
|
private visitStatements;
|
|
66
67
|
private setSourceMapRange;
|
|
67
68
|
private attachComments;
|
|
@@ -28,8 +28,8 @@ export interface TypeCheckableDirectiveMeta extends DirectiveMeta, DirectiveType
|
|
|
28
28
|
imports: Reference<ClassDeclaration>[] | null;
|
|
29
29
|
rawImports: ts.Expression | null;
|
|
30
30
|
}
|
|
31
|
-
export type
|
|
32
|
-
__brand: '
|
|
31
|
+
export type TypeCheckId = string & {
|
|
32
|
+
__brand: 'TypeCheckId';
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* A `ts.Diagnostic` with additional information about the diagnostic related to template
|
|
@@ -39,11 +39,11 @@ export interface TemplateDiagnostic extends ts.Diagnostic {
|
|
|
39
39
|
/**
|
|
40
40
|
* The component with the template that resulted in this diagnostic.
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
sourceFile: ts.SourceFile;
|
|
43
43
|
/**
|
|
44
|
-
* The
|
|
44
|
+
* The type check ID of the directive that resulted in this diagnostic.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
typeCheckId: TypeCheckId;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* A `TemplateDiagnostic` with a specific error code.
|
|
@@ -59,14 +59,14 @@ export interface TypeCheckBlockMetadata {
|
|
|
59
59
|
/**
|
|
60
60
|
* A unique identifier for the class which gave rise to this TCB.
|
|
61
61
|
*
|
|
62
|
-
* This can be used to map errors back to the `ts.ClassDeclaration` for the
|
|
62
|
+
* This can be used to map errors back to the `ts.ClassDeclaration` for the directive.
|
|
63
63
|
*/
|
|
64
|
-
id:
|
|
64
|
+
id: TypeCheckId;
|
|
65
65
|
/**
|
|
66
66
|
* Semantic information about the template of the component.
|
|
67
67
|
*/
|
|
68
68
|
boundTarget: BoundTarget<TypeCheckableDirectiveMeta>;
|
|
69
|
-
pipes: Map<string, PipeMeta
|
|
69
|
+
pipes: Map<string, PipeMeta> | null;
|
|
70
70
|
/**
|
|
71
71
|
* Schemas that apply to this template.
|
|
72
72
|
*/
|
|
@@ -309,26 +309,24 @@ export interface TypeCheckingConfig {
|
|
|
309
309
|
*/
|
|
310
310
|
checkTwoWayBoundEvents: boolean;
|
|
311
311
|
}
|
|
312
|
-
export type
|
|
312
|
+
export type SourceMapping = DirectSourceMapping | IndirectSourceMapping | ExternalTemplateSourceMapping;
|
|
313
313
|
/**
|
|
314
|
-
* A mapping to
|
|
314
|
+
* A mapping to a node within the same source file..
|
|
315
315
|
*
|
|
316
|
-
* `ParseSourceSpan`s for this
|
|
317
|
-
* message.
|
|
316
|
+
* `ParseSourceSpan`s for this node should be accurate for direct reporting in a TS error message.
|
|
318
317
|
*/
|
|
319
|
-
export interface
|
|
318
|
+
export interface DirectSourceMapping {
|
|
320
319
|
type: 'direct';
|
|
321
|
-
node: ts.
|
|
320
|
+
node: ts.Expression;
|
|
322
321
|
}
|
|
323
322
|
/**
|
|
324
|
-
* A mapping to a
|
|
323
|
+
* A mapping to a node which is still in a TS file, but where the positions in any
|
|
325
324
|
* `ParseSourceSpan`s are not accurate for one reason or another.
|
|
326
325
|
*
|
|
327
|
-
* This can occur if the
|
|
328
|
-
* construct a contiguous mapping for the template string.
|
|
329
|
-
* expression.
|
|
326
|
+
* This can occur if the expression was interpolated in a way where the compiler could not
|
|
327
|
+
* construct a contiguous mapping for the template string.
|
|
330
328
|
*/
|
|
331
|
-
export interface
|
|
329
|
+
export interface IndirectSourceMapping {
|
|
332
330
|
type: 'indirect';
|
|
333
331
|
componentClass: ClassDeclaration;
|
|
334
332
|
node: ts.Expression;
|
|
@@ -348,18 +346,18 @@ export interface ExternalTemplateSourceMapping {
|
|
|
348
346
|
templateUrl: string;
|
|
349
347
|
}
|
|
350
348
|
/**
|
|
351
|
-
* A mapping of a TCB template id to a span in the corresponding
|
|
349
|
+
* A mapping of a TCB template id to a span in the corresponding source code.
|
|
352
350
|
*/
|
|
353
351
|
export interface SourceLocation {
|
|
354
|
-
id:
|
|
352
|
+
id: TypeCheckId;
|
|
355
353
|
span: AbsoluteSourceSpan;
|
|
356
354
|
}
|
|
357
355
|
/**
|
|
358
|
-
* A representation of all a node's
|
|
356
|
+
* A representation of all a node's type checking information we know. Useful for producing
|
|
359
357
|
* diagnostics based on a TCB node or generally mapping from a TCB node back to a template location.
|
|
360
358
|
*/
|
|
361
|
-
export interface
|
|
359
|
+
export interface FullSourceMapping {
|
|
362
360
|
sourceLocation: SourceLocation;
|
|
363
|
-
|
|
361
|
+
sourceMapping: SourceMapping;
|
|
364
362
|
span: ParseSourceSpan;
|
|
365
363
|
}
|
|
@@ -12,7 +12,7 @@ import { ErrorCode } from '../../diagnostics';
|
|
|
12
12
|
import { Reference } from '../../imports';
|
|
13
13
|
import { NgModuleMeta, PipeMeta } from '../../metadata';
|
|
14
14
|
import { ClassDeclaration } from '../../reflection';
|
|
15
|
-
import {
|
|
15
|
+
import { FullSourceMapping, NgTemplateDiagnostic, TypeCheckableDirectiveMeta } from './api';
|
|
16
16
|
import { GlobalCompletion } from './completion';
|
|
17
17
|
import { PotentialDirective, PotentialImport, PotentialImportMode, PotentialPipe } from './scope';
|
|
18
18
|
import { ElementSymbol, Symbol, TcbLocation, TemplateSymbol } from './symbols';
|
|
@@ -50,10 +50,10 @@ export interface TemplateTypeChecker {
|
|
|
50
50
|
*/
|
|
51
51
|
getDiagnosticsForFile(sf: ts.SourceFile, optimizeFor: OptimizeFor): ts.Diagnostic[];
|
|
52
52
|
/**
|
|
53
|
-
* Given a `shim` and position within the file, returns information for mapping back to a
|
|
53
|
+
* Given a `shim` and position within the file, returns information for mapping back to a source
|
|
54
54
|
* location.
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
getSourceMappingAtTcbLocation(tcbLocation: TcbLocation): FullSourceMapping | null;
|
|
57
57
|
/**
|
|
58
58
|
* Get all `ts.Diagnostic`s currently available that pertain to the given component.
|
|
59
59
|
*
|
|
@@ -10,34 +10,43 @@ 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 { SourceMapping, TypeCheckableDirectiveMeta } from './api';
|
|
14
|
+
/** Contextuable data for type checking the template of a component. */
|
|
15
|
+
export interface TemplateContext {
|
|
16
|
+
/** AST nodes representing the template. */
|
|
17
|
+
nodes: TmplAstNode[];
|
|
18
|
+
/** Describes the origin of the template text. Used for mapping errors back. */
|
|
19
|
+
sourceMapping: SourceMapping;
|
|
20
|
+
/** `ParseSourceFile` associated with the template. */
|
|
21
|
+
file: ParseSourceFile;
|
|
22
|
+
/** Errors produced while parsing the template. */
|
|
23
|
+
parseErrors: ParseError[] | null;
|
|
24
|
+
/** Pipes available within the template. */
|
|
25
|
+
pipes: Map<string, PipeMeta>;
|
|
26
|
+
/** Whether the template preserves whitespaces. */
|
|
27
|
+
preserveWhitespaces: boolean;
|
|
28
|
+
}
|
|
14
29
|
/**
|
|
15
30
|
* A currently pending type checking operation, into which templates for type-checking can be
|
|
16
31
|
* registered.
|
|
17
32
|
*/
|
|
18
33
|
export interface TypeCheckContext {
|
|
19
34
|
/**
|
|
20
|
-
* Register a
|
|
35
|
+
* Register a directive to be potentially be type-checked.
|
|
21
36
|
*
|
|
22
|
-
*
|
|
23
|
-
* checking of that
|
|
24
|
-
*
|
|
37
|
+
* Directives registered via `addDIrective` are available for checking, but might be skipped if
|
|
38
|
+
* checking of that class is not required. This can happen for a few reasons, including if it was
|
|
39
|
+
* previously checked and the prior results are still valid.
|
|
25
40
|
*
|
|
26
|
-
* @param ref a `Reference` to the
|
|
41
|
+
* @param ref a `Reference` to the directive class which yielded this template.
|
|
27
42
|
* @param binder an `R3TargetBinder` which encapsulates the scope of this template, including all
|
|
28
43
|
* available directives.
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
*
|
|
32
|
-
* @param
|
|
33
|
-
* template text described by the AST.
|
|
34
|
-
* @param file the `ParseSourceFile` associated with the template.
|
|
35
|
-
* @param parseErrors the `ParseError`'s associated with the template.
|
|
36
|
-
* @param isStandalone a boolean indicating whether the component is standalone.
|
|
37
|
-
* @param preserveWhitespaces a boolean indicating whether the component's template preserves
|
|
38
|
-
* whitespaces.
|
|
44
|
+
* @param schemas Schemas that will apply when checking the directive.
|
|
45
|
+
* @param templateContext Contextual information necessary for checking the template.
|
|
46
|
+
* Only relevant for component classes.
|
|
47
|
+
* @param isStandalone a boolean indicating whether the directive is standalone.
|
|
39
48
|
*/
|
|
40
|
-
|
|
49
|
+
addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, isStandalone: boolean): void;
|
|
41
50
|
}
|
|
42
51
|
/**
|
|
43
52
|
* Interface to trigger generation of type-checking code for a program given a new
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ParseSourceSpan } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
|
-
import { TemplateDiagnostic,
|
|
10
|
+
import { TemplateDiagnostic, TypeCheckId, SourceMapping } from '../../api';
|
|
11
11
|
/**
|
|
12
12
|
* Constructs a `ts.Diagnostic` for a given `ParseSourceSpan` within a template.
|
|
13
13
|
*/
|
|
14
|
-
export declare function makeTemplateDiagnostic(
|
|
14
|
+
export declare function makeTemplateDiagnostic(id: TypeCheckId, mapping: SourceMapping, span: ParseSourceSpan, category: ts.DiagnosticCategory, code: number, messageText: string | ts.DiagnosticMessageChain, relatedMessages?: {
|
|
15
15
|
text: string;
|
|
16
16
|
start: number;
|
|
17
17
|
end: number;
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { DeclarationNode } from '../../../reflection';
|
|
9
|
-
import {
|
|
10
|
-
export declare function
|
|
9
|
+
import { TypeCheckId } from '../../api';
|
|
10
|
+
export declare function getTypeCheckId(clazz: DeclarationNode): TypeCheckId;
|
|
@@ -16,9 +16,9 @@ import { PerfRecorder } from '../../perf';
|
|
|
16
16
|
import { ProgramDriver } from '../../program_driver';
|
|
17
17
|
import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
18
18
|
import { ComponentScopeReader, TypeCheckScopeRegistry } from '../../scope';
|
|
19
|
-
import { ElementSymbol,
|
|
19
|
+
import { ElementSymbol, FullSourceMapping, GlobalCompletion, NgTemplateDiagnostic, OptimizeFor, PotentialDirective, PotentialImport, PotentialImportMode, PotentialPipe, ProgramTypeCheckAdapter, TcbLocation, TemplateSymbol, TemplateTypeChecker, TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
|
|
20
20
|
import { ShimTypeCheckingData } from './context';
|
|
21
|
-
import {
|
|
21
|
+
import { DirectiveSourceManager } from './source';
|
|
22
22
|
/**
|
|
23
23
|
* Primary template type-checking engine, which performs type-checking using a
|
|
24
24
|
* `TypeCheckingProgramStrategy` for type-checking program maintenance, and the
|
|
@@ -82,7 +82,7 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
|
|
|
82
82
|
isTrackedTypeCheckFile(filePath: AbsoluteFsPath): boolean;
|
|
83
83
|
private getFileRecordForTcbLocation;
|
|
84
84
|
private getFileAndShimRecordsForPath;
|
|
85
|
-
|
|
85
|
+
getSourceMappingAtTcbLocation(tcbLocation: TcbLocation): FullSourceMapping | null;
|
|
86
86
|
generateAllTypeCheckBlocks(): void;
|
|
87
87
|
/**
|
|
88
88
|
* Retrieve type-checking and template parse diagnostics from the given `ts.SourceFile` using the
|
|
@@ -150,10 +150,10 @@ export interface FileTypeCheckingData {
|
|
|
150
150
|
*/
|
|
151
151
|
hasInlines: boolean;
|
|
152
152
|
/**
|
|
153
|
-
*
|
|
154
|
-
* original
|
|
153
|
+
* Information for mapping diagnostics from inlined type check blocks
|
|
154
|
+
* back to their original sources.
|
|
155
155
|
*/
|
|
156
|
-
sourceManager:
|
|
156
|
+
sourceManager: DirectiveSourceManager;
|
|
157
157
|
/**
|
|
158
158
|
* Data for each shim generated from this input file.
|
|
159
159
|
*
|
|
@@ -9,7 +9,7 @@ import { AST, LiteralPrimitive, PropertyRead, PropertyWrite, SafePropertyRead, T
|
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { AbsoluteFsPath } from '../../file_system';
|
|
11
11
|
import { GlobalCompletion, TcbLocation } from '../api';
|
|
12
|
-
import {
|
|
12
|
+
import { TypeCheckData } from './context';
|
|
13
13
|
/**
|
|
14
14
|
* Powers autocompletion for a specific component.
|
|
15
15
|
*
|
|
@@ -28,7 +28,7 @@ export declare class CompletionEngine {
|
|
|
28
28
|
*/
|
|
29
29
|
private templateContextCache;
|
|
30
30
|
private expressionCompletionCache;
|
|
31
|
-
constructor(tcb: ts.Node, data:
|
|
31
|
+
constructor(tcb: ts.Node, data: TypeCheckData, tcbPath: AbsoluteFsPath, tcbIsShim: boolean);
|
|
32
32
|
/**
|
|
33
33
|
* Get global completions within the given template context and AST node.
|
|
34
34
|
*
|