import type { Dirent } from 'fs'; import { ConfigOptions, ExecutionEnvironment } from '../common/configOptions'; import { Host } from '../common/host'; import { PythonVersion } from '../common/pythonVersion'; import { ServiceProvider } from '../common/serviceProvider'; import { Uri } from '../common/uri/uri'; import { ImportLogger } from './importLogger'; import { ImplicitImport, ImportResult, ImportType } from './importResult'; import { ParentDirectoryCache } from './parentDirectoryCache'; export interface ImportedModuleDescriptor { leadingDots: number; nameParts: string[]; hasTrailingDot?: boolean | undefined; importedSymbols: Set | undefined; } export interface ModuleNameAndType { moduleName: string; importType: ImportType; isLocalTypingsFile: boolean; } export interface ModuleImportInfo extends ModuleNameAndType { isTypeshedFile: boolean; isThirdPartyPyTypedPresent: boolean; } export interface ModuleNameInfoFromPath { moduleName: string; containsInvalidCharacters?: boolean; } export declare function createImportedModuleDescriptor(moduleName: string): ImportedModuleDescriptor; interface CachedDir { entries: Map; resolvableNames: Set; } export declare const supportedSourceFileExtensions: string[]; export declare const supportedFileExtensions: string[]; export declare class ImportResolver { readonly serviceProvider: ServiceProvider; private _configOptions; readonly host: Host; private _cachedPythonSearchPaths; private _cachedImportResults; private _cachedModuleNameResults; private _cachedTypeshedRoot; private _cachedTypeshedStdLibPath; private _cachedTypeshedStdLibModuleVersionInfo; private _cachedTypeshedThirdPartyPath; private _cachedTypeshedThirdPartyPackagePaths; private _cachedTypeshedThirdPartyPackageRoots; private _cachedEntriesForPath; private _cachedFilesForPath; private _cachedDirExistenceForRoot; private _stdlibModules; protected readonly cachedParentImportResults: ParentDirectoryCache; constructor(serviceProvider: ServiceProvider, _configOptions: ConfigOptions, host: Host); get fileSystem(): import("../common/fileSystem").FileSystem; get tmp(): import("../common/fileSystem").TempFile | undefined; get partialStubs(): import("../partialStubService").SupportPartialStubs; static isSupportedImportSourceFile(uri: Uri): boolean; static isSupportedImportFile(uri: Uri): boolean; invalidateCache(): void; resolveImport(sourceFileUri: Uri, execEnv: ExecutionEnvironment, moduleDescriptor: ImportedModuleDescriptor): ImportResult; getCompletionSuggestions(sourceFileUri: Uri, execEnv: ExecutionEnvironment, moduleDescriptor: ImportedModuleDescriptor): Map; getConfigOptions(): ConfigOptions; setConfigOptions(configOptions: ConfigOptions): void; getSourceFilesFromStub(stubFileUri: Uri, execEnv: ExecutionEnvironment, _mapCompiled: boolean): Uri[]; getModuleNameForImport(fileUri: Uri, execEnv: ExecutionEnvironment, allowInvalidModuleName?: boolean, detectPyTyped?: boolean): ModuleImportInfo; getTypeshedStdLibPath(execEnv: ExecutionEnvironment): Uri | undefined; getTypeshedThirdPartyPath(execEnv: ExecutionEnvironment): Uri | undefined; isStdlibModule(module: ImportedModuleDescriptor, execEnv: ExecutionEnvironment): boolean; getImportRoots(execEnv: ExecutionEnvironment, forLogging?: boolean): Uri[]; ensurePartialStubPackages(execEnv: ExecutionEnvironment): boolean; getPythonSearchPaths(importLogger?: ImportLogger): Uri[]; getTypeshedStdlibExcludeList(customTypeshedPath: Uri | undefined, pythonVersion: PythonVersion, pythonPlatform: string | undefined): Uri[]; getTypeshedPathEx(execEnv: ExecutionEnvironment, importLogger?: ImportLogger): Uri | undefined; protected readdirEntriesCached(uri: Uri): CachedDir; protected resolveImportInternal(sourceFileUri: Uri, execEnv: ExecutionEnvironment, moduleDescriptor: ImportedModuleDescriptor): ImportResult; protected fileExistsCached(uri: Uri): boolean; protected dirExistsCached(uri: Uri): boolean; protected addResultsToCache(sourceFileUri: Uri, execEnv: ExecutionEnvironment, importName: string, importResult: ImportResult, moduleDescriptor: ImportedModuleDescriptor | undefined, fromUserFile: boolean): ImportResult; protected resolveAbsoluteImport(sourceFileUri: Uri | undefined, rootPath: Uri, execEnv: ExecutionEnvironment, moduleDescriptor: ImportedModuleDescriptor, importName: string, importLogger: ImportLogger | undefined, allowPartial?: boolean, allowNativeLib?: boolean, useStubPackage?: boolean, allowPyi?: boolean, lookForPyTyped?: boolean): ImportResult | undefined; protected resolveImportEx(sourceFileUri: Uri, execEnv: ExecutionEnvironment, moduleDescriptor: ImportedModuleDescriptor, importName: string, importLogger?: ImportLogger, allowPyi?: boolean): ImportResult | undefined; protected resolveNativeImportEx(libraryFileUri: Uri, importName: string, importLogger?: ImportLogger): Uri | undefined; protected getNativeModuleName(uri: Uri): string | undefined; protected filterImplicitImports(importResult: ImportResult, importedSymbols: Set | undefined): ImportResult; protected findImplicitImports(importingModuleName: string, dirPath: Uri, exclusions: Uri[]): Map | undefined; private _isPossibleImportDir; private _resolveImportStrict; private _getCompletionSuggestionsStrict; private _getModuleNameForImport; private _invalidateFileSystemCache; private _resolveAbsoluteImport; private _getImportCacheKey; private _lookUpResultsInCache; private _isNamespacePackageResolved; private _resolveBestAbsoluteImport; private _pickBestImport; private _findTypeshedPath; private _buildStdlibCache; private _buildTypeshedThirdPartyPackageMap; private _getCompletionSuggestionsTypeshedPath; private _getStdlibTypeshedPath; private _getThirdPartyTypeshedPath; private _isStdlibTypeshedStubValidForVersion; private _readTypeshedStdLibVersions; private _getThirdPartyTypeshedPackagePaths; private _getThirdPartyTypeshedPackageRoots; private _getTypeshedRoot; private _getTypeshedSubdirectory; private _resolveRelativeImport; private _getCompletionSuggestionsRelative; private _getFilesInDirectory; private _getCompletionSuggestionsAbsolute; private _addFilteredSuggestionsAbsolute; private _isResolvableSuggestion; private _isUniqueValidSuggestion; private _getPyTypedInfo; private _findAndResolveNativeModule; private _resolveNativeModuleWithStub; private _isNativeModuleFileName; private _tryWalkUp; private _shouldWalkUp; } export type ImportResolverFactory = (serviceProvider: ServiceProvider, options: ConfigOptions, host: Host) => ImportResolver; export declare function formatImportName(moduleDescriptor: ImportedModuleDescriptor): string; export declare function getParentImportResolutionRoot(sourceFileUri: Uri, executionRoot: Uri | undefined): Uri; export declare function getModuleNameFromPath(containerPath: Uri, fileUri: Uri, stripTopContainerDir?: boolean): string | undefined; export declare function isDefaultWorkspace(uri: Uri | undefined): boolean; export {};