File tree 4 files changed +26
-9
lines changed
cache-dir/fast-refresh-overlay
4 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 1
1
import * as React from "react"
2
- import StackTrace from "stack-trace "
2
+ import ErrorStackParser from "error- stack-parser "
3
3
import { Overlay , Header , HeaderOpenClose , Body } from "./overlay"
4
4
import { useStackFrame } from "./hooks"
5
5
import { CodeFrame } from "./code-frame"
6
6
import { getCodeFrameInformation , openInEditor } from "../utils"
7
7
import { Accordion , AccordionItem } from "./accordion"
8
8
9
9
function WrappedAccordionItem ( { error, open } ) {
10
- const stacktrace = StackTrace . parse ( error )
10
+ const stacktrace = ErrorStackParser . parse ( error )
11
11
const codeFrameInformation = getCodeFrameInformation ( stacktrace )
12
12
13
13
const modulePath = codeFrameInformation ?. moduleId
Original file line number Diff line number Diff line change @@ -36,15 +36,19 @@ export function skipSSR() {
36
36
}
37
37
38
38
export function getCodeFrameInformation ( stackTrace ) {
39
- const callSite = stackTrace . find ( CallSite => CallSite . getFileName ( ) )
40
- if ( ! callSite ) {
39
+ const stackFrame = stackTrace . find ( stackFrame => {
40
+ const fileName = stackFrame . getFileName ( )
41
+ return fileName && fileName !== `[native code]` // Quirk of Safari error stack frames
42
+ } )
43
+
44
+ if ( ! stackFrame ) {
41
45
return null
42
46
}
43
47
44
- const moduleId = formatFilename ( callSite . getFileName ( ) )
45
- const lineNumber = callSite . getLineNumber ( )
46
- const columnNumber = callSite . getColumnNumber ( )
47
- const functionName = callSite . getFunctionName ( )
48
+ const moduleId = formatFilename ( stackFrame . getFileName ( ) )
49
+ const lineNumber = stackFrame . getLineNumber ( )
50
+ const columnNumber = stackFrame . getColumnNumber ( )
51
+ const functionName = stackFrame . getFunctionName ( )
48
52
49
53
return {
50
54
moduleId,
Original file line number Diff line number Diff line change 67
67
"devcert" : " ^1.2.0" ,
68
68
"dotenv" : " ^8.6.0" ,
69
69
"enhanced-resolve" : " ^5.8.3" ,
70
+ "error-stack-parser" : " ^2.1.4" ,
70
71
"eslint" : " ^7.32.0" ,
71
72
"eslint-config-react-app" : " ^6.0.0" ,
72
73
"eslint-plugin-flowtype" : " ^5.10.0" ,
271
272
"yargs" : {
272
273
"boolean-negation" : false
273
274
}
274
- }
275
+ }
Original file line number Diff line number Diff line change @@ -10259,6 +10259,13 @@ error-stack-parser@^2.0.6:
10259
10259
dependencies:
10260
10260
stackframe "^1.1.1"
10261
10261
10262
+ error-stack-parser@^2.1.4:
10263
+ version "2.1.4"
10264
+ resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.1.4.tgz#229cb01cdbfa84440bfa91876285b94680188286"
10265
+ integrity sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==
10266
+ dependencies:
10267
+ stackframe "^1.3.4"
10268
+
10262
10269
error@^7.0.0:
10263
10270
version "7.0.2"
10264
10271
resolved "https://registry.yarnpkg.com/error/-/error-7.0.2.tgz#a5f75fff4d9926126ddac0ea5dc38e689153cb02"
@@ -23613,6 +23620,11 @@ stackframe@^1.1.1:
23613
23620
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.1.1.tgz#ffef0a3318b1b60c3b58564989aca5660729ec71"
23614
23621
integrity sha512-0PlYhdKh6AfFxRyK/v+6/k+/mMfyiEBbTM5L94D0ZytQnJ166wuwoTYLHFWGbs2dpA8Rgq763KGWmN1EQEYHRQ==
23615
23622
23623
+ stackframe@^1.3.4:
23624
+ version "1.3.4"
23625
+ resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.3.4.tgz#b881a004c8c149a5e8efef37d51b16e412943310"
23626
+ integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==
23627
+
23616
23628
standard-version@^9.0.0:
23617
23629
version "9.1.0"
23618
23630
resolved "https://registry.yarnpkg.com/standard-version/-/standard-version-9.1.0.tgz#07589469324d967ffe665fa86ef612949a858a80"
You can’t perform that action at this time.
0 commit comments