weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
52 lines (51 loc) • 3.58 kB
TypeScript
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
import type { TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourcePattern } from '../types.js';
import { LRUCache } from 'lru-cache';
export declare const INCREMENTAL_GENERATE_CACHE_MAX = 8;
export declare const INCREMENTAL_GENERATE_TASK_CACHE_MAX = 32;
export declare const INCREMENTAL_GENERATE_ENTRY_CANDIDATES_MAX = 12000;
export declare const INCREMENTAL_GENERATE_ENTRY_CSS_BYTES_MAX: number;
export declare const incrementalGenerateCache: LRUCache<string, TailwindV4IncrementalGenerateCacheEntry, unknown>;
export declare const incrementalGenerateTaskCache: LRUCache<string, Promise<import("../index.js").TailwindV4GenerateResult>, unknown>;
interface TailwindV4IncrementalGenerateCacheEntry {
seenCandidates: Set<string>;
classSet: Set<string>;
css: string;
rawCss: string;
customPropertyValues: Map<string, string>;
designSystemPromise: Promise<TailwindV4DesignSystem>;
dependencies: string[];
sources: TailwindV4SourcePattern[];
root: null | 'none' | {
base: string;
pattern: string;
};
target: TailwindV4GenerateTarget;
}
interface TailwindV4IncrementalCacheSeedOptions {
compatibleSource: TailwindV4ResolvedSource;
generated: Awaited<ReturnType<TailwindV4Engine['generate']>>;
requestedCandidates: Set<string>;
styleOptions: Partial<IStyleHandlerOptions> | undefined;
target: TailwindV4GenerateTarget;
}
export declare function collectCandidates(candidates: Iterable<string> | undefined): Set<string>;
export declare function hasRemovedCandidates(previousCandidates: Set<string>, nextCandidates: Set<string>): boolean;
export declare function createTailwindV4SourceCacheKey(source: TailwindV4ResolvedSource): string;
export declare function createIncrementalGenerateCacheKey(source: TailwindV4ResolvedSource, target: TailwindV4GenerateTarget, styleOptions: Partial<IStyleHandlerOptions> | undefined): string;
export declare function runIncrementalGenerateTask(cacheKey: string, requestedCandidates: Set<string>, scanSources: TailwindV4GenerateOptions['scanSources'], task: () => Promise<Awaited<ReturnType<TailwindV4Engine['generate']>>>): Promise<import("../index.js").TailwindV4GenerateResult>;
export declare function resolveTargetCandidates(candidates: Iterable<string> | undefined, target: TailwindV4GenerateTarget): Set<string>;
export declare function createIncrementalStyleOptions(styleOptions: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
export declare function resolveStyleOptions(source: TailwindV4ResolvedSource, options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions> | undefined;
export declare function mergeCustomPropertyValues(target: Map<string, string>, css: string): void;
export declare function summarizeIncrementalCacheKey(key: string): {
keyHash: string;
keyBytes: number;
};
export declare function shouldRebuildIncrementalEntry(cached: TailwindV4IncrementalGenerateCacheEntry, requestedCandidates: Set<string>, missingCandidates: string[]): boolean;
export declare function seedIncrementalGenerateCache(options: TailwindV4IncrementalCacheSeedOptions): boolean;
export declare function normalizeTargetRpxLengthCandidates(candidates: Iterable<string>, target: TailwindV4GenerateTarget, styleOptions: Partial<IStyleHandlerOptions> | undefined): {
candidates: Set<string>;
restoreCandidates: Map<string, string>;
};
export {};