Documentation
¶
Index ¶
- func ContainsNodeModules(s string) bool
- func CountPathComponents(path string) int
- func GetModuleSpecifier(compilerOptions *core.CompilerOptions, host ModuleSpecifierGenerationHost, ...) string
- func GetModuleSpecifiers(moduleSymbol *ast.Symbol, checker CheckerShape, ...) []string
- func GetNodeModulesPackageName(compilerOptions *core.CompilerOptions, importingSourceFile *ast.SourceFile, ...) string
- func GetPackageNameFromTypesPackageName(mangledName string) string
- func PathIsBareSpecifier(path string) bool
- type CheckerShape
- type ImportModuleSpecifierEndingPreference
- type ImportModuleSpecifierPreference
- type Info
- type MatchingMode
- type ModulePath
- type ModuleSpecifierEnding
- type ModuleSpecifierGenerationHost
- type ModuleSpecifierOptions
- type ModuleSpecifierPreferences
- type NodeModulePathParts
- type PackageJsonInfo
- type RelativePreferenceKind
- type ResultKind
- type SourceFileForSpecifierGeneration
- type UserPreferences
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsNodeModules ¶
func CountPathComponents ¶
func GetModuleSpecifier ¶
func GetModuleSpecifier( compilerOptions *core.CompilerOptions, host ModuleSpecifierGenerationHost, importingSourceFile *ast.SourceFile, importingSourceFileName string, oldImportSpecifier string, toFileName string, options ModuleSpecifierOptions, ) string
`importingSourceFile` and `importingSourceFileName`? Why not just use `importingSourceFile.path`? Because when this is called by the declaration emitter, `importingSourceFile` is the implementation file, but `importingSourceFileName` and `toFileName` refer to declaration files (the former to the one currently being produced; the latter to the one being imported). We need an implementation file just to get its `impliedNodeFormat` and to detect certain preferences from existing import module specifiers.
func GetModuleSpecifiers ¶
func GetModuleSpecifiers( moduleSymbol *ast.Symbol, checker CheckerShape, compilerOptions *core.CompilerOptions, importingSourceFile SourceFileForSpecifierGeneration, host ModuleSpecifierGenerationHost, userPreferences UserPreferences, options ModuleSpecifierOptions, forAutoImports bool, ) []string
func GetNodeModulesPackageName ¶
func GetNodeModulesPackageName( compilerOptions *core.CompilerOptions, importingSourceFile *ast.SourceFile, nodeModulesFileName string, host ModuleSpecifierGenerationHost, preferences UserPreferences, options ModuleSpecifierOptions, ) string
func PathIsBareSpecifier ¶
Types ¶
type CheckerShape ¶
type ImportModuleSpecifierEndingPreference ¶
type ImportModuleSpecifierEndingPreference string
const ( ImportModuleSpecifierEndingPreferenceNone ImportModuleSpecifierEndingPreference = "" ImportModuleSpecifierEndingPreferenceAuto ImportModuleSpecifierEndingPreference = "auto" ImportModuleSpecifierEndingPreferenceMinimal ImportModuleSpecifierEndingPreference = "minimal" ImportModuleSpecifierEndingPreferenceIndex ImportModuleSpecifierEndingPreference = "index" ImportModuleSpecifierEndingPreferenceJs ImportModuleSpecifierEndingPreference = "js" )
type ImportModuleSpecifierPreference ¶
type ImportModuleSpecifierPreference string
const ( ImportModuleSpecifierPreferenceNone ImportModuleSpecifierPreference = "" ImportModuleSpecifierPreferenceShortest ImportModuleSpecifierPreference = "shortest" ImportModuleSpecifierPreferenceProjectRelative ImportModuleSpecifierPreference = "project-relative" ImportModuleSpecifierPreferenceRelative ImportModuleSpecifierPreference = "relative" ImportModuleSpecifierPreferenceNonRelative ImportModuleSpecifierPreference = "non-relative" )
type MatchingMode ¶
type MatchingMode uint8
const ( MatchingModeExact MatchingMode = iota MatchingModeDirectory MatchingModePattern )
type ModulePath ¶
func GetEachFileNameOfModule ¶
func GetEachFileNameOfModule( importingFileName string, importedFileName string, host ModuleSpecifierGenerationHost, preferSymlinks bool, ) []ModulePath
type ModuleSpecifierEnding ¶
type ModuleSpecifierEnding uint8
const ( ModuleSpecifierEndingMinimal ModuleSpecifierEnding = iota ModuleSpecifierEndingIndex ModuleSpecifierEndingJsExtension ModuleSpecifierEndingTsExtension )
type ModuleSpecifierGenerationHost ¶
type ModuleSpecifierGenerationHost interface { // GetModuleResolutionCache() any // !!! TODO: adapt new resolution cache model // GetSymlinkCache() any // !!! TODO: adapt new resolution cache model // GetFileIncludeReasons() any // !!! TODO: adapt new resolution cache model CommonSourceDirectory() string GetGlobalTypingsCacheLocation() string UseCaseSensitiveFileNames() bool GetCurrentDirectory() string GetProjectReferenceFromSource(path tspath.Path) *tsoptions.SourceOutputAndProjectReference GetRedirectTargets(path tspath.Path) []string GetSourceOfProjectReferenceIfOutputIncluded(file ast.HasFileName) string FileExists(path string) bool GetNearestAncestorDirectoryWithPackageJson(dirname string) string GetPackageJsonInfo(pkgJsonPath string) PackageJsonInfo GetDefaultResolutionModeForFile(file ast.HasFileName) core.ResolutionMode GetResolvedModuleFromModuleSpecifier(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) *module.ResolvedModule GetModeForUsageLocation(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) core.ResolutionMode }
type ModuleSpecifierOptions ¶
type ModuleSpecifierOptions struct {
OverrideImportMode core.ResolutionMode
}
type ModuleSpecifierPreferences ¶
type ModuleSpecifierPreferences struct {
// contains filtered or unexported fields
}
type NodeModulePathParts ¶
type NodeModulePathParts struct { TopLevelNodeModulesIndex int TopLevelPackageNameIndex int PackageRootIndex int FileNameIndex int }
func GetNodeModulePathParts ¶
func GetNodeModulePathParts(fullPath string) *NodeModulePathParts
type PackageJsonInfo ¶
type PackageJsonInfo interface { GetDirectory() string GetContents() *packagejson.PackageJson }
type RelativePreferenceKind ¶
type RelativePreferenceKind uint8
const ( RelativePreferenceRelative RelativePreferenceKind = iota RelativePreferenceNonRelative RelativePreferenceShortest RelativePreferenceExternalNonRelative )
type ResultKind ¶
type ResultKind uint8
const ( ResultKindNone ResultKind = iota ResultKindNodeModules ResultKindPaths ResultKindRedirect ResultKindRelative ResultKindAmbient )
func GetModuleSpecifiersWithInfo ¶
func GetModuleSpecifiersWithInfo( moduleSymbol *ast.Symbol, checker CheckerShape, compilerOptions *core.CompilerOptions, importingSourceFile SourceFileForSpecifierGeneration, host ModuleSpecifierGenerationHost, userPreferences UserPreferences, options ModuleSpecifierOptions, forAutoImports bool, ) ([]string, ResultKind)
type UserPreferences ¶
type UserPreferences struct { ImportModuleSpecifierPreference ImportModuleSpecifierPreference ImportModuleSpecifierEndingPreference ImportModuleSpecifierEndingPreference AutoImportSpecifierExcludeRegexes []string }
Click to show internal directories.
Click to hide internal directories.