MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / filenameIsInApp

Function filenameIsInApp

packages/core/src/utils/node-stack-trace.ts:32–50  ·  view source on GitHub ↗
(filename: string, isNative: boolean = false)

Source from the content-addressed store, hash-verified

30 * Does this filename look like it's part of the app code?
31 */
32export 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 */
53export function node(getModule?: GetModuleFn): StackLineParserFn {

Callers 3

callFrameToStackFrameFunction · 0.90
prepareStackFramesFunction · 0.90
nodeFunction · 0.85

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected