{"version":3,"file":"FinishPlugin.mjs","sources":[""],"sourcesContent":["import type webpack from \"webpack\";\r\nimport { styleText } from \"node:util\";\r\n\r\n/**\n * Плагин для завершения сборки\n * @example\n * import { FinishPlugin } from \"@delement/ui/utils/webpack\";\n *\n * const plugins = [ new FinishPlugin({ isExitInCI: true }) ];\n */\nexport default class FinishPlugin {\n\r\n  private readonly isShouldExit: boolean;\r\n\r\n  constructor(options?: { isExitInCI?: boolean; }) {\r\n    this.isShouldExit = options?.isExitInCI || false;\r\n  }\r\n\r\n  apply(compiler: webpack.Compiler) {\r\n    compiler.hooks.done.tap(this.constructor.name, () => {\r\n      if (this.isShouldExit) {\r\n        console.debug(styleText(\"green\", `[${this.constructor.name}] Frontend build are ready`));\r\n        setTimeout(() => {\r\n          process.exit(0);\r\n        });\r\n      }\r\n    });\r\n  }\r\n\r\n}\r\n"],"names":["FinishPlugin","isShouldExit","constructor","options","this","isExitInCI","apply","compiler","hooks","done","tap","name","console","debug","styleText","setTimeout","process","exit"],"mappings":";;;;;;;GAUe,MAAMA,aAEFC,aAEjB,WAAAC,CAAYC,SACVC,KAAKH,aAAeE,SAASE,YAAc,KAC7C,CAEA,KAAAC,CAAMC,UACJA,SAASC,MAAMC,KAAKC,IAAIN,KAAKF,YAAYS,KAAM,KAC7C,GAAIP,KAAKH,aAAc,CACrBW,QAAQC,MAAMC,UAAU,QAAS,IAAIV,KAAKF,YAAYS,mCACtDI,WAAW,KACTC,QAAQC,KAAK,IAEjB,GAEJ"}