|
1 |
| -export interface StartOfSourceMap { |
2 |
| - file?: string; |
3 |
| - sourceRoot?: string; |
4 |
| -} |
| 1 | +declare module 'source-map-js' { |
| 2 | + export interface StartOfSourceMap { |
| 3 | + file?: string; |
| 4 | + sourceRoot?: string; |
| 5 | + } |
5 | 6 |
|
6 |
| -export interface RawSourceMap extends StartOfSourceMap { |
7 |
| - version: string; |
8 |
| - sources: string[]; |
9 |
| - names: string[]; |
10 |
| - sourcesContent?: string[]; |
11 |
| - mappings: string; |
12 |
| -} |
| 7 | + export interface RawSourceMap extends StartOfSourceMap { |
| 8 | + version: string; |
| 9 | + sources: string[]; |
| 10 | + names: string[]; |
| 11 | + sourcesContent?: string[]; |
| 12 | + mappings: string; |
| 13 | + } |
13 | 14 |
|
14 |
| -export interface Position { |
15 |
| - line: number; |
16 |
| - column: number; |
17 |
| -} |
| 15 | + export interface Position { |
| 16 | + line: number; |
| 17 | + column: number; |
| 18 | + } |
18 | 19 |
|
19 |
| -export interface LineRange extends Position { |
20 |
| - lastColumn: number; |
21 |
| -} |
| 20 | + export interface LineRange extends Position { |
| 21 | + lastColumn: number; |
| 22 | + } |
22 | 23 |
|
23 |
| -export interface FindPosition extends Position { |
24 |
| - // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND |
25 |
| - bias?: number; |
26 |
| -} |
| 24 | + export interface FindPosition extends Position { |
| 25 | + // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND |
| 26 | + bias?: number; |
| 27 | + } |
27 | 28 |
|
28 |
| -export interface SourceFindPosition extends FindPosition { |
29 |
| - source: string; |
30 |
| -} |
| 29 | + export interface SourceFindPosition extends FindPosition { |
| 30 | + source: string; |
| 31 | + } |
31 | 32 |
|
32 |
| -export interface MappedPosition extends Position { |
33 |
| - source: string; |
34 |
| - name?: string; |
35 |
| -} |
| 33 | + export interface MappedPosition extends Position { |
| 34 | + source: string; |
| 35 | + name?: string; |
| 36 | + } |
36 | 37 |
|
37 |
| -export interface MappingItem { |
38 |
| - source: string; |
39 |
| - generatedLine: number; |
40 |
| - generatedColumn: number; |
41 |
| - originalLine: number; |
42 |
| - originalColumn: number; |
43 |
| - name: string; |
44 |
| -} |
| 38 | + export interface MappingItem { |
| 39 | + source: string; |
| 40 | + generatedLine: number; |
| 41 | + generatedColumn: number; |
| 42 | + originalLine: number; |
| 43 | + originalColumn: number; |
| 44 | + name: string; |
| 45 | + } |
45 | 46 |
|
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 |
| -} |
| 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 | + } |
62 | 84 |
|
63 |
| -export interface Mapping { |
64 |
| - generated: Position; |
65 |
| - original: Position; |
66 |
| - source: string; |
67 |
| - name?: string; |
| 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 | + } |
68 | 100 | }
|
69 | 101 |
|
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; |
| 102 | +declare module 'source-map-js/lib/source-map-generator' { |
| 103 | + import { SourceMapGenerator } from 'source-map-js' |
| 104 | + export { SourceMapGenerator } |
77 | 105 | }
|
78 | 106 |
|
79 |
| -export interface CodeWithSourceMap { |
80 |
| - code: string; |
81 |
| - map: SourceMapGenerator; |
| 107 | +declare module 'source-map-js/lib/source-map-consumer' { |
| 108 | + import { SourceMapConsumer } from 'source-map-js' |
| 109 | + export { SourceMapConsumer } |
82 | 110 | }
|
83 | 111 |
|
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; |
| 112 | +declare module 'source-map-js/lib/source-node' { |
| 113 | + import { SourceNode } from 'source-map-js' |
| 114 | + export { SourceNode } |
98 | 115 | }
|
0 commit comments