Documentation
¶
Index ¶
- type DependencyFields
- type Expected
- type ExportsOrImports
- func (e ExportsOrImports) AsArray() []ExportsOrImports
- func (e ExportsOrImports) AsObject() *collections.OrderedMap[string, ExportsOrImports]
- func (e ExportsOrImports) IsConditions() bool
- func (e ExportsOrImports) IsImports() bool
- func (e ExportsOrImports) IsSubpaths() bool
- func (e *ExportsOrImports) UnmarshalJSONFrom(dec *json.Decoder) error
- type Fields
- type HeaderFields
- type InfoCache
- type InfoCacheEntry
- type JSONValue
- type JSONValueType
- type PackageJson
- type PathFields
- type TypeValidatedField
- type VersionPaths
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"`
DevDependencies Expected[map[string]string] `json:"devDependencies"`
PeerDependencies Expected[map[string]string] `json:"peerDependencies"`
OptionalDependencies Expected[map[string]string] `json:"optionalDependencies"`
}
func (*DependencyFields) GetRuntimeDependencyNames ¶
func (df *DependencyFields) GetRuntimeDependencyNames() *collections.Set[string]
func (*DependencyFields) HasDependency ¶
func (df *DependencyFields) HasDependency(name string) bool
HasDependency returns true if the package.json has a dependency with the given name under any of the dependency fields (dependencies, devDependencies, peerDependencies, optionalDependencies).
func (*DependencyFields) RangeDependencies ¶
func (df *DependencyFields) RangeDependencies(f func(name, version, dependencyField string) bool)
type Expected ¶
type Expected[T any] struct { Null bool Valid bool Value T // contains filtered or unexported fields }
func ExpectedOf ¶
func (*Expected[T]) ActualJSONType ¶
func (*Expected[T]) ExpectedJSONType ¶
func (*Expected[T]) UnmarshalJSON ¶
type ExportsOrImports ¶
type ExportsOrImports struct {
JSONValue
// contains filtered or unexported fields
}
func (ExportsOrImports) AsArray ¶
func (e ExportsOrImports) AsArray() []ExportsOrImports
func (ExportsOrImports) AsObject ¶
func (e ExportsOrImports) AsObject() *collections.OrderedMap[string, ExportsOrImports]
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) UnmarshalJSONFrom ¶
func (e *ExportsOrImports) UnmarshalJSONFrom(dec *json.Decoder) error
type Fields ¶
type Fields struct {
HeaderFields
PathFields
DependencyFields
}
type HeaderFields ¶
type InfoCache ¶
type InfoCache struct {
// contains filtered or unexported fields
}
func NewInfoCache ¶
func (*InfoCache) Get ¶
func (p *InfoCache) Get(packageJsonPath string) *InfoCacheEntry
func (*InfoCache) Range ¶ added in v0.22.0
func (p *InfoCache) Range(f func(key tspath.Path, value *InfoCacheEntry) bool)
func (*InfoCache) Set ¶
func (p *InfoCache) Set(packageJsonPath string, info *InfoCacheEntry) *InfoCacheEntry
type InfoCacheEntry ¶
type InfoCacheEntry struct {
PackageDirectory string
DirectoryExists bool
Contents *PackageJson
}
func (*InfoCacheEntry) Exists ¶
func (p *InfoCacheEntry) Exists() bool
func (*InfoCacheEntry) GetContents ¶
func (p *InfoCacheEntry) GetContents() *PackageJson
func (*InfoCacheEntry) GetDirectory ¶
func (p *InfoCacheEntry) GetDirectory() string
func (*InfoCacheEntry) WithPackageDirectory ¶ added in v0.22.0
func (p *InfoCacheEntry) WithPackageDirectory(packageDirectory string) *InfoCacheEntry
WithPackageDirectory returns an entry whose PackageDirectory matches the caller's value. The package.json info cache is keyed by the canonical path of the package.json file, but multiple callers may look up the same package.json using directory paths that differ only by a trailing separator (e.g. "node_modules/preact/compat" vs "node_modules/preact/compat/"). Because the cache uses first-writer-wins semantics, a later caller may receive an entry whose PackageDirectory doesn't match its own candidate path. Downstream code compares the candidate against PackageDirectory, so we must return a corrected shallow copy when they diverge. See https://github.com/microsoft/TypeScript/pull/50740.
type JSONValue ¶
type JSONValue struct {
Type JSONValueType
Value any
}
func (JSONValue) AsObject ¶
func (v JSONValue) AsObject() *collections.OrderedMap[string, JSONValue]
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 ¶
func (*PackageJson) GetVersionPaths ¶
func (p *PackageJson) GetVersionPaths(trace func(m *diagnostics.Message, args ...any)) 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 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]