{"version":3,"sources":["build-lock.ts"],"sourcesContent":["import { logger } from \"../utils/global-values.ts\";\n\nlet buildLocks: Promise<void>[] = [];\n\n/**\n * Register a build lock, indicating that files are being built.\n * Build locks are await during hot reloading before reloading the web pages\n * @param lock \n */\nexport function registerBuildLock(lock: Promise<void>) {\n\tbuildLocks.push(lock);\n}\n\n/**\n * Await all build locks to finish\n */\nexport async function waitForBuildLocks() {\n\tlet finished = false;\n\tconst locks = Promise.race([\n\t\tPromise.allSettled(buildLocks),\n\t\tsleep(15_000).then(() => {\n\t\t\tif (!finished) logger.warn(\"Some build proceses did not finish after 15 seconds. Continuing...\");\n\t\t})\n\t]);\n\tawait locks;\n\tfinished = true;\n\tbuildLocks = [];\n}"],"names":["logger","buildLocks","registerBuildLock","lock","push","waitForBuildLocks","finished","locks","Promise","race","allSettled","sleep","then","warn"],"mappings":"AAAA,SAASA,MAAM,QAAQ,4BAA4B;AAEnD,IAAIC,aAA8B,EAAE;AAOpC,OAAO,SAASC,kBAAkBC,IAAmB;IACpDF,WAAWG,IAAI,CAACD;AACjB;AAKA,OAAO,eAAeE;IACrB,IAAIC,WAAW,CAAA,GACTC,QAAQC,QAAQC,IAAI,CAAC;QAC1BD,QAAQE,UAAU,CAACT;QACnBU,MAAM,QAAQC,IAAI,CAAC;YACbN,YAAUN,OAAOa,IAAI,CAAC;QAC5B;KACA;IACD,MAAMN,OACND,WAAW,CAAA,GACXL,aAAa,EAAE;AAChB","sourceRoot":"/lib/uix-0.4.22/src/app/","file":"build-lock.ts"}