Documentation
¶
Overview ¶
Package typescript provides a Source interface implementation for parsing TypeScript source code from any TypeScript-based library (Angular, NestJS, RxJS, Zod, etc.). It uses tree-sitter for AST parsing and the shared JSDoc parser for documentation extraction.
Index ¶
- func NewAdonisFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewAnalogFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewAngularFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewAstroFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewBlitzFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDateFnsFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDrizzleFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewEffectFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewElectronFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewElysiaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewFeathersFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewFoalFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewFreshFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewHonoFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewJestFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNestJSFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNextJSFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNitroFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNuxtFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewPrismaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRxJSFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSocketIOFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSolidFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewStdlibFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewStrapiFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewTRPCFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewTypeORMFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewVitestFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewZodFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- type Config
- type Option
- type Source
- func (s *Source) DetectWrapper(method *source.Method) (bool, string, string)
- func (s *Source) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
- func (s *Source) ID() string
- func (s *Source) Meta() source.LibraryMeta
- func (s *Source) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
- func (s *Source) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
- func (s *Source) ParseSourceCode(entityID string, content []byte) (string, error)
- func (s *Source) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdonisFactory ¶
NewAdonisFactory creates a Source for the AdonisJS framework.
func NewAnalogFactory ¶
NewAnalogFactory creates a Source for the Analog framework.
func NewAngularFactory ¶
NewAngularFactory creates a Source for the Angular framework.
func NewAstroFactory ¶
NewAstroFactory creates a Source for the Astro framework.
func NewBlitzFactory ¶
NewBlitzFactory creates a Source for the Blitz.js framework.
func NewDateFnsFactory ¶
NewDateFnsFactory creates a Source for the date-fns library.
func NewDrizzleFactory ¶
NewDrizzleFactory creates a Source for the Drizzle ORM.
func NewEffectFactory ¶
NewEffectFactory creates a Source for the Effect library.
func NewElectronFactory ¶
NewElectronFactory creates a Source for the Electron framework.
func NewElysiaFactory ¶
NewElysiaFactory creates a Source for the Elysia framework.
func NewFeathersFactory ¶
NewFeathersFactory creates a Source for the Feathers framework.
func NewFoalFactory ¶
NewFoalFactory creates a Source for the FoalTS framework.
func NewFreshFactory ¶
NewFreshFactory creates a Source for the Fresh framework.
func NewHonoFactory ¶
NewHonoFactory creates a Source for the Hono web framework.
func NewJestFactory ¶
NewJestFactory creates a Source for the Jest testing framework.
func NewNestJSFactory ¶
NewNestJSFactory creates a Source for the NestJS framework.
func NewNextJSFactory ¶
NewNextJSFactory creates a Source for the Next.js framework.
func NewNitroFactory ¶
NewNitroFactory creates a Source for the Nitro server toolkit.
func NewNuxtFactory ¶
NewNuxtFactory creates a Source for the Nuxt framework.
func NewPrismaFactory ¶
NewPrismaFactory creates a Source for the Prisma ORM.
func NewRxJSFactory ¶
NewRxJSFactory creates a Source for the RxJS reactive extensions library.
func NewSocketIOFactory ¶
NewSocketIOFactory creates a Source for the Socket.IO library.
func NewSolidFactory ¶
NewSolidFactory creates a Source for the SolidJS reactive UI library. Replaces Wasp, whose compiler is written in Haskell and cannot be indexed by the TypeScript adapter.
func NewStdlibFactory ¶
NewStdlibFactory creates a Source for the TypeScript standard type definitions.
func NewStrapiFactory ¶
NewStrapiFactory creates a Source for the Strapi headless CMS.
func NewTRPCFactory ¶
NewTRPCFactory creates a Source for the tRPC framework.
func NewTypeORMFactory ¶
NewTypeORMFactory creates a Source for the TypeORM database framework.
func NewVitestFactory ¶
NewVitestFactory creates a Source for the Vitest testing framework.
func NewZodFactory ¶
NewZodFactory creates a Source for the Zod schema validation library.
Types ¶
type Config ¶
type Config struct {
// LibraryID is the canonical library ID (e.g., "typescript/angular").
LibraryID string
// Name is the human-readable library name (e.g., "Angular").
Name string
// Description is a brief library description.
Description string
// SourceURL is the canonical URL (e.g., "https://github.com/angular/angular").
SourceURL string
// Owner is the GitHub repository owner.
Owner string
// Repo is the GitHub repository name.
Repo string
// SourceDirs are relative directories within the repo to scan.
// If empty, defaults to ["src/"].
SourceDirs []string
// ExcludeDirs are directory names to skip during discovery.
// Always includes: node_modules, test, tests, __tests__, dist, build, .git
ExcludeDirs []string
// IncludeDeclarationFiles controls whether .d.ts files are indexed.
// Useful for type-only libraries.
IncludeDeclarationFiles bool
}
Config holds the configuration for a TypeScript source adapter. Each TypeScript library (Angular, NestJS, RxJS, etc.) provides its own Config with appropriate repository and directory settings.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is a documentation source adapter that reads TypeScript source code from a local clone of a GitHub repository. It uses tree-sitter for AST parsing and JSDoc for documentation extraction.
func (*Source) DetectWrapper ¶
DetectWrapper analyzes a method's source code for wrapper patterns.
func (*Source) DiscoverEntities ¶
DiscoverEntities walks the local repository and returns identifiers for all exported TypeScript entities. The fetch parameter is unused -- all discovery reads files locally.
func (*Source) Meta ¶
func (s *Source) Meta() source.LibraryMeta
Meta returns metadata for the library record.
func (*Source) ParseEntity ¶
func (s *Source) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
ParseEntity parses a single entity from file content.
func (*Source) ParseMethod ¶
func (s *Source) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
ParseMethod parses a single method from file content.
func (*Source) ParseSourceCode ¶
ParseSourceCode extracts just the source code of a specific entity or method from file content.
func (*Source) ResolveWrapperURL ¶
ResolveWrapperURL constructs an identifier to fetch the wrapped target's source.