@angular/compiler-cli
Advanced tools
Comparing version
@@ -9,3 +9,3 @@ | ||
constructorParametersDownlevelTransform | ||
} from "./chunk-SNXU6YPZ.js"; | ||
} from "./chunk-FVYXSSAL.js"; | ||
import { | ||
@@ -37,3 +37,3 @@ DEFAULT_ERROR_CODE, | ||
readConfiguration | ||
} from "./chunk-O2OVHMWL.js"; | ||
} from "./chunk-RFDMMGNB.js"; | ||
import { | ||
@@ -43,3 +43,3 @@ angularJitApplicationTransform, | ||
getInitializerApiJitTransform | ||
} from "./chunk-SEPXPBD2.js"; | ||
} from "./chunk-PAYJFU4V.js"; | ||
import { | ||
@@ -52,3 +52,3 @@ ConsoleLogger, | ||
TsCreateProgramDriver | ||
} from "./chunk-PLKJMRGZ.js"; | ||
} from "./chunk-CD575TJ6.js"; | ||
import { | ||
@@ -58,3 +58,3 @@ ErrorCode, | ||
ngErrorCode | ||
} from "./chunk-QYORKQDN.js"; | ||
} from "./chunk-7HRFJETP.js"; | ||
import { | ||
@@ -90,3 +90,3 @@ ActivePerfRecorder, | ||
import { Version } from "@angular/compiler"; | ||
var VERSION = new Version("20.0.0-next.1"); | ||
var VERSION = new Version("20.0.0-next.2"); | ||
@@ -93,0 +93,0 @@ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/tsc_plugin.mjs |
@@ -11,3 +11,3 @@ | ||
isFatalLinkerError | ||
} from "../../chunk-UAA7BTBW.js"; | ||
} from "../../chunk-SWJRL4N4.js"; | ||
import { | ||
@@ -18,3 +18,3 @@ ConsoleLogger, | ||
import "../../chunk-77D5CI2U.js"; | ||
import "../../chunk-QYORKQDN.js"; | ||
import "../../chunk-7HRFJETP.js"; | ||
import { | ||
@@ -21,0 +21,0 @@ NodeJSFileSystem |
@@ -13,5 +13,5 @@ | ||
needsLinking | ||
} from "../chunk-UAA7BTBW.js"; | ||
} from "../chunk-SWJRL4N4.js"; | ||
import "../chunk-77D5CI2U.js"; | ||
import "../chunk-QYORKQDN.js"; | ||
import "../chunk-7HRFJETP.js"; | ||
import "../chunk-37JMVF7H.js"; | ||
@@ -18,0 +18,0 @@ import "../chunk-KPQ72R34.js"; |
@@ -11,4 +11,4 @@ | ||
StaticInterpreter, | ||
forwardRefResolver | ||
} from "../chunk-PLKJMRGZ.js"; | ||
createForwardRefResolver | ||
} from "../chunk-CD575TJ6.js"; | ||
import { | ||
@@ -19,3 +19,3 @@ ImportManager, | ||
reflectObjectLiteral | ||
} from "../chunk-QYORKQDN.js"; | ||
} from "../chunk-7HRFJETP.js"; | ||
import "../chunk-Q2WE7ECN.js"; | ||
@@ -33,3 +33,3 @@ import "../chunk-37JMVF7H.js"; | ||
TypeScriptReflectionHost, | ||
forwardRefResolver, | ||
createForwardRefResolver, | ||
reflectObjectLiteral | ||
@@ -36,0 +36,0 @@ }; |
@@ -9,6 +9,6 @@ | ||
constructorParametersDownlevelTransform | ||
} from "../chunk-SNXU6YPZ.js"; | ||
import "../chunk-SEPXPBD2.js"; | ||
import "../chunk-PLKJMRGZ.js"; | ||
import "../chunk-QYORKQDN.js"; | ||
} from "../chunk-FVYXSSAL.js"; | ||
import "../chunk-PAYJFU4V.js"; | ||
import "../chunk-CD575TJ6.js"; | ||
import "../chunk-7HRFJETP.js"; | ||
import "../chunk-Q2WE7ECN.js"; | ||
@@ -15,0 +15,0 @@ import "../chunk-37JMVF7H.js"; |
@@ -9,9 +9,9 @@ #!/usr/bin/env node | ||
readCommandLineAndConfiguration | ||
} from "../../chunk-YSSSYIZJ.js"; | ||
} from "../../chunk-B73DMM7T.js"; | ||
import { | ||
EmitFlags | ||
} from "../../chunk-O2OVHMWL.js"; | ||
import "../../chunk-SEPXPBD2.js"; | ||
import "../../chunk-PLKJMRGZ.js"; | ||
import "../../chunk-QYORKQDN.js"; | ||
} from "../../chunk-RFDMMGNB.js"; | ||
import "../../chunk-PAYJFU4V.js"; | ||
import "../../chunk-CD575TJ6.js"; | ||
import "../../chunk-7HRFJETP.js"; | ||
import "../../chunk-Q2WE7ECN.js"; | ||
@@ -18,0 +18,0 @@ import { |
@@ -8,7 +8,7 @@ #!/usr/bin/env node | ||
main | ||
} from "../../chunk-YSSSYIZJ.js"; | ||
import "../../chunk-O2OVHMWL.js"; | ||
import "../../chunk-SEPXPBD2.js"; | ||
import "../../chunk-PLKJMRGZ.js"; | ||
import "../../chunk-QYORKQDN.js"; | ||
} from "../../chunk-B73DMM7T.js"; | ||
import "../../chunk-RFDMMGNB.js"; | ||
import "../../chunk-PAYJFU4V.js"; | ||
import "../../chunk-CD575TJ6.js"; | ||
import "../../chunk-7HRFJETP.js"; | ||
import "../../chunk-Q2WE7ECN.js"; | ||
@@ -15,0 +15,0 @@ import { |
@@ -10,3 +10,3 @@ /** | ||
import { AstObject, AstValue } from '../../ast/ast_value'; | ||
export declare const PLACEHOLDER_VERSION = "20.0.0-next.1"; | ||
export declare const PLACEHOLDER_VERSION = "20.0.0-next.2"; | ||
export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference; | ||
@@ -13,0 +13,0 @@ /** |
{ | ||
"name": "@angular/compiler-cli", | ||
"version": "20.0.0-next.1", | ||
"version": "20.0.0-next.2", | ||
"description": "Angular - the compiler CLI for Node.js", | ||
@@ -55,3 +55,3 @@ "typings": "index.d.ts", | ||
"peerDependencies": { | ||
"@angular/compiler": "20.0.0-next.1", | ||
"@angular/compiler": "20.0.0-next.2", | ||
"typescript": ">=5.8 <5.9" | ||
@@ -58,0 +58,0 @@ }, |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export { forwardRefResolver } from '../src/ngtsc/annotations'; | ||
export { createForwardRefResolver } from '../src/ngtsc/annotations'; | ||
export { AbsoluteFsPath } from '../src/ngtsc/file_system'; | ||
@@ -15,0 +15,0 @@ export { Reference } from '../src/ngtsc/imports'; |
@@ -12,3 +12,3 @@ /** | ||
import { ClassDeclaration, Decorator } from '../../../reflection'; | ||
export declare function resolveEnumValue(evaluator: PartialEvaluator, metadata: Map<string, ts.Expression>, field: string, enumSymbolName: string): number | null; | ||
export declare function resolveEnumValue(evaluator: PartialEvaluator, metadata: Map<string, ts.Expression>, field: string, enumSymbolName: string, isCore: boolean): number | null; | ||
/** | ||
@@ -15,0 +15,0 @@ * Resolves a EncapsulationEnum expression locally on best effort without having to calculate the |
@@ -29,3 +29,20 @@ /** | ||
}; | ||
export declare function isAngularCoreReference(reference: Reference, symbolName: string): boolean; | ||
/** | ||
* This function is used for verifying that a given reference is declared | ||
* inside `@angular/core` and corresponds to the given symbol name. | ||
* | ||
* In some cases, due to the compiler face duplicating many symbols as | ||
* an independent bridge between core and the compiler, the dts bundler may | ||
* decide to alias declarations in the `.d.ts`, to avoid conflicts. | ||
* | ||
* e.g. | ||
* | ||
* ``` | ||
* declare enum ViewEncapsulation {} // from the facade | ||
* declare enum ViewEncapsulation$1 {} // the real one exported to users. | ||
* ``` | ||
* | ||
* This function accounts for such potential re-namings. | ||
*/ | ||
export declare function isAngularCoreReferenceWithPotentialAliasing(reference: Reference, symbolName: string, isCore: boolean): boolean; | ||
export declare function findAngularDecorator(decorators: Decorator[], name: string, isCore: boolean): Decorator | undefined; | ||
@@ -59,3 +76,3 @@ export declare function isAngularDecorator(decorator: Decorator, name: string, isCore: boolean): boolean; | ||
*/ | ||
export declare const forwardRefResolver: ForeignFunctionResolver; | ||
export declare function createForwardRefResolver(isCore: boolean): ForeignFunctionResolver; | ||
/** | ||
@@ -62,0 +79,0 @@ * Combines an array of resolver functions into a one. |
@@ -11,3 +11,3 @@ /** | ||
import { Reference } from '../../../imports'; | ||
import { ClassPropertyMapping, ComponentResources, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping } from '../../../metadata'; | ||
import { ClassPropertyMapping, DirectiveResources, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping } from '../../../metadata'; | ||
import { ClassDeclaration } from '../../../reflection'; | ||
@@ -47,3 +47,3 @@ import { SubsetOfKeys } from '../../../util/src/typescript'; | ||
viewProvidersRequiringFactory: Set<Reference<ClassDeclaration>> | null; | ||
resources: ComponentResources; | ||
resources: DirectiveResources; | ||
/** | ||
@@ -50,0 +50,0 @@ * `styleUrls` extracted from the decorator, if present. |
@@ -16,3 +16,3 @@ /** | ||
import { CompilationMode } from '../../../transform'; | ||
import { TemplateSourceMapping } from '../../../typecheck/api'; | ||
import { SourceMapping } from '../../../typecheck/api'; | ||
import { ResourceLoader } from '../../common'; | ||
@@ -62,3 +62,3 @@ /** | ||
content: string; | ||
sourceMapping: TemplateSourceMapping; | ||
sourceMapping: SourceMapping; | ||
declaration: TemplateDeclaration; | ||
@@ -109,2 +109,3 @@ } | ||
export declare function extractTemplate(node: ClassDeclaration, template: TemplateDeclaration, evaluator: PartialEvaluator, depTracker: DependencyTracker | null, resourceLoader: ResourceLoader, options: ExtractTemplateOptions, compilationMode: CompilationMode): ParsedTemplateWithSource; | ||
export declare function createEmptyTemplate(componentClass: ClassDeclaration, component: Map<string, ts.Expression>, containingFile: string): ParsedTemplateWithSource; | ||
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; | ||
@@ -111,0 +112,0 @@ 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>; |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export { forwardRefResolver, findAngularDecorator, getAngularDecorators, isAngularDecorator, NoopReferencesRegistry, ReferencesRegistry, ResourceLoader, ResourceLoaderContext, JitDeclarationRegistry, } from './common'; | ||
export { createForwardRefResolver, findAngularDecorator, getAngularDecorators, isAngularDecorator, NoopReferencesRegistry, ReferencesRegistry, ResourceLoader, ResourceLoaderContext, JitDeclarationRegistry, } from './common'; | ||
export { ComponentDecoratorHandler } from './component'; | ||
@@ -11,0 +11,0 @@ export { DirectiveDecoratorHandler, InitializerApiFunction, INPUT_INITIALIZER_FN, MODEL_INITIALIZER_FN, OUTPUT_INITIALIZER_FNS, QUERY_INITIALIZER_FNS, queryDecoratorNames, QueryFunctionName, tryParseInitializerApi, tryParseInitializerBasedOutput, tryParseSignalInputMapping, tryParseSignalModelMapping, tryParseSignalQueryFromInitializer, } from './directive'; |
@@ -41,2 +41,10 @@ /** | ||
_checkTwoWayBoundEvents?: boolean; | ||
/** | ||
* Whether this is a compilation of Angular core itself. | ||
* | ||
* By default, we detect this automatically based on the existence of `r3_symbols.ts` | ||
* in the compilation, but there are other test targets within the `core` package that | ||
* import e.g. `Component` relatively and should be detected by the compiler. | ||
*/ | ||
_isAngularCoreCompilation?: boolean; | ||
} | ||
@@ -43,0 +51,0 @@ /** |
@@ -13,3 +13,3 @@ /** | ||
import { IndexedComponent } from '../../indexer'; | ||
import { ComponentResources, DirectiveMeta, PipeMeta } from '../../metadata'; | ||
import { DirectiveResources, DirectiveMeta, PipeMeta } from '../../metadata'; | ||
import { ActivePerfRecorder } from '../../perf'; | ||
@@ -212,5 +212,5 @@ import { ProgramDriver } from '../../program_driver'; | ||
/** | ||
* Retrieves external resources for the given component. | ||
* Retrieves external resources for the given directive. | ||
*/ | ||
getComponentResources(classDecl: DeclarationNode): ComponentResources | null; | ||
getDirectiveResources(classDecl: DeclarationNode): DirectiveResources | null; | ||
getMeta(classDecl: DeclarationNode): PipeMeta | DirectiveMeta | null; | ||
@@ -217,0 +217,0 @@ /** |
@@ -10,3 +10,3 @@ /** | ||
import { EntryType, FunctionEntry, ParameterEntry } from './entities'; | ||
export type FunctionLike = ts.FunctionDeclaration | ts.MethodDeclaration | ts.MethodSignature | ts.CallSignatureDeclaration | ts.ConstructSignatureDeclaration; | ||
export type FunctionLike = ts.FunctionDeclaration | ts.MethodDeclaration | ts.MethodSignature | ts.CallSignatureDeclaration | ts.ConstructSignatureDeclaration | ts.ConstructorDeclaration; | ||
export declare class FunctionExtractor { | ||
@@ -13,0 +13,0 @@ private name; |
@@ -10,2 +10,3 @@ /*! | ||
import { CompileResult } from '../../transform'; | ||
import { ClassDeclaration } from '../../reflection'; | ||
import ts from 'typescript'; | ||
@@ -16,4 +17,4 @@ /** | ||
* @param meta HMR metadata about the class. | ||
* @param sourceFile File in which the class is defined. | ||
* @param declaration Class for which the update declaration is being generated. | ||
*/ | ||
export declare function getHmrUpdateDeclaration(compilationResults: CompileResult[], constantStatements: o.Statement[], meta: R3HmrMetadata, sourceFile: ts.SourceFile): ts.FunctionDeclaration; | ||
export declare function getHmrUpdateDeclaration(compilationResults: CompileResult[], constantStatements: o.Statement[], meta: R3HmrMetadata, declaration: ClassDeclaration): ts.FunctionDeclaration; |
@@ -12,3 +12,3 @@ /** | ||
export { CompoundMetadataRegistry, LocalMetadataRegistry } from './src/registry'; | ||
export { ResourceRegistry, Resource, ComponentResources, isExternalResource, ExternalResource, } from './src/resource_registry'; | ||
export { ResourceRegistry, Resource, DirectiveResources, isExternalResource, ExternalResource, } from './src/resource_registry'; | ||
export { extractDirectiveTypeCheckMeta, hasInjectableFields, CompoundMetadataReader, isHostDirectiveMetaForGlobalMode, } from './src/util'; | ||
@@ -15,0 +15,0 @@ export { BindingPropertyName, ClassPropertyMapping, ClassPropertyName, InputOrOutput, } from './src/property_mapping'; |
@@ -27,12 +27,13 @@ /** | ||
/** | ||
* Represents the either inline or external resources of a component. | ||
* Represents the either inline or external resources of a directive. | ||
* | ||
* A resource with a `path` of `null` is considered inline. | ||
* The template will be present for components, but will be null for directives. | ||
*/ | ||
export interface ComponentResources { | ||
template: Resource; | ||
styles: ReadonlySet<Resource>; | ||
export interface DirectiveResources { | ||
template: Resource | null; | ||
styles: ReadonlySet<Resource> | null; | ||
} | ||
/** | ||
* Tracks the mapping between external template/style files and the component(s) which use them. | ||
* Tracks the mapping between external resources and the directives(s) which use them. | ||
* | ||
@@ -49,8 +50,8 @@ * This information is produced during analysis of the program and is used mainly to support | ||
getComponentsWithTemplate(template: AbsoluteFsPath): ReadonlySet<ClassDeclaration>; | ||
registerResources(resources: ComponentResources, component: ClassDeclaration): void; | ||
registerTemplate(templateResource: Resource, component: ClassDeclaration): void; | ||
registerResources(resources: DirectiveResources, directive: ClassDeclaration): void; | ||
private registerTemplate; | ||
getTemplate(component: ClassDeclaration): Resource | null; | ||
registerStyle(styleResource: Resource, component: ClassDeclaration): void; | ||
private registerStyle; | ||
getStyles(component: ClassDeclaration): Set<Resource>; | ||
getComponentsWithStyle(styleUrl: AbsoluteFsPath): ReadonlySet<ClassDeclaration>; | ||
} |
@@ -31,4 +31,4 @@ /** | ||
} | ||
export type TemplateId = string & { | ||
__brand: 'TemplateId'; | ||
export type TypeCheckId = string & { | ||
__brand: 'TypeCheckId'; | ||
}; | ||
@@ -43,7 +43,7 @@ /** | ||
*/ | ||
componentFile: ts.SourceFile; | ||
sourceFile: ts.SourceFile; | ||
/** | ||
* The template id of the component that resulted in this diagnostic. | ||
* The type check ID of the directive that resulted in this diagnostic. | ||
*/ | ||
templateId: TemplateId; | ||
typeCheckId: TypeCheckId; | ||
} | ||
@@ -64,5 +64,5 @@ /** | ||
* | ||
* This can be used to map errors back to the `ts.ClassDeclaration` for the component. | ||
* This can be used to map errors back to the `ts.ClassDeclaration` for the directive. | ||
*/ | ||
id: TemplateId; | ||
id: TypeCheckId; | ||
/** | ||
@@ -72,3 +72,3 @@ * Semantic information about the template of the component. | ||
boundTarget: BoundTarget<TypeCheckableDirectiveMeta>; | ||
pipes: Map<string, PipeMeta>; | ||
pipes: Map<string, PipeMeta> | null; | ||
/** | ||
@@ -316,22 +316,20 @@ * Schemas that apply to this template. | ||
} | ||
export type TemplateSourceMapping = DirectTemplateSourceMapping | IndirectTemplateSourceMapping | ExternalTemplateSourceMapping; | ||
export type SourceMapping = DirectSourceMapping | IndirectSourceMapping | ExternalTemplateSourceMapping; | ||
/** | ||
* A mapping to an inline template in a TS file. | ||
* A mapping to a node within the same source file.. | ||
* | ||
* `ParseSourceSpan`s for this template should be accurate for direct reporting in a TS error | ||
* message. | ||
* `ParseSourceSpan`s for this node should be accurate for direct reporting in a TS error message. | ||
*/ | ||
export interface DirectTemplateSourceMapping { | ||
export interface DirectSourceMapping { | ||
type: 'direct'; | ||
node: ts.StringLiteral | ts.NoSubstitutionTemplateLiteral; | ||
node: ts.Expression; | ||
} | ||
/** | ||
* A mapping to a template which is still in a TS file, but where the node positions in any | ||
* A mapping to a node which is still in a TS file, but where the positions in any | ||
* `ParseSourceSpan`s are not accurate for one reason or another. | ||
* | ||
* This can occur if the template expression was interpolated in a way where the compiler could not | ||
* construct a contiguous mapping for the template string. The `node` refers to the `template` | ||
* expression. | ||
* This can occur if the expression was interpolated in a way where the compiler could not | ||
* construct a contiguous mapping for the template string. | ||
*/ | ||
export interface IndirectTemplateSourceMapping { | ||
export interface IndirectSourceMapping { | ||
type: 'indirect'; | ||
@@ -356,16 +354,16 @@ componentClass: ClassDeclaration; | ||
/** | ||
* A mapping of a TCB template id to a span in the corresponding template source. | ||
* A mapping of a TCB template id to a span in the corresponding source code. | ||
*/ | ||
export interface SourceLocation { | ||
id: TemplateId; | ||
id: TypeCheckId; | ||
span: AbsoluteSourceSpan; | ||
} | ||
/** | ||
* A representation of all a node's template mapping information we know. Useful for producing | ||
* A representation of all a node's type checking information we know. Useful for producing | ||
* diagnostics based on a TCB node or generally mapping from a TCB node back to a template location. | ||
*/ | ||
export interface FullTemplateMapping { | ||
export interface FullSourceMapping { | ||
sourceLocation: SourceLocation; | ||
templateSourceMapping: TemplateSourceMapping; | ||
sourceMapping: SourceMapping; | ||
span: ParseSourceSpan; | ||
} |
@@ -15,3 +15,3 @@ /** | ||
import { ClassDeclaration } from '../../reflection'; | ||
import { FullTemplateMapping, NgTemplateDiagnostic, TypeCheckableDirectiveMeta } from './api'; | ||
import { FullSourceMapping, NgTemplateDiagnostic, TypeCheckableDirectiveMeta } from './api'; | ||
import { GlobalCompletion } from './completion'; | ||
@@ -54,6 +54,6 @@ import { PotentialDirective, PotentialImport, PotentialImportMode, PotentialPipe } from './scope'; | ||
/** | ||
* Given a `shim` and position within the file, returns information for mapping back to a template | ||
* Given a `shim` and position within the file, returns information for mapping back to a source | ||
* location. | ||
*/ | ||
getTemplateMappingAtTcbLocation(tcbLocation: TcbLocation): FullTemplateMapping | null; | ||
getSourceMappingAtTcbLocation(tcbLocation: TcbLocation): FullSourceMapping | null; | ||
/** | ||
@@ -60,0 +60,0 @@ * Get all `ts.Diagnostic`s currently available that pertain to the given component. |
@@ -13,3 +13,18 @@ /** | ||
import { ClassDeclaration } from '../../reflection'; | ||
import { TemplateSourceMapping, TypeCheckableDirectiveMeta } from './api'; | ||
import { SourceMapping, TypeCheckableDirectiveMeta } from './api'; | ||
/** Contextuable data for type checking the template of a component. */ | ||
export interface TemplateContext { | ||
/** AST nodes representing the template. */ | ||
nodes: TmplAstNode[]; | ||
/** Describes the origin of the template text. Used for mapping errors back. */ | ||
sourceMapping: SourceMapping; | ||
/** `ParseSourceFile` associated with the template. */ | ||
file: ParseSourceFile; | ||
/** Errors produced while parsing the template. */ | ||
parseErrors: ParseError[] | null; | ||
/** Pipes available within the template. */ | ||
pipes: Map<string, PipeMeta>; | ||
/** Whether the template preserves whitespaces. */ | ||
preserveWhitespaces: boolean; | ||
} | ||
/** | ||
@@ -21,23 +36,17 @@ * A currently pending type checking operation, into which templates for type-checking can be | ||
/** | ||
* Register a template to potentially be type-checked. | ||
* Register a directive to be potentially be type-checked. | ||
* | ||
* Templates registered via `addTemplate` are available for checking, but might be skipped if | ||
* checking of that component is not required. This can happen for a few reasons, including if | ||
* the component was previously checked and the prior results are still valid. | ||
* Directives registered via `addDIrective` are available for checking, but might be skipped if | ||
* checking of that class is not required. This can happen for a few reasons, including if it was | ||
* previously checked and the prior results are still valid. | ||
* | ||
* @param ref a `Reference` to the component class which yielded this template. | ||
* @param ref a `Reference` to the directive class which yielded this template. | ||
* @param binder an `R3TargetBinder` which encapsulates the scope of this template, including all | ||
* available directives. | ||
* @param template the original template AST of this component. | ||
* @param pipes a `Map` of pipes available within the scope of this template. | ||
* @param schemas any schemas which apply to this template. | ||
* @param sourceMapping a `TemplateSourceMapping` instance which describes the origin of the | ||
* template text described by the AST. | ||
* @param file the `ParseSourceFile` associated with the template. | ||
* @param parseErrors the `ParseError`'s associated with the template. | ||
* @param isStandalone a boolean indicating whether the component is standalone. | ||
* @param preserveWhitespaces a boolean indicating whether the component's template preserves | ||
* whitespaces. | ||
* @param schemas Schemas that will apply when checking the directive. | ||
* @param templateContext Contextual information necessary for checking the template. | ||
* Only relevant for component classes. | ||
* @param isStandalone a boolean indicating whether the directive is standalone. | ||
*/ | ||
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; | ||
addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, isStandalone: boolean): void; | ||
} | ||
@@ -44,0 +53,0 @@ /** |
@@ -10,7 +10,7 @@ /** | ||
import ts from 'typescript'; | ||
import { TemplateDiagnostic, TemplateId, TemplateSourceMapping } from '../../api'; | ||
import { TemplateDiagnostic, TypeCheckId, SourceMapping } from '../../api'; | ||
/** | ||
* Constructs a `ts.Diagnostic` for a given `ParseSourceSpan` within a template. | ||
*/ | ||
export declare function makeTemplateDiagnostic(templateId: TemplateId, mapping: TemplateSourceMapping, span: ParseSourceSpan, category: ts.DiagnosticCategory, code: number, messageText: string | ts.DiagnosticMessageChain, relatedMessages?: { | ||
export declare function makeTemplateDiagnostic(id: TypeCheckId, mapping: SourceMapping, span: ParseSourceSpan, category: ts.DiagnosticCategory, code: number, messageText: string | ts.DiagnosticMessageChain, relatedMessages?: { | ||
text: string; | ||
@@ -17,0 +17,0 @@ start: number; |
@@ -9,3 +9,3 @@ /** | ||
import { DeclarationNode } from '../../../reflection'; | ||
import { TemplateId } from '../../api'; | ||
export declare function getTemplateId(clazz: DeclarationNode): TemplateId; | ||
import { TypeCheckId } from '../../api'; | ||
export declare function getTypeCheckId(clazz: DeclarationNode): TypeCheckId; |
@@ -19,5 +19,5 @@ /** | ||
import { ComponentScopeReader, TypeCheckScopeRegistry } from '../../scope'; | ||
import { ElementSymbol, FullTemplateMapping, GlobalCompletion, NgTemplateDiagnostic, OptimizeFor, PotentialDirective, PotentialImport, PotentialImportMode, PotentialPipe, ProgramTypeCheckAdapter, TcbLocation, TemplateSymbol, TemplateTypeChecker, TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api'; | ||
import { ElementSymbol, FullSourceMapping, GlobalCompletion, NgTemplateDiagnostic, OptimizeFor, PotentialDirective, PotentialImport, PotentialImportMode, PotentialPipe, ProgramTypeCheckAdapter, TcbLocation, TemplateSymbol, TemplateTypeChecker, TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api'; | ||
import { ShimTypeCheckingData } from './context'; | ||
import { TemplateSourceManager } from './source'; | ||
import { DirectiveSourceManager } from './source'; | ||
/** | ||
@@ -86,3 +86,3 @@ * Primary template type-checking engine, which performs type-checking using a | ||
private getFileAndShimRecordsForPath; | ||
getTemplateMappingAtTcbLocation(tcbLocation: TcbLocation): FullTemplateMapping | null; | ||
getSourceMappingAtTcbLocation(tcbLocation: TcbLocation): FullSourceMapping | null; | ||
generateAllTypeCheckBlocks(): void; | ||
@@ -155,6 +155,6 @@ /** | ||
/** | ||
* Source mapping information for mapping diagnostics from inlined type check blocks back to the | ||
* original template. | ||
* Information for mapping diagnostics from inlined type check blocks | ||
* back to their original sources. | ||
*/ | ||
sourceManager: TemplateSourceManager; | ||
sourceManager: DirectiveSourceManager; | ||
/** | ||
@@ -161,0 +161,0 @@ * Data for each shim generated from this input file. |
@@ -12,3 +12,3 @@ /** | ||
import { GlobalCompletion, TcbLocation } from '../api'; | ||
import { TemplateData } from './context'; | ||
import { TypeCheckData } from './context'; | ||
/** | ||
@@ -32,3 +32,3 @@ * Powers autocompletion for a specific component. | ||
private expressionCompletionCache; | ||
constructor(tcb: ts.Node, data: TemplateData, tcbPath: AbsoluteFsPath, tcbIsShim: boolean); | ||
constructor(tcb: ts.Node, data: TypeCheckData, tcbPath: AbsoluteFsPath, tcbIsShim: boolean); | ||
/** | ||
@@ -35,0 +35,0 @@ * Get global completions within the given template context and AST node. |
@@ -8,14 +8,13 @@ /** | ||
*/ | ||
import { BoundTarget, ParseError, ParseSourceFile, R3TargetBinder, SchemaMetadata, TmplAstNode } from '@angular/compiler'; | ||
import { BoundTarget, ParseError, R3TargetBinder, SchemaMetadata, TmplAstNode } from '@angular/compiler'; | ||
import ts from 'typescript'; | ||
import { AbsoluteFsPath } from '../../file_system'; | ||
import { Reference, ReferenceEmitter } from '../../imports'; | ||
import { PipeMeta } from '../../metadata'; | ||
import { PerfRecorder } from '../../perf'; | ||
import { FileUpdate } from '../../program_driver'; | ||
import { ClassDeclaration, ReflectionHost } from '../../reflection'; | ||
import { TemplateDiagnostic, TemplateId, TemplateSourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata } from '../api'; | ||
import { TemplateDiagnostic, TypeCheckId, SourceMapping, TypeCheckableDirectiveMeta, TypeCheckContext, TypeCheckingConfig, TypeCtorMetadata, TemplateContext } from '../api'; | ||
import { DomSchemaChecker } from './dom'; | ||
import { OutOfBandDiagnosticRecorder } from './oob'; | ||
import { TemplateSourceManager } from './source'; | ||
import { DirectiveSourceManager } from './source'; | ||
import { TypeCheckFile } from './type_check_file'; | ||
@@ -38,15 +37,15 @@ export interface ShimTypeCheckingData { | ||
/** | ||
* Map of `TemplateId` to information collected about the template during the template | ||
* Map of `TypeCheckId` to information collected about the template during the template | ||
* type-checking process. | ||
*/ | ||
templates: Map<TemplateId, TemplateData>; | ||
data: Map<TypeCheckId, TypeCheckData>; | ||
} | ||
/** | ||
* Data tracked for each template processed by the template type-checking system. | ||
* Data tracked for each class processed by the type-checking system. | ||
*/ | ||
export interface TemplateData { | ||
export interface TypeCheckData { | ||
/** | ||
* Template nodes for which the TCB was generated. | ||
*/ | ||
template: TmplAstNode[]; | ||
template: TmplAstNode[] | null; | ||
/** | ||
@@ -58,5 +57,5 @@ * `BoundTarget` which was used to generate the TCB, and contains bindings for the associated | ||
/** | ||
* Errors found while parsing them template, which have been converted to diagnostics. | ||
* Errors found while parsing the template, which have been converted to diagnostics. | ||
*/ | ||
templateDiagnostics: TemplateDiagnostic[]; | ||
templateParsingDiagnostics: TemplateDiagnostic[]; | ||
} | ||
@@ -75,3 +74,3 @@ /** | ||
*/ | ||
sourceManager: TemplateSourceManager; | ||
sourceManager: DirectiveSourceManager; | ||
/** | ||
@@ -96,5 +95,5 @@ * Map of in-progress shim data for shims generated from this input file. | ||
/** | ||
* Map of `TemplateId` to information collected about the template as it's ingested. | ||
* Map of `TypeCheckId` to information collected about the template as it's ingested. | ||
*/ | ||
templates: Map<TemplateId, TemplateData>; | ||
data: Map<TypeCheckId, TypeCheckData>; | ||
} | ||
@@ -110,13 +109,13 @@ /** | ||
/** | ||
* Retrieve the `TemplateSourceManager` responsible for components in the given input file path. | ||
* Retrieve the `DirectiveSourceManager` responsible for directives in the given input file path. | ||
*/ | ||
getSourceManager(sfPath: AbsoluteFsPath): TemplateSourceManager; | ||
getSourceManager(sfPath: AbsoluteFsPath): DirectiveSourceManager; | ||
/** | ||
* Whether a particular component class should be included in the current type-checking pass. | ||
* Whether a particular class should be included in the current type-checking pass. | ||
* | ||
* Not all components offered to the `TypeCheckContext` for checking may require processing. For | ||
* example, the component may have results already available from a prior pass or from a previous | ||
* Not all classes offered to the `TypeCheckContext` for checking may require processing. For | ||
* example, the directive may have results already available from a prior pass or from a previous | ||
* program. | ||
*/ | ||
shouldCheckComponent(node: ts.ClassDeclaration): boolean; | ||
shouldCheckClass(node: ts.ClassDeclaration): boolean; | ||
/** | ||
@@ -127,3 +126,3 @@ * Report data from a shim generated from the given input file path. | ||
/** | ||
* Record that all of the components within the given input file path had code generated - that | ||
* Record that all of the classes within the given input file path had code generated - that | ||
* is, coverage for the file can be considered complete. | ||
@@ -149,4 +148,3 @@ */ | ||
* | ||
* The `TypeCheckContext` allows registration of components and their templates which need to be | ||
* type checked. | ||
* The `TypeCheckContext` allows registration of directives to be type checked. | ||
*/ | ||
@@ -178,3 +176,3 @@ export declare class TypeCheckContextImpl implements TypeCheckContext { | ||
*/ | ||
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; | ||
addDirective(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, schemas: SchemaMetadata[], templateContext: TemplateContext | null, isStandalone: boolean): void; | ||
/** | ||
@@ -193,5 +191,5 @@ * Record a type constructor for the given `node` with the given `ctorMetadata`. | ||
private addInlineTypeCheckBlock; | ||
private pendingShimForComponent; | ||
private pendingShimForClass; | ||
private dataForFile; | ||
} | ||
export declare function getTemplateDiagnostics(parseErrors: ParseError[], templateId: TemplateId, sourceMapping: TemplateSourceMapping): TemplateDiagnostic[]; | ||
export declare function getTemplateDiagnostics(parseErrors: ParseError[], templateId: TypeCheckId, sourceMapping: SourceMapping): TemplateDiagnostic[]; |
@@ -10,4 +10,4 @@ /** | ||
import ts from 'typescript'; | ||
import { TemplateDiagnostic, TemplateId } from '../api'; | ||
import { TemplateSourceResolver } from './tcb_util'; | ||
import { TemplateDiagnostic, TypeCheckId } from '../api'; | ||
import { TypeCheckSourceResolver } from './tcb_util'; | ||
/** | ||
@@ -38,6 +38,6 @@ * Wraps the node in parenthesis such that inserted span comments become attached to the proper | ||
/** | ||
* Adds a synthetic comment to the function declaration that contains the template id | ||
* Adds a synthetic comment to the function declaration that contains the type checking ID | ||
* of the class declaration. | ||
*/ | ||
export declare function addTemplateId(tcb: ts.FunctionDeclaration, id: TemplateId): void; | ||
export declare function addTypeCheckId(tcb: ts.FunctionDeclaration, id: TypeCheckId): void; | ||
/** | ||
@@ -57,2 +57,2 @@ * Determines if the diagnostic should be reported. Some diagnostics are produced because of the | ||
*/ | ||
export declare function translateDiagnostic(diagnostic: ts.Diagnostic, resolver: TemplateSourceResolver): TemplateDiagnostic | null; | ||
export declare function translateDiagnostic(diagnostic: ts.Diagnostic, resolver: TypeCheckSourceResolver): TemplateDiagnostic | null; |
@@ -9,4 +9,4 @@ /** | ||
import { ParseSourceSpan, SchemaMetadata, TmplAstElement } from '@angular/compiler'; | ||
import { TemplateDiagnostic, TemplateId } from '../api'; | ||
import { TemplateSourceResolver } from './tcb_util'; | ||
import { TemplateDiagnostic, TypeCheckId } from '../api'; | ||
import { TypeCheckSourceResolver } from './tcb_util'; | ||
/** | ||
@@ -59,5 +59,5 @@ * Checks every non-Angular element/property processed in a template and potentially produces | ||
get diagnostics(): ReadonlyArray<TemplateDiagnostic>; | ||
constructor(resolver: TemplateSourceResolver); | ||
checkElement(id: TemplateId, element: TmplAstElement, schemas: SchemaMetadata[], hostIsStandalone: boolean): void; | ||
checkProperty(id: TemplateId, element: TmplAstElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[], hostIsStandalone: boolean): void; | ||
constructor(resolver: TypeCheckSourceResolver); | ||
checkElement(id: TypeCheckId, element: TmplAstElement, schemas: SchemaMetadata[], hostIsStandalone: boolean): void; | ||
checkProperty(id: TypeCheckId, element: TmplAstElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[], hostIsStandalone: boolean): void; | ||
} |
@@ -11,4 +11,4 @@ /** | ||
import { ClassDeclaration } from '../../reflection'; | ||
import { TemplateDiagnostic, TemplateId } from '../api'; | ||
import { TemplateSourceResolver } from './tcb_util'; | ||
import { TemplateDiagnostic, TypeCheckId } from '../api'; | ||
import { TypeCheckSourceResolver } from './tcb_util'; | ||
/** | ||
@@ -29,7 +29,6 @@ * Collects `ts.Diagnostic`s on problems which occur in the template which aren't directly sourced | ||
* | ||
* @param templateId the template type-checking ID of the template which contains the broken | ||
* reference. | ||
* @param id the type-checking ID of the template which contains the broken reference. | ||
* @param ref the `TmplAstReference` which could not be matched to a directive. | ||
*/ | ||
missingReferenceTarget(templateId: TemplateId, ref: TmplAstReference): void; | ||
missingReferenceTarget(id: TypeCheckId, ref: TmplAstReference): void; | ||
/** | ||
@@ -39,7 +38,6 @@ * Reports usage of a `| pipe` expression in the template for which the named pipe could not be | ||
* | ||
* @param templateId the template type-checking ID of the template which contains the unknown | ||
* pipe. | ||
* @param id the type-checking ID of the template which contains the unknown pipe. | ||
* @param ast the `BindingPipe` invocation of the pipe which could not be found. | ||
*/ | ||
missingPipe(templateId: TemplateId, ast: BindingPipe): void; | ||
missingPipe(id: TypeCheckId, ast: BindingPipe): void; | ||
/** | ||
@@ -49,7 +47,6 @@ * Reports usage of a pipe imported via `@Component.deferredImports` outside | ||
* | ||
* @param templateId the template type-checking ID of the template which contains the unknown | ||
* pipe. | ||
* @param id the type-checking ID of the template which contains the unknown pipe. | ||
* @param ast the `BindingPipe` invocation of the pipe which could not be found. | ||
*/ | ||
deferredPipeUsedEagerly(templateId: TemplateId, ast: BindingPipe): void; | ||
deferredPipeUsedEagerly(id: TypeCheckId, ast: BindingPipe): void; | ||
/** | ||
@@ -59,11 +56,10 @@ * Reports usage of a component/directive imported via `@Component.deferredImports` outside | ||
* | ||
* @param templateId the template type-checking ID of the template which contains the unknown | ||
* pipe. | ||
* @param id the type-checking ID of the template which contains the unknown pipe. | ||
* @param element the element which hosts a component that was defer-loaded. | ||
*/ | ||
deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void; | ||
deferredComponentUsedEagerly(id: TypeCheckId, element: TmplAstElement): void; | ||
/** | ||
* Reports a duplicate declaration of a template variable. | ||
* | ||
* @param templateId the template type-checking ID of the template which contains the duplicate | ||
* @param id the type-checking ID of the template which contains the duplicate | ||
* declaration. | ||
@@ -73,5 +69,5 @@ * @param variable the `TmplAstVariable` which duplicates a previously declared variable. | ||
*/ | ||
duplicateTemplateVar(templateId: TemplateId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void; | ||
requiresInlineTcb(templateId: TemplateId, node: ClassDeclaration): void; | ||
requiresInlineTypeConstructors(templateId: TemplateId, node: ClassDeclaration, directives: ClassDeclaration[]): void; | ||
duplicateTemplateVar(id: TypeCheckId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void; | ||
requiresInlineTcb(id: TypeCheckId, node: ClassDeclaration): void; | ||
requiresInlineTypeConstructors(id: TypeCheckId, node: ClassDeclaration, directives: ClassDeclaration[]): void; | ||
/** | ||
@@ -81,32 +77,32 @@ * Report a warning when structural directives support context guards, but the current | ||
*/ | ||
suboptimalTypeInference(templateId: TemplateId, variables: TmplAstVariable[]): void; | ||
suboptimalTypeInference(id: TypeCheckId, variables: TmplAstVariable[]): void; | ||
/** | ||
* Reports a split two way binding error message. | ||
*/ | ||
splitTwoWayBinding(templateId: TemplateId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void; | ||
splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void; | ||
/** Reports required inputs that haven't been bound. */ | ||
missingRequiredInputs(templateId: TemplateId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void; | ||
missingRequiredInputs(id: TypeCheckId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void; | ||
/** | ||
* Reports accesses of properties that aren't available in a `for` block's tracking expression. | ||
*/ | ||
illegalForLoopTrackAccess(templateId: TemplateId, block: TmplAstForLoopBlock, access: PropertyRead): void; | ||
illegalForLoopTrackAccess(id: TypeCheckId, block: TmplAstForLoopBlock, access: PropertyRead): void; | ||
/** | ||
* Reports deferred triggers that cannot access the element they're referring to. | ||
*/ | ||
inaccessibleDeferredTriggerElement(templateId: TemplateId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void; | ||
inaccessibleDeferredTriggerElement(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void; | ||
/** | ||
* Reports cases where control flow nodes prevent content projection. | ||
*/ | ||
controlFlowPreventingContentProjection(templateId: TemplateId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void; | ||
controlFlowPreventingContentProjection(id: TypeCheckId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void; | ||
/** Reports cases where users are writing to `@let` declarations. */ | ||
illegalWriteToLetDeclaration(templateId: TemplateId, node: PropertyWrite, target: TmplAstLetDeclaration): void; | ||
illegalWriteToLetDeclaration(id: TypeCheckId, node: PropertyWrite, target: TmplAstLetDeclaration): void; | ||
/** Reports cases where users are accessing an `@let` before it is defined.. */ | ||
letUsedBeforeDefinition(templateId: TemplateId, node: PropertyRead, target: TmplAstLetDeclaration): void; | ||
letUsedBeforeDefinition(id: TypeCheckId, node: PropertyRead, target: TmplAstLetDeclaration): void; | ||
/** | ||
* Reports a `@let` declaration that conflicts with another symbol in the same scope. | ||
* | ||
* @param templateId the template type-checking ID of the template which contains the declaration. | ||
* @param id the type-checking ID of the template which contains the declaration. | ||
* @param current the `TmplAstLetDeclaration` which is invalid. | ||
*/ | ||
conflictingDeclaration(templateId: TemplateId, current: TmplAstLetDeclaration): void; | ||
conflictingDeclaration(id: TypeCheckId, current: TmplAstLetDeclaration): void; | ||
} | ||
@@ -121,20 +117,20 @@ export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnosticRecorder { | ||
private recordedPipes; | ||
constructor(resolver: TemplateSourceResolver); | ||
constructor(resolver: TypeCheckSourceResolver); | ||
get diagnostics(): ReadonlyArray<TemplateDiagnostic>; | ||
missingReferenceTarget(templateId: TemplateId, ref: TmplAstReference): void; | ||
missingPipe(templateId: TemplateId, ast: BindingPipe): void; | ||
deferredPipeUsedEagerly(templateId: TemplateId, ast: BindingPipe): void; | ||
deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void; | ||
duplicateTemplateVar(templateId: TemplateId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void; | ||
requiresInlineTcb(templateId: TemplateId, node: ClassDeclaration): void; | ||
requiresInlineTypeConstructors(templateId: TemplateId, node: ClassDeclaration, directives: ClassDeclaration[]): void; | ||
suboptimalTypeInference(templateId: TemplateId, variables: TmplAstVariable[]): void; | ||
splitTwoWayBinding(templateId: TemplateId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void; | ||
missingRequiredInputs(templateId: TemplateId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void; | ||
illegalForLoopTrackAccess(templateId: TemplateId, block: TmplAstForLoopBlock, access: PropertyRead): void; | ||
inaccessibleDeferredTriggerElement(templateId: TemplateId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void; | ||
controlFlowPreventingContentProjection(templateId: TemplateId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void; | ||
illegalWriteToLetDeclaration(templateId: TemplateId, node: PropertyWrite, target: TmplAstLetDeclaration): void; | ||
letUsedBeforeDefinition(templateId: TemplateId, node: PropertyRead, target: TmplAstLetDeclaration): void; | ||
conflictingDeclaration(templateId: TemplateId, decl: TmplAstLetDeclaration): void; | ||
missingReferenceTarget(id: TypeCheckId, ref: TmplAstReference): void; | ||
missingPipe(id: TypeCheckId, ast: BindingPipe): void; | ||
deferredPipeUsedEagerly(id: TypeCheckId, ast: BindingPipe): void; | ||
deferredComponentUsedEagerly(id: TypeCheckId, element: TmplAstElement): void; | ||
duplicateTemplateVar(id: TypeCheckId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void; | ||
requiresInlineTcb(id: TypeCheckId, node: ClassDeclaration): void; | ||
requiresInlineTypeConstructors(id: TypeCheckId, node: ClassDeclaration, directives: ClassDeclaration[]): void; | ||
suboptimalTypeInference(id: TypeCheckId, variables: TmplAstVariable[]): void; | ||
splitTwoWayBinding(id: TypeCheckId, input: TmplAstBoundAttribute, output: TmplAstBoundEvent, inputConsumer: ClassDeclaration, outputConsumer: ClassDeclaration | TmplAstElement): void; | ||
missingRequiredInputs(id: TypeCheckId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void; | ||
illegalForLoopTrackAccess(id: TypeCheckId, block: TmplAstForLoopBlock, access: PropertyRead): void; | ||
inaccessibleDeferredTriggerElement(id: TypeCheckId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void; | ||
controlFlowPreventingContentProjection(id: TypeCheckId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstSwitchBlockCase | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty, preservesWhitespaces: boolean): void; | ||
illegalWriteToLetDeclaration(id: TypeCheckId, node: PropertyWrite, target: TmplAstLetDeclaration): void; | ||
letUsedBeforeDefinition(id: TypeCheckId, node: PropertyRead, target: TmplAstLetDeclaration): void; | ||
conflictingDeclaration(id: TypeCheckId, decl: TmplAstLetDeclaration): void; | ||
} |
@@ -10,4 +10,4 @@ /** | ||
import ts from 'typescript'; | ||
import { TemplateId, TemplateSourceMapping } from '../api'; | ||
import { TemplateSourceResolver } from './tcb_util'; | ||
import { TypeCheckId, SourceMapping } from '../api'; | ||
import { TypeCheckSourceResolver } from './tcb_util'; | ||
/** | ||
@@ -18,6 +18,6 @@ * Represents the source of a template that was processed during type-checking. This information is | ||
export declare class TemplateSource { | ||
readonly mapping: TemplateSourceMapping; | ||
readonly mapping: SourceMapping; | ||
private file; | ||
private lineStarts; | ||
constructor(mapping: TemplateSourceMapping, file: ParseSourceFile); | ||
constructor(mapping: SourceMapping, file: ParseSourceFile); | ||
toParseSourceSpan(start: number, end: number): ParseSourceSpan; | ||
@@ -28,7 +28,7 @@ private toParseLocation; | ||
/** | ||
* Assigns IDs to templates and keeps track of their origins. | ||
* Assigns IDs for type checking and keeps track of their origins. | ||
* | ||
* Implements `TemplateSourceResolver` to resolve the source of a template based on these IDs. | ||
* Implements `TypeCheckSourceResolver` to resolve the source of a template based on these IDs. | ||
*/ | ||
export declare class TemplateSourceManager implements TemplateSourceResolver { | ||
export declare class DirectiveSourceManager implements TypeCheckSourceResolver { | ||
/** | ||
@@ -40,6 +40,6 @@ * This map keeps track of all template sources that have been type-checked by the id that is | ||
private templateSources; | ||
getTemplateId(node: ts.ClassDeclaration): TemplateId; | ||
captureSource(node: ts.ClassDeclaration, mapping: TemplateSourceMapping, file: ParseSourceFile): TemplateId; | ||
getSourceMapping(id: TemplateId): TemplateSourceMapping; | ||
toParseSourceSpan(id: TemplateId, span: AbsoluteSourceSpan): ParseSourceSpan | null; | ||
getTypeCheckId(node: ts.ClassDeclaration): TypeCheckId; | ||
captureTemplateSource(id: TypeCheckId, mapping: SourceMapping, file: ParseSourceFile): void; | ||
getTemplateSourceMapping(id: TypeCheckId): SourceMapping; | ||
toTemplateParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null; | ||
} |
@@ -12,21 +12,21 @@ /** | ||
import { Reference } from '../../imports'; | ||
import { FullTemplateMapping, SourceLocation, TemplateId, TemplateSourceMapping } from '../api'; | ||
import { FullSourceMapping, SourceLocation, TypeCheckId, SourceMapping } from '../api'; | ||
import { ReferenceEmitEnvironment } from './reference_emit_environment'; | ||
/** | ||
* Adapter interface which allows the template type-checking diagnostics code to interpret offsets | ||
* in a TCB and map them back to original locations in the template. | ||
* Adapter interface which allows the directive type-checking diagnostics code to interpret offsets | ||
* in a TCB and map them back to their original locations. | ||
*/ | ||
export interface TemplateSourceResolver { | ||
getTemplateId(node: ts.ClassDeclaration): TemplateId; | ||
export interface TypeCheckSourceResolver { | ||
getTypeCheckId(node: ts.ClassDeclaration): TypeCheckId; | ||
/** | ||
* For the given template id, retrieve the original source mapping which describes how the offsets | ||
* in the template should be interpreted. | ||
* For the given type checking id, retrieve the original source mapping which describes how the | ||
* offsets in the template should be interpreted. | ||
*/ | ||
getSourceMapping(id: TemplateId): TemplateSourceMapping; | ||
getTemplateSourceMapping(id: TypeCheckId): SourceMapping; | ||
/** | ||
* Convert an absolute source span associated with the given template id into a full | ||
* `ParseSourceSpan`. The returned parse span has line and column numbers in addition to only | ||
* absolute offsets and gives access to the original template source. | ||
* Convert an absolute source span coming from the template associated with the given type | ||
* checking id into a full `ParseSourceSpan`. The returned parse span has line and column | ||
* numbers in addition to only absolute offsets and gives access to the original source code. | ||
*/ | ||
toParseSourceSpan(id: TemplateId, span: AbsoluteSourceSpan): ParseSourceSpan | null; | ||
toTemplateParseSourceSpan(id: TypeCheckId, span: AbsoluteSourceSpan): ParseSourceSpan | null; | ||
} | ||
@@ -55,5 +55,5 @@ /** | ||
export declare function requiresInlineTypeCheckBlock(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, env: ReferenceEmitEnvironment, usedPipes: Reference<ClassDeclaration<ts.ClassDeclaration>>[], reflector: ReflectionHost): TcbInliningRequirement; | ||
/** Maps a shim position back to a template location. */ | ||
export declare function getTemplateMapping(shimSf: ts.SourceFile, position: number, resolver: TemplateSourceResolver, isDiagnosticRequest: boolean): FullTemplateMapping | null; | ||
export declare function findTypeCheckBlock(file: ts.SourceFile, id: TemplateId, isDiagnosticRequest: boolean): ts.Node | null; | ||
/** Maps a shim position back to a source code location. */ | ||
export declare function getSourceMapping(shimSf: ts.SourceFile, position: number, resolver: TypeCheckSourceResolver, isDiagnosticRequest: boolean): FullSourceMapping | null; | ||
export declare function findTypeCheckBlock(file: ts.SourceFile, id: TypeCheckId, isDiagnosticRequest: boolean): ts.Node | null; | ||
/** | ||
@@ -60,0 +60,0 @@ * Traverses up the AST starting from the given node to extract the source location from comments |
@@ -13,3 +13,3 @@ /** | ||
import { ElementSymbol, LetDeclarationSymbol, ReferenceSymbol, Symbol, TemplateSymbol, VariableSymbol } from '../api'; | ||
import { TemplateData } from './context'; | ||
import { TypeCheckData } from './context'; | ||
/** | ||
@@ -25,7 +25,7 @@ * Generates and caches `Symbol`s for various template structures for a given component. | ||
private readonly typeCheckBlock; | ||
private readonly templateData; | ||
private readonly typeCheckData; | ||
private readonly componentScopeReader; | ||
private readonly getTypeChecker; | ||
private symbolCache; | ||
constructor(tcbPath: AbsoluteFsPath, tcbIsShim: boolean, typeCheckBlock: ts.Node, templateData: TemplateData, componentScopeReader: ComponentScopeReader, getTypeChecker: () => ts.TypeChecker); | ||
constructor(tcbPath: AbsoluteFsPath, tcbIsShim: boolean, typeCheckBlock: ts.Node, typeCheckData: TypeCheckData, componentScopeReader: ComponentScopeReader, getTypeChecker: () => ts.TypeChecker); | ||
getSymbol(node: TmplAstTemplate | TmplAstElement): TemplateSymbol | ElementSymbol | null; | ||
@@ -32,0 +32,0 @@ getSymbol(node: TmplAstReference | TmplAstVariable | TmplAstLetDeclaration): ReferenceSymbol | VariableSymbol | LetDeclarationSymbol | null; |
@@ -13,3 +13,3 @@ /** | ||
import { ClassDeclaration } from '../../reflection'; | ||
import { TemplateId, TypeCheckableDirectiveMeta, TypeCheckBlockMetadata } from '../api'; | ||
import { TypeCheckId, TypeCheckableDirectiveMeta, TypeCheckBlockMetadata } from '../api'; | ||
import { DomSchemaChecker } from './dom'; | ||
@@ -131,3 +131,3 @@ import { Environment } from './environment'; | ||
readonly oobRecorder: OutOfBandDiagnosticRecorder; | ||
readonly id: TemplateId; | ||
readonly id: TypeCheckId; | ||
readonly boundTarget: BoundTarget<TypeCheckableDirectiveMeta>; | ||
@@ -139,3 +139,3 @@ private pipes; | ||
private nextId; | ||
constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, PipeMeta>, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean); | ||
constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TypeCheckId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, PipeMeta> | null, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean); | ||
/** | ||
@@ -142,0 +142,0 @@ * Allocate a new variable name for use within the `Context`. |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2648737
0.28%44390
0.3%22
15.79%