| import { codeFrameColumns } from 'next/dist/compiled/babel/code-frame'; |
| import isInternal from '../../shared/lib/is-internal'; |
| import { ignoreListAnonymousStackFramesIfSandwiched as ignoreListAnonymousStackFramesIfSandwichedGeneric } from '../../server/lib/source-maps'; |
| export function ignoreListAnonymousStackFramesIfSandwiched(responses) { |
| ignoreListAnonymousStackFramesIfSandwichedGeneric(responses, (response)=>{ |
| return response.status === 'fulfilled' && response.value.originalStackFrame !== null && response.value.originalStackFrame.file === '<anonymous>'; |
| }, (response)=>{ |
| return response.status === 'fulfilled' && response.value.originalStackFrame !== null && response.value.originalStackFrame.ignored === true; |
| }, (response)=>{ |
| return response.status === 'fulfilled' && response.value.originalStackFrame !== null ? response.value.originalStackFrame.methodName : ''; |
| }, (response)=>{ |
| ; |
| response.value.originalStackFrame.ignored = true; |
| }); |
| } |
| |
| |
| |
| export function getOriginalCodeFrame(frame, source, colors) { |
| if (colors === void 0) colors = process.stdout.isTTY; |
| if (!source || isInternal(frame.file)) { |
| return null; |
| } |
| var _frame_line1, _frame_column1; |
| return codeFrameColumns(source, { |
| start: { |
| |
| line: (_frame_line1 = frame.line1) != null ? _frame_line1 : -1, |
| |
| column: (_frame_column1 = frame.column1) != null ? _frame_column1 : 0 |
| } |
| }, { |
| forceColor: colors |
| }); |
| } |
|
|
| |