Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (align === 'right') {
return pad + text;
}
return text + pad;
}
// Count visible characters in a string
function stringWidth(string) {
return countBreaks(stripAnsi('' + string));
}
// If we are in a worker, make a proxy class which will
// send the logger calls to the main process via IPC.
// These are handled in WorkerFarm and directed to handleMessage above.
if (WorkerFarm.isWorker()) {
class LoggerProxy {}
for (let method of Object.getOwnPropertyNames(Logger.prototype)) {
LoggerProxy.prototype[method] = (...args) => {
WorkerFarm.callMaster(
{
location: __filename,
method,
args
},
false
);
};
}
module.exports = new LoggerProxy();
} else {
export function installPackage(
fs: FileSystem,
modules: Array,
filePath: FilePath,
options?: InstallOptions,
): Promise {
if (WorkerFarm.isWorker()) {
let workerApi = WorkerFarm.getWorkerApi();
return workerApi.callMaster({
location: __filename,
args: [fs, modules, filePath, options],
method: '_addToInstallQueue',
});
}
return _addToInstallQueue(fs, modules, filePath, options);
}