UNPKG

1.04 kBTypeScriptView Raw
1import { Replacement, SourceAndMapMixin } from '.';
2import Source = require('./Source');
3
4/**
5 * Decorates a Source with replacements and insertions of source code.
6 *
7 */
8declare class ReplaceSource extends Source implements SourceAndMapMixin {
9 replacements: Replacement[];
10
11 /**
12 * The ReplaceSource supports "identity" mappings for child source.
13 * When original source matches generated source for a mapping it's assumed to be mapped char by char allowing to split mappings at replacements/insertions.
14 */
15 constructor(source: Source, name?: string);
16
17 /**
18 * Replaces chars from start (0-indexed, inclusive) to end (0-indexed, inclusive) with replacement.
19 */
20 replace(start: number, end: number, newValue: string, name?: string): void;
21
22 /**
23 * Inserts the insertion before char pos (0-indexed).
24 */
25 insert(pos: number, newValue: string, name?: string): void;
26
27 /**
28 * Get decorated Source.
29 */
30 original(): Source;
31
32 source(): string;
33}
34
35export = ReplaceSource;