/**
 * Resolves absolute import paths to file-relative import paths.
 */ export class ImportPathResolver { param filePath param importPath public resolve ( filePath , importPath ) { const resolvedPath = [ ] ; let i = 0 ; while ( i < filePath . length && i < importPath . length ) { if ( filePath [ i ] !== importPath [ i ] ) { break ; } i += 1 ; } while ( i < filePath . length && i < importPath . length ) { resolvedPath . unshift ( ".." ) ; resolvedPath . push ( importPath [ i ] ) ; i += 1 ; } while ( i < filePath . length && i >= importPath . length ) { resolvedPath . unshift ( ".." ) ; i += 1 ; } while ( i >= filePath . length && i < importPath . length ) { resolvedPath . push ( importPath [ i ] ) ; i += 1 ; } return resolvedPath ; } }