weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
55 lines (54 loc) • 3.39 kB
TypeScript
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
import type { OutputAsset } from 'rollup';
import type { ResolvedConfig } from 'vite';
import type { ViteFrameworkCssPipelineContext, ViteFrameworkCssPipelineStrategy } from '../shared/framework-strategy.js';
import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan.js';
import type { InternalUserDefinedOptions } from '../../../types/index.js';
interface RememberedMainCssSource {
rawSource: string;
sourceFile: string;
}
export interface CssFinalizerContext {
opts: InternalUserDefinedOptions;
runtimeState: {
tailwindRuntime: InternalUserDefinedOptions['tailwindRuntime'];
readyPromise: Promise<void>;
};
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined;
isCssAssetProcessed: (asset: OutputAsset, file?: string) => boolean;
markCssAssetProcessed: (asset: OutputAsset, file?: string) => void;
debug: (format: string, ...args: unknown[]) => void;
getResolvedConfig: () => ResolvedConfig | undefined;
recordCssAssetResult?: (file: string, css: string) => void;
recordViteProcessedCssAssetResult?: (file: string, css: string, options?: {
injectIntoMain?: boolean | undefined;
outputFile?: string | undefined;
}) => void;
getViteProcessedCssAssetResults?: () => Iterable<[string, string | {
css: string;
injectIntoMain?: boolean | undefined;
outputFile?: string | undefined;
}]>;
getRecordedGeneratorCandidates?: () => Set<string> | undefined;
getSourceCandidates?: () => Set<string>;
getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
getSourceCandidateSourcesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Map<string, Set<string>>) | undefined;
waitForSourceCandidateSyncs?: () => Promise<void>;
rememberMainCssSource?: (file: string, rawSource: string) => void;
getRememberedMainCssSource?: (file: string) => RememberedMainCssSource | undefined;
isViteProcessedCssAsset?: (asset: OutputAsset, file?: string) => boolean;
frameworkRootImportShellTargetByFile?: ReadonlyMap<string, string> | undefined;
}
export interface CssFinalizerThis {
addWatchFile?: (id: string) => void;
}
export declare function inferPlatformFromViteOutDir(outDir: string | undefined): string | undefined;
export declare function registerGeneratorDependencies(ctx: CssFinalizerThis, dependencies: readonly string[] | undefined): void;
export declare function createCssHandlerOptions(opts: InternalUserDefinedOptions, majorVersion: number | undefined, file: string, outputRoot: string | undefined, extraOptions?: Record<string, unknown>): IStyleHandlerOptions;
export declare function shouldGenerateCssByGenerator(opts: InternalUserDefinedOptions, majorVersion: number | undefined, file: string, rawSource: string, processed: boolean): boolean;
export declare function collectViteProcessedCssSources(getViteProcessedCssAssetResults: CssFinalizerContext['getViteProcessedCssAssetResults']): string[];
export declare function finalizeWebCss(css: string, context: ViteFrameworkCssPipelineContext & {
file: string;
}, cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined): string;
export {};