javascript

package
v0.0.4-beta.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package javascript implements a tree-sitter-based parser for JavaScript and TypeScript source files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Path       string
	Type       string // "import" | "require"
	LineNumber int
	IsLocal    bool
}

Dependency represents an import or require statement.

type Entity

type Entity struct {
	Name      string
	Type      string // "function" | "method" | "class"
	Kind      string // "function" | "async_function" | "arrow_function" | "async_arrow_function" | "method" | "async_method" | "class"
	Signature string
	StartLine int
	EndLine   int
	Docs      string
	Parent    string // enclosing class name, or ""
}

Entity represents a named code element.

type JSParser

type JSParser struct{}

JSParser is the entry point.

func (*JSParser) Parse

func (p *JSParser) Parse(filePath string, content string) (*ParseResult, error)

Parse parses a JavaScript or TypeScript source file using tree-sitter.

type ParseResult

type ParseResult struct {
	FilePath     string
	Entities     []*Entity
	Dependencies []*Dependency
}

ParseResult is the output of Parse.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL