+31
-17
lines changedFilter options
+31
-17
lines changed Original file line number Diff line number Diff line change
@@ -5,11 +5,13 @@
5
5
const lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
6
6
7
7
function simpleErrorStack() {
8
-
try {
9
-
(lorem as any).BANG();
10
-
} catch (e) {
11
-
return e.stack;
12
-
}
8
+
[1].map(() => {
9
+
try {
10
+
(lorem as any).BANG();
11
+
} catch (e) {
12
+
return e.stack;
13
+
}
14
+
})
13
15
}
14
16
15
17
export {
Original file line number Diff line number Diff line change
@@ -53,9 +53,15 @@ function prepareStackTraceWithSourceMaps(error, trace) {
53
53
const sm = fileName === lastFileName ?
54
54
lastSourceMap :
55
55
findSourceMap(fileName);
56
-
lastSourceMap = sm;
57
-
lastFileName = fileName;
56
+
// Only when a source map is found, cache it for the next iteration.
57
+
// This is a performance optimization to avoid interleaving with JS builtin function
58
+
// invalidating the cache.
59
+
// - at myFunc (file:///path/to/file.js:1:2)
60
+
// - at Array.map (<anonymous>)
61
+
// - at myFunc (file:///path/to/file.js:3:4)
58
62
if (sm) {
63
+
lastSourceMap = sm;
64
+
lastFileName = fileName;
59
65
return `${kStackLineAt}${serializeJSStackFrame(sm, callSite, trace[i + 1])}`;
60
66
}
61
67
} catch (err) {
Original file line number Diff line number Diff line change
@@ -347,6 +347,11 @@ function findSourceMap(sourceURL) {
347
347
return undefined;
348
348
}
349
349
350
+
// No source maps for builtin modules.
351
+
if (sourceURL.startsWith('node:')) {
352
+
return undefined;
353
+
}
354
+
350
355
SourceMap ??= require('internal/source_map/source_map').SourceMap;
351
356
try {
352
357
if (RegExpPrototypeExec(kLeadingProtocol, sourceURL) === null) {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4