import { postcss } from "opticss"; import { Block } from "../BlockTree"; import { Options } from "../configuration"; import { FileIdentifier } from "../importing"; import { BlockFactory } from "./index"; import { BlockFactorySync } from "./index"; import { Syntax } from "./preprocessing"; export interface ParsedSource { identifier: FileIdentifier; defaultName: string; originalSource: string; originalSyntax: Syntax; parseResult: postcss.Root; dependencies: string[]; } /** * Parser that, given a PostCSS AST will return a `Block` object. Main public * interface is `BlockParser.parse`. */ export declare class BlockParser { private config; private factory; constructor(opts: Options, factory: BlockFactory | BlockFactorySync); parseSource(source: ParsedSource): Promise; parseSourceSync(source: ParsedSource): Block; parseDefinitionSource(root: postcss.Root, identifier: string, expectedId: string, defaultName: string): Promise; parseDefinitionSourceSync(root: postcss.Root, identifier: string, expectedId: string, defaultName: string): Block; /** * Main public interface of `BlockParser`. Given a PostCSS AST, returns a promise * for the new `Block` object. * @param root - PostCSS AST * @param sourceFile - Source file name * @param name - Name of block * @param isDfnFile - Whether the block being parsed is a definition file. Definition files are incomplete blocks * that will need to merge in rules from its Compiled CSS later. They are also expected to declare * additional properties that regular Blocks don't, such as `block-id`. * @param expectedGuid - If a GUID is defined in the file, it's expected to match this value. This argument is only * relevant to definition files, where the definition file is linked to Compiled CSS and * both files may declare a GUID. */ parse(root: postcss.Root, identifier: string, name: string, isDfnFile?: boolean, expectedGuid?: string): Promise; /** * Main public interface of `BlockParser`. Given a PostCSS AST, returns a * new `Block` object if the block hasn't yet been parsed, or the existing block if it has. * * @param root - PostCSS AST * @param sourceFile - Source file name * @param name - Name of block * @param isDfnFile - Whether the block being parsed is a definition file. Definition files are incomplete blocks * that will need to merge in rules from its Compiled CSS later. They are also expected to declare * additional properties that regular Blocks don't, such as `block-id`. * @param expectedGuid - If a GUID is defined in the file, it's expected to match this value. This argument is only * relevant to definition files, where the definition file is linked to Compiled CSS and * both files may declare a GUID. */ parseSync(root: postcss.Root, identifier: string, name: string, isDfnFile?: boolean, expectedGuid?: string): Block; } //# sourceMappingURL=BlockParser.d.ts.map