UNPKG

ngast

Version:

Parsing tools for Angular. The project is an abstraction over the Angular compiler which provides friendly interface.

52 lines (51 loc) 3.06 kB
import { WorkspaceSymbols } from './workspace.symbols'; import { ClassDeclaration, DeclarationNode, Decorator } from '@angular/compiler-cli/src/ngtsc/reflection'; import { Trait, AnalyzedTrait, ResolvedTrait } from '@angular/compiler-cli/src/ngtsc/transform'; import { AnnotationNames } from './utils'; import { NgModuleAnalysis } from '@angular/compiler-cli/src/ngtsc/annotations/src/ng_module'; import { PipeHandlerData } from '@angular/compiler-cli/src/ngtsc/annotations/src/pipe'; import { InjectableHandlerData } from '@angular/compiler-cli/src/ngtsc/annotations/src/injectable'; import { DirectiveHandlerData } from '@angular/compiler-cli/src/ngtsc/annotations/src/directive'; import { ComponentAnalysisData } from '@angular/compiler-cli/src/ngtsc/annotations/src/component'; declare const handlerName: { readonly NgModule: "NgModuleDecoratorHandler"; readonly Pipe: "PipeDecoratorHandler"; readonly Injectable: "InjectableDecoratorHandler"; readonly Directive: "DirectiveDecoratorHandler"; readonly Component: "ComponentDecoratorHandler"; }; export interface HandlerData { 'NgModuleDecoratorHandler': NgModuleAnalysis; 'PipeDecoratorHandler': PipeHandlerData; 'InjectableDecoratorHandler': InjectableHandlerData; 'DirectiveDecoratorHandler': DirectiveHandlerData; 'ComponentDecoratorHandler': ComponentAnalysisData; } declare type GetHandlerData<A extends keyof typeof handlerName> = HandlerData[(typeof handlerName)[A]]; export declare const filterByHandler: <A extends "NgModule" | "Pipe" | "Injectable" | "Directive" | "Component">(annotation: A) => (trait: Trait<Decorator, any, unknown>) => trait is Trait<Decorator, GetHandlerData<A>, unknown>; export declare const isAnalysed: <A, B, C>(trait?: import("@angular/compiler-cli/src/ngtsc/transform").PendingTrait<A, B, C> | import("@angular/compiler-cli/src/ngtsc/transform").SkippedTrait<A, B, C> | AnalyzedTrait<A, B, C> | ResolvedTrait<A, B, C> | undefined) => trait is AnalyzedTrait<A, B, C> | ResolvedTrait<A, B, C>; export declare abstract class Symbol<A extends AnnotationNames> { protected workspace: WorkspaceSymbols; node: ClassDeclaration<DeclarationNode>; readonly abstract annotation: A; private _trait; private _path; constructor(workspace: WorkspaceSymbols, node: ClassDeclaration<DeclarationNode>); /** Name of the class */ get name(): string; /** Path where the class is declared */ get path(): string; /** Logs from @angular/compiler when something got wrong */ get diagnostics(): import("typescript").Diagnostic[] | null; /** Check if the ClassDeclaration has been analyzed by the trait compiler */ get isAnalysed(): boolean; /** The record of the ClassDeclaration in the trait compiler */ private get record(); /** The result of the analysis. Specific per annotation */ get analysis(): Readonly<GetHandlerData<A>> | null; private get trait(); /** Analyse this specific ClassDeclaration */ analyse(): void; protected ensureAnalysis(): void; } export {};