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