(filename: string, isNative: boolean = false)
| 30 | * Does this filename look like it's part of the app code? |
| 31 | */ |
| 32 | export function filenameIsInApp(filename: string, isNative: boolean = false): boolean { |
| 33 | const isInternal = |
| 34 | isNative || |
| 35 | (filename && |
| 36 | // It's not internal if it's an absolute linux path |
| 37 | !filename.startsWith('/') && |
| 38 | // It's not internal if it's an absolute windows path |
| 39 | !filename.match(/^[A-Z]:/) && |
| 40 | // It's not internal if the path is starting with a dot |
| 41 | !filename.startsWith('.') && |
| 42 | // 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 |
| 43 | !filename.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//)); // Schema from: https://stackoverflow.com/a/3641782 |
| 44 | |
| 45 | // in_app is all that's not an internal Node function or a module within node_modules |
| 46 | // note that isNative appears to return true even for node core libraries |
| 47 | // see https://github.com/getsentry/raven-node/issues/176 |
| 48 | |
| 49 | return !isInternal && filename !== undefined && !filename.includes('node_modules/'); |
| 50 | } |
| 51 | |
| 52 | /** Node Stack line parser */ |
| 53 | export function node(getModule?: GetModuleFn): StackLineParserFn { |
no test coverage detected