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 = () => {
|
|
|
|
let resultString = `[${chalk.green("/".repeat(frameCounter))}${" ".repeat(loaderLength - frameCounter)}] starting ${moduleName}`;
|
2016-05-23 02:40:04 +00:00
|
|
|
if (frameCounter == loaderLength) {
|
|
|
|
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-05-23 02:40:04 +00:00
|
|
|
};
|
2016-08-20 05:03:49 +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
|
|
|
};
|
|
|
|
start(process.env.moduleNameArg, process.env.loaderLengthArg);
|
2016-08-20 05:41:56 +00:00
|
|
|
process.on('SIGINT', () => {
|
2016-06-10 03:59:21 +00:00
|
|
|
logEarlyAbort = true;
|
|
|
|
rl.write(null, { ctrl: true, name: 'u' });
|
2016-08-20 07:09:03 +00:00
|
|
|
process.exit(0);
|
2016-06-10 03:59:21 +00:00
|
|
|
});
|
2016-08-20 07:09:03 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWFybHkuY2hpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9lYXJseS5jaGlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLE1BQU8sS0FBSyxXQUFXLE9BQU8sQ0FBQyxDQUFDO0FBQ2hDLE1BQU8sUUFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQ3RDLElBQUksRUFBRSxHQUFHLFFBQVEsQ0FBQyxlQUFlLENBQUM7SUFDOUIsS0FBSyxFQUFFLE9BQU8sQ0FBQyxLQUFLO0lBQ3BCLE1BQU0sRUFBRSxPQUFPLENBQUMsTUFBTTtDQUN6QixDQUFDLENBQUM7QUFFSCxJQUFJLFVBQWtCLENBQUM7QUFDdkIsSUFBSSxZQUFvQixDQUFDO0FBQ3pCLElBQUksWUFBWSxHQUFXLENBQUMsQ0FBQztBQUU3QixJQUFJLFNBQVMsR0FBRztJQUNaLElBQUksWUFBWSxHQUFXLElBQUksS0FBSyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQyxDQUFDLEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQyxZQUFZLEdBQUcsWUFBWSxDQUFDLGNBQWMsVUFBVSxFQUFFLENBQUM7SUFDekksRUFBRSxDQUFDLENBQUMsWUFBWSxJQUFJLFlBQVksQ0FBQyxDQUFDLENBQUM7UUFDL0IsWUFBWSxHQUFHLENBQUMsQ0FBQztJQUNyQixDQUFDO0lBQUMsSUFBSSxDQUF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