Documentation
¶
Overview ¶
Package provider defines the extension point of the permits library. A new dependency ecosystem is added by implementing Scanner (parse a lockfile into dependencies) and Fetcher (retrieve raw license artifacts for a dependency), then registering them in a Registry. The collector depends only on these interfaces and never on a concrete ecosystem, so third parties can add ecosystems without forking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirectScanner ¶
type DirectScanner interface {
Scanner
ScanDirect(ctx context.Context, path string) ([]model.Dependency, error)
}
DirectScanner is an optional capability: a Scanner that can also restrict results to the project's direct (top-level) dependencies, excluding transitive ones. Providers implement it when the distinction is recoverable (pnpm importers / top-level deps, go.mod non-indirect requires). The collector checks for this interface only when direct-only mode is requested.
type Fetcher ¶
type Fetcher interface {
Source
// Fetch returns every license artifact found for dep. Returning an empty slice with a nil
// error means "fetched, but no license file present".
Fetch(ctx context.Context, dep model.Dependency) ([]model.LicenseArtifact, error)
}
Fetcher retrieves the raw license artifacts for a single dependency.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps an ecosystem to its Scanner and Fetcher.
func (*Registry) FetcherFor ¶
FetcherFor returns the fetcher registered for the given ecosystem.
type Scanner ¶
type Scanner interface {
Source
// Detect reports whether this scanner handles the given file. It may inspect the filename
// and/or peek at the file contents.
Detect(path string) bool
// Scan parses the file into the resolved dependency set.
Scan(ctx context.Context, path string) ([]model.Dependency, error)
}
Scanner parses a lockfile/manifest into the set of resolved dependencies.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package gomod implements the permits provider for the Go module ecosystem: a Scanner for go.sum and a Fetcher that reads raw license text from the local module cache, falling back to the Go module proxy when the module is not cached.
|
Package gomod implements the permits provider for the Go module ecosystem: a Scanner for go.sum and a Fetcher that reads raw license text from the local module cache, falling back to the Go module proxy when the module is not cached. |
|
Package npm implements the permits provider for the npm ecosystem: a Scanner for pnpm-lock.yaml (lockfileVersion 5, 6 and 9) and a Fetcher that resolves raw license text from the package tarball published to the npm registry.
|
Package npm implements the permits provider for the npm ecosystem: a Scanner for pnpm-lock.yaml (lockfileVersion 5, 6 and 9) and a Fetcher that resolves raw license text from the package tarball published to the npm registry. |