Merge pull request #3951 from rogierschouten/stack-mapper

Add definitions for stack-mapper.
This commit is contained in:
Masahiro Wakame
2015-03-25 01:25:33 +09:00
3 changed files with 55 additions and 0 deletions
+1
View File
@@ -730,6 +730,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](sprintf/sprintf.d.ts) [sprintff](https://github.com/maritz/node-sprintff) by [Carlos Ballesteros Velasco](https://github.com/soywiz)
* [:link:](sharepoint/SharePoint.d.ts) [sptypescript](http://sptypescript.codeplex.com) by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru), [Andrey Markeev](http://markeev.com)
* [:link:](sqlite3/sqlite3.d.ts) [sqlite3](https://github.com/mapbox/node-sqlite3) by [Nick Malaguti](https://github.com/nmalaguti)
* [:link:](stack-mapper/stack-mapper.d.ts) [stack-mapper](https://github.com/thlorenz/stack-mapper) by [rogierschouten](https://github.com/rogierschouten)
* [:link:](stampit/stampit.d.ts) [stampit](https://github.com/ericelliott/stampit) by [Vasyl Boroviak](https://github.com/koresar)
* [:link:](stats/stats.d.ts) [Stats.js r12](http://github.com/mrdoob/stats.js) by [Gregory Dalton](https://github.com/gregolai)
* [:link:](status-bar/status-bar.d.ts) [status-bar](https://github.com/atom/status-bar) by [vvakame](https://github.com/vvakame)
+8
View File
@@ -0,0 +1,8 @@
/// <reference path="stack-mapper.d.ts" />
import stackMapper = require("stack-mapper");
var map: any = {};
var sm: stackMapper.StackMapper = stackMapper(map);
var input: stackMapper.Callsite[] = [{ filename: "boo", line: 1, column: 10 }];
var cs: stackMapper.Callsite[] = sm.map(input);
+46
View File
@@ -0,0 +1,46 @@
// Type definitions for stack-mapper 0.2.2
// Project: https://github.com/thlorenz/stack-mapper
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "stack-mapper" {
module stackMapper {
export class StackMapper {
/**
* Maps the trace statements of the given error stack and replaces locations
* referencing code in the generated file with the locations inside the original files.
*
* @name map
* @function
* @param {Array} array of callsite objects (see readme for details about Callsite object)
* @return {Array.<Object>} info about the error stack with adapted locations, each with the following properties
* - filename: original filename
* - line: origial line in that filename of the trace
* - column: origial column on that line of the trace
*/
public map(stack: Callsite[]): Callsite[];
}
export interface Callsite {
filename: string;
line: number;
column: number;
}
}
/**
* Returns a Stackmapper that will use the given source map to map error trace locations.
*
* @name stackMapper
* @function
* @param {Object} sourcemap source map for the generated file
* @return {StackMapper} stack mapper for the particular source map
*/
function stackMapper(sourcemap: any): stackMapper.StackMapper;
export = stackMapper;
}