import MagicString, { SourceMap, MagicStringOptions, SourceMapOptions } from 'magic-string'; /** * Count lines in a string. */ declare function countLines(source: string): number; /** * Find the length of last line of a string. */ declare function lastLineLength(source: string): number; /** * Creates a SourceLocation from a string. */ declare function createSourceLocation(source: string): SourceLocation; /** * Finds a SourceLocation array from a string to search in a source. */ declare function findAllSourceLocations(source: string, search: string): SourceLocation[]; /** * Creates a SourceLocation from two string offset integers. */ declare function createSourceLocationFromOffsets(source: string, start: number, end: number): SourceLocation; /** * Position of a caret in a string. */ interface Position { offset: number; line: number; column: number; } /** * Position of a string in a source. */ interface SourceLocation { source: string; start: Position; end: Position; } interface MagicBlockBase { loc?: SourceLocation | { start: number; end: number; }; _source?: string; _loc?: SourceLocation; [key: string]: any; } type MagicBlock = T & MagicString; declare function proxyBlock(source: MagicString, block?: T, loc?: SourceLocation | { start: number; end: number; }, handler?: ProxyHandler): MagicBlock; interface TransformResult { code: string; map: SourceMap | null; etag?: string; deps?: string[]; dynamicDeps?: string[]; } interface MagicSFCOptions extends MagicStringOptions { parser?: any; parserOptions?: any; silent?: boolean; } declare const magicSfcDefaultOptions: MagicSFCOptions; declare class MagicSFC { source: string; ms: MagicString; options: MagicSFCOptions; parsed?: any; templates: MagicBlock[]; scripts: MagicBlock[]; styles: MagicBlock[]; customs: MagicBlock[]; constructor(source: string | MagicString, userOptions?: T, defaultOptions?: MagicSFCOptions); parse(): Promise | void>; toString(): string; getSourcemap(sourceMapOptions?: SourceMapOptions): SourceMap; getTransformResult(): TransformResult; } export { type MagicBlock, type MagicBlockBase, MagicSFC, type MagicSFCOptions, type Position, type SourceLocation, type TransformResult, countLines, createSourceLocation, createSourceLocationFromOffsets, findAllSourceLocations, lastLineLength, magicSfcDefaultOptions, proxyBlock };