(sourcePath, currentFile, opts)
| 97 | const resolvers = [resolvePathFromAliasConfig, resolvePathFromRootConfig]; |
| 98 | |
| 99 | export default function resolvePath(sourcePath, currentFile, opts) { |
| 100 | // `.` and `./` are specific paths, we can't transfrom them |
| 101 | if (isRelativePath(sourcePath) || sourcePath === '.' || sourcePath === './') { |
| 102 | return sourcePath; |
| 103 | } |
| 104 | |
| 105 | const normalizedOpts = normalizeOptions(currentFile, opts); |
| 106 | |
| 107 | // File param is a relative path from the environment current working directory |
| 108 | // (not from cwd param) |
| 109 | const absoluteCurrentFile = path.resolve(currentFile); |
| 110 | let resolvedPath = null; |
| 111 | |
| 112 | resolvers.some(resolver => { |
| 113 | resolvedPath = resolver(sourcePath, absoluteCurrentFile, normalizedOpts); |
| 114 | return resolvedPath !== null; |
| 115 | }); |
| 116 | |
| 117 | return resolvedPath; |
| 118 | } |
no test coverage detected