* * @param {string} target * @param {string[]=} filenames * @returns {Promise }
(target, filenames)
| 387 | * @returns {Promise<string[]>} |
| 388 | */ |
| 389 | async function computeBuildTargetsForFiles(target, filenames) { |
| 390 | const SUPPORTED_EXTENSIONS = ['.css', '.ts']; |
| 391 | if ( |
| 392 | filenames && |
| 393 | filenames.length && |
| 394 | filenames.every(filename => |
| 395 | SUPPORTED_EXTENSIONS.includes(path.extname(filename)), |
| 396 | ) |
| 397 | ) { |
| 398 | if (isInChromiumDirectory().isInChromium) { |
| 399 | filenames = filenames.map(filename => |
| 400 | path.join('third_party', 'devtools-frontend', 'src', filename), |
| 401 | ); |
| 402 | } |
| 403 | const gnArgs = await gnArgsForTarget(target); |
| 404 | if (gnArgs.get('devtools_bundle') === 'false') { |
| 405 | try { |
| 406 | const gnRefs = ( |
| 407 | await Promise.all( |
| 408 | filenames.map(filename => gnRefsForTarget(target, filename)), |
| 409 | ) |
| 410 | ).flat(); |
| 411 | if (gnRefs.length) { |
| 412 | // If there are any changes to TypeScript files, we need to also rebuild the |
| 413 | // `en-US.json`, as otherwise the changes to `UIStrings` aren't picked up. |
| 414 | if (filenames.some(filename => path.extname(filename) === '.ts')) { |
| 415 | gnRefs.push('collect_strings'); |
| 416 | } |
| 417 | return gnRefs; |
| 418 | } |
| 419 | } catch (error) { |
| 420 | console.error(error); |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | return ['devtools_all_files']; |
| 426 | } |
| 427 | |
| 428 | /** |
| 429 | * @param {string} target |
no test coverage detected