| 17 | */ |
| 18 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 19 | export function getFilenameToMetadataMap(parser: StackParser): Record<string, any> { |
| 20 | if (!GLOBAL_OBJ._sentryModuleMetadata) { |
| 21 | return {}; |
| 22 | } |
| 23 | |
| 24 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 25 | const filenameMap: Record<string, any> = {}; |
| 26 | |
| 27 | for (const stack of Object.keys(GLOBAL_OBJ._sentryModuleMetadata)) { |
| 28 | const metadata = GLOBAL_OBJ._sentryModuleMetadata[stack]; |
| 29 | const frames = parser(stack); |
| 30 | |
| 31 | for (const frame of frames.reverse()) { |
| 32 | if (frame.filename) { |
| 33 | filenameMap[frame.filename] = metadata; |
| 34 | break; |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | return filenameMap; |
| 40 | } |
| 41 | |
| 42 | function ensureMetadataStacksAreParsed(parser: StackParser): void { |
| 43 | if (!GLOBAL_OBJ._sentryModuleMetadata) { |