Skip to content

Commit ab16d45

Browse files
committed
feat: implement emptyCache function
Refs evanw#266
1 parent d058745 commit ab16d45

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

source-map-support.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,16 @@ function wrapCallSite(frame, state) {
408408
return frame;
409409
}
410410

411+
function emptyCache() {
412+
fileContentsCache = {};
413+
sourceMapCache = {};
414+
}
415+
411416
// This function is part of the V8 stack trace API, for more info see:
412417
// https://v8.dev/docs/stack-trace-api
413418
function prepareStackTrace(error, stack) {
414419
if (emptyCacheBetweenOperations) {
415-
fileContentsCache = {};
416-
sourceMapCache = {};
420+
emptyCache();
417421
}
418422

419423
var name = error.name || 'Error';
@@ -503,6 +507,7 @@ exports.wrapCallSite = wrapCallSite;
503507
exports.getErrorSource = getErrorSource;
504508
exports.mapSourcePosition = mapSourcePosition;
505509
exports.retrieveSourceMap = retrieveSourceMap;
510+
exports.emptyCache = emptyCache;
506511

507512
exports.install = function(options) {
508513
options = options || {};

0 commit comments

Comments
 (0)