Skip to content

Commit

Permalink
feat: use source-map-support wrapCallSite to apply source maps to cal…
Browse files Browse the repository at this point in the history
…l stacks (#1015)
  • Loading branch information
AaronFriel authored and kjin committed May 3, 2019
1 parent b06a5bb commit c558455
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@types/request": "^2.48.1",
"@types/semver": "^6.0.0",
"@types/shimmer": "^1.0.1",
"@types/source-map-support": "^0.5.0",
"@types/tmp": "0.1.0",
"@types/uuid": "^3.4.3",
"axios": "^0.18.0",
Expand All @@ -90,7 +91,6 @@
"pify": "^4.0.0",
"retry-axios": "^1.0.0",
"rimraf": "^2.6.2",
"source-map-support": "^0.5.6",
"standard-version": "^5.0.0",
"teeny-request": "^3.11.1",
"timekeeper": "^2.0.0",
Expand All @@ -110,6 +110,7 @@
"methods": "^1.1.1",
"require-in-the-middle": "^4.0.0",
"semver": "^6.0.0",
"source-map-support": "^0.5.12",
"shimmer": "^1.2.0",
"uuid": "^3.0.1"
}
Expand Down
5 changes: 3 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as path from 'path';
import * as sourceMapSupport from 'source-map-support';

const {hexToDec, decToHex}: {[key: string]: (input: string) => string} =
require('hex2dec');

Expand Down Expand Up @@ -206,7 +207,7 @@ export function createStackTrace(
const origPrepare = Error.prepareStackTrace;
Error.prepareStackTrace =
(error: Error, structured: NodeJS.CallSite[]): NodeJS.CallSite[] => {
return structured;
return structured.map(sourceMapSupport.wrapCallSite);
};
const e: {stack?: NodeJS.CallSite[]} = {};
Error.captureStackTrace(e, constructorOpt);
Expand Down

0 comments on commit c558455

Please sign in to comment.