javascript

package
v3.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMaxVersion

func FindMaxVersion(version string, versions []string) string

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

func ParseYarnLock(file *model.File) map[string]*YarnLock

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

type PackageLockDep struct {
	Version      string                     `json:"version"`
	Develop      bool                       `json:"dev"`
	Requires     map[string]string          `json:"requires"`
	Dependencies map[string]*PackageLockDep `json:"dependencies"`
	// contains filtered or unexported fields
}

type Sca

type Sca struct{}

func (Sca) Filter

func (sca Sca) Filter(relpath string) bool

func (Sca) Language

func (sca Sca) Language() model.Language

func (Sca) Sca

func (sca Sca) Sca(ctx context.Context, parent *model.File, files []*model.File, call model.ResCallback)

type YarnLock

type YarnLock struct {
	Name         string
	Version      string
	Dependencies map[string]string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL