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