@@ -79,6 +79,14 @@ declare namespace ts {
7979 readonly kind: EventEndInstallTypes;
8080 readonly installSuccess: boolean;
8181 }
82+ interface InstallTypingHost extends JsTyping.TypingResolutionHost {
83+ useCaseSensitiveFileNames: boolean;
84+ writeFile(path: string, content: string): void;
85+ createDirectory(path: string): void;
86+ getCurrentDirectory?(): string;
87+ watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
88+ watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
89+ }
8290 interface SetTypings extends ProjectResponse {
8391 readonly typeAcquisition: TypeAcquisition;
8492 readonly compilerOptions: CompilerOptions;
@@ -2965,6 +2973,55 @@ declare namespace ts {
29652973 bigintLiteral = 25
29662974 }
29672975 }
2976+ namespace typingsInstaller {
2977+ interface Log {
2978+ isEnabled(): boolean;
2979+ writeLine(text: string): void;
2980+ }
2981+ type RequestCompletedAction = (success: boolean) => void;
2982+ interface PendingRequest {
2983+ requestId: number;
2984+ packageNames: string[];
2985+ cwd: string;
2986+ onRequestCompleted: RequestCompletedAction;
2987+ }
2988+ abstract class TypingsInstaller {
2989+ protected readonly installTypingHost: InstallTypingHost;
2990+ private readonly globalCachePath;
2991+ private readonly safeListPath;
2992+ private readonly typesMapLocation;
2993+ private readonly throttleLimit;
2994+ protected readonly log: Log;
2995+ private readonly packageNameToTypingLocation;
2996+ private readonly missingTypingsSet;
2997+ private readonly knownCachesSet;
2998+ private readonly projectWatchers;
2999+ private safeList;
3000+ readonly pendingRunRequests: PendingRequest[];
3001+ private readonly toCanonicalFileName;
3002+ private readonly globalCachePackageJsonPath;
3003+ private installRunCount;
3004+ private inFlightRequestCount;
3005+ abstract readonly typesRegistry: Map<string, MapLike<string>>;
3006+ constructor(installTypingHost: InstallTypingHost, globalCachePath: string, safeListPath: Path, typesMapLocation: Path, throttleLimit: number, log?: Log);
3007+ closeProject(req: CloseProject): void;
3008+ private closeWatchers;
3009+ install(req: DiscoverTypings): void;
3010+ private initializeSafeList;
3011+ private processCacheLocation;
3012+ private filterTypings;
3013+ protected ensurePackageDirectoryExists(directory: string): void;
3014+ private installTypings;
3015+ private ensureDirectoryExists;
3016+ private watchFiles;
3017+ private createSetTypings;
3018+ private installTypingsAsync;
3019+ private executeWithThrottling;
3020+ protected abstract installWorker(requestId: number, packageNames: string[], cwd: string, onRequestCompleted: RequestCompletedAction): void;
3021+ protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes): void;
3022+ protected readonly latestDistTag = "latest";
3023+ }
3024+ }
29683025 interface CompressedData {
29693026 length: number;
29703027 compressionKind: string;
@@ -9789,6 +9846,14 @@ declare namespace ts {
97899846 emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject<T> | undefined;
97909847 }
97919848 type InvalidatedProject<T extends BuilderProgram> = UpdateOutputFileStampsProject | BuildInvalidedProject<T> | UpdateBundleProject<T>;
9849+ namespace JsTyping {
9850+ interface TypingResolutionHost {
9851+ directoryExists(path: string): boolean;
9852+ fileExists(fileName: string): boolean;
9853+ readFile(path: string, encoding?: string): string | undefined;
9854+ readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[];
9855+ }
9856+ }
97929857 function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatCodeSettings;
97939858 /**
97949859 * Represents an immutable snapshot of a script at a specified time.Once acquired, the
0 commit comments