File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,16 @@ export function node(getModule?: GetModuleFn): StackLineParserFn {
85
85
}
86
86
87
87
const isInternal =
88
- isNative || ( filename && ! filename . startsWith ( '/' ) && ! filename . startsWith ( '.' ) && ! filename . includes ( ':\\' ) ) ;
88
+ isNative ||
89
+ ( filename &&
90
+ // It's not internal if it's an absolute linux path
91
+ ! filename . startsWith ( '/' ) &&
92
+ // It's not internal if it's an absolute windows path
93
+ ! filename . includes ( ':\\' ) &&
94
+ // It's not internal if the path is starting with a dot
95
+ ! filename . startsWith ( '.' ) &&
96
+ // It's not internal if the frame has a protocol. In node, this is usually the case if the file got pre-processed with a bundler like webpack
97
+ ! filename . match ( / ^ [ a - z A - Z ] ( [ a - z A - Z 0 - 9 . \- + ] ) * : \/ \/ / ) ) ; // Schema from: https://stackoverflow.com/a/3641782
89
98
90
99
// in_app is all that's not an internal Node function or a module within node_modules
91
100
// note that isNative appears to return true even for node core libraries
Original file line number Diff line number Diff line change @@ -264,4 +264,10 @@ describe('node', () => {
264
264
in_app : true ,
265
265
} ) ;
266
266
} ) ;
267
+
268
+ it ( 'should mark frames with protocols as in_app: true' , ( ) => {
269
+ const line = 'at Object.<anonymous> (app:///_next/server/pages/[error].js:10:20)' ;
270
+ const result = node ( line ) ;
271
+ expect ( result ?. in_app ) . toBe ( true ) ;
272
+ } ) ;
267
273
} ) ;
You can’t perform that action at this time.
0 commit comments