[d565449] | 1 | export interface StartOfSourceMap {
|
---|
| 2 | file?: string;
|
---|
| 3 | sourceRoot?: string;
|
---|
| 4 | }
|
---|
| 5 |
|
---|
| 6 | export interface RawSourceMap extends StartOfSourceMap {
|
---|
| 7 | version: string;
|
---|
| 8 | sources: string[];
|
---|
| 9 | names: string[];
|
---|
| 10 | sourcesContent?: string[];
|
---|
| 11 | mappings: string;
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | export interface Position {
|
---|
| 15 | line: number;
|
---|
| 16 | column: number;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | export interface LineRange extends Position {
|
---|
| 20 | lastColumn: number;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | export interface FindPosition extends Position {
|
---|
| 24 | // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
|
---|
| 25 | bias?: number;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | export interface SourceFindPosition extends FindPosition {
|
---|
| 29 | source: string;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | export interface MappedPosition extends Position {
|
---|
| 33 | source: string;
|
---|
| 34 | name?: string;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | export interface MappingItem {
|
---|
| 38 | source: string;
|
---|
| 39 | generatedLine: number;
|
---|
| 40 | generatedColumn: number;
|
---|
| 41 | originalLine: number;
|
---|
| 42 | originalColumn: number;
|
---|
| 43 | name: string;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | export class SourceMapConsumer {
|
---|
| 47 | static GENERATED_ORDER: number;
|
---|
| 48 | static ORIGINAL_ORDER: number;
|
---|
| 49 |
|
---|
| 50 | static GREATEST_LOWER_BOUND: number;
|
---|
| 51 | static LEAST_UPPER_BOUND: number;
|
---|
| 52 |
|
---|
| 53 | constructor(rawSourceMap: RawSourceMap);
|
---|
| 54 | computeColumnSpans(): void;
|
---|
| 55 | originalPositionFor(generatedPosition: FindPosition): MappedPosition;
|
---|
| 56 | generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
|
---|
| 57 | allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
|
---|
| 58 | hasContentsOfAllSources(): boolean;
|
---|
| 59 | sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
|
---|
| 60 | eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | export interface Mapping {
|
---|
| 64 | generated: Position;
|
---|
| 65 | original: Position;
|
---|
| 66 | source: string;
|
---|
| 67 | name?: string;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | export class SourceMapGenerator {
|
---|
| 71 | constructor(startOfSourceMap?: StartOfSourceMap);
|
---|
| 72 | static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
|
---|
| 73 | addMapping(mapping: Mapping): void;
|
---|
| 74 | setSourceContent(sourceFile: string, sourceContent: string): void;
|
---|
| 75 | applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
|
---|
| 76 | toString(): string;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | export interface CodeWithSourceMap {
|
---|
| 80 | code: string;
|
---|
| 81 | map: SourceMapGenerator;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | export class SourceNode {
|
---|
| 85 | constructor();
|
---|
| 86 | constructor(line: number, column: number, source: string);
|
---|
| 87 | constructor(line: number, column: number, source: string, chunk?: string, name?: string);
|
---|
| 88 | static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
|
---|
| 89 | add(chunk: string): void;
|
---|
| 90 | prepend(chunk: string): void;
|
---|
| 91 | setSourceContent(sourceFile: string, sourceContent: string): void;
|
---|
| 92 | walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
|
---|
| 93 | walkSourceContents(fn: (file: string, content: string) => void): void;
|
---|
| 94 | join(sep: string): SourceNode;
|
---|
| 95 | replaceRight(pattern: string, replacement: string): SourceNode;
|
---|
| 96 | toString(): string;
|
---|
| 97 | toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
|
---|
| 98 | }
|
---|