import type { Context } from '../context'; import type { Visitor } from '../visitor'; import { OutputCollector } from '../output'; export declare type Primitive = string | number | Node; /** Function is used by the Call node */ export declare type NodeValue = Function | Primitive | Primitive[]; export declare type NodeMap = { value?: NodeValue; [k: string]: NodeValue; }; export declare type LocationInfo = [ startOffset?: number, startLine?: number, startColumn?: number, endOffset?: number, endLine?: number, endColumn?: number ]; export declare type FileInfo = { filename?: string; rootpath?: string; }; export declare const isNodeMap: (val: NodeValue | NodeMap) => val is NodeMap; export declare abstract class Node { location: LocationInfo; fileInfo: FileInfo; type: string; evaluated: boolean; allowRoot: boolean; allowRuleRoot: boolean; _nodeKeys: string[]; /** Used by Ruleset */ rootRules: Node[]; value: NodeValue; /** We'll put arbitrary props on the node */ [k: string]: unknown; constructor(value: NodeValue | NodeMap, location?: LocationInfo, fileInfo?: FileInfo); /** * Mutates node children in place. Used by eval() * which first makes a shallow clone before mutating. */ processNodes(func: (n: Node) => Node): void; /** * Fire a function for each Node in the tree, recursively */ walkNodes(func: (n: Node) => void): void; collectRoots(): Node[]; accept(visitor: Visitor): void; /** * Creates a copy of the current node. */ clone(): this; eval(context: Context): Node; inherit(node: Node): this; fround(value: number): number; valueOf(): NodeValue; /** * Generate a .ts module and .ts.map * @todo - Should we generate an ESTree AST to avoid re-parsing in Rollup? */ abstract toModule(context: Context, out: OutputCollector): void; /** Generate a .css file and .css.map */ toCSS(context: Context, out: OutputCollector): void; }