/** * Span-based splicing over SWC parses, shared by the compiler transforms. * Spans are byte offsets with a per-process global base — the base is read * off a prepended sentinel import rather than searched for (see * scripts/packaging/specifiers.ts, where the technique comes from, for why * searching is ambiguous). */ export interface Span { start: number; end: number; } export interface Edit extends Span { text: string; } export interface SpannedModule { body: any[]; /** Subtract from any span to get a byte offset into the original code. */ offset: number; } /** Parses with the sentinel prepended; undefined when the module does not parse. */ export declare function parseWithSpanBase(code: string, tsx: boolean): SpannedModule | undefined; /** One pass over ascending edits: O(source + edits), and the caller's array is left alone. */ export declare function splice(source: Buffer, edits: Edit[]): Buffer; /** The original bytes a span covers. */ export declare function sliceSpan(bytes: Buffer, span: Span, offset: number): string;