Documentation ¶
Index ¶
- func FindMaxVersion(version string, versions []string) string
- func ParsePackageJsonWithLock(pkgjson *PackageJson, pkglock *PackageLock) *model.DepGraph
- func ParsePackageJsonWithLockV3(pkgjson *PackageJson, pkglock *PackageLock) *model.DepGraph
- func ParsePackageJsonWithNode(pkgjson *PackageJson, nodeMap map[string]*PackageJson, ...) *model.DepGraph
- func ParsePackageJsonWithYarnLock(pkgjson *PackageJson, yarnlock map[string]*YarnLock) *model.DepGraph
- func ParseYarnLock(file *model.File) map[string]*YarnLock
- func RegisterNpmOrigin(origin func(name, version string) *PackageJson)
- func RegisterNpmRepo(repos ...common.RepoConfig)
- type NpmJson
- type PackageJson
- type PackageLock
- type PackageLockDep
- type Sca
- type YarnLock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindMaxVersion ¶
FindMaxVersion 从一组版本中查找符合版本约束的最大版本 version: 范围约束 versions: 待查找的版本列表 return: 符合要求的最大版本
func ParsePackageJsonWithLock ¶
func ParsePackageJsonWithLock(pkgjson *PackageJson, pkglock *PackageLock) *model.DepGraph
ParsePackageJsonWithLock 借助package.lock解析package.json
func ParsePackageJsonWithLockV3 ¶
func ParsePackageJsonWithLockV3(pkgjson *PackageJson, pkglock *PackageLock) *model.DepGraph
ParsePackageJsonWithLockV3 借助package.lock(v3)解析package.json
func ParsePackageJsonWithNode ¶
func ParsePackageJsonWithNode(pkgjson *PackageJson, nodeMap map[string]*PackageJson, pkgMap map[string]*PackageJson) *model.DepGraph
ParsePackageJsonWithNode 借助node_modules解析package.json pkgjson: 需要解析的package.json nodeMap: node_modules信息 key:node_modules下的package.json路径 pkgMap: 项目中存在的package.json信息 key:package.json的name
func ParsePackageJsonWithYarnLock ¶
func ParsePackageJsonWithYarnLock(pkgjson *PackageJson, yarnlock map[string]*YarnLock) *model.DepGraph
ParsePackageJsonWithYarnLock 借助yarn.lock文件解析pacakge.json
func ParseYarnLock ¶
ParseYarnLock 解析yarn.lock文件结构
func RegisterNpmOrigin ¶
func RegisterNpmOrigin(origin func(name, version string) *PackageJson)
RegisterNpmOrigin 注册npm数据源
func RegisterNpmRepo ¶
func RegisterNpmRepo(repos ...common.RepoConfig)
Types ¶
type NpmJson ¶
type NpmJson struct { Time map[string]string `json:"time"` Versions map[string]*PackageJson `json:"versions"` }
type PackageJson ¶
type PackageJson struct { Name string `json:"name"` Version string `json:"version"` // License string `json:"license"` Develop bool `json:"dev"` // lock v3 // TODO 只有依赖冲突时才会使用 Resolutions map[string]string `json:"resolutions"` Dependencies map[string]string `json:"dependencies"` DevDependencies map[string]string `json:"devDependencies"` PeerDependencies map[string]string `json:"peerDependencies"` OptionalDependencies map[string]string `json:"optionalDependencies"` PeerDependenciesMeta map[string]struct { Optional bool `json:"optional"` } `json:"peerDependenciesMeta"` File *model.File `json:"-"` }
func ReadNpmJson ¶
func ReadNpmJson(reader io.Reader, version string) *PackageJson
type PackageLock ¶
type PackageLock struct { Name string `json:"name"` LockfileVersion int `json:"lockfileVersion"` Version string `json:"version"` Dependencies map[string]*PackageLockDep `json:"dependencies"` Packages map[string]*PackageJson `json:"packages"` }
type PackageLockDep ¶
Click to show internal directories.
Click to hide internal directories.