| 35 | } |
| 36 | |
| 37 | export function rankPaths(paths) { |
| 38 | // search for paths with no '*' |
| 39 | const names = Object.keys(paths); |
| 40 | |
| 41 | const exactPaths = names.filter(path => /\*/.test(path) === false); |
| 42 | if (exactPaths.length){ |
| 43 | // sort on lengt |
| 44 | exactPaths.sort(sortOnStringLengthDescending); |
| 45 | } |
| 46 | |
| 47 | const wildCardPaths = names.filter(path => /\*/.test(path) === true); |
| 48 | if (wildCardPaths.length){ |
| 49 | // sort on lengt |
| 50 | wildCardPaths.sort(sortOnStringLengthDescending); |
| 51 | } |
| 52 | return { exactPaths, wildCardPaths }; |
| 53 | } |
| 54 | |
| 55 | function isRelativeImport(path){ |
| 56 | return path.startsWith('./') || path.startsWith('../'); |