[6a3a178] | 1 | // Type definitions for source-list-map v0.1.6
|
---|
| 2 | // Project: https://github.com/webpack/source-list-map.git
|
---|
| 3 | // Definitions by: e-cloud <https://github.com/e-cloud>
|
---|
| 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
---|
| 5 |
|
---|
| 6 | export class CodeNode {
|
---|
| 7 | generatedCode: string;
|
---|
| 8 |
|
---|
| 9 | constructor(generatedCode: string);
|
---|
| 10 |
|
---|
| 11 | clone(): CodeNode;
|
---|
| 12 |
|
---|
| 13 | getGeneratedCode(): string;
|
---|
| 14 |
|
---|
| 15 | getMappings(mappingsContext?: MappingsContext): string;
|
---|
| 16 |
|
---|
| 17 | addGeneratedCode(generatedCode: string): void;
|
---|
| 18 |
|
---|
| 19 | mapGeneratedCode(fn: (code: string) => string): void;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | export class MappingsContext {
|
---|
| 23 | sources: string[];
|
---|
| 24 | sourcesContent: string[];
|
---|
| 25 | hasSourceContent: boolean;
|
---|
| 26 | currentOriginalLine: number;
|
---|
| 27 | currentSource: number;
|
---|
| 28 |
|
---|
| 29 | constructor();
|
---|
| 30 |
|
---|
| 31 | ensureSource(source: string, originalSource: string): number;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | export class SourceNode {
|
---|
| 35 | generatedCode: string;
|
---|
| 36 | source: string;
|
---|
| 37 | originalSource: string;
|
---|
| 38 | startingLine: number;
|
---|
| 39 |
|
---|
| 40 | constructor(generatedCode: string, source: string, originalSource: string, startingLine?: number);
|
---|
| 41 |
|
---|
| 42 | clone(): SourceNode;
|
---|
| 43 |
|
---|
| 44 | getGeneratedCode(): string;
|
---|
| 45 |
|
---|
| 46 | getMappings(mappingsContext: MappingsContext): string;
|
---|
| 47 |
|
---|
| 48 | mapGeneratedCode(fn: (code: string) => string): void;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | export class SourceListMap {
|
---|
| 52 | children: (SourceNode | CodeNode)[];
|
---|
| 53 |
|
---|
| 54 | constructor(generatedCode: (SourceNode | CodeNode)[]);
|
---|
| 55 | constructor(
|
---|
| 56 | generatedCode?: string | SourceNode | CodeNode | SourceListMap,
|
---|
| 57 | source?: string,
|
---|
| 58 | originalSource?: string
|
---|
| 59 | );
|
---|
| 60 |
|
---|
| 61 | add(
|
---|
| 62 | generatedCode: string | CodeNode | SourceNode | SourceListMap,
|
---|
| 63 | source?: string,
|
---|
| 64 | originalSource?: string
|
---|
| 65 | ): void;
|
---|
| 66 |
|
---|
| 67 | prepend(generatedCode: SourceListMap | SourceNode | CodeNode, source?: string, originalSource?: string): void;
|
---|
| 68 |
|
---|
| 69 | mapGeneratedCode(fn: (code: string) => string): void;
|
---|
| 70 |
|
---|
| 71 | toString(): string;
|
---|
| 72 |
|
---|
| 73 | toStringWithSourceMap(options: { file: any }): {
|
---|
| 74 | source: string;
|
---|
| 75 | map: {
|
---|
| 76 | version: number;
|
---|
| 77 | file: any;
|
---|
| 78 | sources: string[];
|
---|
| 79 | sourcesContent: string[];
|
---|
| 80 | mappings: string;
|
---|
| 81 | };
|
---|
| 82 | };
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | export function fromStringWithSourceMap(
|
---|
| 86 | code: string, map: {
|
---|
| 87 | sources: (string | SourceNode | CodeNode) [];
|
---|
| 88 | sourcesContent: string[];
|
---|
| 89 | mappings: string;
|
---|
| 90 | }
|
---|
| 91 | ): SourceListMap;
|
---|