thedesk/app/node_modules/electron-publish/out/multiProgress.js.map
2019-09-12 23:38:13 +09:00

2 lines
4.4 KiB
Plaintext

{"version":3,"sources":["../src/multiProgress.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEM,MAAO,aAAP,CAAoB;AAA1B,EAAA,WAAA,GAAA;AACmB,SAAA,MAAA,GAAS,OAAO,CAAC,MAAjB;AACT,SAAA,MAAA,GAAS,CAAT;AAEA,SAAA,UAAA,GAAa,CAAb;AAEA,SAAA,kBAAA,GAAqB,KAArB;AAEA,SAAA,QAAA,GAAW,CAAX;AA4ET;;AA1EC,EAAA,SAAS,CAAC,MAAD,EAAiB,OAAjB,EAA6B;AACpC,IAAA,OAAO,CAAC,MAAR,GAAiB,KAAK,MAAtB,CADoC,CAGpC;;AACA,UAAM,OAAO,GAAG,IAAhB;;AACA,UAAM,gBAAN,SAA+B,uBAA/B,CAA0C;AAGxC,MAAA,WAAA,CAAY,MAAZ,EAA4B,OAA5B,EAAwC;AACtC,cAAM,MAAN,EAAc,OAAd;AAHM,aAAA,KAAA,GAAQ,CAAC,CAAT;AAIP;;AAED,MAAA,MAAM,GAAA;AACJ,YAAI,KAAK,KAAL,KAAe,CAAC,CAApB,EAAuB;AACrB,eAAK,KAAL,GAAa,OAAO,CAAC,UAArB;AACA,UAAA,OAAO,CAAC,aAAR,CAAsB,CAAtB;AACD,SAHD,MAIK;AACH,UAAA,OAAO,CAAC,UAAR,CAAmB,KAAK,KAAxB;AACD;;AAED,cAAM,MAAN;;AAEA,YAAI,CAAC,OAAO,CAAC,kBAAb,EAAiC;AAC/B,UAAA,OAAO,CAAC,kBAAR,GAA6B,IAA7B;AACA,iCAAW,OAAO,IAAG;AACnB,gBAAI,YAAY,GAAG,CAAnB;AACA,gBAAI,YAAY,GAAG,OAAO,CAAC,OAAR,CAAgB,IAAhB,CAAnB;;AACA,mBA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CAAY,SAAZ;AACA,SAAK,MAAL,CAAY,QAAZ,CAAqB,CAArB;AACD;;AAnFuB,C","sourcesContent":["import { setPrinter } from \"builder-util/out/log\"\nimport { ProgressBar } from \"./progress\"\n\nexport class MultiProgress {\n private readonly stream = process.stdout as any\n private cursor = 0\n\n private totalLines = 0\n\n private isLogListenerAdded = false\n\n private barCount = 0\n\n createBar(format: string, options: any): ProgressBar {\n options.stream = this.stream\n\n // tslint:disable:no-this-assignment\n const manager = this\n class MultiProgressBar extends ProgressBar {\n private index = -1\n\n constructor(format: string, options: any) {\n super(format, options)\n }\n\n render() {\n if (this.index === -1) {\n this.index = manager.totalLines\n manager.allocateLines(1)\n }\n else {\n manager.moveCursor(this.index)\n }\n\n super.render()\n\n if (!manager.isLogListenerAdded) {\n manager.isLogListenerAdded = true\n setPrinter(message => {\n let newLineCount = 0\n let newLineIndex = message.indexOf(\"\\n\")\n while (newLineIndex > -1) {\n newLineCount++\n newLineIndex = message.indexOf(\"\\n\", ++newLineIndex)\n }\n\n manager.allocateLines(newLineCount + 1)\n manager.stream.write(message)\n })\n }\n }\n\n terminate() {\n manager.barCount--\n if (manager.barCount === 0 && manager.totalLines > 0) {\n manager.allocateLines(1)\n manager.totalLines = 0\n manager.cursor = 0\n setPrinter(null)\n manager.isLogListenerAdded = false\n }\n }\n }\n\n const bar = new MultiProgressBar(format, options)\n this.barCount++\n return bar\n }\n\n private allocateLines(count: number) {\n this.stream.moveCursor(0, this.totalLines - 1)\n // if cursor pointed to previous line where \\n is already printed, another \\n is ignored, so, we can simply print it\n this.stream.write(\"\\n\")\n this.totalLines += count\n this.cursor = this.totalLines - 1\n }\n\n private moveCursor(index: number) {\n this.stream.moveCursor(0, index - this.cursor)\n this.cursor = index\n }\n\n terminate() {\n this.moveCursor(this.totalLines)\n this.stream.clearLine()\n this.stream.cursorTo(0)\n }\n}"],"sourceRoot":""}