import { posix as path } from 'path' ; import { ObjectLiteralExpression , ClassDeclaration , SourceFile , Decorator , PropertyAssignment , StringLiteral } from 'ts-simple-ast' ; /**
 * [Abstract] Angular External Resources Analyzer
 */ export abstract class AngularExternalResourcesAnalyzer { param classDeclaration param propertyName returns protected static getComponentDecoratorPropertyOrThrow ( classDeclaration , propertyName ) { const componentDecorator = classDeclaration . getDecoratorOrThrow ( 'Component' ) ; const componentDecoratorArgument = < ObjectLiteralExpression > componentDecorator . getArguments ( ) [ 0 ] || ( ( ) => { throw new Error ( 'Component decorator does not have an argument.' ) ; } ) ( ) ; const componentDecoratorProperty = < PropertyAssignment > componentDecoratorArgument . getPropertyOrThrow ( propertyName ) ; return componentDecoratorProperty ; } param externalResourceAssigmentValue returns protected static getExternalResourcePath ( externalResourceAssigmentValue ) { return externalResourceAssigmentValue . getText ( ) . replace ( /['"`]/g , '' ) ; } param externalResourcePath returns protected static resolveExternalResourcePath ( externalResourcePath , file ) { return path . isAbsolute ( externalResourcePath ) ? externalResourcePath : path . join ( path . dirname ( file . getFilePath ( ) ) , externalResourcePath ) ; } }