* Gets the compiled version of the given target program, if it exists and * we can find it. Otherwise we fall back to evaluating it directly. * @see https://github.com/microsoft/vscode-js-debug/issues/291
(targetProgram: string)
| 305 | * @see https://github.com/microsoft/vscode-js-debug/issues/291 |
| 306 | */ |
| 307 | private async tryGetCompiledFile(targetProgram: string) { |
| 308 | targetProgram = fixDriveLetterAndSlashes(targetProgram); |
| 309 | |
| 310 | const ext = extname(targetProgram); |
| 311 | if (!ext || ext === '.js') { |
| 312 | return targetProgram; |
| 313 | } |
| 314 | |
| 315 | const mapped = await this.bpPredictor.getPredictionForSource(targetProgram); |
| 316 | if (!mapped || mapped.size === 0) { |
| 317 | return targetProgram; |
| 318 | } |
| 319 | |
| 320 | // There can be more than one compile file per source file. Just pick |
| 321 | // whichever one in that case. |
| 322 | const entry = iteratorFirst(mapped.values()); |
| 323 | if (!entry) { |
| 324 | return targetProgram; |
| 325 | } |
| 326 | |
| 327 | this.logger.info(LogTag.RuntimeLaunch, 'Updating entrypoint to compiled file', { |
| 328 | from: targetProgram, |
| 329 | to: entry.compiledPath, |
| 330 | candidates: mapped.size, |
| 331 | }); |
| 332 | |
| 333 | return entry.compiledPath; |
| 334 | } |
| 335 | } |
no test coverage detected