stryker
Version:
The extendable JavaScript mutation testing framework
78 lines • 2.75 kB
TypeScript
import { File, Location, StrykerOptions } from 'stryker-api/core';
import { StrykerError } from '@stryker-mutator/util';
export interface MappedLocation {
fileName: string;
location: Location;
}
export declare class SourceMapError extends StrykerError {
constructor(message: string, innerError?: Error);
}
/**
* Represents an object that can calculated a transpiled location for a given original location
* It is implemented with the [composite pattern](https://en.wikipedia.org/wiki/Composite_pattern)
* Use the `create` method to retrieve a specific `SourceMapper` implementation
*/
export default abstract class SourceMapper {
/**
* Calculated a transpiled location for a given original location
* @param originalLocation The original location to be converted to a transpiled location
*/
abstract transpiledLocationFor(originalLocation: MappedLocation): MappedLocation;
abstract transpiledFileNameFor(originalFileName: string): string;
static create(transpiledFiles: ReadonlyArray<File>, options: StrykerOptions): SourceMapper;
}
export declare class TranspiledSourceMapper extends SourceMapper {
private readonly transpiledFiles;
private sourceMaps;
private readonly log;
constructor(transpiledFiles: ReadonlyArray<File>);
/**
* @inheritDoc
*/
transpiledFileNameFor(originalFileName: string): string;
/**
* @inheritdoc
*/
transpiledLocationFor(originalLocation: MappedLocation): MappedLocation;
private getRelativeSource;
/**
* Gets the source map for given file
*/
private getSourceMap;
/**
* Creates all source maps for lazy loading purposes
*/
private createSourceMaps;
private getRawSourceMap;
private getSourceMapForFile;
/**
* Gets the source map file from a url.
* @param sourceMapUrl The source map url. Can be a data url (data:application/json;base64,ABC...), or an actual file url
* @param transpiledFile The transpiled file for which the data url is
*/
private getSourceMapFileFromUrl;
private isInlineUrl;
/**
* Gets the source map from a data url
*/
private getInlineSourceMap;
/**
* Gets the source map from a file
*/
private getExternalSourceMap;
/**
* Gets the source map url from a transpiled file (the last comment with sourceMappingURL= ...)
*/
private getSourceMapUrl;
}
export declare class PassThroughSourceMapper extends SourceMapper {
/**
* @inheritdoc
*/
transpiledFileNameFor(originalFileName: string): string;
/**
* @inheritdoc
*/
transpiledLocationFor(originalLocation: MappedLocation): MappedLocation;
}
//# sourceMappingURL=SourceMapper.d.ts.map