st-bundle
Version:
CLI for watching and bundling SpringType projects.
68 lines (67 loc) • 2.06 kB
TypeScript
import { IFastAnalysis } from '../analysis/fastAnalysis';
import { Context } from '../core/Context';
import { Module } from '../core/Module';
import { Package } from '../core/Package';
import { ICachePackageResponse, ICacheTreeContents } from './Interfaces';
export interface IFileCacheProps {
ctx: Context;
}
export interface IModuleCacheBasics {
contents: string;
sourceMap: string;
weakReferences?: Array<string>;
breakDependantsCache?: boolean;
dependants?: Array<string>;
}
export interface IModuleCache {
meta: {
[key: string]: any;
};
mtime: number;
absPath: string;
extension: string;
breakDependantsCache?: boolean;
dependants?: Array<string>;
weakReferences?: {
[key: string]: number;
};
fuseBoxPath: string;
fastAnalysis: IFastAnalysis;
contents: string;
sourceMap: string;
}
export declare class Cache {
rootFolder: string;
private unsynced;
private synced;
ctx: Context;
private packageCacheFolder;
private projectCacheFolder;
constructor(props: IFileCacheProps);
init(): void;
nukeAll(): void;
nukeProjectCache(): void;
nukePackageCache(): void;
set(key: string, value: any): void;
unset(key: string): void;
forceSyncOnKey(key: string): void;
/**
* get dependency tree (here we store all information about cached packages)
*
* @returns
* @memberof FileAdapter
*/
getTree(): ICacheTreeContents;
get<T>(key: string, folder?: string): T;
clearMemory(): void;
sync(): Promise<void>;
clearTree(): void;
private getPackageKey;
getPackage(pkg: Package, userModules?: Array<Module>): ICachePackageResponse;
getModuleCacheKey(module: Module): string;
saveModule(module: Module, basics: IModuleCacheBasics): void;
getModuleCacheData(module: Module): IModuleCache;
restoreModule(module: Module): Module;
savePackage(pkg: Package, basics: IModuleCacheBasics): void;
}
export declare function createCache(props: IFileCacheProps): Cache;