weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
44 lines (43 loc) • 2 kB
TypeScript
import type { Buffer } from 'node:buffer';
import type { sources } from 'webpack';
import { LRUCache } from 'lru-cache';
export interface HashMapValue {
hash: string;
changed: boolean;
}
export type HashMapKey = string | number;
export type CacheValue = sources.Source | string;
export interface CacheProcessResult<T extends CacheValue> {
result: T;
cacheValue?: CacheValue | undefined;
}
export interface CacheProcessOptions<T extends CacheValue> {
key: string;
hashKey?: HashMapKey | undefined;
rawSource?: string | Buffer | undefined;
hash?: string | undefined;
resolveCache?: (() => T | undefined) | undefined;
transform: () => Promise<CacheProcessResult<T> | T>;
onCacheHit?: ((value: T) => void | Promise<void>) | undefined;
}
export interface ICreateCacheReturnType {
readonly hashMap: Map<HashMapKey, HashMapValue>;
readonly instance: LRUCache<string, CacheValue>;
hasHashKey: (key: HashMapKey) => boolean;
getHashValue: (key: HashMapKey) => HashMapValue | undefined;
setHashValue: (key: HashMapKey, value: HashMapValue) => Map<HashMapKey, HashMapValue>;
computeHash: (message: string | Buffer) => string;
get: <V extends CacheValue = sources.Source>(key: string) => V | undefined;
set: <V extends CacheValue = sources.Source>(key: string, value: V) => LRUCache<string, CacheValue>;
has: (key: string) => boolean;
calcHashValueChanged: (key: HashMapKey, hash: string) => ICreateCacheReturnType;
prune?: (options: {
cacheKeys?: Iterable<string> | undefined;
hashKeys?: Iterable<HashMapKey> | undefined;
}) => void;
pruneHashKeys?: (hashKeys: Iterable<HashMapKey>) => void;
process: <T extends CacheValue>(options: CacheProcessOptions<T>) => Promise<T>;
}
declare function createCache(options?: boolean): ICreateCacheReturnType;
declare function initializeCache(cacheConfig?: boolean | ICreateCacheReturnType): ICreateCacheReturnType;
export { createCache, initializeCache };