UNPKG

@vendure/ngx-translate-extract

Version:

Extract strings from projects using ngx-translate

42 lines (41 loc) 3.3 kB
import { ParsedTemplate, type TmplAstNode, TmplAstSwitchBlock } from '@angular/compiler'; import pkg, { type CallExpression, type ClassDeclaration, type ConstructorDeclaration, type Expression, type Identifier, type Node, type PropertyAssignment, type SourceFile } from 'typescript'; interface ParsedScriptSource { source: string; parsedFile: SourceFile; parsedTemplates: ParsedTemplate[]; } interface ParsedTemplateSource { source: string; parsedFile: null; parsedTemplates: [ParsedTemplate]; } type ParsedSource = ParsedScriptSource | ParsedTemplateSource; export declare function clearAstCache(): void; export declare function getAST(source: string, fileName?: string): ParsedSource; export declare function parseSource(source: string, fileName?: string): ParsedSource; export declare function getComponentInlineTemplate(node: Node): PropertyAssignment[]; export declare function getNamedImportIdentifiers(node: Node, moduleName: string, importPath: string | RegExp): Identifier[]; export declare function getNamedImport(node: Node, importName: string, importPath: string | RegExp): string | null; export declare function getNamedImportAlias(node: Node, importName: string, importPath: string | RegExp): string | null; export declare function findClassDeclarations(node: Node, name?: string): ClassDeclaration[]; export declare function findFunctionExpressions(node: Node): pkg.Node[]; export declare function getSuperClassName(node: Node): string | null; export declare function getImportPath(node: Node, className: string): string | null; export declare function findClassPropertiesByType(node: ClassDeclaration, type: string): string[]; export declare function findConstructorDeclaration(node: ClassDeclaration): ConstructorDeclaration | undefined; export declare function findMethodParameterByType(node: Node, type: string): string | null; export declare function findVariableNameByInjectType(node: Node, type: string): string | null; export declare function findMethodCallExpressions(node: Node, propName: string, fnName: string | string[]): CallExpression[]; export declare function findInlineInjectCallExpressions(node: Node, injectType: string, fnName: string | string[]): CallExpression[]; export declare function findClassPropertiesConstructorParameterByType(node: ClassDeclaration, type: string): string[]; export declare function findClassPropertiesDeclarationByType(node: ClassDeclaration, type: string): string[]; export declare function findClassPropertiesDeclarationByInject(node: ClassDeclaration, type: string): string[]; export declare function findClassPropertiesGetterByType(node: ClassDeclaration, type: string): string[]; export declare function findFunctionCallExpressions(node: Node, fnName: string | string[]): CallExpression[]; export declare function findSimpleCallExpressions(node: Node, fnName: string): pkg.CallExpression[]; export declare function findPropertyCallExpressions(node: Node, prop: string, fnName: string | string[]): CallExpression[]; export declare function getStringsFromExpression(expression: Expression): string[]; export declare function getNodesFromSwitchBlockTmpl(node: TmplAstSwitchBlock): TmplAstNode[]; export declare function unwrapMatchedCallExpressions(nodes: Node[], fnNames: string[]): CallExpression[]; export {};