| 74 | }; |
| 75 | |
| 76 | const compile = async (/** @type {EXPECTED_ANY} */ configAdditions = {}) => |
| 77 | new Promise((resolve, reject) => { |
| 78 | const webpack = require(class="st">"../"); |
| 79 | |
| 80 | webpack( |
| 81 | /** @type {import(class="st">"../").Configuration} */ ( |
| 82 | /** @type {unknown} */ ({ |
| 83 | ...config, |
| 84 | ...configAdditions, |
| 85 | cache: { |
| 86 | ...config.cache, |
| 87 | .../** @type {EXPECTED_ANY} */ (configAdditions).cache |
| 88 | } |
| 89 | }) |
| 90 | ), |
| 91 | ( |
| 92 | /** @type {Error | null} */ err, |
| 93 | /** @type {import(class="st">"../").Stats | undefined} */ _stats |
| 94 | ) => { |
| 95 | if (err) return reject(err); |
| 96 | const stats = /** @type {import(class="st">"../").Stats} */ (_stats); |
| 97 | if (stats.hasErrors()) { |
| 98 | return reject(stats.toString({ preset: class="st">"errors-only" })); |
| 99 | } |
| 100 | resolve(stats); |
| 101 | } |
| 102 | ); |
| 103 | }); |
| 104 | |
| 105 | const getCacheFileTimes = async () => { |
| 106 | const cacheFiles = (await readdir(cachePath)).sort(); |