()
| 49 | // thread is guaranteed alive here: phase changes arrive via its own |
| 50 | // progress callback. |
| 51 | const printPhaseDone = (): void => { |
| 52 | if (!lastPhaseName) return; |
| 53 | let detail = ''; |
| 54 | if (lastPercent >= 0) detail = ` ${G.dash} done`; |
| 55 | else if (lastCount > 0) detail = ` ${G.dash} ${lastCount.toLocaleString()} found`; |
| 56 | // Leading \r + erase clears the worker's in-flight animation line; one |
| 57 | // atomic write so a worker frame can't interleave mid-line. |
| 58 | process.stdout.write( |
| 59 | `\r\x1b[K${DM}${G.rail}${RST} ${GRN}${G.phaseDone}${RST} ${lastPhaseName}${detail}\n` |
| 60 | ); |
| 61 | lastPhaseName = ''; |
| 62 | lastPercent = -1; |
| 63 | lastCount = 0; |
| 64 | }; |
| 65 | |
| 66 | const workerPath = path.join(__dirname, 'shimmer-worker.js'); |
| 67 | const worker = new Worker(workerPath, { |
no test coverage detected