( maybeRelativePath: string, absoluteProjectRoots: Array<string>, )
| 110 | let childProcess = null; |
| 111 | |
| 112 | export function getValidFilePath( |
| 113 | maybeRelativePath: string, |
| 114 | absoluteProjectRoots: Array<string>, |
| 115 | ): string | null { |
| 116 | // We use relative paths at Facebook with deterministic builds. |
| 117 | // This is why our internal tooling calls React DevTools with absoluteProjectRoots. |
| 118 | // If the filename is absolute then we don't need to care about this. |
| 119 | if (isAbsolute(maybeRelativePath)) { |
| 120 | if (existsSync(maybeRelativePath)) { |
| 121 | return maybeRelativePath; |
| 122 | } |
| 123 | } else { |
| 124 | for (let i = 0; i < absoluteProjectRoots.length; i++) { |
| 125 | const projectRoot = absoluteProjectRoots[i]; |
| 126 | const joinedPath = join(projectRoot, maybeRelativePath); |
| 127 | if (existsSync(joinedPath)) { |
| 128 | return joinedPath; |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | return null; |
| 134 | } |
| 135 | |
| 136 | export function doesFilePathExist( |
| 137 | maybeRelativePath: string, |
no outgoing calls
no test coverage detected