early/dist/index.js

45 lines
4.8 KiB
JavaScript

"use strict";
require("typings-global");
var path = require("path");
var readline = require("readline");
var childProcess = require("child_process");
var earlyChild;
var doAnimation = true;
var doText = false;
if (process.argv.indexOf("-v") != -1 || process.env.CI) {
doAnimation = false;
}
else if (process.argv.indexOf("-v") == -1) {
doText = true;
}
// exports
exports.start = function (moduleNameArg, loaderLengthArg) {
if (moduleNameArg === void 0) { moduleNameArg = ""; }
if (loaderLengthArg === void 0) { loaderLengthArg = "10"; }
if (doAnimation) {
earlyChild = childProcess.fork(path.join(__dirname, "early.child.js"), [], {
env: {
moduleNameArg: moduleNameArg,
loaderLengthArg: loaderLengthArg,
CI: process.env.CI
}
});
}
else if (doText) {
console.log("**** starting " + moduleNameArg.cyan + " ****");
}
};
exports.stop = function () {
if (doAnimation) {
earlyChild.kill();
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.write(null, { ctrl: true, name: 'u' });
rl.close();
}
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsSUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDOUIsSUFBTyxRQUFRLFdBQVcsVUFBVSxDQUFDLENBQUM7QUFDdEMsSUFBTyxZQUFZLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDL0MsSUFBSSxVQUFVLENBQUM7QUFFZixJQUFJLFdBQVcsR0FBVyxJQUFJLENBQUM7QUFDL0IsSUFBSSxNQUFNLEdBQVcsS0FBSyxDQUFDO0FBQzNCLEVBQUUsQ0FBQSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFBRSxDQ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