diff --git a/types/istanbul-lib-source-maps/index.d.ts b/types/istanbul-lib-source-maps/index.d.ts index 12569d62cd..45f7f3d05d 100644 --- a/types/istanbul-lib-source-maps/index.d.ts +++ b/types/istanbul-lib-source-maps/index.d.ts @@ -1,43 +1,43 @@ -// Type definitions for istanbul-lib-source-maps 1.2 +// Type definitions for istanbul-lib-source-maps 4.0 // Project: https://istanbul.js.org, https://github.com/istanbuljs/istanbuljs // Definitions by: Jason Cheatham +// Sridhar Mallela // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 import { CoverageMap } from 'istanbul-lib-coverage'; import { RawSourceMap } from 'source-map'; -export function createSourceMapStore( - options?: Partial -): MapStore; +export function createSourceMapStore(options?: Partial): MapStore; export interface MapStoreOptions { - verbose: boolean; - baseDir: string; - sourceStore: 'memory' | 'file'; - tmpdir: string; + verbose: boolean; + baseDir: string; + sourceStore: 'memory' | 'file'; + tmpdir: string; } export interface MapStore { - baseDir: string | null; - verbose: boolean; - sourceStore: SourceStore; - data: { - [filepath: string]: { - type: string; - data: any; - }; - }; + baseDir: string | null; + verbose: boolean; + sourceStore: SourceStore; + data: { + [filepath: string]: { + type: string; + data: any; + }; + }; - registerURL(transformedFilePath: string, sourceMapUrl: string): void; - registerMap(filename: string, sourceMap: RawSourceMap): void; - transformCoverage( - coverageMap: CoverageMap - ): { map: CoverageMap; sourceFinder(path: string): string }; - dispose(): void; + registerURL(transformedFilePath: string, sourceMapUrl: string): void; + registerMap(filename: string, sourceMap: RawSourceMap): void; + getSourceMapSync(filePath: string): any; + addInputSourceMapsSync(coverageData: any): void; + sourceFinder(filePath: string): string; + transformCoverage(coverageMap: CoverageMap): CoverageMap; + dispose(): void; } export class SourceStore { - getSource(filepath: string): string | null; - registerSource(filepath: string, sourceText: string): void; + getSource(filepath: string): string | null; + registerSource(filepath: string, sourceText: string): void; } diff --git a/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts b/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts index 844205df8d..68fdf24fa8 100644 --- a/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts +++ b/types/istanbul-lib-source-maps/istanbul-lib-source-maps-tests.ts @@ -1,24 +1,24 @@ -import { createSourceMapStore } from 'istanbul-lib-source-maps'; import { CoverageMap } from 'istanbul-lib-coverage'; import { RawSourceMap } from 'source-map'; +import { createSourceMapStore } from 'istanbul-lib-source-maps'; createSourceMapStore(); createSourceMapStore({}); const store = createSourceMapStore({ - verbose: false, - baseDir: 'foo', - sourceStore: 'memory', - tmpdir: 'foo' + verbose: false, + baseDir: 'foo', + sourceStore: 'memory', + tmpdir: 'foo', }); store.data['foo'].type.trim(); const sourceMap: RawSourceMap = { - version: 1 as any as string, // Fixed by https://github.com/mozilla/source-map/pull/293 but the fix is not yet published - sources: ['foo', 'bar'], - names: ['foo', 'bar'], - mappings: 'foo', - file: 'foo' + version: (1 as any) as string, // Fixed by https://github.com/mozilla/source-map/pull/293 but the fix is not yet published + sources: ['foo', 'bar'], + names: ['foo', 'bar'], + mappings: 'foo', + file: 'foo', }; store.registerMap('foo', sourceMap); @@ -26,13 +26,12 @@ store.registerURL('foo', 'foo'); const map = new CoverageMap({}); const transformed = store.transformCoverage(map); -transformed.map.data; -transformed.sourceFinder('foo').trim(); +transformed.data; store.dispose(); store.sourceStore.registerSource('foo', 'bar'); const source = store.sourceStore.getSource('foo'); if (source != null) { - source.trim(); + source.trim(); }