Description
Represents a reflected module as a collection of imports, exports and class/interface/function/type-alias/enum declarations
Methods
-
getTSNode
codeThe original TypeScript node
getTSNode(): SourceFileReturns
SourceFile:The TypeScript AST node associated with this module
-
getSourcePath
codeThe path to the source file for this module relative to the current working directory
getSourcePath(): stringReturns
string:The relative path where the module is located
-
getOutputPath
codeThe path where the JS file will be output by the TypeScript Compiler
getOutputPath(): stringReturns
string:The relative path where the TypeScript compiler would emit the JS module. If the source file is a JS file, it returns the source path.
-
getContext
codeThe context includes useful APIs that are shared across all the reflected symbols. Some APIs include the parsed configuration options, the system interface, the type checker
getContext(): ProjectContextReturns
ProjectContext:The analyser context
-
getImports
codeAll the import declarations found in the source file
getImports(): ImportNode[]Returns
ImportNode[]:The reflected import declarations
-
getExports
codeAll the export declarations found in the source file
getExports(): ExportNode[]Returns
ExportNode[]:The reflected export declarations
-
getDeclarations
codeAll the class/interface/function/type-alias/enum declarations found in the source file
getDeclarations(): DeclarationNode<Declaration, Node>[]Returns
DeclarationNode<Declaration, Node>[]:The reflected declaration nodes
-
getJSDoc
codeReflects the module-level JSDoc comment
getJSDoc(): CommentNodeReturns
CommentNode:The module-level JSDoc comment blocks for a given source file.
-
getDeclarationByKind
codeFinds a declaration based on it’s kind
getDeclarationByKind(kind: DeclarationKind): DeclarationNode<Declaration, Node>[]Parameters
kind DeclarationKindThe declaration kind
Returns
DeclarationNode<Declaration, Node>[]:All declaration nodes found
-
getDeclarationByName
codeFinds a declaration based on it’s name
getDeclarationByName(name: string): DeclarationNode<Declaration, Node> | nullParameters
name stringThe declaration name
Returns
DeclarationNode<Declaration, Node> | null:The matched declaration found if any
-
getDeclarationsByCategory
codegetDeclarationsByCategory(category: string): DeclarationNode<Declaration, Node>[]Parameters
category stringReturns
DeclarationNode<Declaration, Node>[]: -
serialize
codeSerializes the reflected node
serialize(): ModuleReturns
Module:The reflected node as a serializable object