Documentation
¶
Overview ¶
Package extract holds the shared types used by depusage's public API and its per-language sub-packages. Splitting the types out here breaks the import cycle that would otherwise exist between the root package (which dispatches by Language) and the per-language extractors (which need to construct Result/Import values).
External callers should use the re-exported aliases in package depusage; the path under internal/ is not part of the API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallGraph ¶
CallGraph is the per-file caller→callees graph. Edges keys are Function.Name values; entries point at other Function names within the same file. Calls to non-local symbols are excluded.
type Function ¶
type Function struct {
Name string
Exported bool // visible outside the file per language rules
StartLn int
EndLn int
}
Function is a function-or-method definition discovered in the file.
type Import ¶
type Import struct {
Module string
DepKey string
Symbols []string // imported binding names; ["*"] wildcard, ["default"] default
Aliases map[string]string // local-name → canonical-symbol within Module
Kind ImportKind
Line int
Column int
}
Import is a single reference to an external (or relative) module.
Module is the verbatim string from the source. DepKey is the per-ecosystem normalization to a lockfile key (e.g. npm scoped `@scope/pkg/sub` → `@scope/pkg`); empty when normalization can't resolve to a single key (e.g. relative paths, computed imports).
type ImportKind ¶
type ImportKind string
ImportKind classifies how a module reference enters the file.
const ( // ImportStatic is a top-level static import: ES `import`, // Python `from ... import`, Go `import "x"`, Java `import com.x.Y`. ImportStatic ImportKind = "static" // ImportDynamic is a runtime import expression: `import("x")`, // `__import__`, `Class.forName`. The argument may be a literal // (captured) or computed (skipped). ImportDynamic ImportKind = "dynamic" // ImportRequire is a function-style import: node `require("x")`, // Ruby `require "x"`, PHP `require_once`. ImportRequire ImportKind = "require" // ImportRelative covers same-project paths (`./x`, `../x`). The // raw Module is preserved; DepKey is empty. ImportRelative ImportKind = "relative" )
type Language ¶
type Language string
Language identifies the source-language grammar to use. Each value corresponds to one tree-sitter grammar bundled by the library.
type Options ¶
Options selects which passes to run. Each pass gates downstream passes — UsedSymbols depends on Imports, CallGraph is independent.