weapp-tailwindcss
Version:
把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!
90 lines (89 loc) • 5.52 kB
TypeScript
import type { OutputAsset, OutputBundle } from 'rollup';
import type { ViteFrameworkCssPipelineContext, ViteFrameworkCssPipelineStrategy } from '../shared/framework-strategy.js';
import type { InternalUserDefinedOptions } from '../../../types/index.js';
export { isCssOutputFile } from './style-files.js';
export interface CssAssetMarkerMatcher {
(asset: OutputAsset, file?: string): boolean;
}
interface CssAssetProcessedMarker {
(asset: OutputAsset, file?: string): void;
}
interface CssAssetResultRecordOptions {
injectIntoMain?: boolean | undefined;
outputFile?: string | undefined;
}
export interface CssAssetResultRecorder {
(file: string, css: string, options?: CssAssetResultRecordOptions): void;
}
interface CssAssetResultsGetter {
(): Iterable<[string, string | {
css: string;
injectIntoMain?: boolean | undefined;
outputFile?: string | undefined;
}]>;
}
export interface CollectViteProcessedCssAssetOptions {
opts?: InternalUserDefinedOptions | undefined;
cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined;
createCssPipelineContext?: ((file: string) => ViteFrameworkCssPipelineContext) | undefined;
isViteProcessedCssAsset?: CssAssetMarkerMatcher | undefined;
markCssAssetProcessed?: CssAssetProcessedMarker | undefined;
recordCssAssetResult?: CssAssetResultRecorder | undefined;
recordViteProcessedCssAssetResult?: CssAssetResultRecorder | undefined;
resolveViteProcessedCssOutputFile?: ((file: string) => string | undefined) | undefined;
subpackageRoots?: Set<string> | undefined;
transformCss?: ((css: string, file: string) => string) | undefined;
debug?: ((format: string, ...args: unknown[]) => void) | undefined;
}
export interface InjectViteProcessedCssAssetOptions {
opts: InternalUserDefinedOptions;
cssPipelineStrategy?: ViteFrameworkCssPipelineStrategy | undefined;
createCssPipelineContext?: ((file: string) => ViteFrameworkCssPipelineContext) | undefined;
getViteProcessedCssAssetResults?: CssAssetResultsGetter | undefined;
markCssAssetProcessed?: CssAssetProcessedMarker | undefined;
recordCssAssetResult?: CssAssetResultRecorder | undefined;
shouldRemoveInjectedSourceAsset?: ((file: string, record: {
file: string;
css: string;
injectIntoMain?: boolean | undefined;
outputFile?: string | undefined;
}) => boolean) | undefined;
transformCss?: ((css: string, file: string) => string) | undefined;
debug?: ((format: string, ...args: unknown[]) => void) | undefined;
onUpdate?: ((file: string, original: string, generated: string) => void) | undefined;
recordTimingDetail?: ((name: string, startedAt: number) => void) | undefined;
}
export declare function createCssAssetPipelineContext(options: Pick<CollectViteProcessedCssAssetOptions & InjectViteProcessedCssAssetOptions, 'createCssPipelineContext'>, file: string, bundle: OutputBundle): {
bundle: OutputBundle;
currentGeneratorBranch: ReturnType<typeof import("../../../runtime-branch.js").resolveGeneratorRuntimeBranch>;
currentGeneratorOptions: ReturnType<typeof import("../../../index.js").normalizeWeappTailwindcssGeneratorOptions>;
opts: InternalUserDefinedOptions;
resolvedConfig: import("vite").ResolvedConfig | undefined;
resolveStylePlatform: () => string | undefined;
} | undefined;
export declare function getAssetFile(bundleFile: string, asset: OutputAsset): string;
export declare function readAssetSource(asset: OutputAsset): string;
export declare function clearAssetSource(asset: OutputAsset): void;
export declare function appendCss(baseCss: string, css: string): string;
export declare function hasNonCommentCss(css: string): boolean;
export declare function dedupeViteCssResults<T extends {
css: string;
outputFile?: string | undefined;
}>(records: T[]): T[];
export declare function removeTailwindEntryDirectivesFromCss(css: string): string;
interface NormalizeInjectableCssResult {
css: string;
importedStyleFiles: Set<string>;
}
export declare function normalizeInjectableCssForTarget(css: string, file: string): string;
export declare function normalizeInjectableCssForTargetWithImports(css: string, file: string): NormalizeInjectableCssResult;
export declare function isStyleImportRequest(request: string | undefined): boolean;
export declare function collectImportedStyleFiles(css: string, targetFile: string): Set<string>;
export declare function normalizeMarkerOutputFile(markerFile: string, resolveViteProcessedCssOutputFile: ((file: string) => string | undefined) | undefined): string;
export declare function isMatchingGeneratedCssMarkerFile(targetFile: string, markerFile: string | undefined, resolveViteProcessedCssOutputFile: ((file: string) => string | undefined) | undefined): boolean;
export declare function resolveViteProcessedCssAssetSource(file: string, rawSource: string, resolveViteProcessedCssOutputFile: ((file: string) => string | undefined) | undefined): string;
export declare function collectMatchingGeneratedCssMarkerFiles(file: string, rawSource: string, resolveViteProcessedCssOutputFile: ((file: string) => string | undefined) | undefined): string[];
export declare function collectRootStyleBundleCssSources(bundle: OutputBundle, excludedFile: string): string[];
export declare function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle: OutputBundle, options?: {
debug?: ((format: string, ...args: unknown[]) => void) | undefined;
}): number;