Documentation
¶
Overview ¶
Package deps extracts direct dependencies from Go and npm manifests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GoPlugin ¶
type GoPlugin struct{}
func (GoPlugin) Run ¶
Run reports every requirement of every go.mod. A requirement marked // indirect is a transitive dependency: direct false, roots the module folder. Since Go 1.17 a module's go.mod lists every module its build needs, so go.mod is the lockfile; go.sum adds hashes, not packages. No via: go.mod does not record which module requires which. The key carries the module directory, so two modules in one repo can pin different versions without clashing, and the unit links the dependency to the service built from that directory.
A requirement is internal when a replace directive points it to a folder of the repo with a go.mod, or a go.work uses both modules.
Scope comes from the import lines of the module's own Go files: imported from a non-test file = prod, only from _test.go = test, imported nowhere = unknown (a tool, a build tag, a leftover).
type NpmPlugin ¶
type NpmPlugin struct{}
func (NpmPlugin) Run ¶
Run reports the direct dependencies of every package.json. The version is the exact one from the nearest package-lock.json when it has the package, else the declared range as written (a URL in either loses its credentials); the licence is the lockfile's, when it records one.
Transitive dependencies come from package-lock.json (lockfile version 2 or 3, the packages section): one fact per installed location that a manifest reaches only through another package, resolved the way npm resolves node_modules. Without a lockfile, direct dependencies only.
A dependency is internal when it names a member of the workspace its manifest belongs to, or its spec is workspace:, file: or link: pointing to a tracked package.json. It then carries internal {name, path, spec} and is never a third-party package.
type NugetPlugin ¶
type NugetPlugin struct{}
func (NugetPlugin) Name ¶
func (NugetPlugin) Name() string
func (NugetPlugin) Run ¶
func (NugetPlugin) Run(r *repo.Repo) plugin.Result
Run reports the direct dependencies of every .NET project file: PackageReference items with their versions resolved by the msbuild reader, ProjectReference items to other projects of the repo as internal dependencies, and, for a non-SDK-style project only, the entries of its sibling packages.config (which lists transitive packages too, so every entry is direct).
The key carries the lower-cased NuGet id, since ids are case-insensitive; name keeps the spelling as written. A package listed twice in one project (for example per target framework) is reported once, from its first line. A project reference that leaves the repo, or names a project the repo does not contain, gives no fact.
func (NugetPlugin) Version ¶
func (NugetPlugin) Version() string
func (NugetPlugin) Watches ¶
func (NugetPlugin) Watches(p string) bool
type PythonPlugin ¶
type PythonPlugin struct{}
PythonPlugin reads Python dependencies: pyproject.toml (PEP 621 [project], [dependency-groups], Poetry tables) and requirements*.txt (PEP 508 lines, -r includes), with the exact version from a lockfile in the same folder or above (uv.lock, poetry.lock, Pipfile.lock). Transitive dependencies come from the same lockfile: uv.lock and poetry.lock record which package requires which; Pipfile.lock does not, so its other packages are transitive with no via. Nothing is installed or run; setup.py is code and is not read.
func (PythonPlugin) Name ¶
func (PythonPlugin) Name() string
func (PythonPlugin) Version ¶
func (PythonPlugin) Version() string
func (PythonPlugin) Watches ¶
func (PythonPlugin) Watches(p string) bool