import * as path from 'path' ; import { normalizePath } from './normalizePath' ; const ensureDot = ( value ) => ( value . startsWith ( '.' ) ? value : `./${ value }` ) ; const stripTS = ( value ) => path . join ( path . dirname ( value ) , path . basename ( value , value . endsWith ( '.jsx' ) ? '.jsx' : value . endsWith ( '.tsx' ) ? '.tsx' : value . endsWith ( '.js' ) ? '.js' : value . endsWith ( '.d.ts' ) ? '.d.ts' : '.ts' ) ) ; export const getRelativeImport = ( from , to ) => ensureDot ( normalizePath ( stripTS ( path . relative ( path . dirname ( from ) , to ) ) ) ) ;