packagejson

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 3 modules, 12 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidName

func IsValidName(name string) bool

func ParseWorkspaces added in v0.67.0

func ParseWorkspaces(val any) []string

ParseWorkspaces returns slice of workspaces `workspaces` field supports 2 types - string array and map with `packages` key only cf. https://github.com/npm/map-workspaces#usage

Types

type License added in v0.71.0

type License struct {
	// contains filtered or unexported fields
}

License represents the npm "license" field, which historically supports several shapes:

  • string: "MIT"
  • object (legacy): {"type": "MIT", "url": "..."}
  • array of objects (legacy): [{"type": "MIT", ...}, {"type": "Apache-2.0", ...}]

See https://docs.npmjs.com/cli/v11/configuring-npm/package-json#license

func (License) Names added in v0.71.0

func (l License) Names() []string

Names returns the list of license names extracted from the field.

func (*License) UnmarshalJSON added in v0.71.0

func (l *License) UnmarshalJSON(data []byte) error

type Package

type Package struct {
	ftypes.Package
	Dependencies         map[string]string
	OptionalDependencies map[string]string
	DevDependencies      map[string]string
	Workspaces           []string
}

type Parser

type Parser struct{}

func NewParser

func NewParser() *Parser

func (*Parser) Parse

func (p *Parser) Parse(r io.Reader) (Package, error)

Jump to

Keyboard shortcuts

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