* The stack string usually contains a copy of the message at the start of the stack. * If the stack starts with the message, we remove it and just return the stack trace * portion. Otherwise the original stack trace is used.
(e: RollupError)
| 956 | * portion. Otherwise the original stack trace is used. |
| 957 | */ |
| 958 | function extractStack(e: RollupError) { |
| 959 | const { stack, name = 'Error', message } = e |
| 960 | |
| 961 | // If we don't have a stack, not much we can do. |
| 962 | if (!stack) { |
| 963 | return stack |
| 964 | } |
| 965 | |
| 966 | const expectedPrefix = `${name}: ${message}\n` |
| 967 | if (stack.startsWith(expectedPrefix)) { |
| 968 | return stack.slice(expectedPrefix.length) |
| 969 | } |
| 970 | |
| 971 | return stack |
| 972 | } |
| 973 | |
| 974 | /** |
| 975 | * Esbuild code frames have newlines at the start and end of the frame, rollup doesn't |
no outgoing calls
no test coverage detected