packagejson

package
v0.72.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 12

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