module

package
v0.0.0-...-9f6a04c Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeResolutionFeaturesImports NodeResolutionFeatures = 1 << iota
	NodeResolutionFeaturesSelfName
	NodeResolutionFeaturesExports
	NodeResolutionFeaturesExportsPatternTrailers

	NodeResolutionFeaturesNone            NodeResolutionFeatures = 0
	NodeResolutionFeaturesAll                                    = NodeResolutionFeaturesImports | NodeResolutionFeaturesSelfName | NodeResolutionFeaturesExports | NodeResolutionFeaturesExportsPatternTrailers
	NodeResolutionFeaturesNode16Default                          = NodeResolutionFeaturesImports | NodeResolutionFeaturesSelfName | NodeResolutionFeaturesExports | NodeResolutionFeaturesExportsPatternTrailers
	NodeResolutionFeaturesNodeNextDefault                        = NodeResolutionFeaturesAll
	NodeResolutionFeaturesBundlerDefault                         = NodeResolutionFeaturesImports | NodeResolutionFeaturesSelfName | NodeResolutionFeaturesExports | NodeResolutionFeaturesExportsPatternTrailers
)
View Source
const InferredTypesContainingFile = "__inferred type names__.ts"

Variables

This section is empty.

Functions

func ComparePatternKeys

func ComparePatternKeys(a, b string) int

func GetAutomaticTypeDirectiveNames

func GetAutomaticTypeDirectiveNames(options *core.CompilerOptions, host ResolutionHost) []string

func GetCompilerOptionsWithRedirect

func GetCompilerOptionsWithRedirect(compilerOptions *core.CompilerOptions, redirectedReference ResolvedProjectReference) *core.CompilerOptions

func GetConditions

func GetConditions(options *core.CompilerOptions, resolutionMode core.ResolutionMode) []string

func GetResolutionDiagnostic

func GetResolutionDiagnostic(options *core.CompilerOptions, resolvedModule *ResolvedModule, file *ast.SourceFile) *diagnostics.Message

Returns a DiagnosticMessage if we won't include a resolved module due to its extension. The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to. This returns a diagnostic even if the module will be an untyped module.

func GetTypesPackageName

func GetTypesPackageName(packageName string) string

func MangleScopedPackageName

func MangleScopedPackageName(packageName string) string

func MatchPatternOrExact

func MatchPatternOrExact(patterns *ParsedPatterns, candidate string) core.Pattern

func ParseNodeModuleFromPath

func ParseNodeModuleFromPath(resolved string, isFolder bool) string

func ParsePackageName

func ParsePackageName(moduleName string) (packageName, rest string)

func UnmangleScopedPackageName

func UnmangleScopedPackageName(packageName string) string

Types

type LookupLocations

type LookupLocations struct {
	FailedLookupLocations []string
	AffectingLocations    []string
	ResolutionDiagnostics []*ast.Diagnostic
}

type ModeAwareCache

type ModeAwareCache[T any] map[ModeAwareCacheKey]T

type ModeAwareCacheKey

type ModeAwareCacheKey struct {
	Name string
	Mode core.ResolutionMode
}

type NodeResolutionFeatures

type NodeResolutionFeatures int32

type PackageId

type PackageId struct {
	Name             string
	SubModuleName    string
	Version          string
	PeerDependencies string
}

func (*PackageId) PackageName

func (p *PackageId) PackageName() string

func (*PackageId) String

func (p *PackageId) String() string

type ParsedPatterns

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

func TryParsePatterns

func TryParsePatterns(pathMappings *collections.OrderedMap[string, []string]) *ParsedPatterns

type ResolutionHost

type ResolutionHost interface {
	FS() vfs.FS
	GetCurrentDirectory() string
}

type ResolvedModule

type ResolvedModule struct {
	LookupLocations
	ResolvedFileName         string
	OriginalPath             string
	Extension                string
	ResolvedUsingTsExtension bool
	PackageId                PackageId
	IsExternalLibraryImport  bool
	AlternateResult          string
}

func ResolveConfig

func ResolveConfig(moduleName string, containingFile string, host ResolutionHost) *ResolvedModule

func (*ResolvedModule) GetLookupLocations

func (r *ResolvedModule) GetLookupLocations() *LookupLocations

func (*ResolvedModule) IsResolved

func (r *ResolvedModule) IsResolved() bool

type ResolvedProjectReference

type ResolvedProjectReference interface {
	ConfigName() string
	CompilerOptions() *core.CompilerOptions
}

type ResolvedTypeReferenceDirective

type ResolvedTypeReferenceDirective struct {
	LookupLocations
	Primary                 bool
	ResolvedFileName        string
	OriginalPath            string
	PackageId               PackageId
	IsExternalLibraryImport bool
}

func (*ResolvedTypeReferenceDirective) GetLookupLocations

func (r *ResolvedTypeReferenceDirective) GetLookupLocations() *LookupLocations

func (*ResolvedTypeReferenceDirective) IsResolved

func (r *ResolvedTypeReferenceDirective) IsResolved() bool

type Resolver

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

func NewResolver

func NewResolver(
	host ResolutionHost,
	options *core.CompilerOptions,
	typingsLocation string,
	projectName string,
) *Resolver

func (*Resolver) GetPackageJsonScopeIfApplicable

func (r *Resolver) GetPackageJsonScopeIfApplicable(path string) *packagejson.InfoCacheEntry

func (*Resolver) GetPackageScopeForPath

func (r *Resolver) GetPackageScopeForPath(directory string) *packagejson.InfoCacheEntry

func (*Resolver) ResolveModuleName

func (r *Resolver) ResolveModuleName(moduleName string, containingFile string, resolutionMode core.ResolutionMode, redirectedReference ResolvedProjectReference) (*ResolvedModule, []string)

func (*Resolver) ResolveTypeReferenceDirective

func (r *Resolver) ResolveTypeReferenceDirective(
	typeReferenceDirectiveName string,
	containingFile string,
	resolutionMode core.ResolutionMode,
	redirectedReference ResolvedProjectReference,
) (*ResolvedTypeReferenceDirective, []string)

Jump to

Keyboard shortcuts

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