Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.118.161.96
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/task/3/root/proc/3/root/lib/node_modules/pm2/node_modules/blessed/browser/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/task/3/root/proc/3/root/lib/node_modules/pm2/node_modules/blessed/browser/transform.js
/**
 * transform.js - browserify workaround for blessed
 * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
 * https://github.com/chjj/blessed
 */

var Transform = require('stream').Transform
  , path = require('path')
  , fs = require('fs');

/**
 * Transformer
 */

function transformer(code) {
  var stream = new Transform;
  stream._transform = function(chunk, encoding, callback) {
    return callback(null, chunk);
  };
  stream._flush = function(callback) {
    if (code) {
      stream.push(code);
    }
    return callback();
  };
  return stream;
}

/**
 * Explicitly require all widgets in widget.js
 */

var widgets = fs.readdirSync(__dirname + '/../lib/widgets');

var requireWidgets = widgets.reduce(function(out, name) {
  name = path.basename(name, '.js');
  out += '\nrequire(\'./widgets/' + name + '\');';
  return out;
}, '');

/**
 * Do not make filesystem calls in tput.js for
 * terminfo or termcap, just use xterm terminfo/cap.
 */

var infoPath = path.resolve(__dirname, '..', 'usr', 'xterm-256color')
  , capPath = path.resolve(__dirname, '..', 'usr', 'xterm.termcap');

var infoPathFake = path.resolve(
  path.sep, 'usr', 'share', 'terminfo',
  path.basename(infoPath)[0],
  path.basename(infoPath)
);

function readMethods() {
  Tput._infoBuffer = new Buffer(TERMINFO, 'base64');

  Tput.prototype.readTerminfo = function() {
    this.terminal = TERMINFO_NAME;
    return this.parseTerminfo(Tput._infoBuffer, TERMINFO_PATH);
  };

  Tput.cpaths = [];
  Tput.termcap = TERMCAP;

  Tput.prototype._readTermcap = Tput.prototype.readTermcap;
  Tput.prototype.readTermcap = function() {
    this.terminal = TERMCAP_NAME;
    return this._readTermcap(this.terminal);
  };

  Tput.prototype.detectUnicode = function() {
    return true;
  };
}

readMethods = readMethods.toString().slice(24, -2)
  .replace(/^  /gm, '')
  .replace('TERMINFO', JSON.stringify(fs.readFileSync(infoPath, 'base64')))
  .replace('TERMINFO_NAME', JSON.stringify(path.basename(infoPath)))
  .replace('TERMINFO_PATH', JSON.stringify(infoPathFake))
  .replace('TERMCAP', JSON.stringify(fs.readFileSync(capPath, 'utf8')))
  .replace('TERMCAP_NAME', JSON.stringify(path.basename(capPath, '.termcap')));

/**
 * Helpers
 */

function end(file, offset) {
  return file.split(path.sep).slice(-offset).join('/');
}

/**
 * Expose
 */

module.exports = function(file) {
  if (end(file, 2) === 'lib/widget.js') {
    return transformer(requireWidgets);
  }
  if (end(file, 2) === 'lib/tput.js') {
    return transformer(readMethods);
  }
  return transformer();
};

Anon7 - 2022
AnonSec Team