packagejson

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyFields

type DependencyFields struct {
	Dependencies         Expected[map[string]string] `json:"dependencies"`
	PeerDependencies     Expected[map[string]string] `json:"peerDependencies"`
	OptionalDependencies Expected[map[string]string] `json:"optionalDependencies"`
}

type Expected

type Expected[T any] struct {
	Null  bool
	Valid bool
	Value T
	// contains filtered or unexported fields
}

func (*Expected[T]) ActualJSONType

func (e *Expected[T]) ActualJSONType() string

func (*Expected[T]) ExpectedJSONType

func (e *Expected[T]) ExpectedJSONType() string

func (*Expected[T]) GetValue

func (e *Expected[T]) GetValue() (value T, ok bool)

func (*Expected[T]) IsPresent

func (e *Expected[T]) IsPresent() bool

func (*Expected[T]) IsValid

func (e *Expected[T]) IsValid() bool

func (*Expected[T]) UnmarshalJSON

func (e *Expected[T]) UnmarshalJSON(data []byte) error

type ExportsOrImports

type ExportsOrImports struct {
	JSONValue
	// contains filtered or unexported fields
}

func (ExportsOrImports) AsArray

func (e ExportsOrImports) AsArray() []ExportsOrImports

func (ExportsOrImports) AsObject

func (ExportsOrImports) IsConditions

func (e ExportsOrImports) IsConditions() bool

func (ExportsOrImports) IsImports

func (e ExportsOrImports) IsImports() bool

func (ExportsOrImports) IsSubpaths

func (e ExportsOrImports) IsSubpaths() bool

func (*ExportsOrImports) UnmarshalJSON

func (e *ExportsOrImports) UnmarshalJSON(data []byte) error

func (*ExportsOrImports) UnmarshalJSONFrom

func (e *ExportsOrImports) UnmarshalJSONFrom(dec *jsontext.Decoder) error

type Fields

type Fields struct {
	HeaderFields
	PathFields
	DependencyFields
}

func Parse

func Parse(data []byte) (Fields, error)

type HeaderFields

type HeaderFields struct {
	Name    Expected[string] `json:"name"`
	Version Expected[string] `json:"version"`
	Type    Expected[string] `json:"type"`
}

type InfoCache

type InfoCache struct {
	IsReadonly bool
	// contains filtered or unexported fields
}

func NewInfoCache

func NewInfoCache(currentDirectory string, useCaseSensitiveFileNames bool) *InfoCache

func (*InfoCache) Get

func (p *InfoCache) Get(packageJsonPath string) *InfoCacheEntry

func (*InfoCache) Set

func (p *InfoCache) Set(packageJsonPath string, info *InfoCacheEntry)

type InfoCacheEntry

type InfoCacheEntry struct {
	PackageDirectory string
	DirectoryExists  bool
	Contents         *PackageJson
}

func (*InfoCacheEntry) Exists

func (p *InfoCacheEntry) Exists() bool

type JSONValue

type JSONValue struct {
	Type  JSONValueType
	Value any
}

func (JSONValue) AsArray

func (v JSONValue) AsArray() []JSONValue

func (JSONValue) AsObject

func (*JSONValue) IsFalsy

func (v *JSONValue) IsFalsy() bool

func (*JSONValue) UnmarshalJSON

func (v *JSONValue) UnmarshalJSON(data []byte) error

func (*JSONValue) UnmarshalJSONFrom

func (v *JSONValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error

type JSONValueType

type JSONValueType int8
const (
	JSONValueTypeNotPresent JSONValueType = iota
	JSONValueTypeNull
	JSONValueTypeString
	JSONValueTypeNumber
	JSONValueTypeBoolean
	JSONValueTypeArray
	JSONValueTypeObject
)

func (JSONValueType) String

func (t JSONValueType) String() string

type PackageJson

type PackageJson struct {
	Fields
	// contains filtered or unexported fields
}

func (*PackageJson) GetVersionPaths

func (p *PackageJson) GetVersionPaths(trace func(string)) VersionPaths

type PathFields

type PathFields struct {
	TSConfig      Expected[string] `json:"tsconfig"`
	Main          Expected[string] `json:"main"`
	Types         Expected[string] `json:"types"`
	Typings       Expected[string] `json:"typings"`
	TypesVersions JSONValue        `json:"typesVersions"`
	Imports       ExportsOrImports `json:"imports"`
	Exports       ExportsOrImports `json:"exports"`
}

type TypeValidatedField

type TypeValidatedField interface {
	IsPresent() bool
	IsValid() bool
	ExpectedJSONType() string
	ActualJSONType() string
}

type VersionPaths

type VersionPaths struct {
	Version string
	// contains filtered or unexported fields
}

func (*VersionPaths) Exists

func (v *VersionPaths) Exists() bool

func (*VersionPaths) GetPaths

func (v *VersionPaths) GetPaths() *collections.OrderedMap[string, []string]

Jump to

Keyboard shortcuts

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