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