2016-05-23 02:40:04 +00:00
|
|
|
"use strict";
|
2016-06-10 03:18:03 +00:00
|
|
|
require("typings-global");
|
2016-08-20 05:03:49 +00:00
|
|
|
const chalk = require("chalk");
|
|
|
|
const readline = require("readline");
|
|
|
|
let rl = readline.createInterface({
|
2016-06-10 03:59:21 +00:00
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout
|
|
|
|
});
|
2016-08-20 05:03:49 +00:00
|
|
|
let moduleName;
|
|
|
|
let loaderLength;
|
|
|
|
let frameCounter = 0;
|
|
|
|
let makeFrame = () => {
|
2016-09-18 21:11:26 +00:00
|
|
|
let resultString = `[${chalk.green('/'.repeat(frameCounter))}${' '.repeat(loaderLength - frameCounter)}] starting ${moduleName}`;
|
|
|
|
if (frameCounter === loaderLength) {
|
2016-05-23 02:40:04 +00:00
|
|
|
frameCounter = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
frameCounter++;
|
|
|
|
}
|
|
|
|
return resultString;
|
|
|
|
};
|
2016-08-20 05:03:49 +00:00
|
|
|
let logEarlyAbort = false;
|
|
|
|
let logEarly = () => {
|
|
|
|
if (!logEarlyAbort) {
|
|
|
|
rl.write(null, { ctrl: true, name: 'u' });
|
|
|
|
rl.write(makeFrame());
|
|
|
|
setTimeout(function () {
|
2016-06-10 03:59:21 +00:00
|
|
|
logEarly();
|
2016-08-20 05:03:49 +00:00
|
|
|
}, 80);
|
|
|
|
}
|
2016-09-18 21:11:26 +00:00
|
|
|
else {
|
|
|
|
readline.clearLine(process.stdout, 0);
|
|
|
|
process.exit(0);
|
|
|
|
}
|
2016-05-23 02:40:04 +00:00
|
|
|
};
|
2016-09-18 21:11:26 +00:00
|
|
|
let start = function (moduleNameArg = '', loaderLengthArg = '10') {
|
2016-05-23 02:40:04 +00:00
|
|
|
moduleName = moduleNameArg;
|
|
|
|
loaderLength = parseInt(loaderLengthArg);
|
2016-06-10 03:36:06 +00:00
|
|
|
logEarly();
|
2016-05-23 02:40:04 +00:00
|
|
|
};
|
2016-08-20 05:41:56 +00:00
|
|
|
process.on('SIGINT', () => {
|
2016-06-10 03:59:21 +00:00
|
|
|
logEarlyAbort = true;
|
|
|
|
});
|
2016-09-18 21:11:26 +00:00
|
|
|
start();
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWFybHkuY2hpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9lYXJseS5jaGlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLCtCQUErQjtBQUMvQixxQ0FBcUM7QUFDckMsSUFBSSxFQUFFLEdBQUcsUUFBUSxDQUFDLGVBQWUsQ0FBQztJQUM5QixLQUFLLEVBQUUsT0FBTyxDQUFDLEtBQUs7SUFDcEIsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNO0NBQ3pCLENBQUMsQ0FBQTtBQUVGLElBQUksVUFBa0IsQ0FBQTtBQUN0QixJQUFJLFlBQW9CLENBQUE7QUFDeEIsSUFBSSxZQUFZLEdBQVcsQ0FBQyxDQUFBO0FBRTVCLElBQUksU0FBUyxHQUFHO0lBQ1osSUFBSSxZQUFZLEdBQVcsSUFBSSxLQUFLLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUMsR0FBRyxHQUFHLENBQUMsTUFBTSxDQUFDLFlBQVksR0FBRyxZQUFZLENBQUMsY0FBYyxVQUFVLEVBQUUsQ0FBQTtJQUN4SSxFQUFFLENBQUMsQ0FBQyxZQUFZLEtBQUssWUFBWSxDQUFDLENBQUMsQ0FBQztRQUNoQyxZQUFZLEdBQUcsQ0FBQyxDQUFBO0lBQ3BCLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLFlBQVksRUFBRSxDQUFBO0lBQ2xCLENBQUM7SUFDRCxNQUFNLENBQUMsWUFBWSxDQUFBO0FBQ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