import os from 'os' ; import ts from 'typescript' ; import { codeFrameColumns , SourceLocation } from '@babel/code-frame' ; export function createFrame ( { source , location , } ) { const frame = codeFrameColumns ( source , location , { highlightCode : true , } ) . split ( '\n' ) . map ( ( line ) => '  ' + line ) . join ( os . EOL ) ; return frame ; } export function tsLocationToBabelLocation ( tsLoc ) { return { start : { line : tsLoc . start . line + 1 , column : tsLoc . start . character + 1 } , end : { line : tsLoc . end . line + 1 , column : tsLoc . end . character + 1 } , } ; }