UNPKG

1.84 kBTypeScriptView Raw
1// Type definitions for source-map-support 0.5
2// Project: https://github.com/evanw/node-source-map-support
3// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4// Jason Cheatham <https://github.com/jason0x43>
5// Alcedo Nathaniel De Guzman Jr <https://github.com/natealcedo>
6// Griffin Yourick <https://github.com/tough-griff>
7// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8
9import { RawSourceMap } from 'source-map';
10
11/**
12 * Output of retrieveSourceMap().
13 * From source-map-support:
14 * The map field may be either a string or the parsed JSON object (i.e.,
15 * it must be a valid argument to the SourceMapConsumer constructor).
16 */
17export interface UrlAndMap {
18 url: string;
19 map: string | RawSourceMap;
20}
21
22/**
23 * Options to install().
24 */
25export interface Options {
26 handleUncaughtExceptions?: boolean | undefined;
27 hookRequire?: boolean | undefined;
28 emptyCacheBetweenOperations?: boolean | undefined;
29 environment?: 'auto' | 'browser' | 'node' | undefined;
30 overrideRetrieveFile?: boolean | undefined;
31 overrideRetrieveSourceMap?: boolean | undefined;
32 retrieveFile?(path: string): string;
33 retrieveSourceMap?(source: string): UrlAndMap | null;
34}
35
36export interface Position {
37 source: string;
38 line: number;
39 column: number;
40}
41
42export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */;
43export function getErrorSource(error: Error): string | null;
44export function mapSourcePosition(position: Position): Position;
45export function retrieveSourceMap(source: string): UrlAndMap | null;
46export function resetRetrieveHandlers(): void;
47
48/**
49 * Install SourceMap support.
50 * @param options Can be used to e.g. disable uncaughtException handler.
51 */
52export function install(options?: Options): void;