UNPKG

1.55 kBTypeScriptView Raw
1import { FakeFS, ZipFS, PortablePath, Filename } from '@yarnpkg/fslib';
2import { Configuration } from './Configuration';
3import { LocatorHash, Locator } from './types';
4export declare type FetchFromCacheOptions = {
5 checksums: Map<LocatorHash, Locator>;
6};
7export declare class Cache {
8 readonly configuration: Configuration;
9 readonly cwd: PortablePath;
10 readonly markedFiles: Set<PortablePath>;
11 readonly immutable: boolean;
12 readonly check: boolean;
13 readonly cacheKey: string;
14 private mutexes;
15 static find(configuration: Configuration, { immutable, check }?: {
16 immutable?: boolean;
17 check?: boolean;
18 }): Promise<Cache>;
19 constructor(cacheCwd: PortablePath, { configuration, immutable, check }: {
20 configuration: Configuration;
21 immutable?: boolean;
22 check?: boolean;
23 });
24 get mirrorCwd(): PortablePath | null;
25 getVersionFilename(locator: Locator): Filename;
26 getChecksumFilename(locator: Locator, checksum: string): Filename;
27 getLocatorPath(locator: Locator, expectedChecksum: string | null): PortablePath | null;
28 getLocatorMirrorPath(locator: Locator): PortablePath | null;
29 setup(): Promise<void>;
30 fetchPackageFromCache(locator: Locator, expectedChecksum: string | null, { onHit, onMiss, loader, skipIntegrityCheck }: {
31 onHit?: () => void;
32 onMiss?: () => void;
33 loader?: () => Promise<ZipFS>;
34 skipIntegrityCheck?: boolean;
35 }): Promise<[FakeFS<PortablePath>, () => void, string]>;
36 private writeFileWithLock;
37}