import { SaxesParser } from 'saxes'; import { Attr, Node } from 'slimdom'; /** * The helper functions to track node positions. */ declare type PositionTracker = { trackNodePosition(node: N): PositionTrackedNode; trackNodeClosePosition(node: PositionTrackedNode): PositionTrackedElement; updateLastTrackedPosition(): void; getCurrentPosition(): Position; trackAttributePosition(attr: A, endPosition: Position): PositionTrackedAttr; }; /** * One (collapsed) location in code. `offset` is equal to the length of all preceding lines + column. */ export declare type Position = { offset: number; line: number; column: number; }; /** * A location in code, possibly spanning text. `start` and `end` are both offsets from the start of * the XML source. */ export declare type PositionRange = { line: number; column: number; start: number; end: number; }; /** * Various properties on nodes that contain the position information. */ export declare type PositionTrackedNode = N & { position: PositionRange; }; export declare type PositionTrackedElement = PositionTrackedNode & { closePosition: PositionRange; }; export declare type PositionTrackedAttr = A & { position: { end: number; }; }; /** * Create the context needed to track the positions in an XML string at which a Slimdom node was defined. Is based on * input from the saxes parser and fixes some unexpected behaviour by it. */ export default function createPositionTracker(parser: SaxesParser): PositionTracker; /** * No-op alternative for position tracking, when position tracking is disabled. */ export declare const positionTrackerStubs: PositionTracker; export {};