| 206 | } |
| 207 | |
| 208 | function rebuild(kind: 'full' | 'incremental') { |
| 209 | async function run() { |
| 210 | if (!compiler && kind !== 'full') { |
| 211 | return |
| 212 | } |
| 213 | |
| 214 | let buildId = nextBuildId++ |
| 215 | |
| 216 | I.start(`Build #${buildId} (${kind})`) |
| 217 | |
| 218 | if (kind === 'full') { |
| 219 | await createCompiler() |
| 220 | } |
| 221 | |
| 222 | I.start(`Build`) |
| 223 | await build(kind) |
| 224 | I.end(`Build`) |
| 225 | |
| 226 | I.end(`Build #${buildId} (${kind})`) |
| 227 | } |
| 228 | |
| 229 | buildQueue = buildQueue.then(run).catch((err) => I.error(err)) |
| 230 | } |
| 231 | |
| 232 | // Handle changes to known stylesheets |
| 233 | let styleObserver = new MutationObserver(() => rebuild('full')) |