Repository navigation
Expand file tree
/
Copy pathtypes.go
More file actions
97 lines (84 loc) · 2.78 KB
/
Copy pathtypes.go
File metadata and controls
97 lines (84 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package provides
// EvidenceMethod identifies how a package or binding mapping was obtained.
type EvidenceMethod string
const (
// EvidenceResolver comes from package-manager resolution output.
EvidenceResolver EvidenceMethod = "resolver"
// EvidenceManifest comes from a manifest, lockfile, or import map.
EvidenceManifest EvidenceMethod = "manifest"
// EvidenceInstalled comes from installed package metadata or contents.
EvidenceInstalled EvidenceMethod = "installed"
// EvidenceArtifact comes from a package artifact.
EvidenceArtifact EvidenceMethod = "artifact"
// EvidenceCurated comes from an explicit maintained mapping.
EvidenceCurated EvidenceMethod = "curated"
// EvidenceHeuristic comes from an opt-in naming guess.
EvidenceHeuristic EvidenceMethod = "heuristic"
)
// MatchMode controls how a source name matches an import name.
type MatchMode string
const (
// MatchExact matches only the complete source name.
MatchExact MatchMode = "exact"
// MatchPrefix matches a source-name prefix.
MatchPrefix MatchMode = "prefix"
)
// Evidence describes where a mapping came from.
type Evidence struct {
Method EvidenceMethod
Source string
}
// Package identifies a package whose source-level surface should be resolved.
type Package struct {
PURL string
}
// Surface contains the source-level names provided by a package.
type Surface struct {
PURL string
Provides []ProvidedName
}
// ProvidedName is a source-level name supplied by a package.
type ProvidedName struct {
Language string
Name string
Kind string
Match MatchMode
// Separator is the boundary between a prefix name and a matched
// descendant, for example "." for a Python module or "/" for an npm
// subpath. It is unused for MatchExact.
Separator string
// CaseInsensitive folds ASCII case when matching. Set it for languages
// whose module or namespace lookup is itself case-insensitive, for
// example PHP, where `use GuzzleHttp\Client` and `use guzzlehttp\client`
// resolve to the same class. Name still retains its canonical spelling.
CaseInsensitive bool
Evidence []Evidence
}
// Binding connects a package to the name used by one project.
type Binding struct {
PURL string
Imported string
Target string
Local string
Match MatchMode
Evidence []Evidence
}
// Diagnostic records a non-fatal resolver problem.
type Diagnostic struct {
Source string
Message string
}
// SurfaceOptions controls package-surface resolution.
type SurfaceOptions struct {
IncludeHeuristics bool
}
// SurfaceResult contains a package surface and any non-fatal diagnostics.
type SurfaceResult struct {
Surface Surface
Diagnostics []Diagnostic
}
// BindingResult contains project bindings and any non-fatal diagnostics.
type BindingResult struct {
Bindings []Binding
Diagnostics []Diagnostic
}