Documentation
¶
Overview ¶
Package typescript parses TypeScript source files for code analysis.
Extracts functions, classes, interfaces, and type definitions from .ts and .tsx files.
Index ¶
- func NewTypeScriptPlugin(logger *slog.Logger) schema.ParserPlugin
- type Parser
- func (p *Parser) CanHandle(path string, info fs.FileInfo) bool
- func (p *Parser) Chunk(content string, path string, opts *schema.CodeChunkingOptions) ([]schema.CodeChunk, error)
- func (p *Parser) Extensions() []string
- func (p *Parser) ExtractMetadata(content string, path string) (schema.FileMetadata, error)
- func (p *Parser) ExtractUsedSymbols(content string) []string
- func (p *Parser) IsGenerated(content string, path string) bool
- func (p *Parser) Name() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTypeScriptPlugin ¶
func NewTypeScriptPlugin(logger *slog.Logger) schema.ParserPlugin
NewTypeScriptPlugin creates and initializes a new TypeScript parser that satisfies the ParserPlugin interface.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements the schema.ParserPlugin interface for TypeScript.
func (*Parser) CanHandle ¶
CanHandle determines if the parser can process a given file. It accepts .ts and .tsx files, excluding common test file patterns (*.test.*, *.spec.*).
func (*Parser) Chunk ¶
func (p *Parser) Chunk(content string, path string, opts *schema.CodeChunkingOptions) ([]schema.CodeChunk, error)
Chunk parses TypeScript code and divides it into logical code chunks.
func (*Parser) Extensions ¶
Extensions returns the file extensions this parser handles.
func (*Parser) ExtractMetadata ¶
ExtractMetadata parses TypeScript code to extract high-level metadata.
func (*Parser) ExtractUsedSymbols ¶ added in v0.15.0
ExtractUsedSymbols identifies potential external types/functions being used in the code.