import { postcss, postcssSelectorParser as selectorParser } from "opticss"; import { Configuration } from "./configuration"; /** * Represents a character. */ export interface SourcePosition { /** * 1-based index of the line containing the character. */ line: number; /** * 1-based index of the column containing the character. */ column: number; } export interface SourceFile { filename: string; } export declare type SourceLocation = Partial & SourcePosition; /** * Represents a text range in a file. * The range is inclusive of both the start and end characters, * so a range of a single character will have the same value for the * start and the end positions. */ export interface SourceRange extends Partial { start: SourcePosition; end: SourcePosition; } /** * Represents the source range with additional range information that spans the * same location in the output from compiling that source. * * Because we use the source map to work backwards from the generated output, * the range information as it applies to the generated source is more accurate, * but also less actionable. */ export interface MappedSourceRange extends Required { generated: Required & { source: string; }; } /** * Reduces multiple `SourceLocation` objects into a single object capturing the * actual location of the source code on disk. * @param locations An array of SourceLocation objects. * @returns An object containing the line number and column number. */ export declare function addSourcePositions(...locations: SourcePosition[]): SourcePosition; /** * Utility function to fetch the filename, start and end positions * of a given `postcss.Node`. * @param sourceFile The source file name that contains this rule. * @param node The PostCSS Node object in question. * @returns An object representing the filename, line number and column number. */ export declare function sourceRange(configuration: Configuration, root: postcss.Root | null | undefined, filename: string, node: postcss.Node): MappedSourceRange | SourceRange | SourceFile; /** * Utility function to fetch the filename, line number and column number * of a given selector. * @param filename The source file name that contains this rule. * @param rule The PostCSS Rule object containing this selector. * @param selector The PostCSS selector node in question. * @returns An object representing the filename, line number and column number. */ export declare function selectorSourceRange(configuration: Configuration, root: postcss.Root | null | undefined, filename: string, rule: postcss.Rule, selector: selectorParser.Node): SourceRange | SourceFile | MappedSourceRange; //# sourceMappingURL=SourceLocation.d.ts.map