import { ObjectDictionary } from "@opticss/util"; import { postcss } from "opticss"; import { RawSourceMap } from "source-map"; import { Block } from "../BlockTree"; import { Options, ResolvedConfiguration } from "../configuration"; import { ImportedCompiledCssFile, Importer } from "../importing"; import { ProcessedFile } from "./preprocessing"; /** * This factory ensures that instances of a block are re-used when blocks are * going to be compiled/optimized together. Multiple instances of the same * block will result in analysis and optimization bugs. * * This also ensures that importers and preprocessors are correctly used when loading a block file. */ export declare class BlockFactoryBase { postcssImpl: typeof postcss; importer: Importer; configuration: ResolvedConfiguration; blockNames: ObjectDictionary; faultTolerant: boolean; private guids; constructor(options: Options, postcssImpl?: typeof postcss, faultTolerant?: boolean); /** * Toss out any caches in this BlockFactory. Any future requests for a block * or block path will be loaded fresh from persistent storage. */ reset(): void; /** * Depending on whether the blockFactory is fault tolerant or not, it either * surfaces the errors or swallows them and reexports the block interface * @param block the block to check for errors */ protected _surfaceBlockErrors(block: Block): Block; protected _prepareDefinitionASTs(file: ImportedCompiledCssFile): { definitionAst: postcss.Root; cssContentsAst: postcss.Root; }; /** * Merges the CSS rules from a Compiled CSS file into its associated block. The block * will have been created previously from parsing the definition file using BlockParser. * @param block - The block that was generated from a definition file. * @param cssContentsAst - The parsed AST generated from the CSS file's contents. * @param file - The CompiledCSSFile that this block and CSS file was parsed from. */ protected _mergeCssRulesIntoDefinitionBlock(block: Block, cssContentsAst: postcss.Root, file: ImportedCompiledCssFile): void; /** * Register a new block name with the BlockFactory. * @param name The new block name to register. * @param doNotOverride If true, will not attempt to provide a new block name if the given * name has already been registered. * @return The unique block name that is now registered with the BlockFactory, or null if * the name has already been registered and should not be overridden. */ getUniqueBlockName(name: string, identifier: string, doNotOverride?: boolean): string | null; /** * Registers a new GUID with the BlockFactory. * @param guid - The guid to register. * @param identifier - A reference to the file this block was generated from, for error reporting. * @return True if registration is successful, false otherwise. */ registerGuid(guid: string): boolean; } export declare function sourceMapFromProcessedFile(result: ProcessedFile): RawSourceMap | string | undefined; //# sourceMappingURL=BlockFactoryBase.d.ts.map