@polyfill-io-aot/builder
Version:
This is the builder module for polyfill-io-aot.
61 lines • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const lazy_get_decorator_1 = require("lazy-get-decorator");
const ImportedOra = require("ora");
const BuildEvent_1 = require("./interfaces/BuildEvent");
const $builder = Symbol('builder');
// They messed up the typings
const ora = ImportedOra;
//tslint:disable:no-empty
/** @internal */
class Executor {
constructor(builder) {
this[$builder] = builder;
}
get _ora() {
const opts = {
spinner: 'dots',
stream: process.stdout
};
return ora(opts);
}
get builder() {
return this[$builder];
}
get conf() {
return this.builder.conf;
}
start() {
setImmediate(() => {
this.execute();
});
return this;
}
emit(event, ...args) {
setImmediate(() => {
this.builder.emit(event, ...args);
});
return this;
}
formatError(e) {
if (!e) {
return '[unknown error]';
}
return e.stack || e.message || e;
}
onError(e) {
this.emit(BuildEvent_1.BuildEvent.ERROR, e);
}
}
tslib_1.__decorate([
lazy_get_decorator_1.LazyGetter()
], Executor.prototype, "_ora", null);
tslib_1.__decorate([
lazy_get_decorator_1.LazyGetter()
], Executor.prototype, "builder", null);
tslib_1.__decorate([
lazy_get_decorator_1.LazyGetter()
], Executor.prototype, "conf", null);
exports.Executor = Executor;
//# sourceMappingURL=Executor.js.map