source-map-support updates

- Handle new config options
- Enable strictNullChecks
- Setup tslint
This commit is contained in:
Jason Cheatham 2017-05-16 13:43:56 -04:00
parent 08fe65cf1a
commit 91db150773
4 changed files with 29 additions and 20 deletions

View File

@ -1,11 +1,10 @@
// Type definitions for source-map-support 0.2.10
// Type definitions for source-map-support 0.4
// Project: https://github.com/evanw/source-map-support
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Jason Cheatham <https://github.com/jason0x43>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* Output of retrieveSourceMap().
*/
@ -19,9 +18,13 @@ export interface UrlAndMap {
*/
export interface Options {
handleUncaughtExceptions?: boolean;
hookRequire?: boolean;
emptyCacheBetweenOperations?: boolean;
retrieveFile?: (path: string) => string;
retrieveSourceMap?: (source: string) => UrlAndMap;
environment?: 'auto' | 'browser' | 'node';
overrideRetrieveFile?: boolean;
overrideRetrieveSourceMap?: boolean;
retrieveFile?(path: string): string;
retrieveSourceMap?(source: string): UrlAndMap;
}
export interface Position {
@ -30,13 +33,13 @@ export interface Position {
column: number;
}
export declare function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */;
export declare function getErrorSource(error: Error): string;
export declare function mapSourcePosition(position: Position): Position;
export declare function retrieveSourceMap(source: string): UrlAndMap;
export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */;
export function getErrorSource(error: Error): string | null;
export function mapSourcePosition(position: Position): Position;
export function retrieveSourceMap(source: string): UrlAndMap | null;
/**
* Install SourceMap support.
* @param options Can be used to e.g. disable uncaughtException handler.
*/
export declare function install(options?: Options): void;
export function install(options?: Options): void;

View File

@ -1,4 +1,3 @@
import sms = require('source-map-support');
sms.install();
@ -14,27 +13,31 @@ function retrieveSourceMap(source: string): sms.UrlAndMap {
};
}
var options: sms.Options = {
const options: sms.Options = {
emptyCacheBetweenOperations: false,
handleUncaughtExceptions: false,
retrieveFile: retrieveFile,
retrieveSourceMap: retrieveSourceMap
retrieveFile,
retrieveSourceMap,
environment: 'node',
hookRequire: false,
overrideRetrieveSourceMap: false,
overrideRetrieveFile: false
};
sms.install(options);
var stackFrame: any; // TODO: this should be a StackFrame, but it seems this would need to be defined elsewhere (in e.g. lib.d.ts)
let stackFrame: any; // TODO: this should be a StackFrame, but it seems this would need to be defined elsewhere (in e.g. lib.d.ts)
stackFrame = sms.wrapCallSite(stackFrame);
var s: string;
let s: string | null;
s = sms.getErrorSource(new Error("foo"));
var p: sms.Position = {
let p: sms.Position = {
column: 0,
line: 0,
source: "foo"
};
p = sms.mapSourcePosition(p);
var u: sms.UrlAndMap;
let u: sms.UrlAndMap;
u = retrieveSourceMap("foo");

View File

@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@ -19,4 +19,4 @@
"index.d.ts",
"source-map-support-tests.ts"
]
}
}

View File

@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}